NVIDIA / NVIDIA/SkillSpector

P2 "Hidden Instructions" rule produces false positives due to missing word boundary on GET

Open Beginner friendly
#297 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
1.5k
Avg merge
5d 10h
Merged PRs (30d)
66

Description

Issue

The P2 pattern in static_patterns_prompt_injection.py (line 52) matches GET case-insensitively without a word boundary:

(r"<!--.*?(?:system|instructions?|ignore|POST|GET|send|transmit).*?-->", 0.7),
Result

This causes false positives in two scenarios:

1. Substring match — common words containing "get"

For example any HTML comment containing the word target will trigger the rule because the regex matches the substring get inside target.

Example:

<!-- Minimum touch target size for button controls -->

This fires at 70% confidence despite no malicious intent.

2. Multi-comment spanning

The regex can span across multiple HTML comments, treating everything between the first <!-- and a distant --> as a single match. This means it picks up get from completely unrelated code like document.getElementById(...) in between.

Example:

<!-- Section header -->
<button id="openBtn">Open</button>
<script>
document.getElementById("openBtn").addEventListener("click", handler);
</script>
<!-- End of section -->

The entire block is flagged as a single match.

Suggested fix:

Add \b word boundaries:

(r"<!--.*?(?:\bsystem\b|\binstructions?\b|\bignore\b|\bPOST\b|\bGET\b|\bsend\b|\btransmit\b).*?-->", 0.7),

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/skillspector/nodes/analyzers/static_patterns_prompt_injection.py at the P2 pattern on line 52 and reproduce the two HTML-comment examples from the issue. Update the matching behavior so ordinary words such as "target" and code between separate comments do not trigger the rule, while intended instruction-related words still match. Verify the reported examples no longer produce false positives.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.