Skip to content
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

fix: handle image references with both a tag and digest present #763

Merged
merged 2 commits into from
Dec 23, 2022

Conversation

chgl
Copy link
Contributor

@chgl chgl commented Aug 22, 2022

Fixes #749

Description

It is possible for image references to contain both a tag and a digest at the same time. Previously, this was not handled causing the validators to fail.

I'm not sure if what I did is the most idiomatic or even elegant Python, but the changes are at least fairly small.

I've built and pushed the image as ghcr.io/chgl/connaisseur:fix-image-tag-and-digest and testet it using the helm chart by setting

deployment:
  image: ghcr.io/chgl/connaisseur:fix-image-tag-and-digest

The images that were previously causing issues were now correctly validated and accepted.

Checklist

  • PR is rebased to/aimed at branch develop
  • PR follows Contributing Guide
  • Added tests (if necessary)
  • Extended README/Documentation (if necessary)
  • Adjusted versions of image and Helm chart in values.yaml and Chart.yaml (if necessary)

@chgl
Copy link
Contributor Author

chgl commented Aug 22, 2022

Draft as long as there is no consensus on whether or not this is actually the right approach in #749

@xopham xopham changed the base branch from master to develop August 26, 2022 15:54
@chgl chgl force-pushed the fix-image-digest-detection branch 2 times, most recently from ca3e612 to 67015b0 Compare August 26, 2022 16:11
@chgl chgl marked this pull request as ready for review August 26, 2022 22:47
@phbelitz phbelitz mentioned this pull request Dec 2, 2022
5 tasks
@phbelitz
Copy link
Member

phbelitz commented Dec 2, 2022

@richgerrard with this the tag is preserved and should be visible in the k8s pod description. additionally, what might be possible to do is add the tag and digest as annotations to the mutated resource. that might be more convenient to get information about the resource, without the need to do additional parsing. is that something you deem as useful?

@phbelitz phbelitz force-pushed the fix-image-digest-detection branch 2 times, most recently from 384aaca to 7342024 Compare December 2, 2022 12:52
tests/validators/notaryv1/test_notaryv1_validator.py Outdated Show resolved Hide resolved
connaisseur/image.py Show resolved Hide resolved
connaisseur/image.py Show resolved Hide resolved
connaisseur/image.py Show resolved Hide resolved
connaisseur/image.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Base: 96.90% // Head: 96.94% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (5ed6c9b) compared to base (00b6d2a).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #763      +/-   ##
===========================================
+ Coverage    96.90%   96.94%   +0.04%     
===========================================
  Files           22       22              
  Lines         1226     1244      +18     
===========================================
+ Hits          1188     1206      +18     
  Misses          38       38              
Impacted Files Coverage Δ
connaisseur/flask_application.py 93.75% <100.00%> (ø)
connaisseur/image.py 100.00% <100.00%> (ø)
...naisseur/validators/notaryv1/notaryv1_validator.py 98.36% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

connaisseur/image.py Outdated Show resolved Hide resolved
connaisseur/image.py Outdated Show resolved Hide resolved
@phbelitz phbelitz force-pushed the fix-image-digest-detection branch 3 times, most recently from d78dfa6 to df37c94 Compare December 23, 2022 12:01
chgl and others added 2 commits December 23, 2022 13:06
With this change, Connaisseur now supports the use of tags and digests simultaneously. The signature is still validated based on the digest, but the human readable aspect of the tag isn't lost.
@phbelitz phbelitz merged commit 420fb36 into sse-secure-systems:develop Dec 23, 2022
@chgl chgl deleted the fix-image-digest-detection branch December 23, 2022 12:47
@phbelitz phbelitz mentioned this pull request Dec 23, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrectly parsed image references if they contain both a tag and digest
4 participants