How it works
- After authentication and policies admit the request, the gateway collects every message’s text content plus
promptandinput. - Each rule is matched across that text. A rule contributes its score once per request, however many times or segments it matches.
- The scores are summed. If the total reaches
firewall.threshold, the firewall trips. - The team’s mode decides what happens: nothing (
off), a recorded finding (audit), or a403(enforce).
Rules
With the default threshold of 50, any one strong rule trips the firewall on its own, while the 25-point rules only trip in combination.
Configuration
Key fields
Mode for every team that does not set its own. Any value other than
off, audit or enforce stops startup.
These values are read from
gateway.yaml by the gateway process. The per-team override is stored on the team and is set through the teams API below (or teams[].firewall_mode in gateway.yaml).
What a block returns
403, its findings (source firewall, the rule name and score), and a redacted copy of the body when bodies are recorded. No tokens are consumed.
Common configurations
Roll out safely: audit first
Roll out safely: audit first
Keep
default_mode: audit, watch manylayers_firewall_events_total and the audit findings for a week, then switch high-risk teams to enforce.POST /admin/teams creates the team or, if an organization team with that name exists, updates it. The update replaces monthly_token_budget, rpm_limit, tpm_limit, cache_enabled, firewall_mode and default_config_id with what you send, so include the team’s current values; models changes only when you send it. It requires org.teams.manage and refuses (409) a name used by a workspace team.Exempt an internal red-team
Exempt an internal red-team
Set
firewall_mode: off on that team only; everyone else keeps the default.Stricter scoring
Stricter scoring
Lower
threshold to 25 so every single signal, including a bare system: line or a long base64 blob, trips the firewall. Expect more false positives on technical prompts.Metrics
Firewall vs. the prompt_injection guardrail
They are independent detectors and can run together: the firewall is a cheap first line that runs on text requests (chat completions, completions, embeddings, responses and messages); the guardrail gives finer, per-workspace control and a richer detector set (indirect injection, obfuscation, instruction hierarchy).
The firewall inspects request text only. It does not scan model output or tool results returned in later turns unless they are sent back as message content.
Next steps
Guardrails
Configure the
prompt_injection guardrail per workspace.PII Detection & Redaction
The step that runs right after the firewall.
Metrics
Every Prometheus series the gateway exports.
Request Logging & Audit
Find blocked requests and their findings.