Prompt Firewall
A guardrail that decides whether text should be allowed, flagged, or blocked before it reaches an LLM — combining injection detection, secret detection, and PII redaction under a policy you control.
100% client-side · a demonstration of middleware guardrails
Policy
Try a sample
The firewall decision, the rules that triggered it, and a sanitized version of your text will appear here.
Use it in your code
The exact engine on this page ships as a free npm package and a CLI, so you can run the same allow / flag / block policy in your app and in CI. Nothing is uploaded.
npm package
npm install @opensecureai/firewallimport { evaluateFirewall } from "@opensecureai/firewall";
const { decision, sanitized } = evaluateFirewall(userInput);
if (decision === "block") reject();
else use(sanitized);CLI
# check a file, or pipe via stdin
npx -y @opensecureai/firewall check prompt.txt
# CI gate: exit non-zero if anything is flagged
cat prompt.txt | npx -y @opensecureai/firewall check --fail-on flagHow it works
The firewall runs two engines over your text — the prompt-injection scanner and the PII & secrets scanner — then applies your policy: injection or secrets trigger a block, PII is redacted and flagged. This is the same logic a production middleware would run on both inputs and model outputs.