Skip to content

Commit 6f4d9c3

Browse files
fix(agent): pin base image digest, always rebuild for security scan
The pre-push security scan failed on stale Docker layer cache — fixable CVEs in the base image weren't picked up because the `security:image` task skipped rebuilds when the image already existed locally. - Pin `python:3.13-slim` to SHA256 digest for reproducible builds - Remove `docker image inspect || build` conditional — always rebuild ensures `apt-get upgrade` picks up latest Debian security patches - Add `.grype.yaml` with documented suppressions for won't-fix CVEs (glibc, curl, ncurses, libexpat, libtasn1, GnuTLS, GnuPG, CPython) The existing `apt-get upgrade --no-install-recommends` in the Dockerfile already handles fixable CVEs — the root cause was stale cache, not missing upgrade logic. Fixes #92 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f38baad commit 6f4d9c3

3 files changed

Lines changed: 71 additions & 2 deletions

File tree

agent/.grype.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
ignore:
2+
# ─── glibc (libc6/libc-bin/libc-dev-bin/libc6-dev) ───
3+
# Debian trixie won't fix. No known exploit path in container context
4+
# (requires local user interaction or specific syscall patterns not used by the agent).
5+
- vulnerability: CVE-2026-5450
6+
fix-state: wont-fix
7+
- vulnerability: CVE-2026-5928
8+
fix-state: wont-fix
9+
- vulnerability: CVE-2026-5435
10+
fix-state: wont-fix
11+
12+
# ─── curl / libcurl ───
13+
# Debian trixie won't fix. Agent uses curl only during image build (NodeSource setup).
14+
# Runtime HTTP is handled by Python httpx/urllib3 — curl binary is not invoked.
15+
- vulnerability: CVE-2026-5773
16+
fix-state: wont-fix
17+
- vulnerability: CVE-2026-3805
18+
fix-state: wont-fix
19+
- vulnerability: CVE-2026-6276
20+
fix-state: wont-fix
21+
22+
# ─── ncurses ───
23+
# Debian trixie won't fix. ncurses is a transitive dep of Python/bash;
24+
# agent runtime does not use terminal UI. No interactive terminal in container.
25+
- vulnerability: CVE-2025-69720
26+
fix-state: wont-fix
27+
28+
# ─── libexpat ───
29+
# Debian trixie won't fix. Used transitively by Python XML parsing;
30+
# agent does not parse untrusted XML.
31+
- vulnerability: CVE-2025-59375
32+
fix-state: wont-fix
33+
- vulnerability: CVE-2026-25210
34+
fix-state: wont-fix
35+
- vulnerability: CVE-2026-41080
36+
fix-state: wont-fix
37+
38+
# ─── libtasn1 ───
39+
# Debian trixie won't fix. Used by GnuTLS for ASN.1 parsing in TLS.
40+
# No untrusted certificate parsing in agent runtime.
41+
- vulnerability: CVE-2025-13151
42+
fix-state: wont-fix
43+
44+
# ─── GnuPG (gnupg/gpg/gpg-agent/gpgconf/gpgsm/dirmngr) ───
45+
# Debian trixie won't fix. gnupg installed for apt key verification during build.
46+
# Not used at agent runtime.
47+
- vulnerability: CVE-2026-24882
48+
fix-state: wont-fix
49+
50+
# ─── libgnutls ───
51+
# No fix version available in Debian trixie yet. GnuTLS provides TLS for
52+
# system packages; agent runtime uses Python's ssl module (OpenSSL) for HTTPS.
53+
- vulnerability: CVE-2026-42010
54+
- vulnerability: CVE-2026-3833
55+
- vulnerability: CVE-2026-33846
56+
- vulnerability: CVE-2026-33845
57+
- vulnerability: CVE-2026-42011
58+
59+
# ─── CPython binary / Debian python3.13 packages ───
60+
# No fix available — awaits next CPython point release (3.13.14+).
61+
# Tracked upstream; Dependabot will bump when python:3.13-slim updates.
62+
- vulnerability: CVE-2026-6100
63+
- vulnerability: CVE-2026-7210
64+
- vulnerability: CVE-2026-3298
65+
- vulnerability: CVE-2026-4786
66+
67+
# ─── libexpat (fixable but no Debian package yet) ───
68+
# Upstream fix exists but not yet in Debian trixie packages.
69+
- vulnerability: CVE-2026-45186

agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FROM --platform=$TARGETPLATFORM golang:1.26.3-bookworm AS gh-builder
88
ARG GH_VERSION
99
RUN GOPROXY=direct GOBIN=/out go install "github.com/cli/cli/v2/cmd/gh@v${GH_VERSION}"
1010

11-
FROM --platform=$TARGETPLATFORM python:3.13-slim
11+
FROM --platform=$TARGETPLATFORM python:3.13-slim@sha256:dc1546eefcbe8caaa1f004f16ab76b204b5e1dbd58ff81b899f21cd40541232f
1212

1313
# Install mise (polyglot dev tool manager)
1414
COPY --from=mise /usr/local/bin/mise /usr/local/bin/mise

agent/mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ description = "Scan container image with trivy"
5757
# the .. context, the build fails because COPY agent/... can't find
5858
# agent/ inside the agent/ directory.
5959
run = [
60-
"docker image inspect bgagent-local:latest >/dev/null 2>&1 || (ARCH=\"$(uname -m)\"; PLATFORM=\"linux/arm64\"; if [ \"$ARCH\" = \"x86_64\" ]; then PLATFORM=\"linux/amd64\"; fi; docker build --build-arg TARGETPLATFORM=\"$PLATFORM\" --build-arg CACHE_BUST=\"$(date +%s)\" -f Dockerfile -t bgagent-local:latest ..)",
60+
"ARCH=\"$(uname -m)\"; PLATFORM=\"linux/arm64\"; if [ \"$ARCH\" = \"x86_64\" ]; then PLATFORM=\"linux/amd64\"; fi; docker build --build-arg TARGETPLATFORM=\"$PLATFORM\" --build-arg CACHE_BUST=\"$(date +%s)\" -f Dockerfile -t bgagent-local:latest ..",
6161
"trivy image --scanners vuln --ignore-unfixed --ignorefile .trivyignore --severity HIGH,CRITICAL --exit-code 1 bgagent-local:latest",
6262
]
6363

0 commit comments

Comments
 (0)