Skip to content

Commit

Permalink
Fix a sync filtered cosign without sigstore issue
Browse files Browse the repository at this point in the history
fixes: #1759
  • Loading branch information
git-hyagi committed Sep 9, 2024
1 parent 0406fa2 commit a9f2fce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES/1759.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Resolved an issue where syncing filtered content with a `cosign` signature from a remote source lacking `Sigstore`,
and with `signed_only: true` enabled, could occasionally fail.
4 changes: 2 additions & 2 deletions pulp_container/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ async def run(self):
content_data, raw_text_data, response = await artifact

digest = calculate_digest(raw_text_data)
tag_name = response.url.split("/")[-1]

# Look for cosign signatures
# cosign signature has a tag convention 'sha256-1234.sig'
if self.signed_only and not signature_source:
if (
not (tag_name.endswith(".sig") and tag_name.startswith("sha256-"))
and f"sha256-{digest}.sig" not in tag_list
and f"sha256-{digest.removeprefix('sha256:')}.sig" not in tag_list
):
# skip this tag, there is no corresponding signature
log.info(
Expand All @@ -168,7 +169,6 @@ async def run(self):
media_type = determine_media_type(content_data, response)
validate_manifest(content_data, media_type, digest)

tag_name = response.url.split("/")[-1]
tag_dc = DeclarativeContent(Tag(name=tag_name))

if media_type in (MEDIA_TYPE.MANIFEST_LIST, MEDIA_TYPE.INDEX_OCI):
Expand Down

0 comments on commit a9f2fce

Please sign in to comment.