T09 · Insecure Skill Coding Practices
- Location
scripts/vet.py:287- Finding
Security Scanner Omits Multiple Classes of Attacker-Controlled Content
- Content
View full analysis
list[Path]: """Recursively find scannable files in a skill folder. Skips: - Hidden directories (.git, .clawhub, __pycache__) — except .github - references/ and tests/ subdirectories — these are documentation and test samples by convention, and audit-skill's own references/ naturally mentions sensitive patterns when describing rules. For a normal skill without references/ or tests/, this is a no-op. """ EXCLUDE_DIRS = {"references", "tests", "examples", "__pycache__"} files = [] for p in sorted(skill_path.rglob("*")): if not p.is_file(): continue if any(part.startswith(".") and part not in (".github",) for part in p.parts): # skip hidden dirs (.git, .clawhub) but keep .github continue # Skip excluded subdirs (relative to skill root) try: rel_parts = p.relative_to(skill_path).parts if any(part in EXCLUDE_DIRS for part in rel_parts[:-1]): continue except ValueError: pass if p.suffix.lower() in SCANNABLE_EXT: files.append(p) return files def strip_python_non_code(text: str) -> str: """Remove comments and string literals from Python code. Static analysis of detection-rule code is tricky: the rule descriptions and regex patterns are themselves strings that naturally contain the very patterns we scan for (e.g. score.py has "Reads ~/.aws/credentials" as a rule description). Stripping strings and comments leaves only actual code, so pattern matches reflect real behaviour, not documentation. """ # Remove triple-quoted strings (docstrings) text = re.sub(r'"""[\s\S]*?"""', '""', text) tex ...[truncated 3730 chars]- Remediation
View remediation
