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(registry): ignore empty challenge fields #1626

Merged
merged 2 commits into from
Apr 12, 2023
Merged

Conversation

piksel
Copy link
Member

@piksel piksel commented Apr 11, 2023

The GetAuthURL method splits challenge response header fields by = and then stores the key and value in a map. If an empty field (or a key without a value) is encountered, this causes a "index out of range" panic.

This PR replaces the unchecked strings.Split with strings.Cut, and skips any fields that does not contain a value.

Fixes #1624.

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (9d6b008) 66.91% compared to head (d96481d) 66.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1626      +/-   ##
==========================================
- Coverage   66.91%   66.89%   -0.03%     
==========================================
  Files          25       25              
  Lines        2376     2374       -2     
==========================================
- Hits         1590     1588       -2     
  Misses        685      685              
  Partials      101      101              
Impacted Files Coverage Δ
pkg/registry/auth/auth.go 42.44% <100.00%> (-0.82%) ⬇️

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@piksel piksel merged commit 4d661bf into main Apr 12, 2023
@piksel piksel deleted the fix/auth-header-split branch April 12, 2023 06:18
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.

crash when update image
1 participant