T09 · Insecure Skill Coding Practices
- Location
sentinel_wrapper.py:342- Finding
Caller-controlled non-finite or negative costs bypass budget enforcement
- Content
View full analysis
run_budget: _append_event( state=state, action_name="openclaw_check", estimated_cost=estimated_cost, outcome="error", details={ "cmd": cmd, "decision": "blocked", "reason": ( f"Run budget exceeded: {run_total:.2f} > {run_budget:.2f} USD" ), }, ) print( json.dumps( { "status": "BLOCKED", "cmd": cmd, "estimated_cost": estimated_cost, "error": ( f"Run budget exceeded: {run_total:.2f} > {run_budget:.2f} USD" ), "instruction": "Action blocked by local safety policy.", "remote_sync": remote_enabled, } ) ) return if session_total > session_budget: _append_event( state=state, action_name="openclaw_check", estimated_cost=estimated_cost, outcome="error", details={ "cmd": cmd, "decision": "blocked", "reason": ( "Session budget exceeded: " f"{session_total:.2f} > {session_budget:.2f} USD" ), }, ) ``` ### Technical Analysis The caller fully controls `args.cost`. Converting it with `float()` does not ensure that it is non-negative and finite. Python accepts values such as negative numbers, `nan`, and `inf`. A negative cost reduces `run_total` and `session_total`, effectively restoring budget that ha ...[truncated 1336 chars]- Remediation
View remediation
