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: 9 additions & 1 deletion release/scripts/check_postgresql_advisory_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ def image_evidence(report: Any, report_name: str, target_key: str) -> tuple[str,
if SHA256_DIGEST.fullmatch(digest) is None:
fail(f"{report_name} image target must use a sha256 digest")
repo_digests = target.get("repoDigests")
if not isinstance(repo_digests, list) or user_input not in repo_digests:
if (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required DCO sign-off

The full message for commit c5361ccf5edae41e560c77807d7f27832a6861e2 has no Signed-off-by: trailer, while the root AGENTS.md requires a DCO sign-off on every commit; recreate this commit with a matching sign-off before it is merged.

AGENTS.md reference: AGENTS.md:L70-L70

Useful? React with 👍 / 👎.

not isinstance(repo_digests, list)
or not any(
isinstance(repo_digest, str)
and "@" in repo_digest
and repo_digest.rsplit("@", 1)[1] == digest
Comment on lines +78 to +79

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject malformed repository digest references

When either report contains a malformed entry such as @sha256:<locked digest> or not a repository@sha256:<locked digest>, this predicate accepts it because it validates only the presence of @ and the suffix. The advisory checker therefore no longer fails closed on malformed repoDigests metadata, despite this being a release-provenance gate; parse and validate the repository component while allowing only the intended Docker Hub alias normalization.

AGENTS.md reference: AGENTS.md:L79-L81

Useful? React with 👍 / 👎.

for repo_digest in repo_digests
)
):
fail(f"{report_name} image target digest must appear in repoDigests")
if target.get("architecture") != "amd64" or target.get("os") != "linux":
fail(f"{report_name} image target must be linux/amd64")
Expand Down
25 changes: 25 additions & 0 deletions release/scripts/test_registry_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,31 @@ def run_checker(
)
self.assertEqual(0, extra_metadata_result.returncode, extra_metadata_result.stderr)

target["repoDigests"] = [
f"index.docker.io/library/postgres@{digest}"
]
normalized_repository_result = run_checker(
"Low", {"versions": [], "state": "not-fixed"}
)
self.assertEqual(
0,
normalized_repository_result.returncode,
normalized_repository_result.stderr,
)

target["repoDigests"] = [
"index.docker.io/library/postgres@sha256:" + "d" * 64
]
wrong_digest_result = run_checker(
"Low", {"versions": [], "state": "not-fixed"}
)
self.assertEqual(1, wrong_digest_result.returncode)
self.assertIn(
"image target digest must appear in repoDigests",
wrong_digest_result.stderr,
)
target["repoDigests"] = [image_ref]

mismatch_result = run_checker(
"Low",
{"versions": [], "state": "not-fixed"},
Expand Down
Loading