Repository navigation
Trim credentials read from the Provider secret - #1446
Merged
Merged
Conversation
Since the token, username and password are read with secrets.AuthMethodsFromSecret, they are passed to the notifiers as stored in the Secret. A token with a trailing newline, as produced by `echo $TOKEN | base64` or `kubectl create secret --from-file`, makes Go reject the Authorization header and every notification fails with "invalid header field value". Basic auth credentials are sent with the whitespace included. Trim them again, as extractAuthFromSecret did before the switch. Assisted-by: claude-code/claude-opus-5-5 Signed-off-by: George Gaál <gb12335@gmail.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1445
Since #1146 the token and basic auth credentials are read with
secrets.AuthMethodsFromSecretand passed to the notifiers untrimmed, so the trimming added in #789 (for #760) no longer applies to them. A token with a trailing newline breaks theAuthorizationheader (net/http: invalid header field value for "Authorization"); a username/password with whitespace is sent as is.This trims them again in
extractAuthFromSecret. The new test fails onmainfor both cases and passes with the change.make tidy fmt vet && make testpass locally.A reproduction with kind against v1.6.0, v1.7.0 and v1.10.1 is in #1445.
I used Claude Code to investigate the regression and draft the change and the test; I reviewed and tested it.