T09 · Insecure Skill Coding Practices
Error
- Location
- trader.py:38
- Finding
- Minimum Market Volume Safeguard Is Declared but Never Enforced<![CDATA[ ## Vulnerability Details **File Location**: `trader.py:38`, `trader.py:75`, and trade execution flow at `trader.py:469-531` **Vulnerability Type**: Missing enforcement of a declared financial risk control **Risk Level**: High The skill documentation identifies `SIMMER_MIN_VOLUME` as the minimum market-volume filter, and the program loads this setting: ```python MAX_POSITION = float(os.environ.get("SIMMER_MAX_POSITION", "40")) MIN_VOLUME = float(os.environ.get("SIMMER_MIN_VOLUME", "5000")) MAX_SPREAD = float(os.environ.get("SIMMER_MAX_SPREAD", "0.08")) MIN_DAYS = int(os.environ.get( "SIMMER_MIN_DAYS", "0")) MAX_POSITIONS = int(os.environ.get( "SIMMER_MAX_POSITIONS", "8")) YES_THRESHOLD = float(os.environ.get("SIMMER_YES_THRESHOLD", "0.38")) NO_THRESHOLD = float(os.environ.get("SIMMER_NO_THRESHOLD", "0.62")) MIN_TRADE = float(os.environ.get("SIMMER_MIN_TRADE", "5")) ``` It is reloaded after application of the skill configuration: ```python MAX_POSITION = float(os.environ.get("SIMMER_MAX_POSITION", str(MAX_POSITION))) MIN_VOLUME = float(os.environ.get("SIMMER_MIN_VOLUME", str(MIN_VOLUME))) MAX_SPREAD = float(os.environ.get("SIMMER_MAX_SPREAD", str(MAX_SPREAD))) MIN_DAYS = int(os.environ.get( "SIMMER_MIN_DAYS", str(MIN_DAYS))) MAX_POSITIONS = int(os.environ.get( "SIMMER_MAX_POSITIONS", str(MAX_POSITIONS))) YES_THRESHOLD = float(os.environ.get("SIMMER_YES_THRESHOLD", str(YES_THRESHOLD))) NO_THRESHOLD = float(os.environ.get("SIMMER_NO_THRESHOLD", str(NO_THRESHOLD))) MIN_TRADE = float(os.environ.get("SIMMER_MIN_TRADE", str(MIN_TRADE))) MIN_INCONSISTENCY = float(os.environ.get("SIMMER_MIN_INCONSISTENCY", str(MIN_INCONSISTENCY))) ``` However, no volume check occurs before the execution flow reaches `client.trade()`: ```python side, size, reasoning = compute_signal(market, opp) if not side: safe_print(f" [ski ...[truncated 1998 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Enforce the volume threshold before signal generation and again immediately before trading. - Retrieve the canonical numeric volume field from the SDK and reject markets whose volume is missing, malformed, non-finite, or below `MIN_VOLUME`. - Prefer fail-closed behavior when the SDK does not provide reliable volume data. - Re-fetch market data immediately before a live order to reduce time-of-check/time-of-use exposure. - Add unit and integration tests proving that a market below `MIN_VOLUME` cannot reach `client.trade()`. - Log the observed volume and configured threshold for every rejection. For example: ```python volume = getattr(market, "volume", None) if not isinstance(volume, (int, float)) or volume < MIN_VOLUME: return None, 0, ( f"Volume unavailable or below minimum: " f"{volume!r} < {MIN_VOLUME}" ) ``` ]]>
