Skip to content

feat: retag a caller-verified image digest on releases - #173

Closed
robertvangor wants to merge 3 commits into
mainfrom
retag-verified-digest
Closed

robertvangor wants to merge 3 commits into
mainfrom
retag-verified-digest

Conversation

@robertvangor

@robertvangor robertvangor commented Oct 20, 2026 •

Copy link
Copy Markdown

Bug: The release retag looked up main-/master- again at retag time, so a caller that had verified an image digest could still promote whatever the tag pointed to by then. The retag also re-uploaded the manifest without its trailing newlines, so a newline-terminated manifest was stored under a different digest, and the tag had already been changed by the time that was detected.

Fix: A new optional docker-retag-digest input makes the retag fetch exactly that manifest, check that the fetched bytes hash to it before any tag is changed, and fail if the registry stores another digest. The manifest is now uploaded byte for byte; without the input the tag lookup is unchanged, and the only difference for existing callers is that the release tag keeps the exact bytes and digest of the source manifest.

The release retag re-resolved main-<sha8>/master-<sha8> by tag, so a caller that had verified a digest could still promote whatever the tag pointed to at retag time. An optional docker-retag-digest input makes the retag fetch exactly that manifest, fail if the registry returns another digest, and check that each new tag is stored under it. Without the input the tag lookup is unchanged.
Copilot AI balanced review requested due to automatic review settings October 20, 2026 21:45
@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@robertvangor robertvangor added the minor Pull requests with new features label Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Manifest capture can strip trailing newlines, publishing altered bytes before digest verification fails.

1 open issue
What changed in this PR

Adds optional digest-pinned release retagging so callers can promote a verified image without resolving mutable tags again.

Changes:

  • Wires docker-retag-digest into retagging and validates registry digests.
  • Adds success and failure tests.
  • Documents the input and ignores PUT response headers.
File Description
tests/​retag-image.bats Tests digest-pinned retagging and validation failures.
scripts/​retag-image.sh Adds digest lookup and response verification.
README.md Documents the new input.
AGENTS.md Updates the retagging architecture description.
action.yml Declares and passes the optional digest input.
.gitignore Ignores PUT header artifacts.

Review effort: Balanced

Comment thread scripts/retag-image.sh
if [[ -n "$RETAG_DIGEST" ]]; then
local stored
stored=$(grep -i "^Docker-Content-Digest:" put-headers.txt | cut -d' ' -f2 | tr -d '\r' || true)
if [[ "$stored" != "$RETAG_DIGEST" ]]; then
The manifest was captured with command substitution, which strips trailing newlines, and re-uploaded with -d. A newline-terminated manifest was therefore stored under a different digest, and with docker-retag-digest the mismatch was only detected after the release tag had already been changed.

The manifest is now saved to a temporary file with curl -o, its sha256 is checked against docker-retag-digest before any PUT, and it is uploaded with --data-binary so the bytes stay unchanged. The post-PUT stored-digest check remains as a second guard. Without docker-retag-digest the flow is unchanged except that the uploaded bytes are now exactly the fetched ones.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

minor Pull requests with new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants