fix(container): harden runtime image - #805
Merged
Merged
Conversation
Remove the build-only pip distribution and its embedded vendor SBOM from the final image. Normalize public runtime binary and library permissions for the non-root appuser and protect both invariants with mutation-resistant Dockerfile contract tests.\n\nCloses #804
Reject appended replacement stages that could reintroduce pip or override the non-root runtime user.\n\nRefs #804
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.
Summary
appuserImmutable candidate
4080c7be093b92c5e14b5b10deb2e1d36c9a1d73develop/ merge-base:1f03aae376eb2f7753042549fbbddb2ccc3ed547e4ef3c11b1ab6f3021acd8bededb4a6946ef096bdocker/DockerfileSHA-256:418397d03e37ae029993012b19598fd56acce0fb8b934ab9ee6ad97a88d86f98tests/test_container_runtime_security_contract.pySHA-256:0a19f69f17dda9e3d9dd5b79ad09b91884f8ef5fdaa8545f869da767f2d9ea5aExact PR CI runs
323535457373235354574832353545829Root cause
The fail-closed release scan reported stale
setuptools 70.3.0andmsgpack 1.1.2entries from pip's embeddedpip/_vendor/bom.cdx.json; neither distribution was installed in the final runtime image. Reproduction matched upstream Trivy discussion #11031. The same image inspection found existing restrictive file modes that blocked non-root Uvicorn imports and the curl-based Docker healthcheck.No Trivy ignore, suppression, severity downgrade, package pin, application behavior, API, or schema change is included.
Verification
appuser;/api/health/livereturns alive; Docker health is healthyCloses #804