Commit a4fac5c
Ali Asghar
config: guard against nil oauth2 credential in RoundTrip (#897)
* config: guard against nil oauth2 credential in RoundTrip
toSecret returns (nil, nil) when no source is configured. Most callers
guarded the returned SecretReader with an `!= nil` check before
invoking Fetch, but oauth2RoundTripper.RoundTrip reached directly into
rt.oauthCredential.Immutable() and would nil-deref panic when someone
supplied an oauth2 block with no client-secret source (likely the
proximate cause of prometheus/prometheus#16622).
Return a clear error instead of panicking, and document toSecret's
nil-return contract so future callers explicitly acknowledge it.
Fixes #790
Signed-off-by: Ali <alliasgher123@gmail.com>
* config: simplify comments per review feedback
- toSecret: restore original one-line comment (no need to document
nil-return semantics in the function comment)
- oauth2RoundTripper.RoundTrip nil guard: replace verbose explanation
with a single-line note matching reviewer's suggestion
Signed-off-by: Ali <alliasgher123@gmail.com>
---------
Signed-off-by: Ali <alliasgher123@gmail.com>1 parent 9e28363 commit a4fac5c
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
1066 | 1072 | | |
1067 | 1073 | | |
1068 | 1074 | | |
| |||
0 commit comments