Skip to content

Commit f3c1335

Browse files
committed
fix(sso): validate SSO_OIDC_TOKEN_ENDPOINT_AUTH env var value
Replace unsafe `as` type cast with runtime validation to ensure only 'client_secret_post' or 'client_secret_basic' are accepted. Invalid values (typos, empty strings) now fall back to undefined, letting the downstream ?? fallback apply correctly. Signed-off-by: Mini Jeong <mini.jeong@navercorp.com>
1 parent ac0d326 commit f3c1335

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/db/scripts/register-sso-provider.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ function buildSSOConfigFromEnv(): SSOProviderConfig | null {
216216
pkce: process.env.SSO_OIDC_PKCE !== 'false',
217217
authorizationEndpoint: process.env.SSO_OIDC_AUTHORIZATION_ENDPOINT,
218218
tokenEndpoint: process.env.SSO_OIDC_TOKEN_ENDPOINT,
219-
tokenEndpointAuthentication: process.env.SSO_OIDC_TOKEN_ENDPOINT_AUTH as
220-
| 'client_secret_post'
221-
| 'client_secret_basic'
222-
| undefined,
219+
tokenEndpointAuthentication:
220+
process.env.SSO_OIDC_TOKEN_ENDPOINT_AUTH === 'client_secret_post' ||
221+
process.env.SSO_OIDC_TOKEN_ENDPOINT_AUTH === 'client_secret_basic'
222+
? process.env.SSO_OIDC_TOKEN_ENDPOINT_AUTH
223+
: undefined,
223224
userInfoEndpoint: process.env.SSO_OIDC_USERINFO_ENDPOINT,
224225
jwksEndpoint: process.env.SSO_OIDC_JWKS_ENDPOINT,
225226
discoveryEndpoint:

0 commit comments

Comments
 (0)