kr8s-org / kr8s

A batteries-included Python client library for Kubernetes that feels familiar for folks who already know how to use kubectl
https://kr8s.org
BSD 3-Clause "New" or "Revised" License
839 stars 45 forks source link

Check if embedded cert is base64 encoded before decoding #485

Closed jacobtomlinson closed 2 months ago

jacobtomlinson commented 2 months ago

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.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.