feat: add LLM semantic security review for SKILL.md scanner (QEMETRICS-2415)#43
Open
Benkapner wants to merge 1 commit into
Open
feat: add LLM semantic security review for SKILL.md scanner (QEMETRICS-2415)#43Benkapner wants to merge 1 commit into
Benkapner wants to merge 1 commit into
Conversation
…S-2415) Add 3 LLM-based security checks adapted from harness-eval-lab rubric: - Anti-jailbreak: self-declared safety claims, evaluation bypass attempts - Semantic attacks: polite reframings, gradual escalation, split-instruction - Description-behavior mismatch: stated purpose vs actual instruction Addresses review feedback: - Strip markdown fences from LLM JSON response - Normalize severity values with .strip() to prevent block bypass - Add content size limit (40k chars) for large submissions - Expand pattern allowlists (Italian/Arabic/Hindi, shields.io, raw.githubusercontent) - Add 4 mock tests for LLM review path (valid, fenced, failure, invalid JSON)
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
Adds LLM-based semantic security review to the SKILL.md scanner, complementing the deterministic regex checks merged in PR #42. Adapted from harness-eval-lab's security review rubric.
What the LLM checks
Three checks that catch attacks regex cannot detect:
How it works
source: \"llm\"llm_client.chat_completion()(same as quality review)use-llm=trueconvention--no-llmflagChanges
abevalflow/security/skillmd_scanner.pySECURITY_REVIEW_PROMPT,_extract_json(),llm_security_review()abevalflow/gates/security/base.py.strip()to severity parsing to prevent block bypassscripts/skillmd_security_scan.py--no-llmflag, LLM review runs by defaultpipeline/tasks/phases/test.yamltests/test_skillmd_scanner.pyChanges since previous review (PR #39)
This replaces PR #39 (moved from fork to org branch). All review feedback from Guy has been addressed:
Must Fix:
_extract_json()to strip markdown fences from LLM JSON response before parsing.strip()to severity parsing inbase.pyto prevent block bypass from trailing whitespaceShould Fix:
5. Added content size limit (
MAX_TOTAL_CHARS = 40_000) with truncation warning for large submissions6. Expanded pattern allowlists: added Italian/Arabic/Hindi/Russian/Dutch/Swedish/Turkish to translate evasion; added shields.io and raw.githubusercontent to markdown image
Test plan
./scripts/misc/trigger_test_runs.sh)Ref: QEMETRICS-2415
Replaces PR #39 (moved from fork to org branch per review feedback).">