T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/guard_and_run.py:366
- Finding
- Human-review findings are permitted to execute by default<![CDATA[ ## Vulnerability Details **File Location**: `scripts/guard_and_run.py:366-376, 823-835` **Vulnerability Type**: Fail-open handling of review-required content **Risk Level**: High ### Vulnerable Code ```python blocked = status == "BLOCK" or (strict and status == "REVIEW") if blocked: print( f"Blocked by enterprise legal guardrails ({status}) for {action} on {app or 'unknown'} " f"before command execution. Score: {report.get('score', 'n/a')}, " f"Findings: {report.get('findings_count', 'n/a')}", file=sys.stderr, ) return report, True, duration_ms if status == "REVIEW": suggestion = (report.get("suggestions") or ["Consider rewriting before execution."])[0] print(f"Guardrail REVIEW for {action} on {app or 'unknown'}: {suggestion}", file=sys.stderr) return report, False, duration_ms ``` The returned `False` allows execution to continue: ```python env = None if args.sanitize_env: env = _sanitize_env(args.keep_env, args.keep_env_prefix) command_ms = None command_start = time.perf_counter() try: proc = subprocess.run(command, check=False, env=env, timeout=args.command_timeout) ``` ### Technical Analysis The wrapper only treats `REVIEW` as blocking when optional strict mode is enabled. In the default configuration, `REVIEW` generates a warning and returns `blocked=False`, after which the wrapped outbound command is executed. This behavior conflicts with the documented workflow in `SKILL.md:24-26`, which states that only `PASS` and `WATCH` should proceed and that `REVIEW` content should be rewritten or routed for human or legal review. The behavior is intentional enough to be covered by `scripts/tests_guard_and_run.py:54-68`, where a REVIEW result is expected to execute successfully. A safety boundary intended to prevent risky publication should fail closed when human review is required. Making strict mode optional permits potentially defamatory, privacy-sensitive, legally risky, or mis ...[truncated 1135 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat `REVIEW` as blocking by default: ```python blocked = status in {"REVIEW", "BLOCK"} ``` 2. If REVIEW execution is operationally necessary, require a dedicated override rather than relying on a permissive default. 3. Protect the override with authenticated approval, a ticket or case reference, approver identity, expiration, and immutable audit logging. 4. Do not reuse the command-allowlist override as legal-review approval; these controls address different risks. 5. Update tests so default REVIEW behavior asserts that the command does not run. 6. Update documentation and exit-code behavior to consistently distinguish policy blocks, review requirements, and execution failures. 7. Consider requiring strict mode unconditionally for outbound commands that publish publicly, disclose personal information, or use production credentials. ]]>
