Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE=registry.access.redhat.com/ubi9-micro:latest

FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1785443561 AS builder
FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1786023237 AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ”’ Security & Privacy | ๐ŸŸ  Major | โšก Quick win

๐Ÿงฉ Analysis chain

๐Ÿ Script executed:

#!/usr/bin/env bash
set -euo pipefail

image='registry.access.redhat.com/ubi9/go-toolset:9.8-1786023237'
digest="$(skopeo inspect --format '{{.Digest}}' "docker://${image}")"

case "$digest" in
  sha256:*) ;;
  *) echo "Invalid digest: $digest" >&2; exit 1 ;;
esac

printf 'Use: %s@%s\n' "$image" "$digest"

Repository: openshift-hyperfleet/hyperfleet-api

Length of output: 217


๐Ÿ Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- Dockerfile ---'
cat -n Dockerfile

printf '%s\n' '--- repository references to the image ---'
rg -n -F 'registry.access.redhat.com/ubi9/go-toolset' . --glob '!vendor/**' --glob '!node_modules/**' || true

printf '%s\n' '--- Docker-related files ---'
git ls-files '*Dockerfile*' '*dockerignore*' '.containerignore'

Repository: openshift-hyperfleet/hyperfleet-api

Length of output: 2870


๐Ÿ Script executed (no clone):

#!/usr/bin/env bash
set -euo pipefail

image='registry.access.redhat.com/ubi9/go-toolset'
tag='9.8-1786023237'
manifest_url="https://registry.access.redhat.com/v2/ubi9/go-toolset/manifests/${tag}"

printf '%s\n' '--- registry manifest headers ---'
curl --fail --silent --show-error --location \
  -H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json' \
  -D - -o /tmp/ubi9-go-toolset-manifest.json \
  "$manifest_url" | sed -n '1,40p'

printf '%s\n' '--- registry manifest digest and shape ---'
sha_header="$(curl --fail --silent --show-error --location \
  -H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json' \
  -D - -o /dev/null "$manifest_url" | awk 'BEGIN{IGNORECASE=1} /^Docker-Content-Digest:/ {gsub("\r","",$2); print $2; exit}')"
printf 'Docker-Content-Digest: %s\n' "${sha_header:-<missing>}"
python3 - <<'PY'
import json
with open('/tmp/ubi9-go-toolset-manifest.json', encoding='utf-8') as f:
    data = json.load(f)
print('mediaType:', data.get('mediaType'))
print('schemaVersion:', data.get('schemaVersion'))
print('manifests:', len(data.get('manifests', [])))
for item in data.get('manifests', []):
    print(item.get('platform'), item.get('digest'))
PY

Length of output: 1250


๐Ÿ Script executed (no clone):

#!/usr/bin/env bash
set -euo pipefail

manifest_url='https://registry.access.redhat.com/v2/ubi9-micro/manifests/latest'
curl --fail --silent --show-error --location \
  -H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json' \
  -D - -o /dev/null "$manifest_url" |
  awk 'BEGIN{IGNORECASE=1} /^Docker-Content-Digest:/ {gsub("\r","",$2); print "ubi9-micro:latest digest:", $2; found=1} END{if (!found) exit 1}'

Length of output: 223


Pin all base images by digest before merging.

Proposed fix
-FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1786023237 AS builder
+FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1786023237@sha256:5d26ff5606bd6590930e7cfc202b510e3fe2c7a7a1720860f444ab49c45128cb AS builder
-ARG BASE_IMAGE=registry.access.redhat.com/ubi9-micro:latest
+ARG BASE_IMAGE=registry.access.redhat.com/ubi9-micro:latest@sha256:b1e86b97028b8fcfb6d85f997c39e6b6b67496163ef8d80d243220a4918e8bef

Keep BASE_IMAGE overrides digest-qualified. Mutable tags allow later builds to use different image bytes and create a supply-chain integrity risk (CWE-494).

๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` at line 3, Update the Dockerfileโ€™s builder base image reference
to a digest-qualified form, and ensure any BASE_IMAGE override remains
digest-qualified rather than accepting a mutable tag. Keep the existing builder
stage behavior unchanged.

Source: Path instructions


ARG GIT_SHA=unknown
ARG GIT_DIRTY=""
Expand Down