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.

By Updated

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.

Default state of protective controls in LiteLLM, shortened from LiteLLM's OWASP LLM Top 10 mapping, checked on 27 November 2026
RiskControl in the gatewayDefault
Prompt injectionGuardrails on input, tools and MCP callsOff
Personal data and secrets leavingPII masking, secret detection, log redactionOff
An agent doing too muchPermissions for MCP servers, agents and toolsOpen until you define a list
Runaway costBudgets, rate limits, size capsOff
Harmful or leaking outputGuardrails on the responseOff
Tampered releasesSigned images, locked dependenciesOn

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.

A guardrail that masks personal data before the request leaves, in the form the LiteLLM documentation uses. Presidio also needs the addresses of its analyzer and anonymizer services
guardrails:
  - guardrail_name: "pii-mask"
    litellm_params:
      guardrail: presidio
      mode: "pre_call"
      default_on: true

The 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. 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. 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. 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. 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. 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.

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

Mickey Graf

Founder and CEO of Cloudsail

Rated 4.9 out of 5 on Clutch

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.

The button prepares an email in your own email program, for you to send. Privacy policy (draft)