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

trim whitespace around public keys before parsing #1175

Merged
merged 2 commits into from
Nov 5, 2022

Conversation

bobcallaway
Copy link
Member

If there is trailing whitespace within a public key file, Rekor's parser was "tricked" into thinking that there was a series of concatenated certificates instead of a single key or certificate.

This trims the leading and trailing whitespace for X509 public key/cert objects before parsing to ensure the logic holds correctly.

Fixes: #1137

Signed-off-by: Bob Callaway bcallaway@google.com

Signed-off-by: Bob Callaway <bcallaway@google.com>
@bobcallaway bobcallaway requested a review from a team as a code owner November 4, 2022 13:10
Copy link
Contributor

@asraa asraa left a comment

Choose a reason for hiding this comment

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

otherwise lgtm

pkg/pki/x509/x509_test.go Outdated Show resolved Hide resolved
Signed-off-by: Bob Callaway <bcallaway@google.com>
@codecov-commenter
Copy link

Codecov Report

Merging #1175 (132bbe8) into main (7412e93) will decrease coverage by 22.21%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##             main    #1175       +/-   ##
===========================================
- Coverage   64.23%   42.02%   -22.22%     
===========================================
  Files          82       74        -8     
  Lines        7623     7206      -417     
===========================================
- Hits         4897     3028     -1869     
- Misses       2098     3869     +1771     
+ Partials      628      309      -319     
Flag Coverage Δ
e2etests ?
unittests 42.02% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/pki/x509/x509.go 62.25% <100.00%> (-10.91%) ⬇️
pkg/api/metrics.go 0.00% <0.00%> (-100.00%) ⬇️
cmd/rekor-cli/app/useragent.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/api/trillian_client.go 0.00% <0.00%> (-66.31%) ⬇️
pkg/api/api.go 0.00% <0.00%> (-64.29%) ⬇️
pkg/api/entries.go 0.00% <0.00%> (-64.00%) ⬇️
pkg/types/types.go 0.00% <0.00%> (-63.64%) ⬇️
pkg/types/versionmap.go 0.00% <0.00%> (-63.42%) ⬇️
pkg/api/error.go 0.00% <0.00%> (-59.78%) ⬇️
cmd/rekor-cli/app/verify.go 2.47% <0.00%> (-53.72%) ⬇️
... and 46 more

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

@bobcallaway bobcallaway merged commit abb25c6 into sigstore:main Nov 5, 2022
@github-actions github-actions bot added this to the v1.1.0 milestone Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trailing whitespace in pub key results in HTTP 400
4 participants