sourcegraph/internal/authz
Erik Seliger 25faeadd54
authz: Fix panic when auth provider is missing (#62759)
When authz is enabled for a GitHub code host connection, but there is no corresponding auth.providers entry, this code currently panics, because `GetOAuthContext` returns nil, and then the `RefreshFunc` in the OAuthBearerToken tries to use that context when it refreshes.

This is a misconfiguration, and cannot work (we need both the authz setting, and the auth provider), but the worker pod should not just panic because of that, so we return a nicer error here now.

Test plan:

Added a unit test.
2024-05-17 16:09:39 +02:00
..
permssync bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
providers authz: Fix panic when auth provider is missing (#62759) 2024-05-17 16:09:39 +02:00
subrepoperms bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
types bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
BUILD.bazel bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
CODENOTIFY CODENOTIFY: subscribe changes for joe (#15141) 2020-10-29 15:31:53 +08:00
consts.go Move [enterprise/]cmd/frontend/authz to [enterprise/]internal/authz (#12538) 2020-07-29 10:08:36 -05:00
header_test.go dotcom: MockSourcegraphDotComMode requires a T for cleanup (#61172) 2024-03-14 20:27:21 +00:00
header.go Move dotcom check out of cmd/frontend (#60810) 2024-03-04 16:05:16 +00:00
iface_test.go errors: Introduce internal package (#30558) 2022-02-07 15:03:45 +00:00
iface.go authz: change ValidateConnection to return error instead of []string (#46424) 2023-01-20 13:01:22 +01:00
mocks_temp.go authz: Move sub-repo perms to enterprise (#45659) 2022-12-28 10:44:07 +02:00
perms_test.go Replace all traditional for-loops (#60988) 2024-03-11 16:05:47 +02:00
perms.go Cleanup: use new go 1.21 features (#58617) 2023-11-28 13:49:38 -07:00
register.go Move dotcom check out of cmd/frontend (#60810) 2024-03-04 16:05:16 +00:00
scopes.go Move [enterprise/]cmd/frontend/authz to [enterprise/]internal/authz (#12538) 2020-07-29 10:08:36 -05:00
sub_repo_perms_test.go [sub-repo perms] Move check to CanReadAnyPath instead (#53222) 2023-06-09 14:24:45 +02:00
sub_repo_perms.go Cache results of sub-repo perms enabled checks (#53463) 2023-06-14 14:28:02 +00:00