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 |
|
Thanks @mrmasa88, re-reviewed after the One tiny blocker before merge so we don’t need a follow-up PR:
After that, I’m happy to merge as v0.1 and close #46. Keeping ideas as reference for follow-ups we can track in a later upgrade issue (not blockers for this one):
Nice work as always. <3 |
07050c5 to
406444f
Compare
|
Hey! @rosspeili Added — Good call keeping it in this PR rather than a follow-up — the catalog and CONTRIBUTING now agree, and the "discuss a new top-level category with maintainers first" rule was satisfied by your go-ahead on Telegram. The five follow-up ideas all sound right to me — especially the deployment-pattern docs and the richer encoded-finding metadata. Happy to pick some of them up when you open the upgrade issue. Thanks for the thorough reviews on this one <3 Warm regards, Masa |
|
@mrmasa88, final sweep looks super clean. <3 Merging as v0.1 and closing #46. Follow-up upgrade ideas stay as discussed (mention-vs-use for quoted critical exfil, fixture corpus, encoded-finding metadata, hidden-channel expansion, deployment-pattern docs). Nice work seeing this through. <3 I will create a skill upgrade issue based on what we have, what is missing, and what was discussed before, and ping you on it if you wanna claim and move further with strenghtening this. |
|
Thanks Ross! @rosspeili — and thanks for the reviews on this one. Both of your calls made it a much better skill: killing the LLM path forced the design into something genuinely offline (and removed the auditing model as an attack surface), and opening Yes please, ping me on the upgrade issue — I'd like to claim it. Off the top of my head I'd start with the deployment-pattern docs and the richer encoded-finding metadata, but happy to take whatever order you scope. <3 |
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.