T09 · Insecure Skill Coding Practices
- Location
scripts/validate_skill.py:116- Finding
Executable Package Contents Are Excluded from Security Validation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/validate_skill.py:116-130
Related Location:scripts/package_skill.py:37-46
Vulnerability Type: Incomplete security validation of packaged files
Risk Level: MediumVulnerable Code
scripts/validate_skill.py:116-130:python def validate_no_secrets(skill_dir): """Check whether keys or sensitive information are exposed (only SKILL.md and _meta.json).""" # Only check core skill files, not scripts directory forbidden_patterns = [ r'password\s*=\s*["\'][^"\']+["\']', r'api_key\s*=\s*["\'][^"\']+["\']', r'secret_key\s*=\s*["\'][^"\']+["\']', r'token\s*=\s*["\'][^"\']+["\']', r'-----BEGIN.*PRIVATE KEY-----', ] # Only check core skill files files_to_check = [ os.path.join(skill_dir, 'SKILL.md'), os.path.join(skill_dir, '_meta.json'), ]scripts/package_skill.py:37-46:python # Collect all files to package files_to_package = [] for root, dirs, files in os.walk(skill_dir): # Skip directories such as __pycache__ dirs[:] = [d for d in dirs if d not in ['__pycache__', '.git', '.venv']] for file in files: file_path = os.path.join(root, file) rel_path = os.path.relpath(file_path, skill_dir) files_to_package.append((file_path, rel_path))Technical Analysis
The security validator intentionally examines only
SKILL.mdand_meta.json. In contrast, the packaging routine recursively includes every file beneath the supplied skill directory except files in three excluded directory names.This mismatch means executable Python files, shell scripts, configuration files, credential files, and unexpected binary content can be incorporated into the resulting
.skillarchive without undergoing the advertised secret scan. The validation process can therefore report that the security check passed ...[truncated 2203 chars]- Remediation
View remediation
Remediation Suggestions
- Build one canonical package manifest before validation and use that exact immutable manifest for both validation and archive creation.
- Recursively inspect every regular file selected for packaging, including all files under
scripts/. - Use an explicit allowlist of permitted paths, extensions, and file types. Reject unexpected executable files, binaries, device files, and other unsupported content.
- Reject symbolic links, or securely resolve them and verify that their targets remain inside the intended skill root.
- Apply secret scanning to every textual file using broader credential detection and entropy-based checks. Treat pattern matching as one defense layer rather than a complete security guarantee.
- Add static analysis for executable files and require manual review or cryptographic approval for scripts.
- Compute hashes after validation and verify them immediately before archive creation to reduce time-of-check/time-of-use substitution risks.
- Rename the current check to accurately describe its limited scope unless comprehensive package validation is implemented.
- Add regression tests that place test credentials and unauthorized scripts in nested directories and verify that packaging is rejected.
