Repository navigation
build(container): minimize build-stage images and reorganize CVE catalog - #2007
josecelano merged 11 commits into
Conversation
… add progress log entry
There was a problem hiding this comment.
Pull request overview
This PR reduces the dependency footprint and CVE exposure of the Containerfile build stages (chef, tester, gcc) by switching to slimmer base images and tightening installed APT packages, and it reorganizes the security CVE catalog to separate production-runtime vs build-stage analyses.
Changes:
- Switched
cheftorust:slim-trixiewith only the minimal native dependencies needed for tool installation/builds. - Minimized
testerby consolidating the APT/tooling install into one layer and removing setup-onlycurl. - Replaced
gcc:trixiewithdebian:trixie-slim+ minimal compiler headers, and reorganized/expanded security scan & CVE analysis documentation.
Reviewed changes
Copilot reviewed 12 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Containerfile |
Minimizes foundational build stages via slimmer base images and reduced APT installs. |
project-words.txt |
Adds dpkg to the cspell project dictionary. |
docs/security/README.md |
Updates security documentation pointers for the reorganized CVE catalog. |
docs/security/docker/README.md |
Documents how to run build-stage security scans and where to record results. |
docs/security/docker/scans/README.md |
Splits scan reporting between production exposure and build-stage exposure. |
docs/security/docker/scans/torrust-tracker.md |
Refreshes production image scan history with the post-change verification. |
docs/security/docker/scans/build-images.md |
Adds consolidated scan history for the chef/tester/gcc build stages. |
docs/security/analysis/README.md |
Reorganizes the analysis index/process to use production/ and build/ subcatalogs. |
docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md |
Updates build-stage triage evidence and references for the new minimized stages. |
docs/security/analysis/production/CVE-2026-5435.md |
Adds per-CVE production-runtime non-affecting analysis entry. |
docs/security/analysis/production/CVE-2026-5450.md |
Adds per-CVE production-runtime non-affecting analysis entry. |
docs/security/analysis/production/CVE-2026-5928.md |
Adds per-CVE production-runtime non-affecting analysis entry. |
docs/security/analysis/production/CVE-2026-6238.md |
Adds per-CVE production-runtime non-affecting analysis entry. |
docs/security/analysis/production/CVE-2026-27171.md |
Adds per-CVE production-runtime non-affecting analysis entry. |
docs/issues/open/1463-1457-use-rust-slim-builder-image.md |
Adds an issue spec capturing the rationale, measurements, and verification steps. |
.github/skills/dev/maintenance/catalog-security-vulnerabilities/SKILL.md |
Updates the skill to reflect the new CVE catalog structure. |
.github/skills/dev/maintenance/run-manual-docker-security-scan/SKILL.md |
Updates the scan skill to reflect the new CVE catalog structure. |
Comments suppressed due to low confidence (1)
docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md:3
- The frontmatter
date-analyzedis set to 2026-07-20, but this bulk-triage file is explicitly dated2026-06-10in its filename and referenced that way elsewhere. Keepingdate-analyzedaligned with the filename avoids confusion when grepping/sorting by date; the 2026-07-20 refresh is already captured in the document’s change log.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…uild-stage scan evidence
… add progress log entry
0751c6a to
84d58d5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 18 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md:4
- The frontmatter
date-analyzedis now2026-07-20, but the filename and changelog indicate the analysis was originally created on2026-06-10and later refreshed. To avoid confusion when scanning the catalog by filename/date, consider recording the original analysis date explicitly in frontmatter (or alternatively renaming the file and updating references).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 18 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md:3
- The file name and changelog indicate this analysis was created on 2026-06-10, but frontmatter
date-analyzedwas changed to 2026-07-20. That makes it unclear whetherdate-analyzedmeans ‘initial analysis’ or ‘last refresh’. Keepdate-analyzedaligned with the original analysis date and rely on the changelog for later updates.
…pin cargo-nextest, fix cspell, update security README
…fix GCC casing, add explanatory replies
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 18 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md:7
- The file name suggests this is the 2026-06-10 bulk scan/event record, but the frontmatter and body now describe a 2026-07-20 scan (e.g.,
date-analyzed: 2026-07-20). Indocs/security/analysis/README.mdthe convention for bulk scan/event files is{date}_{source}.md, so this mismatch makes the catalog harder to navigate chronologically. Consider moving this updated analysis into a new file named with the new scan date (and leaving the original 2026-06-10 record intact), then update inbound links accordingly.
|
ACK a20ef3b |
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of #2007 as its change stands at e170b96 on the default branch.
What still runs: the chef stage builds on rust:slim-trixie and installs only curl, libssl-dev and pkg-config (Containerfile:14-26); the tester stage installs sqlite3, time and [email protected] in one layer and purges curl afterwards (Containerfile:44-50); the gcc stage compiles su-exec on debian:trixie-slim with only gcc and libc6-dev (Containerfile:60-67). Later commits moved torrust-cargo-chef from 0.1.78 to 0.1.79 and added the CARGO_BUILD_JOBS cap; the base images, package lists and cargo-nextest pins are as merged. The CVE catalog keeps the production/ and build/ layout this change introduced.
[Minor] The catalog move left references to the old layout, although the description says the cross-references were updated. docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md:9 (a semantic-links.related-artifacts entry) and docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md:97 (the pointer from the ADR's security rationale to the build-stage analysis) both name docs/security/analysis/non-affecting/2026-06-10_containerfile-trixie-cves.md, which does not exist at e170b96; the file is docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md. A reader who follows the ADR to the analysis finds nothing, and the frontmatter validator resolves related-artifacts paths only for issue and epic specs in the draft and open folders (contrib/dev-tools/checks/frontmatter-validator/src/repository.rs:147), so no check reports it. In the moved analysis itself, docs/security/analysis/build/2026-06-10_containerfile-trixie-cves.md:91 still says the tested binary is produced by rust:trixie, which this change replaced with rust:slim-trixie in the same file's tables. Smallest fix: point both ADR lines at the build/ path and change rust:trixie to rust:slim-trixie on line 91.
[Nit] [email protected] is written twice: at Containerfile:28 in chef, whose descendants run cargo nextest archive, and at Containerfile:47 in tester, whose descendants run cargo nextest run --archive-file on those archives. Nothing ties the two lines together, and the repository's dependency-update configuration covers only GitHub Actions and Cargo, so a later bump of one line alone brings back the version skew between the producer and the consumer of the archive that the pin was added to remove. Smallest fix: declare ARG CARGO_NEXTEST_VERSION=0.9.140 once before the first FROM, redeclare ARG CARGO_NEXTEST_VERSION in both stages and install cargo-nextest@${CARGO_NEXTEST_VERSION}.
[Nit] The curl ... | bash pipe at Containerfile:46 runs under /bin/sh without pipefail, so the pipeline's status is that of bash: a failed download exits 0 and the layer fails one command later with cargo's unknown-command error for binstall, not at the download, and a transfer that breaks mid-stream lets bash run a truncated prefix of the installer. .hadolint.yaml:34-37 waives DL4006 because pipefail would require installing bash in every build stage, but the two stages that pipe (Containerfile:27 and Containerfile:46) already pipe into bash, so it is present in both. Smallest fix: add SHELL ["/bin/bash", "-o", "pipefail", "-c"] to the chef and tester stages and reword the DL4006 rationale to match.
Checked and found sound: the slim chef image covers the native build needs of the lockfile at e170b96 (the sqlite feature of sqlx bundles SQLite, openssl-sys finds libssl-dev through pkg-config, aws-lc-sys, ring and zstd-sys build with the C compiler the slim Rust image keeps, and there are no git dependencies or workspace build scripts); apt-get purge --auto-remove curl in tester removes only what curl pulled in, leaving the TLS libraries the tests load and the libz.so.1 that Containerfile:233-234 copies into the shipped image; debian:trixie-slim with gcc and libc6-dev provides the cc and headers that su-exec.c needs; the runtime stage and what it copies from the build stages are unchanged; the cargo-nextest pins match each other at e170b96; and the unpinned installer URL on main at Containerfile:27 and Containerfile:46 is a trade-off the project records in .hadolint.yaml:39-48.
Description
Minimize the three foundational Containerfile build stages (
chef,tester,gcc) by switching to slimmer base images and removing unnecessary dependencies. Reduces build-image size, installed package inventory, vulnerability exposure, and maintenance burden without weakening build or test coverage.Changes
chefstage:rust:trixie→rust:slim-trixiewith three demonstrated native deps (curl,libssl-dev,pkg-config). Reduces from 1,662.7 MB / 455 packages / 2,148 findings to 1,067.4 MB / 145 packages / 1,072 findings.testerstage: Consolidated APT layer, removed setup-onlycurlaftercargo-nextestinstallation. Retains onlysqlite3,time, andcargo-nextest. Finalizes at 975.9 MB / 123 packages / 1,014 findings.gccstage:gcc:trixie→debian:trixie-slimwith onlygccandlibc6-dev. Reduces from 1,556.4 MB / 464 packages / 2,165 findings to 274.3 MB / 114 packages / 1,008 findings.non-affecting/folder into impact-context subdirectories (production/,build/) with per-CVE files and updated cross-references.build-images.mdscan history for ephemeral build stages. Productionreleasescan refreshed confirming no regression (5 MEDIUM, 0 HIGH, 0 CRITICAL).Each stage was implemented, validated, and committed independently. Containerized tests passed for every stage.
Related to #1463, #1457