T09 · Insecure Skill Coding Practices
Error
- Location
- scan.py:251
- Finding
- Inconsistent Script Discovery Omits Root-Level and Supported Script Files from Security Checks## Vulnerability Details **File Location**: `scan.py:251-269` and `scan.py:330-362` **Vulnerability Type**: Incomplete security validation and false-negative scanning **Risk Level**: High ### Vulnerable Code ```python # Extract all URLs from scripts scripts_dir = skill_dir / "scripts" script_urls = set() if scripts_dir.exists(): for f in scripts_dir.rglob("*"): if f.suffix in {".sh", ".bash", ".py"} and f.is_file(): try: script_content = f.read_text(errors="replace") urls = re.findall(r'https?://([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})', script_content) for domain in urls: # Filter out github/known safe infra if domain not in {"github.com", "raw.githubusercontent.com", "api.anthropic.com"}: script_urls.add(domain) except Exception: pass ``` ```python def check_permissions(skill_dir: Path, result: ScanResult): """Look for sensitive file access not reflected in declared permissions.""" sensitive_paths = [ (r"~/\.ssh|/\.ssh/", "SSH keys access"), (r"~/\.aws|/\.aws/", "AWS credentials access"), (r"~/\.config/.*token|~/\.config/.*secret", "Token/secret config access"), (r"/etc/passwd|/etc/shadow", "System password file access"), (r"~/Library/Keychains", "macOS Keychain access"), (r"wallet\.(dat|json)|keystore", "Crypto wallet access"), ] scripts_dir = skill_dir / "scripts" if not scripts_dir.exists(): return found_sensitive = False for f in scripts_dir.rglob("*"): if f.suffix in {".sh", ".bash", ".py"} and f.is_file(): try: content = f.read_text(errors="replace") rel_path = str(f.relative_to(skill_dir)) for i, line in enumerate(content.splitlines(), 1): # S ...[truncated 3296 chars]
- Remediation
- ## Remediation Suggestions - Implement one canonical script-discovery function and reuse it in every check. - Include root-level files and recursively discovered files under `scripts/`. - Apply the same supported-extension set—`.sh`, `.bash`, `.py`, `.rb`, `.js`, and `.ts`—to all relevant checks. - Do not silently return a successful result when `scripts/` is absent; continue scanning eligible root-level files. - Track which checks were applied to each discovered file and report coverage in the final output. - Add regression tests containing sensitive access and undeclared endpoints in every supported extension and location. - Treat incomplete coverage as a warning or failure rather than emitting a PASS verdict.
