Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ jobs:
docker run --rm --read-only --cap-drop=ALL \
--security-opt=no-new-privileges rust-panosmcp:ci --version

# The runtime is distroless base-nossl: no libssl/libcrypto (rustls-only
# binary, libssl3t64 carries an unfixed CVE) but libgcc_s must be staged in.
container_id=$(docker create rust-panosmcp:ci)
files=$(docker export "$container_id" | tar -t)
docker rm "$container_id" > /dev/null
if echo "$files" | grep -E 'libssl|libcrypto'; then
echo "FAIL: image ships libssl/libcrypto"; exit 1
fi
echo "$files" | grep -q 'libgcc_s\.so\.1$' || { echo "FAIL: libgcc_s.so.1 missing from image"; exit 1; }

# Regression test for mecmcp#357: config paths must survive operator overrides.
# Docker replaces CMD entirely when the caller supplies args, but ENTRYPOINT
# is appended to. Security-relevant flags (device-mapping, tokens-file,
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/digest-drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ jobs:
id: drift
run: |
set -euo pipefail
line=$(grep -m1 '^FROM gcr.io/distroless/cc-debian13' Dockerfile)
# The last distroless FROM is the runtime; the first is only the libgcc donor.
line=$(grep '^FROM gcr.io/distroless/' Dockerfile | tail -1)
repo=$(printf '%s' "$line" | sed -n 's|^FROM gcr.io/distroless/\([^:@]*\).*|\1|p')
pinned=$(printf '%s' "$line" | sed -n 's/.*@\(sha256:[0-9a-f]*\).*/\1/p')
tag=$(printf '%s' "$line" | sed -n 's|^FROM gcr.io/distroless/cc-debian13:\([^@]*\)@.*|\1|p')
[ -n "$pinned" ] && [ -n "$tag" ] || { echo "could not parse Dockerfile FROM line"; exit 1; }
tag=$(printf '%s' "$line" | sed -n 's|^FROM gcr.io/distroless/[^:]*:\([^@]*\)@.*|\1|p')
[ -n "$pinned" ] && [ -n "$tag" ] && [ -n "$repo" ] || { echo "could not parse Dockerfile FROM line"; exit 1; }

