Skip to content

fix: stop hard-dropping SKILL.md findings via code-example heuristic - #379

Open
weed33834 wants to merge 1 commit into
NVIDIA:mainfrom
weed33834:fix/issue-373-skill-md-code-example
Open

fix: stop hard-dropping SKILL.md findings via code-example heuristic#379
weed33834 wants to merge 1 commit into
NVIDIA:mainfrom
weed33834:fix/issue-373-skill-md-code-example

Conversation

@weed33834

Copy link
Copy Markdown

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-executable
file, a finding whose context contained a prose indicator like For example was hard-dropped
in static_runner — meaning malicious instructions (prompt injection, destructive commands, etc.)
embedded in SKILL.md could be silently ignored.

Fix

  • common.py: add keyword-only path: str = "" param to is_code_example; return False
    for SKILL.md (case-insensitive), mirroring _is_documentation_context.
  • static_runner.py: pass path=path at the call site.
  • Tests: add regression test reproducing the [SECURITRY] is_code_example() hard-drops findings from .md files #373 PoC; strengthen the backtick test to assert the
    TM1 finding is actually preserved (was only asserting confidence).

Verification

  • ruff check + ruff format --check clean.
  • pytest tests/nodes/analyzers/test_static_runner_filtering.py → 53 passed (incl. new regression).

Closes #373

… 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>
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.

[SECURITRY] is_code_example() hard-drops findings from .md files

1 participant