T09 · Insecure Skill Coding Practices
- Location
src/index.js:318- Finding
Blocked-content policy evaluates only the source path
- Content
View full analysis
{ try { return new RegExp(pattern, 'i').test(sourcePath); } catch { return false; } }); ``` ### Technical Analysis The documented `blockedPatterns` policy is intended to reject candidates containing prohibited behavior. However, every configured regular expression is tested only against `sourcePath`, which is the candidate directory path. Candidate filenames and file contents are never evaluated by this policy control. For example, the documented pattern `curl\s*\|\s*sh` will not detect the command in `fixtures/avoid-skill/scripts/install.sh:2` unless the directory path itself happens to contain matching text. The separate ClawShield scan may classify this fixture as `Avoid`, but that does not make the content-blocking policy effective. An `Avoid` result can be installed with `--force`, whereas a genuine blocked-pattern match is rejected before the approval logic. This discrepancy undermines an administrator's expectation that explicitly prohibited content cannot be overridden. Invalid regular expressions are also silently ignored by the `catch` block, causing a malformed security rule to fail open. ### Attack Path 1. An administrator configures a blocked-content pattern such as `curl\s*\|\s*sh`. 2. An attacker supplies a skill containing that command inside a script while using an innocuous source-directory name. 3. The installer evaluates the pattern against only the source path. 4. The content rule does not match, so the dedicated blocked-pattern rejection is bypassed. 5. If the external scanner misses or suppresses the behavior, the candidate may be approved through another policy branch. If classified as `Avoid`, a user can still install it with `--force`. 6. The prohibited content is copied i ...[truncated 674 chars]- Remediation
View remediation
