Repository navigation
feat(proxy): warn when fips_mode starts with a Postgres password login - #53097
Open
yucheng-berri wants to merge 5 commits into
Open
yucheng-berri wants to merge 5 commits into
yucheng-berri wants to merge 5 commits into
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
Contributor
[Low impact] The PR appears safe to merge, with no new actionable findings.
|
This was referenced Nov 20, 2026
Contributor
Author
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
from
November 20, 2026 19:56
066faf1 to
d8192d7
Compare
Contributor
Author
1 similar comment
Contributor
Author
yucheng-berri
force-pushed
the
litellm_fips_rust_db_tls
branch
from
November 20, 2026 21:14
18e75c9 to
33cd7c7
Compare
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
from
November 20, 2026 21:14
98b5e2f to
89f596b
Compare
Contributor
Author
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
2 times, most recently
from
November 20, 2026 23:30
8226e70 to
fe2dccc
Compare
Contributor
Author
3 of 6 tasks
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
from
November 20, 2026 23:51
fe2dccc to
ba9cdc1
Compare
Contributor
Author
yucheng-berri
force-pushed
the
litellm_fips_rust_db_tls
branch
from
November 21, 2026 00:22
4b599be to
d24f3f1
Compare
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
from
November 21, 2026 00:22
ba9cdc1 to
9c31e72
Compare
Contributor
Author
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
from
November 21, 2026 01:22
9c31e72 to
576d6b5
Compare
Postgres password login (SCRAM-SHA-256) is computed outside the FIPS module by the Rust bridge, Prisma's engines and libpq. With fips_mode on, the proxy now logs a warning when DATABASE_URL carries a password and neither RDS IAM nor Azure Entra token login is on, and names client-certificate login as the fix.
… the token refresh does Greptile: under LITELLM_PGBOUNCER_ENABLED the workers log in to the in-container PgBouncer with a password even when IAM or Entra token login is on upstream, so that case now gets its own warning. Devin: the token flags were read with str_to_bool, which misses values like 1 and yes that token_auth_flag_enabled accepts.
…assword under fips_mode The bridge's reader pool and Prisma both log in to the read replica, so a password there is a SCRAM login outside the FIPS module even when DATABASE_URL uses a client certificate.
The migrations log in with DIRECT_URL when it is set, and RDS IAM or Azure Entra token login never replaces it, so a password there is a SCRAM login outside the FIPS module. The warning now checks DIRECT_URL too, and under token login checks it alone.
3 of 6 tasks
yucheng-berri
force-pushed
the
litellm_fips_rust_db_tls
branch
from
November 23, 2026 20:52
dd0ba79 to
e99e5d9
Compare
yucheng-berri
force-pushed
the
litellm_fips_db_password_warning
branch
from
November 23, 2026 20:52
576d6b5 to
54cce6b
Compare
Contributor
Author
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handwritten 1-3 sentence description
[insert handwritten description here]
Details
TLDR
Problem this solves:
How it solves it:
fips_mode: true, each worker now logs one warning at startup whenDATABASE_URL,DATABASE_URL_READ_REPLICAorDIRECT_URLcarries a password and neitherIAM_TOKEN_DB_AUTHnorAZURE_POSTGRESQL_AUTHis on. The two flags are read withtoken_auth_flag_enabled, the same parser the token refresh usesDIRECT_URLis the URL the migrations log in with. Token login rewrites onlyDATABASE_URL, so under token login a password inDIRECT_URLstill warns, and the warning says to leaveDIRECT_URLunsetLITELLM_PGBOUNCER_ENABLED, the workers always log in to the in-container PgBouncer with a password, even when the upstream login uses a token, so they get a PgBouncer-specific warningBased on
main. It changes only Python, so it does not depend on #53917 or the Rust PRs (#53070, #53103, #53104), and they merge in any order. This is item 2 of 4 for the Rust bridge's crypto in the FIPS image.User Flow
Before: an operator turns on
fips_modewith a password inDATABASE_URL, and nothing tells them the login runs outside the FIPS modulegeneral_settings.fips_mode: trueDATABASE_URLispostgresql://postgres:<password>@db:5432/litellm?sslmode=requireAfter: the same operator gets one warning at startup that names the fix
general_settings.fips_mode is on but DATABASE_URL logs in to Postgres with a password. ... Use client-certificate login instead ...Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreuv run pytest tests/unit/proxy/common_utils/test_fips.py: 82 passed on the head. The new tests cover the warning cases (password, client certificate, a password read replica next to a client-certificate writer, a passwordDIRECT_URLnext to a client-certificate writer or under RDS IAM or Azure Entra token login, a client-certificateDIRECT_URL, a read replica alone, no database, RDS IAM and Azure Entra set totrue,1oryes, an unreadable flag, an unparseable URL, PgBouncer workers with each upstream login), that the message never contains the password, and that onlyfips_mode: truelogs it.Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
A
DIRECT_URLthat logs in with a passwordThis was added after the gauntlet found that a password in
DIRECT_URLgot no warning, including under token login, although the migrations log in with it. The rig is Postgres 16 over TLS withhostssl all migr all scram-sha-256andhostssl all all all cert.DATABASE_URLis a client-certificate login, and the proxy runsfips_mode: truewith 1 worker and runs the migrations at startup. Before ismain's FIPS imagefips-mb:75f71a8, which has no warning at all. After isfips-t:39b5d94, built from917f64aa9fcplus the fixes, with this PR's headfips.py. The576d6b5ac06column is from the gauntlet's 2026-11-21 run of the old stack headfips-r4:917f64a, which carries this PR's previousfips.py.Rerun on 2026-11-23 after main
628e4a6fdc9was merged into the PRs: Beforefips-mb2:628e4a6(main), Afterfips-t4:846a655(the five PRs merged together, built the same way). Every row above came out the same on both, and the format and rotation matrix matched on all 29 rows.576d6b5ac06DIRECT_URL=postgresql://migr:...key/generate200; Postgres logsidentity="migr" method=scram-sha-2565 times; no warninggeneral_settings.fips_mode is on but DIRECT_URL logs in to Postgres with a password. ... Or leave DIRECT_URL unset, so the migrations log in the way DATABASE_URL does.onceDIRECT_URLmethod=cert, no warningDIRECT_URLa client-certificate loginmethod=cert, no warningdatabase_password_login_warningcalled in the After image with RDS IAM (IAM_TOKEN_DB_AUTH=True) or Azure Entra (AZURE_POSTGRESQL_AUTH=True) and a passwordDIRECT_URLnamesDIRECT_URL. With the same token login and noDIRECT_URL, it returns nothing.Before is #53070's head
7194a822331(fips-r1:7194a82, built withdocker build -f litellm/deploy/docker/Dockerfile.fips --target final). After isacf609bfed7(fips-r2:acf609b), built as the Before image with this PR'sfips.pycopied over the installed one, the only file this PR changes outside tests (sha256sumof the installed file matches the PR's). Both run on an x86_64 VM.066faf118f8adds the read replica check, shown in its own section below.d8192d74e91is the same commits restacked onto #53070's18e75c927ab, which fixes the bridge pool's handling of the database root certificate and client key files, and98b5e2f0e98only changes the test's log collector to a tuple.89f596b38a9is that restacked onto #53070's33cd7c7369a, which brings #52997's newfips-checkline for grpc and libpq.9c31e72cd3brestacked them onto #53070'sd24f3f1d42d, which is based onmainwith #52997 merged, and whose pool also picks up replaced or late-mounted client certificate files. The current head576d6b5ac06is the same commits restacked onto #53070'sdd0ba7934de, which only adds a CI step. This PR'sfips.pyis unchanged.Dashboard on the After image, with real OpenAI and Anthropic calls
The audit proxy (After image,
fips_mode: true, password login, 2 workers) after the audit run: a Playground call toanthropic/claude-haiku-4-5, then the Logs page with the audit's calls.The whole flow: login, Virtual Keys, Playground, Logs
Real provider calls and the startup warning, on both images
Same rig as #53070: Postgres 16 over TLS 1.2, the proxy with 2 workers and
fips_mode: true,openai/gpt-4.1-miniandanthropic/claude-haiku-4-5with real keys. Every call sends its ownx-litellm-tagsvalue, and every 200 has to write exactly one spend row with that tag. Each config's database password is random, and the whole proxy log is searched for it. All 29 cells per image give the same status and the same spend rows on both images; the only difference is the warning.sslmode=require: chat,/v1/messages,/v1/responses(SDK sync, async stream, curl), 5 error cases, a repeated call, a 5 KB prompthostssl all all all cert,sslidentity+sslpassword,PGSSLCERT+PGSSLKEY, no password): chat, messages stream, responsesmethod=cert, no warningmethod=cert, no warningPGSSLKEY: chat, messages stream, responsesLITELLM_PGBOUNCER_ENABLED=true, password login upstream: chat, messages stream, responseslitellm-nativeandlitellm-prismaciphersECDHE-RSA-AES256-GCM-SHA384ECDHE-RSA-AES256-GCM-SHA384A read replica that logs in with a password
Added after the gauntlet found that a password in
DATABASE_URL_READ_REPLICAgot no warning whenDATABASE_URLused a client certificate, although the bridge's reader pool and Prisma both log in to the replica. Postgres 16 over TLS withhostssl all reader all scram-sha-256andhostssl all all all cert, the proxy with 2 workers andfips_mode: true,DATABASE_URLa client-certificate login. Before is #53070 (fips-r1:7194a82),acf609bis this PR before the fix, After is066faf118f8(fips-r2:066faf1, the Before image with this PR'sfips.py).acf609bDATABASE_URL_READ_REPLICA=postgresql://reader:...key/generateandkey/list200; Postgres logsidentity="reader" method=scram-sha-256fromlitellm-nativeandlitellm-prisma; no warninggeneral_settings.fips_mode is on but DATABASE_URL_READ_REPLICA logs in to Postgres with a password...oncemethod=cert, no warningThe warnings as logged on After:
Type
🆕 New Feature
Behavior changes
Removed / renamed
None.
Silent regressions to watch
WARNINGlog line per worker at startup, only withfips_mode: trueand a password inDATABASE_URL,DATABASE_URL_READ_REPLICAorDIRECT_URL. Nothing else changes: the proxy starts and connects exactly as beforeMigration for existing customers
None required. To clear the warning, switch the database login to a client certificate, RDS IAM or Azure Entra.
Regression tests
tests/unit/proxy/common_utils/test_fips.py: the warning cases above, including the read replica andDIRECT_URL, the password never appearing in the message, and the warning showing only withfips_mode: true.Caveats (if any)
Medium
fips_mode: trueand a password login still runs the SCRAM math outside the FIPS modulefips_modedeployment that logs in with a password, so it needs its own decisionLow
DATABASE_URL,DATABASE_URL_READ_REPLICAorDIRECT_URLis checked. A password supplied throughPGPASSWORD, a.pgpassfile or apassword=query parameter is not detectedLITELLM_PGBOUNCER_ENABLED) is coveredFinal Attestation