Add security/prompt_injection_firewall skill - #267
Conversation
|
Thanks @mrmasa88, this was a good start as expected when following the AI native workflow from earlier today. Some things to address before merge: The heuristic core is solid and useful as a Layer-1 trust-boundary scanner, but I would remove the Gemini Coverage is a good base but not complete yet. Still add detectors + golden tests for: homoglyphs/confusables, variation-selector / emoji smuggling, markdown/HTML comments actually wired, and at least one nested encoding case. Include one false-positive fixture so the lexicon isn’t hair-trigger. Overal, think about it, and discuss with your model to see what kind of protection a prompt injection firewall could have locally, then pass your insights to the worker model. On category, I have a feeling this could be under security later, but compliance is good for now as requested from the issue, need to think about it. Some minor things
on PR processSince this was automatically opened by the agent, it's ok, but as with the previous PR notice, please try to manually open PRs from your fork, and not let the agent to do it. Agents can commit and push to your fork, from where it is recommended you manually open PR, review the code one last time before PR, and use PR template in content block, short is fine, eg. skip empty N/A noise, also don’t include “Made with Cursor.” Ping when updated and I’ll re-review and merge if green. This is good as a v0.1. In short, I would take some time to think, or discuss with AI, what kind of practices and methods we should use to run this locally without relyig on external models to review prompts, considering if prompt injection is found, it can harm also the auditing model. There was a good repo karpathy shared with context about prompt injection patterns and types that could be used as local reference set, similar to wallet screening or mica skills. Just an idea, don't take it by word, maybe you find a better format. <3 |
|
Hey! @rosspeili Updated per your review — LLM path fully removed (offline-only, One housekeeping note: the first commit (5b5fa4c, from the auto-opened PR) still carries the Co-authored-by: Cursor trailer — the new commit is clean. If you squash-merge, feel free to drop it from the message; or if you'd rather I rewrite the branch for clean history, happy to do that instead. Your call. Warm regards, Masa |
|
Thanks @mrmasa88, this is clearly better <3 I’d still take a hit on:
Ping after that and we can merge as v0.1. <3 |
4529dee to
f482880
Compare
|
Hey! @rosspeili Updated — all eight addressed:
One thing I want to flag rather than quietly diverge on — item 3: I removed Green locally: black/flake8 clean, bundle 26 passed, repo suite 179 passed, Warm regards, Masa |
|
Thanks @mrmasa88, re-reviewed the amended branch, re-ran the skill locally, and this now makes sense to me as a solid local/offline v0.1 for 46. From my side, I don’t see another functional blocker in the current shape. One structural point to decide before merge is category:
One nuance I noticed in live smokesQuoted critical exfil phrases in benign explanatory prose can still trip Follow-up upgrade references for next iterationsAgain, not blockers for v0.1, but good next upgrades:
Net: I’m happy with this as v0.1. Nice work. <3 Let me know if you wanna move to security or keep in compliance for now and move later, eg. in next upgrade. We can merge as is. |
f482880 to
07050c5
Compare
|
Hey! @rosspeili Done — moved to the new security category. Carried the rename through everything: bundle path and All green: black/flake8 clean, bundle 26 passed, repo suite 179 passed, Warm regards, Masa |
Summary
Adds
security/prompt_injection_firewall— a deterministic, offline-only pre-flight scanner that inspects untrusted text before an agent consumes it. Zero network, zero keys; every response carriesoffline: true. There is no auditing model in the loop, so there is nothing for an injection to hijack. This also opens the newsecuritycategory.Detectors: hidden text incl. HTML and markdown comments, zero-width/bidi/tag characters, variation-selector (emoji) smuggling, confusables skeleton for homoglyphs, and bounded nested decoding (base64/hex/percent, depth <= 3). The instruction-override lexicon lives in
kb/injection_patterns.json(17 patterns) alongside a 221-entrykb/confusables.json— all self-authored with provenance, no third-party corpus import. False-positive control via mention-vs-use downgrade plus a corroboration rule;sensitivity: strict|balanced|lenient(defaultbalanced), with a floor that fails a lone critical exfiltration hit at every level. Output keeps the issue-spec fields exactly and addsrisk_level/findings[]/offline/sensitivity.Fixes #46
Type of change
Testing
black / flake8 clean; bundle 26 passed; repo suite 179 passed;
sync_extras.py --checkclean; no stalecompliance/...references; no LLM/network surface outside negative assertions.