Skip to content

Commit

Permalink
Sign ignores .sig, .att, .sbom
Browse files Browse the repository at this point in the history
The signing tasks no longer signs cosign signatures, attestations and
sboms (images that end with .sigg, .att, or .sbom) and ignores them
instead.

closes #1347
  • Loading branch information
MichalPysik committed Jun 17, 2024
1 parent da8a70f commit 72eda42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES/1347.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The signing task no longer signs cosign signatures, attestations and
sboms (images that end with .sigg, .att, or .sbom), and ignores them
instead.
10 changes: 7 additions & 3 deletions pulp_container/app/tasks/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from aiofiles import tempfile
from asgiref.sync import sync_to_async
from django.conf import settings
from django.db.models import Q

from pulpcore.plugin.models import Repository

Expand Down Expand Up @@ -46,12 +47,15 @@ def sign(repository_pk, signing_service_pk, reference, tags_list=None):
latest_version = repository.latest_version()
if tags_list:
latest_repo_content_tags = latest_version.content.filter(
pulp_type=Tag.get_pulp_type(), pk__in=tags_list
pulp_type=Tag.get_pulp_type(),
pk__in=tags_list,
)
else:
latest_repo_content_tags = latest_version.content.filter(pulp_type=Tag.get_pulp_type())
latest_repo_tags = Tag.objects.filter(pk__in=latest_repo_content_tags).select_related(
"tagged_manifest"
latest_repo_tags = (
Tag.objects.filter(pk__in=latest_repo_content_tags)
.select_related("tagged_manifest")
.exclude(Q(name__endswith=".sig") | Q(name__endswith=".att") | Q(name__endswith=".sbom"))
)
signing_service = ManifestSigningService.objects.get(pk=signing_service_pk)

Expand Down

0 comments on commit 72eda42

Please sign in to comment.