fix: patch base-image vulnerabilities; correct multi-arch; safer tags + CI#43
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the maniator/gh Docker image to reduce vulnerability scanner findings by refreshing the Alpine base and ensuring packages are upgraded, and introduces an opt-in rolling tag scheme (vMAJOR, vMAJOR.MINOR) to let consumers receive base-image security updates without relying on mutable rebuilds of fully-qualified vX.Y.Z pins.
Changes:
- Bump the Docker base image (both stages) to Alpine
3.24.1and runapk upgrade --no-cacheduring builds. - Update the default
GH_VERSIONbuild arg and adjustset_tagsto publish rolling tags only for the newest upstreamghrelease. - Document the tag immutability/rolling scheme in
README.mdand add a downstream usage/exposure report.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Dockerfile | Updates Alpine base image and adds apk upgrade; updates default GH_VERSION. |
| hooks/scripts/set_tags | Adds guard logic intended to only move rolling tags on newest release builds. |
| README.md | Documents rolling vs immutable tags and pinning guidance. |
| downstream-usage-report.md | Adds a report summarizing downstream pinning exposure and tag recency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95762adbd8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
95762ad to
75f4895
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Thanks for the automated reviews — all three points are addressed in the latest push:
Also added Trivy / hadolint / shellcheck / dependabot workflows so regressions get caught on future PRs. |
75f4895 to
ed171ba
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…; CI Base image / CVE fixes (apply to `latest` and all future builds — no breakage): - Bump Alpine 3.21.3 -> 3.24.1 in both build stages - Add `apk upgrade --no-cache` to pull OS package security patches - Bump default GH_VERSION 2.10.1 -> 2.95.0 (CI still overrides with latest) Multi-arch correctness (fixes a real bug; supersedes #42): - Download the gh release for TARGETPLATFORM, not BUILDPLATFORM, so arm64/arm images stop shipping the amd64 binary. gh asset names don't map 1:1 to Docker platforms (linux/arm64/v8 -> linux_arm64; no armv7 build, armv6 runs on armv7), so map them explicitly. Verified by a linux/amd64+arm64+arm/v7 buildx build. Tag strategy — protect pinners without breaking reproducibility: - set_tags publishes rolling `vMAJOR`/`vMAJOR.MINOR` (e.g. v2, v2.95) + `latest`, only when building the newest release. - Exact `vX.Y.Z` tags are immutable by default (published once); the nightly job no longer republishes them, so a pin stays byte-for-byte reproducible. - REBUILD_EXACT=1 (workflow_dispatch input) force-refreshes a recent exact tag on the patched base; hooks/scripts/rebuild_recent does this for the latest N=3. - README documents the scheme. New PR-validation workflows (parity with dind-buildx + vuln focus): - Trivy image scan (PR + weekly), hadolint (+ .hadolint.yaml), shellcheck, and dependabot for the base image and Actions. Add downstream-usage-report.md: consumer exposure + Docker Hub tag_last_pulled. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ed171ba to
f5ce245
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Resolved the remaining review threads:
|
Automates the recent-pin security refresh: a matrix job rebuilds the latest 3 exact vX.Y.Z tags on the current patched base (set_tags + bake, REBUILD_EXACT=1), weekly and on demand. Runs the build directly rather than dispatching "Build and Release", since a GITHUB_TOKEN-triggered workflow_dispatch wouldn't start a run. hooks/scripts/rebuild_recent remains for ad-hoc local runs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…tags
- Split release into its own job with contents: write; the workflow now defaults
to contents: read so PR-triggered build steps don't carry a write-capable token
- set_tags emits skip=true when there's nothing to publish (exact tag already
exists and REBUILD_EXACT unset, non-newest); build/release are gated on it so
the run no longer produces an empty tag list and a silent no-op push
- shell-check: use the canonical ${{ github.token }} for reviewdog auth
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Thanks Copilot — addressed the new round:
|
Quote the gh tarball path/URL expansions (SC2086) and add wget -q (DL3047) so hadolint reports zero findings and stops annotating the diff. No behavior change; image still builds gh 2.95.0 across platforms. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- set_tags: resolve VERSION from the latest *stable* gh release (skip drafts/prereleases) so rolling tags aren't suppressed or moved onto a prerelease; validate GH_VERSION matches X.Y.Z before interpolating it into the Docker Hub URL and bake tags (rejects malformed/injected values) - refresh-recent-tags: fetch releases with `curl -fsS --retry` + github.token auth so the matrix step fails fast instead of feeding bad JSON to fromJson Verified set_tags across nightly/dispatch/rebuild/invalid cases; build path unchanged for the normal (newest-release) flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Addressed this round:
Also traced/tested the nightly + push + dispatch + rebuild paths against these changes — the normal newest-release flow still emits |
Why
maniator/gh(~624k pulls) ships on a pinned, increasingly stale Alpine base (what Snyk / Docker Scout flag), and along the way this surfaced a multi-arch binary bug. This patches the base, fixes the binary bug, gives version-pinning consumers a non-breaking path to security updates, and adds CI to catch regressions.What
Base-image / CVE fixes — apply to
latestand all future builds, zero breakage:3.21.3→3.24.1in both stages +apk upgrade --no-cacheGH_VERSION2.10.1→2.95.0(CI still fetches real latest viaset_tags)Multi-arch correctness (real bug; supersedes #42):
TARGETPLATFORM, notBUILDPLATFORM— arm64/arm images were shipping the amd64 binary. gh asset names don't map 1:1 to Docker platforms (linux/arm64/v8→linux_arm64; noarmv7build,armv6runs on armv7), so they're mapped explicitly. Verified with alinux/amd64,linux/arm64,linux/arm/v7buildx build.Tag strategy — protect pinners without breaking reproducibility:
vMAJOR/vMAJOR.MINOR(v2,v2.95) +latestmove on the patched base, only when building the newest release.vX.Y.Ztags are immutable by default (published once; nightly no longer republishes them).REBUILD_EXACT=1(workflow_dispatch input) force-refreshes recent exact tags on the patched base;hooks/scripts/rebuild_recentdoes the latest N=3. Older tags stay frozen.New PR-validation workflows (parity with dind-buildx + vuln focus):
.hadolint.yaml), shellcheck, dependabot (base image + Actions).Report:
downstream-usage-report.md— consumer exposure (gh search code) + Docker Hubtag_last_pulledanalysis.Verification
docker build→gh version 2.95.0; multi-arch buildx confirms each platform pulls its owngh_2.95.0_linux_<arch>.tar.gz.set_tagsvalidated against the live registry: newest build emits rolling tags only (leavesv2.95.0untouched); a missing version emits its exact tag;REBUILD_EXACT=1forces it.hadolint+shellcheckrun clean locally; all workflow YAML validated.Addresses the Copilot + Codex review comments below.
🤖 Generated with Claude Code