Back to skill

Security audit

Tqsdk策略量化

Security checks for vulnerabilities and agentic risk

Overview

This trading-strategy skill is purpose-aligned, but it ships executable strategies with plaintext credentials and automated order-changing code that can affect financial accounts.

Review carefully before installing or running. Do not use the bundled plaintext credentials, rotate them if they are yours, and avoid putting real TqSdk credentials into source files. Run only in TqSim or another simulation account unless you have intentionally configured live trading, reviewed each strategy's order logic, and set your own position and loss limits.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
strategies/18_vwap_mean_reversion.py:56
Finding

Hardcoded Plaintext TqSdk Credentials in Executable Trading Strategies

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
README.md:40
Finding

Documentation Encourages Users to Store Credentials in Tracked Source Files

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
README.md:40
Finding

Unpinned Dependency Upgrade Prevents Reproducible and Reviewed Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (160)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module-level documentation and inline comments describe concrete open/close long-short behavior, yet the code never initializes or queries volume_long and volume_short before using them in the trade conditions. As written, the strategy will raise a runtime error instead of executing the claimed KDJ signal handling, which is an active contradiction between the documented intent and actual behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file contains direct automated order-placement and position-closing logic via TargetPosTask.set_target_volume(...) with no runtime confirmation, authorization gate, dry-run mode, or prominent risk warning. In a trading skill, this is dangerous because simply running the script can place or close trades automatically when market conditions match, which may lead to financial loss if the user did not intend live execution.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The strategy uses volume_long and volume_short in position-closing and entry logic without ever retrieving or initializing current holdings. In practice this can crash with a NameError or, if stale globals were later introduced, make trade decisions based on incorrect position state, which is especially dangerous in an automated trading loop.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code issues live order-intent commands through TargetPosTask.set_target_volume based purely on strategy conditions, without any explicit runtime confirmation, kill switch, dry-run guard, or prominent warning that this performs automated order placement. In an agent-skill context, that increases the chance a user runs the script without appreciating that it can autonomously enter and reverse futures positions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code references position variables such as volume_long and volume_short without ever retrieving or initializing them from the broker/API state. This creates a runtime failure or undefined trading logic in a live strategy, which can prevent exits, break risk controls, or leave positions unmanaged if the strategy is assumed to be operating safely.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The strategy description and comments describe independent per-grid layered positions, but TargetPosTask.set_target_volume uses an absolute net target position. As written, repeated 'buy one grid' and 'sell one grid' actions collapse into a single net position or full flattening, so the actual exposure and exit behavior differ sharply from the described grid accounting and can trigger unintended trades and losses.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented strategy says buying should stop below GRID_LOW and that clearing longs on a lower-bound break is an optional risk control, but the implementation does neither. In an automated trading skill, this mismatch can cause the bot to keep accumulating long exposure during a falling market, materially increasing loss and liquidation risk compared with the operator's documented expectations.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This script issues trading commands directly from market data events without any explicit confirmation, dry-run gate, or prominent execution warning. In the context of an agent skill, that increases the chance a user runs it believing it is educational or simulated, leading to unintended real or simulated order placement and financial consequences.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This is a real logic flaw in the trading strategy: the stop-loss checks are placed inside the elif orb_confirmed and not traded_today: branch, but traded_today is set to True immediately after opening a position. As a result, once a trade is entered, subsequent iterations no longer execute the stop-loss logic, leaving positions unmanaged until the forced close time and creating materially larger-than-documented loss exposure.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script hardcodes what appear to be real TqAuth credentials directly in source code, exposing them to anyone with repository or file access. In an automated trading strategy context, leaked credentials can enable unauthorized access to the trading account or associated market data services, making this substantially more dangerous than a generic demo script secret leak.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code uses hardcoded live-auth credentials without any indication they are placeholders, test-only values, or that executing the strategy may access a real account. Because this is a trading bot, a user running the file could unintentionally connect to someone else's account or a live service, creating risk of unauthorized trading activity, account misuse, and financial loss.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The plaintext phone number and password in the authentication call expose sensitive account information directly in the codebase. This can lead not only to account compromise but also to privacy harm, credential stuffing against reused passwords, and broad downstream exposure if the file is shared publicly or logged during review.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file contains hardcoded TqAuth credentials in source code, which exposes secrets to anyone with repository or artifact access. In a trading context this is especially dangerous because leaked credentials can enable unauthorized account access, strategy execution, order placement, or abuse of associated services.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code embeds login fields directly in the authentication call using literal placeholders for account and password. Even though this is not phrased with explicit leak terminology, it semantically normalizes storing and handling sensitive credentials inline, which creates a data-exposure risk if copied into real use or logs.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The strategy directly calls insert_order to open and close positions based on computed signals, with no explicit arming step, dry-run mode, order-size guardrails, or user confirmation. In the context of an agent skill, this means loading and running the code can trigger real trading actions automatically, which is dangerous because logic bugs, bad parameters, or malformed inputs can rapidly create financial loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file contains hardcoded TqAuth credentials, which exposes account secrets to anyone who can read the source, logs, repository history, or packaged skill contents. In a trading context this is especially dangerous because exposed credentials may allow unauthorized account access, market data access, or live trading actions depending on broker/API permissions.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The strategy automatically calls set_target_volume to change positions without any explicit runtime confirmation, dry-run gate, or prominent live-trading safety interlock. In an agent/skill setting this is more dangerous because merely running the skill can trigger real orders, causing financial loss, unintended exposure, or account abuse if launched in a live authenticated environment.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The composite signal is documented as combining temporal momentum and cross-sectional value as distinct factor sources. In code, momentum is assigned from calc_term_structure at L147 and value is also assigned from calc_term_structure at L150, making both signals effectively identical and contradicting the stated two-factor design.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file contains hardcoded TqAuth credentials, which is a genuine secret exposure issue. Anyone with access to the code can reuse the account credentials, potentially gaining unauthorized access to trading services, account data, or causing financial harm if the credentials are valid.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script embeds plaintext trading credentials directly in source code when creating TqAuth("13556817485", "asd159753"). Hardcoded secrets are dangerous because anyone with access to the file, logs, repo history, or redistributed skill can reuse them to access the associated trading/account API, potentially exposing account data or enabling unauthorized trading actions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code creates TargetPosTask objects and labels the later section as '执行换仓', suggesting live position adjustment will occur. In practice, the rebalance loop only prints the desired changes and updates a local position dictionary at L311-L317, never invoking the target task to submit target positions, so the documented trading behavior is contradicted.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented entry logic requires both a Bollinger breakout and volatility in a historically high regime above the 75th percentile. In code, the long-entry condition at L330 checks current_price > upper_band, adx > 25, and not vol_alert, which only excludes volatility above the 90th percentile and does not enforce the claimed >75th percentile requirement.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file contains hardcoded live trading credentials directly in source code, which exposes authentication secrets to anyone with file access, repository access, logs, or backups. In a trading context this is especially dangerous because leaked credentials can enable unauthorized account access, order placement, account abuse, or financial theft.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file embeds live authentication credentials directly in source code, exposing them to anyone with repository, artifact, log, or backup access. In a trading skill, this is especially dangerous because compromised credentials can allow unauthorized account access, market data usage, or order placement depending on account permissions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code creates TargetPosTask objects, which implies actual order execution will occur, consistent with the strategy description of doing long and short rotation. However, during 'execution' at L294-L300 the program only prints adjustments and mutates a local position dictionary; it never calls the target task objects to place trades, so the implemented behavior does not carry out the documented strategy actions.

Content

No source excerpt is available for this finding.