Skip to content

fix(analyzers): HIGH SC8 when skill ships __pycache__ or .pyc - #357

Merged
rng1995 merged 2 commits into
NVIDIA:mainfrom
ajlennon:fix/sc8-shipped-bytecode-356
Aug 12, 2026
Merged

fix(analyzers): HIGH SC8 when skill ships __pycache__ or .pyc#357
rng1995 merged 2 commits into
NVIDIA:mainfrom
ajlennon:fix/sc8-shipped-bytecode-356

Conversation

@ajlennon

Copy link
Copy Markdown
Contributor

Summary

Closes the silent bytecode skip in #356: __pycache__ is excluded from discovery and .pyc is treated as binary, so a skill can ship decoy sources plus malicious bytecode and still score SAFE.

This adds SC8 (Shipped Python Bytecode) — a HIGH finding whenever __pycache__/ or *.pyc/*.pyo is present under the skill tree (still skipping .git / node_modules / venvs). Presence alone is enough to fail closed; full .pyc disassembly can follow later.

Test plan

  • uv run --with pytest pytest tests/nodes/analyzers/test_sc8_shipped_bytecode.py -q (2 passed)
  • uv run ruff check on touched files

AI disclosure

This pull request was AI-assisted (Cursor) on behalf of Alex Lennon, with human review before open.

Fixes #356

Made with Cursor

Close the silent bytecode skip described in NVIDIA#356: discovery excludes
__pycache__ and treats .pyc as binary, so presence alone must fail the
score even before full disassembly exists.

Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
Co-authored-by: Cursor <cursoragent@cursor.com>
@nedlir

nedlir commented Aug 10, 2026

Copy link
Copy Markdown

Like you mentioned, I think this solution is not comprehensive enough (we still skip node_modules, git files, etc) and need a more agnostic solution

Comment thread src/skillspector/nodes/analyzers/static_patterns_supply_chain.py

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Automated SkillSpector Review]

Requesting changes. SC8 detects the files, but it does not deliver the claimed fail-closed behavior: one .pyc scores 23 (MEDIUM / CAUTION) and the CLI exits 0; per-rule scoring caps three SC8 occurrences at 41. Add explicit blocking semantics and an end-to-end verdict/exit regression. Also run and commit Ruff formatting; ruff format --check fails on the touched analyzer file.

@Spectorian

Copy link
Copy Markdown
Collaborator

An explicit acceptance criterion for bytecode-poisoning scenario: shipped .pyc, .pyo, or pycache content must produce an explicit SC8 finding and must not complete as a passing or SAFE scan.
Please add a full end-to-end scan regression using a harmless poisoned-style fixture. It should verify that analysis completes successfully, SC8 identifies the shipped artifact, the finding is preserved in the report, and the final recommendation and exit behavior are appropriately blocking.
I also reproduced an integration failure where the absolute skill_path is passed to the inspection ledger, which rejects it because ledger paths must be relative. This leaves SC8 absent and changes the result only because analysis failed. A generic degraded-analysis result is not sufficient; the bytecode finding itself must be emitted.

Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__pycache__ skipped entirely during skill scans (v2.8.2) (malicious skill bypasses this scanner)

4 participants