T09 · Insecure Skill Coding Practices
- Location
news_events.py:40- Finding
Trading Safety Checks Fail Open When Market Context Is Unavailable
- Content
View full analysis
0.15: return False, "slippage too high" edge = ctx.get("edge_analysis", {}) if edge.get("recommendation") == "HOLD": return False, "edge below threshold" return True, "ok" except Exception: return True, "context unavailable" ``` The returned approval is used as follows: ```python ok, reason = check_context(client, market_id) if not ok: log.warning("Skipping trade: %s", reason) continue ``` ### Technical Analysis `check_context()` is intended to enforce pre-trade safeguards covering severe flip-flop warnings, excessive slippage, and insufficient market edge. However, every exception—including network timeouts, authentication errors, SDK failures, malformed responses, and unexpected response types—is converted into an affirmative trading decision. This is a fail-open security design. The absence of validated safety information is treated as equivalent to successful validation. In live mode, execution can consequently continue to `client.trade(...)` while all contextual risk controls are unavailable. The broad `except Exception` also suppresses the underlying error and ...[truncated 1111 chars]- Remediation
View remediation
