T09 · Insecure Skill Coding Practices
- Location
scripts/yotta_verify.py:126- Finding
Public signature file permits attacker-controlled test files to bypass scanning
- Content
View full analysis
Vulnerability Details
File Location:
scripts/yotta_verify.py:126-133, 190-220
Vulnerability Type: Trust-classification bypass
Risk Level: HighComplete Code Snippet
python def has_published_signature_data(root): """Whether the target package contains published signature data.""" for name in SIGNATURE_DATA_DIGESTS: p = Path(root) / "scripts" / name if p.is_file() and is_signature_data("scripts/" + name, p): return True return Falsepython def walk_files(root, base="", trusted_tests=None, scan_root=None): out = [] if scan_root is None: scan_root = root trusted_tests = has_published_signature_data(scan_root) try: entries = sorted(root.iterdir()) except OSError: return out for entry in entries: if entry.name in SKIP_DIRS: continue rel = entry.name if not base else base + "/" + entry.name if entry.is_dir(): out.extend(walk_files(entry, rel, trusted_tests, scan_root)) elif entry.is_file(): try: size = entry.stat().st_size except OSError: continue if size > MAX_FILE_SIZE: continue if is_signature_data(rel, entry): continue if trusted_tests and entry.name.startswith("test_") and entry.name.endswith(".py"): continue if is_text_file(entry.name): out.append((entry, rel))Technical Analysis
The scanner treats the presence of a known rule-table file as evidence that the entire target package is trusted to contain test fixtures. This trust decision is based only on:
- A predictable path under
scripts/. - A SHA-256 digest of publicly distributed file content.
A digest verifies content identity but does not authenticate the package or its author. An untrusted package author can copy an unchanged published rule ...[truncated 1803 chars]
- A predictable path under
- Remediation
View remediation
Remediation Suggestions
- Remove the blanket
test_*.pyexclusion when scanning externally supplied packages. - Treat test files as executable source because package code can import them at runtime.
- Do not use a public content hash as proof of package provenance.
- If first-party fixture exclusions are necessary, require an authenticated package signature that covers the complete package manifest and every shipped file.
- Resolve package entry points and import references, and never exclude a file reachable from production code.
- Include all exclusions in the generated report and make security-relevant exclusions produce at least a review-required verdict.
- Add regression tests using a package that contains a valid copied signature file and a malicious
test_*.pymodule referenced by its runtime entry point.
- Remove the blanket
