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

Fixing issue 3743 #3744

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Fixing issue 3743 #3744

merged 4 commits into from
Jun 25, 2024

Conversation

Meeki1l
Copy link
Contributor

@Meeki1l Meeki1l commented Jun 20, 2024

Summary

Fixes #3743.

When retrieving TSA Certs from the local TUF, an infinite loop occurs, since the GetTargetsByMeta function (used in the GetTufTargets function) returns all certificates of the TSA type.

Also if "tsa_leaf.crt.pem" is missing, panic occurs. This is due to the lack of checking for len(leaves) > 0 in the GetTSACerts function.

Release Note

Documentation

Signed-off-by: Meeki1l <meekill2001@gmail.com>
Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for catching this.

cc @ianhundere

@@ -68,7 +80,7 @@ func GetTSACerts(ctx context.Context, certChainPath string, fn GetTargetStub) (*

var raw []byte
var err error

var isExist bool
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, i'd just call this exists

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@haydentherapper Thanks for the comment. Done

@ianhundere
Copy link
Contributor

@Meeki1l as @haydentherapper mentioned above, thanks for catching this / much appreciated. 🙇🏼

Signed-off-by: Meeki1l <meekill2001@gmail.com>
@haydentherapper
Copy link
Contributor

PTAL at the failing test. You can look at https://github.com/sigstore/sigstore/blob/main/pkg/tuf/client_test.go for some examples, or stub out calls to TUF.

Signed-off-by: Meeki1l <meekill2001@gmail.com>
@Meeki1l
Copy link
Contributor Author

Meeki1l commented Jun 24, 2024

@haydentherapper disable the falling autotests. I could not find a public TUF mirror with TSA certificates, so it is not possible to write normal autotests.

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 5.88235% with 16 lines in your changes missing coverage. Please review.

Project coverage is 36.55%. Comparing base (2ef6022) to head (98bb588).
Report is 138 commits behind head on main.

Files Patch % Lines
pkg/cosign/tsa.go 5.88% 15 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3744      +/-   ##
==========================================
- Coverage   40.10%   36.55%   -3.55%     
==========================================
  Files         155      200      +45     
  Lines       10044    12232    +2188     
==========================================
+ Hits         4028     4472     +444     
- Misses       5530     7214    +1684     
- Partials      486      546      +60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Meeki1l <meekill2001@gmail.com>
@cpanato cpanato merged commit 7c20052 into sigstore:main Jun 25, 2024
21 checks passed
@github-actions github-actions bot added this to the v2.3.0 milestone Jun 25, 2024
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.

Error in GetTSACerts function
4 participants