fix: stop hard-dropping SKILL.md findings via code-example heuristic - #379
Open
weed33834 wants to merge 1 commit into
Open
fix: stop hard-dropping SKILL.md findings via code-example heuristic#379weed33834 wants to merge 1 commit into
weed33834 wants to merge 1 commit into
Conversation
… heuristic `is_code_example` lacked the SKILL.md guard that `_is_documentation_context` already has. Because SKILL.md is classified as a non-executable file, any finding whose context contained a prose indicator (e.g. "For example") was silently hard-dropped in `static_runner`, allowing prompt-injection and other malicious instructions in SKILL.md to evade detection. Add a keyword-only `path` parameter to `is_code_example` that returns False for SKILL.md (case-insensitive), mirroring `_is_documentation_context`, and pass `path=path` at the `static_runner` call site. Add a regression test reproducing the NVIDIA#373 PoC and strengthen the existing backtick-filtering test to assert the TM1 finding is actually preserved. Closes NVIDIA#373 Signed-off-by: badhope <weed33834@users.noreply.github.com>
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.
Problem
is_code_example(used to suppress false-positive findings in code examples / documentation)had no SKILL.md guard, unlike
_is_documentation_context. Since SKILL.md is a non-executablefile, a finding whose context contained a prose indicator like
For examplewas hard-droppedin
static_runner— meaning malicious instructions (prompt injection, destructive commands, etc.)embedded in SKILL.md could be silently ignored.
Fix
common.py: add keyword-onlypath: str = ""param tois_code_example; returnFalsefor SKILL.md (case-insensitive), mirroring
_is_documentation_context.static_runner.py: passpath=pathat the call site.TM1 finding is actually preserved (was only asserting confidence).
Verification
ruff check+ruff format --checkclean.pytest tests/nodes/analyzers/test_static_runner_filtering.py→ 53 passed (incl. new regression).Closes #373