fix(skill-scan): stop hiding compiled bytecode from audit surface (Closes #531) - #532
Open
boy-hack wants to merge 2 commits into
Open
fix(skill-scan): stop hiding compiled bytecode from audit surface (Closes #531)#532boy-hack wants to merge 2 commits into
boy-hack wants to merge 2 commits into
Conversation
added 2 commits
August 11, 2026 09:26
…oses #531) skill-scan previously excluded __pycache__ and .pyc/.pyo/.pyd from both the LLM directory tree (dir_tree / _build_repo_tree) and the static pre_scan regex pass. Since CPython loads .pyc at import time independently of any .py source, a malicious skill could ship a clean .py decoy plus a malicious .pyc (PEP 552 UNCHECKED_HASH) and receive a false SAFE verdict (100/100 trust score). Changes: - pre_scan: remove .pyc/.pyo/.pyd from the skip set and scan them as text; add _collect_bytecode_warnings() to surface every compiled artifact. - agent._build_repo_tree: reveal __pycache__ and .pyc, annotate with a compiled-bytecode warning in the injected repo tree. - dir_actions.dir_tree: reveal __pycache__ and .pyc, annotate with [compiled-bytecode] marker so the agent is no longer blind to them. - tests: add tests/test_bytecode_bypass.py regression coverage.
Force-add tests/test_bytecode_bypass.py (root .gitignore excludes 'tests'). Covers: repo tree + dir_tree reveal compiled bytecode, pre_scan detects malicious .pyc payload.
Collaborator
Author
|
Thanks @boy-hack for this fix (Closes #531). This addresses a real security concern: skill-scan previously excluded Changes:
Review notes:
LGTM. @pythoncheng for visibility. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #531. skill-scan previously excluded
__pycache__and.pyc/.pyo/.pydfrom both the LLM directory tree (dir_tree/_build_repo_tree) and the staticpre_scanregex pass. Because CPython loads.pycat import time independently of any.pysource, a malicious skill could ship a clean.pydecoy plus a malicious.pyc(PEP 552 UNCHECKED_HASH) and receive a false SAFE verdict (100/100 trust score).Changes
.pyc/.pyo/.pydfrom the skip set and scan them as text; added_collect_bytecode_warnings()to surface every compiled artifact with an explicit warning.__pycache__and.pyc, annotated with a compiled-bytecode warning injected into the prompt.__pycache__and.pyc, annotated with a[compiled-bytecode]marker so the agent is no longer blind to them.tests/test_bytecode_bypass.pyregression coverage (3 tests, all passing locally).Verification
Reproduced the bypass locally with a malicious UNCHECKED_HASH
.pyccarrying an SSH-key exfil pattern. Before the fix the scanner output no findings; after the fixpre_scanflags the.pycpayload and both tree renderers surface the bytecode artifact with a warning.Note
Per project rules this PR is opened for review; merge is performed by the maintainers.