feat(docker): generuj SBOM (CycloneDX 1.6) w build, upload jako workflow artifact#181
Closed
mpasternak wants to merge 1 commit into
Closed
feat(docker): generuj SBOM (CycloneDX 1.6) w build, upload jako workflow artifact#181mpasternak wants to merge 1 commit into
mpasternak wants to merge 1 commit into
Conversation
Praktyka #15 z lirantal/pypi-security-best-practices (Generate SBOMs). Dockerfile (builder stage): - Po `uv pip uninstall matplotlib` (R6) generujemy sbom.json przez `uvx --from cyclonedx-bom cyclonedx-py environment /app/.venv`. - uvx ephemeral - cyclonedx-bom nie zostaje w obrazie, tylko sbom.json (~50-100 KB) idzie do runtime stage przez COPY --from=builder. Runtime stage: - COPY --from=builder /app/sbom.json ./sbom.json - SBOM jest dostepny pod sciezka `/app/sbom.json` w kazdym obrazie (bpp_base, bpp_appserver itd. - wszystkie ekstendują z tego samego runtime layer). build-docker-images.yml (FAZA 4 - po promote): - Pull obrazu, docker create + docker cp /app/sbom.json - Upload jako workflow artifact "sbom-<final_tag>", 90-dniowa retencja - Fallback dla starych obrazow (sprzed tego PR-a): warning bez fail - actions/upload-artifact pinowane na SHA (zgodnie z PR #176) Use case: # Przy disclosure nowego CVE szybkie sprawdzenie czy production ma vuln: docker run --rm iplweb/bpp_appserver:latest \ cat /app/sbom.json | jq '.components[] | select(.name == "<pkg>")' # Lub pobranie z workflow artifacts dla forensic analizy historycznej: gh run download <run-id> -n sbom-<version>
2 tasks
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.
Podsumowanie
PR 9/12 z serii pypi-security-best-practices — praktyka #15: Generate and Track SBOMs.
Co się zmienia
docker/bpp_base/DockerfileBuilder stage (po
uv pip uninstall matplotlib):RUN --mount=type=cache,target=/root/.cache/uv,id=uv-cache \ uvx --from cyclonedx-bom cyclonedx-py environment \ /app/.venv \ --output-format JSON \ --output-file /app/sbom.jsonuvxpullujecyclonedx-bomephemeral — nie zostaje w obrazie, tylkosbom.json(~50-100 KB) idzie do runtime stage przezCOPY --from=builder.Runtime stage:
COPY --from=builder /app/sbom.json ./sbom.json—SBOM dostępny pod
/app/sbom.jsonw każdym obrazie wynikowym(bpp_appserver, bpp_workerserver itd.).
.github/workflows/build-docker-images.ymlNowa FAZA 4 po promote staging→canonical:
docker pull+docker create+docker cp /app/sbom.jsonactions/upload-artifact(SHA-pinned) → workflow artifactsbom-<final_tag>z 90-dniową retencją./app/sbom.json):warning, bez fail (graceful degradation).
Use cases
Impact assessment przy nowym CVE
Forensic analysis
Co to NIE jest
inwentaryzacji" — pomaga w impact assessment, nie udowadnia tożsamości.
Sigstore byłby kolejnym PR-em ale jest poza scope tej serii (BPP nie
jest publishowany na PyPI).
tylko dla Python deps. Trivy już skanuje warstwę systemową.
Plan testowy
uvx --from cyclonedx-bom cyclonedx-py environment .venv→Components: 240, format: CycloneDX 1.6, valid JSON.
sbom-<tag>widoczny w Actions UI.🤖 Generated with Claude Code