Fix P2 HTML comment boundary matching - #452
Open
Patrick-Erichsen wants to merge 3 commits into
Open
Conversation
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
rng1995
requested changes
Aug 28, 2026
rng1995
left a comment
Collaborator
There was a problem hiding this comment.
[SkillSpector Review]
Re-reviewed at 1e82b2b after the current-main merge. The patch fixes the reported ordinary-substring and standard cross-comment false positives, and all 154 focused static-pattern tests pass, but two boundary cases still block approval. The alphanumeric boundary drops common camel/Pascal-style hidden directives, producing an end-to-end SAFE, complete verdict, and the tempered body does not recognize --!> as an HTML comment closer, so it can still span from a comment into visible text. Please preserve case-transition directive detection, honor browser-compatible comment endings, and add direct plus end-to-end regressions.
Signed-off-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Author
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.
User-visible bug
SkillSpector could start a P2 "hidden instructions" match in one HTML comment, include ordinary visible documentation after that comment had already closed, and stop at a later comment. The resulting finding falsely presented visible text as hidden prompt injection and could change an otherwise safe scan verdict.
What this changes
-->and browser-compatible--!>closerstarget,SYSTEMATIC,POSTGRES, andGETTINGSAFEand real hidden instructions cannot receive aSAFEverdictReviewer follow-up
ignorePreviousInstructions,pleaseIgnorePreviousInstructions,POSTRequestToServer, andSYSTEMPromptare covered--!>terminates the comment, so following visible text cannot be consumed by the hidden-instruction matchFixes #297.
Validation
uv run pytest -m 'not integration and not provider' tests/(3,174 passed, 14 skipped, 38 deselected, 4 xfailed)uv run pytest tests/nodes/analyzers/test_static_patterns.py tests/nodes/test_security_remediation.py -q(237 passed)uv run ruff check src/ tests/uv run ruff format --check src/ tests/release-validation@0.1.3; P2 findings dropped from 2 to 0