BlogSecurity
Guardrails at the gateway: what LiteLLM leaves switched off
A freshly installed LiteLLM gateway checks keys and forwards requests. It does not mask personal data, look for prompt injection, cap spending or restrict tools until you configure each of those. LiteLLM says so itself in its mapping to the OWASP list for LLM applications. Start with budgets, log redaction and one guardrail for personal data, run new guardrails in observation mode first, and do not expect a filter to stop a determined attack. As of 27 November 2026.
What is off by default
The table shortens LiteLLM's own OWASP mapping. The page states that nearly every control stays off until it is configured. Three things are always on: keys are stored as hashes, credentials are masked, and error messages are scrubbed.
| Risk | Control in the gateway | Default |
|---|---|---|
| Prompt injection | Guardrails on input, tools and MCP calls | Off |
| Personal data and secrets leaving | PII masking, secret detection, log redaction | Off |
| An agent doing too much | Permissions for MCP servers, agents and tools | Open until you define a list |
| Runaway cost | Budgets, rate limits, size caps | Off |
| Harmful or leaking output | Guardrails on the response | Off |
| Tampered releases | Signed images, locked dependencies | On |
None of this is a flaw. A gateway cannot know your budgets or which data counts as sensitive in your company. But somebody has to make these decisions, and a pilot that skips them teaches people that the gateway is safe when it is merely running.
How a guardrail is defined
A guardrail is a named entry in the gateway configuration. It says which check runs, at which point in the request, and whether it applies to everyone. Behind the name sits a detector. That can be Presidio for personal data, running in your own network, LiteLLM's built-in content filter, or a hosted service.
guardrails:
- guardrail_name: "pii-mask"
litellm_params:
guardrail: presidio
mode: "pre_call"
default_on: trueThe mode decides what users feel. A check before the call delays every request by the time the check takes. A check during the call runs alongside the model and holds the answer back until it has finished. A check after the call sees the answer as well. Logging only scans in the background and adds no delay, which makes it the right mode for the first weeks.
A blocked request comes back to the application as an error with status 400. Tell developers before you switch a guardrail from observing to blocking, or the first block will be reported as an outage.
A baseline to switch on first
- 1
Budgets and rate limits on every team
The cheapest protection there is. A leaked key or a looping agent then costs a known amount.
- 2
Decide what the logs keep
Redaction of request content in the logs is off by default. Agree with data protection whether prompts are stored at all, and set it before the first user starts.
- 3
One guardrail for personal data on the way out
Mask it before a request reaches an external provider. Run the detector in your own network, so the check itself does not send data elsewhere.
- 4
Explicit permissions for MCP servers
Until a list is defined, every caller can reach every registered server. Define the lists before the first server is added.
- 5
Prompt injection checks in observation mode
Let them log for a few weeks and read what they flag. Switch to blocking once the false alarms are rare enough that developers will not route around the gateway.
Switching guardrails on for a single key or team needs the Enterprise licence. In the open-source version a guardrail applies to all traffic or is requested per call.
German text and where the check runs
Detectors for personal data are built and tested mostly on English. Presidio can be set up for German, but it needs a German language model and recognisers for the formats you care about, such as German addresses or personnel numbers. Test it on your own texts before you rely on it. Fifty real messages from your helpdesk tell you more than any benchmark.
The second question is where the detector runs. A hosted guardrail service receives every prompt it checks, which makes it one more processor of your data. For a company that set up a gateway to keep data under control, a detector in its own network is usually the consistent choice.
What guardrails cannot do
A guardrail recognises patterns. It catches the credit card number and the well-known injection phrase. It does not understand what an agent is about to do with a document it has just read. The protection that holds against prompt injection is limiting what the agent can reach: which tools, which data, with whose rights. Guardrails come on top of that. They do not replace it.
We configure guardrails as part of gateway work and test them on the client's own data before anything is set to block.
Questions
Does LiteLLM block prompt injection out of the box?
No. Its own OWASP mapping lists the guardrails for prompt injection as off by default. You define a guardrail and decide whether it observes or blocks.
How much latency does a guardrail add?
It depends on the detector and the mode. A check before the call adds its full run time to every request, and logging only adds none. Measure it with your own traffic before you commit to a mode.
Do guardrails need the Enterprise licence?
Not in general. Defining guardrails and applying them to all traffic is part of the open-source version, including PII masking with Presidio. Control per key or team needs the licence.
Related services
LiteLLM gateway
Budgets and access rules for every team's AI use, through a LiteLLM gateway that is hardened, connected to your identity provider and kept up to date.
AI system testing
Before go-live, acceptance tests on your own cases tell you how often your chatbot, assistant or agent is right, in terms your QA team already uses.
More from the blog
MCP servers behind the gateway
How to control MCP servers centrally through a LiteLLM gateway: what is open by default, how key, team and organisation permissions combine, how to grant single tools, and who should approve a new server.
Keys, teams and budgets in LiteLLM
A key and budget layout for LiteLLM that works for a pilot of twenty people and still works for five hundred: who gets which kind of key, where budgets belong and how to keep the master key out of daily use.
Prompt injection boundaries
How to limit the damage when an agent follows instructions hidden in a document, email or tool result: map untrusted inputs to actions, cut the paths and test the boundaries.
LiteLLM in production
How to keep running a self-hosted LiteLLM gateway after the March and October 2026 release compromises and two exploited vulnerabilities, from checking whether you were hit to the settings and checklist we use before go-live.
Talk to an engineer
Bring one piece of work you would like to improve. The call takes 30 minutes and needs no access to your systems or your data.
Booking runs on Google Calendar.

Mickey Graf
Founder and CEO of Cloudsail
Prefer to write first? Leave your email and a few lines. Mickey reads every message himself and replies by email with times for a call.
Look for the draft in your email program
Send it from there, and Mickey replies in person with times for a 30-minute call. If no draft has opened, write to us at miki@cloudsail.com.