Repository navigation
feat(security): add opt-in prompt injection heuristics - #52
Conversation
Score managed requests against bounded prompt injection and jailbreak rules when PROMPT_INJECTION_MODE is log or block. Block mode refuses with 422 before dispatch; both modes report the decision in X-MultiLLM-Injection-Action and a content-free log line. Key and route policies can only tighten the operator policy, and request bodies cannot change it. With the mode unset, requests are not inspected.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
multillm-proxy | a532fae | Oct 09 2026, 09:27 AM |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…o feat/prompt-injection # Conflicts: # package.json
522f315
into
integrate/gateway-waves-1-4
Summary
Adds opt-in prompt injection and jailbreak heuristics for managed requests.
PROMPT_INJECTION_MODEisoffby default. While it is off, requests, responses, headers and logs are unchanged and nothing is inspected.logdispatches normally and addsX-MultiLLM-Injection-Action: logged.blockreturns 422prompt_injection_suspectedwithX-MultiLLM-Injection-Action: blockedbefore compaction or generation.PROMPT_INJECTION_THRESHOLDis 3, and the valid range is 1 to 768. An invalid mode or threshold disables inspection and logs one warning, without the value.prompt_injection_mode,prompt_injection_threshold) and route policy can only tighten the operator setting, and can't enable it when it is off.prompt_injectionfield is ordinary content: it is neither interpreted nor removed.Details are in
docs/prompt-injection.md.Wiring in this PR
worker/roleplay/endpoint.mjs). The detector is loaded only when the mode is on.services/secret_firewall.pygainsprotect_managed_payloadand an opt-inmanaged=Truepath onprotect_payload.Coordinator edits in this PR
X-MultiLLM-Injection-Actionin both CORS expose lists (route_helpers.py,worker/cors-policy.mjs).tests/test_prompt_injection_worker.mjsintest:worker;worker/prompt-injection-detection.mjsin the edge module inventory;PROMPT_INJECTION_MODEandPROMPT_INJECTION_THRESHOLDin the Container env keys.setting_change;Left for the Wave 5 integration
Registering
register_prompt_injection(app, is_managed=..., route_policy=...)inapp.py. It goes after retention and credential policy, and before identity, cache replay and admission, with a predicate that excludes raw forwarding.Tests
tests/test_prompt_injection.pyandtests/test_prompt_injection_worker.mjscover:npm run test:worker: 1,486 passed.npm run test:integration: 7 passed.test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.CI notes
python/nodejobs: the dependency-audit steps fail on every branch, including main. fix(deps): clear the CI dependency audit advisories #42 fixes that.AdmissionCoordinatorDurable Object migration, whichwrangler versions uploadcannot apply. This is expected untilwrangler deployruns on main.This is part of Wave 5. It is based on
integrate/gateway-waves-1-4, the Wave 4 integration branch. The README line comes with the Wave 5 integration PR.