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: only load required delegantions #318

Merged
merged 1 commit into from
Nov 5, 2021
Merged

Conversation

phbelitz
Copy link
Member

When using delegation for nv1, Connaisseur now only loads those delegation files it actually needs for verification and not all available.

fixes #171

@codecov-commenter
Copy link

Codecov Report

Merging #318 (ec9e6ed) into develop (e45fb1a) will decrease coverage by 0.09%.
The diff coverage is 87.50%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #318      +/-   ##
===========================================
- Coverage    96.65%   96.56%   -0.10%     
===========================================
  Files           22       22              
  Lines         1077     1076       -1     
===========================================
- Hits          1041     1039       -2     
- Misses          36       37       +1     
Impacted Files Coverage Δ
...naisseur/validators/notaryv1/notaryv1_validator.py 94.95% <87.50%> (-0.88%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e45fb1a...ec9e6ed. Read the comment docs.

@Starkteetje Starkteetje linked an issue Oct 1, 2021 that may be closed by this pull request
@phbelitz phbelitz force-pushed the fix/only-req-delegations branch 2 times, most recently from 64aae21 to 164b4fc Compare October 20, 2021 15:21
Copy link
Member

@Starkteetje Starkteetje left a comment

Choose a reason for hiding this comment

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

There should be a test to highlight and ensure the functional diff

Copy link
Member

@Starkteetje Starkteetje left a comment

Choose a reason for hiding this comment

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

Commit has delegantions, other than that lgtm

@phbelitz phbelitz force-pushed the fix/only-req-delegations branch 2 times, most recently from 22021d7 to c8f3681 Compare November 5, 2021 12:51
@phbelitz
Copy link
Member Author

phbelitz commented Nov 5, 2021

OKOKOK. I had to change the code a bit after adding additional tests and realizing that there were some bugs... so the last commit adds 3 tests:

  1. checking behavior when a delegation is required, that doesn't exist (didn't had to change the code for that).
  2. checking behavior when a delegation is required (e.g. del1) + the targets.json also has said delegation listed, but the actual file (e.g. targets/del1.json) is missing (had to change the code).
  3. checking behavior when no delegations are required, the targets.json says it theoretically has delegation (even though not required), but the delegation files themselves are missing. this corresponds to a very rare edge case, where delegations are added to a repo, but no signatures were yet created using these delegations. normally we would use the targets/releases.json file, but since this file doesn't exists yet, we have to use the targest.json instead (had to change the code again).

When using delegation for nv1, Connaisseur now only loads those delegation files it actually needs for verification and not all available. Additionally fixed a bug, where when a delegation role was present inside the `targets.json` but the actual delegation file was missing, Connaisseur would have raised a `KeyError`. This has been solved with proper error handling.

fixes #171
Copy link
Member

@Starkteetje Starkteetje left a comment

Choose a reason for hiding this comment

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

Nice one catching the regression

@phbelitz phbelitz merged commit b91d745 into develop Nov 5, 2021
@phbelitz phbelitz deleted the fix/only-req-delegations branch November 5, 2021 13:48
@phbelitz phbelitz mentioned this pull request Nov 23, 2021
3 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.

Only download required delegations
3 participants