token=$(curl -sf "https://gcr.io/v2/token?scope=repository:distroless/cc-debian13:pull&service=gcr.io" \
token=$(curl -sf "https://gcr.io/v2/token?scope=repository:distroless/${repo}:pull&service=gcr.io" \
| python3 -c "import sys,json;print(json.load(sys.stdin)['token'])")
current=$(curl -sfI -H "Authorization: Bearer $token" \
-H "Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json" \
"https://gcr.io/v2/distroless/cc-debian13/manifests/$tag" \
"https://gcr.io/v2/distroless/${repo}/manifests/$tag" \
| tr -d '\r' | sed -n 's/^docker-content-digest: //Ip')
[ -n "$current" ] || { echo "registry did not return a digest"; exit 1; }

echo "tag=$tag"; echo "pinned=$pinned"; echo "current=$current"
echo "repo=$repo tag=$tag"; echo "pinned=$pinned"; echo "current=$current"
{
echo "repo=$repo"
echo "tag=$tag"
echo "pinned=$pinned"
echo "current=$current"
Expand All @@ -48,14 +51,15 @@ jobs:
if: steps.drift.outputs.drifted == 'true'
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ steps.drift.outputs.repo }}
TAG: ${{ steps.drift.outputs.tag }}
PINNED: ${{ steps.drift.outputs.pinned }}
CURRENT: ${{ steps.drift.outputs.current }}
run: |
set -euo pipefail
title="Pinned distroless digest has drifted from the registry"
body=$(printf '%s\n' \
"\`gcr.io/distroless/cc-debian13:$TAG\` no longer resolves to the pinned digest." \
"\`gcr.io/distroless/$REPO:$TAG\` no longer resolves to the pinned digest." \
"" \
"| | digest |" \
"|---|---|" \
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- The image runs on `distroless/base-nossl-debian13` (libgcc_s staged from the
pinned cc image), dropping libssl3t64 and its unfixed CVE-2026-124709. The
binary is rustls-only.
- Container images are published for `linux/amd64` and `linux/arm64`, so Apple
Silicon pulls a native image instead of failing with `no matching manifest`
(mechubsec/rustjunosmcp#648). Each platform builds on its own native runner.
Expand Down
25 changes: 22 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# so a digest-only Dependabot refresh moves the compiler across a point
# release while the CI sync check still reports a match. Digest resolved from
# the registry 2026-08-24.
# Source of libgcc-s1 only; the runtime is base-nossl, which lacks it. Keep it
# ahead of the builder so the runtime stays the last FROM.
FROM gcr.io/distroless/cc-debian13:nonroot@sha256:cb87acc574abe719b6e5c547384defa2f7b1f24af9605d3f618cf852495d8be2 AS libgcc

FROM rust:1.100.0-slim-bookworm@sha256:7c7d4eb4d05b7781187a327809466cfddf29753f6defdc3d19a0e291951b7a37 AS builder

WORKDIR /src
Expand All @@ -24,11 +28,25 @@ COPY rust-panosmcp-core/src rust-panosmcp-core/src

RUN cargo build --release --locked --bin rust-panosmcp

# Runtime base digest verified against registry on 2026-11-10.
# libgcc_s.so.1 is the one library the binary needs beyond glibc, and
# base-nossl does not ship it. Stage it with its dpkg records (status.d) so
# Trivy and the SBOM still see libgcc-s1 and gcc-14-base. The multiarch
# directory comes from the builder's own triplet (x86_64 or aarch64).
COPY --from=libgcc / /cc/
RUN triplet="$(gcc -dumpmachine | sed 's/-pc-/-/')" \
&& install -d "/stage-libgcc/usr/lib/${triplet}" /stage-libgcc/var/lib/dpkg/status.d \
&& cp -a "/cc/usr/lib/${triplet}/libgcc_s.so.1" "/stage-libgcc/usr/lib/${triplet}/" \
&& cp -a /cc/var/lib/dpkg/status.d/libgcc-s1 /cc/var/lib/dpkg/status.d/libgcc-s1.md5sums \
/cc/var/lib/dpkg/status.d/gcc-14-base /cc/var/lib/dpkg/status.d/gcc-14-base.md5sums \
/stage-libgcc/var/lib/dpkg/status.d/

# Runtime base: distroless base-nossl (no libssl3t64/libcrypto: the binary is
# rustls-only, and libssl3t64 carries unfixed CVE-2026-124709). Digest is the
# multi-arch index, verified against the registry on 2026-11-21.
# Digests have no version ordering and must be validated by resolving the tag
# against the registry (docker pull gcr.io/distroless/cc-debian13:nonroot),
# against the registry (docker pull gcr.io/distroless/base-nossl-debian13:nonroot),
# never by comparing hashes or by matching sibling repos.
FROM gcr.io/distroless/cc-debian13:nonroot@sha256:cb87acc574abe719b6e5c547384defa2f7b1f24af9605d3f618cf852495d8be2
FROM gcr.io/distroless/base-nossl-debian13:nonroot@sha256:89815d620ac01d8de13cdaf04d19ed874447ca2296d4985b14b818f6e5e47854

ARG VERSION=0.2.0
ARG VCS_REF=unknown
Expand All @@ -41,6 +59,7 @@ LABEL org.opencontainers.image.title="rust-panosmcp" \
# Official MCP Registry ownership check: must equal server.json "name".
LABEL io.modelcontextprotocol.server.name="io.github.mechubsec/rustpanosmcp"

COPY --from=builder /stage-libgcc/ /
COPY --from=builder --chown=nonroot:nonroot /src/target/release/rust-panosmcp /usr/local/bin/rust-panosmcp

ENV RUST_LOG=info
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ grep -Eq '^FROM rust:.*@sha256:[0-9a-f]{64} AS builder$' Dockerfile
# Pins the approved runtime base. This must move whenever the Dockerfile's base
# moves — it is the check that stops the base drifting silently, so it is
# deliberately exact rather than a wildcard over distroless variants.
grep -Eq '^FROM gcr.io/distroless/cc-debian13:nonroot@sha256:[0-9a-f]{64}$' Dockerfile
grep -Eq '^FROM gcr.io/distroless/base-nossl-debian13:nonroot@sha256:[0-9a-f]{64}$' Dockerfile
if grep -En '(^|[[:space:]])(curl|wget|apt-get|apk|dnf)([[:space:]]|$)' Dockerfile; then
echo "runtime/container build contains an unapproved package-fetch command" >&2
exit 1
Expand Down
Loading