Repository navigation
feat(docker): install cryptography, grpcio and libpq from chainguard apks in the fips image - #52997
Merged
Merged
Conversation
…apks in the fips image The PyPI grpcio and psycopg-binary wheels carry their own TLS, so their connections never reach the FIPS provider. Chainguard builds all three packages against its FIPS OpenSSL, so the venv now sees system packages, skips the three wheels, and the runtime stage installs the apks. The scan waivers for the bundled copies are gone, so a wheel that slips back in fails the build.
Contributor
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
3 of 6 tasks
Contributor
Author
Contributor
Author
|
bugbot run |
Contributor
[Medium impact] The PR appears safe to merge, with the previous library-check gap addressed.
|
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4fcd7cc. Configure here.
This was referenced Nov 20, 2026
Contributor
Author
3 of 6 tasks
yuneng-berri
approved these changes
Nov 20, 2026
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:
This covers C2 (LIT-8433) and C4 (LIT-8435), and it replaces #52263's source build for C3 (LIT-8434). Only the FIPS image changes. The regular image is untouched.
User Flow
Before: an operator runs the FIPS image against a Postgres or gRPC server that offers ChaCha20, and those connections use ChaCha20 outside the FIPS module
general_settings.fips_mode: trueand aDATABASE_URLwithsslmode=requirelitellm-prismalogins onECDHE-RSA-CHACHA20-POLY1305After: the same connections use AES-GCM through the FIPS module, and a ChaCha20-only server is refused
litellm-prismalogins onECDHE-RSA-AES256-GCM-SHA384no shared cipherLinear ticket
Resolves LIT-8433
Resolves LIT-8435
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 moreDelays 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
Both images were built on an x86_64 VM from the pinned Chainguard FIPS base in
Dockerfile.fips, with the FIPS provideropenssl-provider-fips-3.4.03.4.0-r5.Before is #52263 at
cc3a0907114. It is main's FIPS image plus the cryptography source build, with the same grpcio and psycopg-binary wheels as main. On main itself, the cryptography wheel also bundles its own OpenSSL andfips_mode: truecannot boot (see #52263).After was built from
8eec05f37cd(#52263 merged with the merged FIPS image PR) with this PR'sDockerfile.fipsand scan change applied. Main has not touchedDockerfile.fips, the scan files, or these three packages inuv.locksince then. The only other difference is the builder'spkgconf, which only the cryptography source build needed.Head rebuild (
4fcd7ccf177, amd64 and arm64)The PR head was rebuilt on both architectures and run through the same checks below plus a production matrix. On both, psycopg and grpc refuse a ChaCha20-only server, chat works over AES-GCM, and client-certificate login works with
PGSSLCERT/PGSSLKEY.Production matrix: 23 of 23 pass on amd64 and arm64 head, same as the amd64 baseline
cc3a0907114/model/new, survives restart (stored keyv2:gcm:)fips_modeoffShared setup, on one docker network, with server names prefixed by
<prefix>(<prefix>pgispgmixbelow):pgmix: Postgres 16, TLS 1.2,ssl_ciphers=ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384,ssl_prefer_server_ciphers=on, so it picks ChaCha20 whenever the client offers itpgchacha: the same, withssl_ciphers=ECDHE-RSA-CHACHA20-POLY1305onlyraw:4443andraw:4444: TLS 1.2 servers with the same two cipher lists that log the cipher each handshake pickedgrpc:50051: a TLS gRPC echo serverGRPC_SSL_CIPHER_SUITES=ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384, so gRPC offers ChaCha20 first. A FIPS OpenSSL drops it, a bundled BoringSSL keeps itDATABASE_URL=postgresql://postgres:pw@pgmix:5432/litellm?sslmode=requireandLITELLM_LOCAL_MODEL_COST_MAP=True, with an OpenAI-compatible TLS upstream that logs the cipherPostgres, servers, client and proxy config
Before (
cc3a0907114)rawserver log for the gRPC handshakes (4443 then 4444, gRPC retries each)fips_mode: true./key/generate, thenPOST /v1/chat/completionswith the new key returns 200. Postgres logins during boot and traffic, byapplication_nameand cipherAfter (
8eec05f37cd+ this change)rawserver log for the gRPC handshakesfips_mode: true./key/generate, thenPOST /v1/chat/completionswith the new key returns 200, and the upstream sawECDHE-RSA-AES256-GCM-SHA384. The proxy worker maps/usr/lib/libpq.so.5.18,/usr/lib/ossl-modules/fips.soand the apk's cryptography_rust.abi3.so. Postgres loginsBuild-time checks in the
fips-checkstage:openssl-fips-testpasses, the cryptographyis_fips_enabled()assert passes, and the scan printsPASS: all 113 ELF binaries accounted forwith the grpc and psycopg waivers removed. Atcf808c19f0cthe amd64 image builds again with the new grpc and libpq check passing (#57 DONE 0.8s)The new check needs
libssl.so.4in the library'sNEEDEDlist and no definedSSL_,EVP_orBIO_symbols. It finds grpc'scygrpcmodule by import and libpq by what psycopg loads. Run against each library on its own:libsslit needscygrpc, amd64 and arm64libssl.so.4libpq.so.5.18, amd64 and arm64libssl.so.4cygrpc(BoringSSL linked in)libpqlibssl-6a9b88ec.so.3The arm64 rows ran on the arm64 head image's libraries. The arm64 image was not rebuilt for this commit
tests/code_coverage_tests/test_scan_bundled_crypto.pypasses locally (52 tests). The new cases fail the scan for a PyPI grpcio or psycopg-binary binary that bundles TLSType
🚄 Infrastructure
✅ Test
Behavior changes
Removed / renamed
Silent regressions to watch
Migration for existing customers
Regression tests
test_pypi_grpcio_and_psycopg_binary_tls_failspins that the bundled copies fail the scanfips-checkstage fails the build if the apk grpc or libpq stops linkinglibssl.so.4or brings its own TLSCaveats (if any)
High
litellm-native) still negotiates ChaCha20Medium
grpcio==1.84.1unmet andpsycopg-binarymissing. Nothing checks this at runtimeLow
/usr/lib/python3.13/site-packages, outside the scan roots like libpq and every other Chainguard packageis_fips_enabled()Final Attestation
Note
High Risk
Changes how the FIPS image supplies TLS for Postgres, gRPC, and cryptography; misconfiguration could break DB/OTel connectivity or weaken FIPS guarantees.
Overview
The FIPS Docker image no longer installs PyPI
cryptography,grpcio, orpsycopg-binary. The builder creates a venv with system site packages anduv syncskips those three packages; the runtime stage pullspy3.13-cryptography,py3.13-grpcio-1.84, andlibpq-18from Chainguard so TLS uses the image’s FIPS OpenSSL instead of bundled wheels.Build-time enforcement is tightened: the
fips-checkstage assertscryptographyreports FIPS enabled,fips_elf_inventory.txtdrops grpc/psycopg wheel binaries, andscan_bundled_crypto.shremoves waivers for cryptography, grpcio, and psycopg-binary—so any returning bundled-TLS wheels fail the build. Tests add cases that those PyPI artifacts are violations, not waived paths.Reviewed by Cursor Bugbot for commit 4fcd7cc. Bugbot is set up for automated code reviews on this repo. Configure here.