Commit 81c6c6c
Ali
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>1 parent 9a26ab2 commit 81c6c6c
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
831 | | - | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
832 | 835 | | |
833 | 836 | | |
834 | 837 | | |
| |||
1053 | 1056 | | |
1054 | 1057 | | |
1055 | 1058 | | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1056 | 1068 | | |
1057 | 1069 | | |
1058 | 1070 | | |
| |||
0 commit comments