Skip to content

Add support for Sigstore bundle files #2247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2023
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
2 changes: 1 addition & 1 deletion downloads/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Meta(GenericResource.Meta):
'creator', 'last_modified_by',
'os', 'release', 'description', 'is_source', 'url', 'gpg_signature_file',
'md5_sum', 'filesize', 'download_button', 'sigstore_signature_file',
'sigstore_cert_file',
'sigstore_cert_file', 'sigstore_bundle_file',
]
filtering = {
'name': ('exact',),
Expand Down
18 changes: 18 additions & 0 deletions downloads/migrations/0009_releasefile_sigstore_bundle_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.24 on 2023-02-14 21:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('downloads', '0008_auto_20220907_2102'),
]

operations = [
migrations.AddField(
model_name='releasefile',
name='sigstore_bundle_file',
field=models.URLField(blank=True, help_text='Sigstore Bundle URL', verbose_name='Sigstore Bundle URL'),
),
]
3 changes: 3 additions & 0 deletions downloads/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ class ReleaseFile(ContentManageable, NameSlugModel):
sigstore_cert_file = models.URLField(
"Sigstore Cert URL", blank=True, help_text="Sigstore Cert URL"
)
sigstore_bundle_file = models.URLField(
"Sigstore Bundle URL", blank=True, help_text="Sigstore Bundle URL"
)
md5_sum = models.CharField('MD5 Sum', max_length=200, blank=True)
filesize = models.IntegerField(default=0)
download_button = models.BooleanField(default=False, help_text="Use for the supernav download button for this OS")
Expand Down
1 change: 1 addition & 0 deletions downloads/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ class Meta:
'resource_uri',
'sigstore_signature_file',
'sigstore_cert_file',
'sigstore_bundle_file',
)
5 changes: 4 additions & 1 deletion downloads/templatetags/download_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ def strip_minor_version(version):

@register.filter
def has_sigstore_materials(files):
return any(f.sigstore_cert_file or f.sigstore_signature_file for f in files)
return any(
f.sigstore_bundle_file or f.sigstore_cert_file or f.sigstore_signature_file
for f in files
)
8 changes: 6 additions & 2 deletions templates/downloads/release_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ <h1 class="page-title">Files</h1>
<td>{{ f.filesize }}</td>
<td>{% if f.gpg_signature_file %}<a href="{{ f.gpg_signature_file }}">SIG</a>{% endif %}</td>
{% if release_files|has_sigstore_materials %}
<td>{% if f.sigstore_cert_file %}<a href="{{ f.sigstore_cert_file}}">CRT</a>{% endif %}</td>
<td>{% if f.sigstore_signature_file %}<a href="{{ f.sigstore_signature_file }}">SIG</a>{% endif %}</td>
{% if f.sigstore_bundle_file %}
<td colspan="2">{% if f.sigstore_bundle_file %}<a href="{{ f.sigstore_bundle_file}}">.sigstore</a>{% endif %}</td>
{% else %}
<td>{% if f.sigstore_cert_file %}<a href="{{ f.sigstore_cert_file}}">CRT</a>{% endif %}</td>
<td>{% if f.sigstore_signature_file %}<a href="{{ f.sigstore_signature_file }}">SIG</a>{% endif %}</td>
{% endif %}
{% endif %}
</tr>
{% endfor %}
Expand Down