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

Check if embedded cert is base64 encoded before decoding #485

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

jacobtomlinson
Copy link
Member

Fixes #484

Instead of trying to base64 decode the certs and failing when they are stored in plain-text this PR checks if they are certs and only decodes them if they are.

This fixes configs which contain new lines in their base64 encoded data (which is technically not valid base64, but decodes fine).

This should not break folks who have plain text certs, which is what the previous try/except behaviour was enabling. Added a test to verify this.

@jacobtomlinson jacobtomlinson added kr8s auth Authenticating with Kubernetes labels Sep 9, 2024
@github-actions github-actions bot added the tests label Sep 9, 2024
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.16%. Comparing base (87063fc) to head (01fc4ab).
Report is 111 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #485      +/-   ##
==========================================
+ Coverage   94.61%   95.16%   +0.54%     
==========================================
  Files          29       30       +1     
  Lines        3141     3933     +792     
==========================================
+ Hits         2972     3743     +771     
- Misses        169      190      +21     

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

@jacobtomlinson jacobtomlinson merged commit 75d5ace into kr8s-org:main Sep 9, 2024
12 checks passed
@jacobtomlinson jacobtomlinson deleted the check-b64-certs branch September 9, 2024 13:26
@jacobtomlinson jacobtomlinson added the bug Something isn't working label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Authenticating with Kubernetes bug Something isn't working kr8s tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certificate data with newlines parsed incorrectly from kubeconfig (NO_CERTIFICATE_OR_CRL_FOUND)
1 participant