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
10 changes: 10 additions & 0 deletions validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,16 @@ def resolve_digest(image_ref: str) -> dict[str, Any]:
"Docker-Content-Digest header, so there is nothing authoritative to pin to"
),
}
# --pin writes this value verbatim into template.yaml, so a hostile or
# broken registry must not be able to inject arbitrary text there.
if not re.fullmatch(r"sha256:[0-9a-f]{64}", digest):
return {
"ok": False, "skipped": False, "network_error": False,
"reason": (
f"{image_ref}: registry returned a malformed Docker-Content-Digest "
f"{digest[:80]!r}; refusing to pin it"
),
}
return {"ok": True, "digest": digest}


Expand Down
Loading