T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/audit.py:326
- Finding
- MEDIUM findings do not block documented publishing workflows<![CDATA[ ## Vulnerability Details **File Location**: `scripts/audit.py`, lines 326-331 **Vulnerability Type**: Fail-open security gate caused by inconsistent severity handling **Risk Level**: Medium ### Complete Code Snippet ```python has_high = bool(grouped.get('HIGH')) has_medium = bool(grouped.get('MEDIUM')) if has_high or (args.strict and (has_medium or grouped.get('LOW'))): sys.exit(1) sys.exit(0) ``` The documented commands in `SKILL.md` do not include `--strict`, although the documentation states that both HIGH and MEDIUM findings should block publishing or pushing. ### Technical Analysis The exit-status logic only returns failure when a HIGH finding exists, or when `--strict` is enabled and a MEDIUM or LOW finding exists. Consequently, MEDIUM findings produce exit code `0` under every documented commit, push, and publish workflow. This contradicts the documented contract in `SKILL.md`, which states that exit code `1` represents HIGH or MEDIUM findings and that MEDIUM findings must be fixed before publication. Systems integrating this scanner are likely to trust the process exit status rather than parse its human-readable output. ### Attack Path 1. An attacker or contributor adds content that matches a MEDIUM rule, such as an absolute home path or a refresh token pattern. 2. The documented command is run without `--strict`, for example: ```bash python3 scripts/audit.py /path/to/skill ``` 3. The scanner prints the MEDIUM finding. 4. The final condition evaluates to false because no HIGH finding exists and `args.strict` is false. 5. The process exits with status `0`. 6. A commit hook, CI pipeline, or publishing workflow interprets the scan as successful and permits the unsafe content to proceed. ### Impact Assessment This issue does not directly grant operating-system privileges or execute attacker-controlled code. Its scope is the integrity of the security gate: MEDIUM-risk content can pass automated validation and be committed, pus ...[truncated 155 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Change the default exit logic so HIGH and MEDIUM findings always block, while `--strict` additionally makes LOW findings blocking: ```python has_high = bool(grouped.get('HIGH')) has_medium = bool(grouped.get('MEDIUM')) has_low = bool(grouped.get('LOW')) if has_high or has_medium or (args.strict and has_low): sys.exit(1) sys.exit(0) ``` Add automated tests covering all combinations of HIGH, MEDIUM, and LOW findings with and without `--strict`. Ensure the implementation, command examples, and documented exit-code contract remain consistent. ]]>
