Skip to content

Use SystemCertPool for OpenShift OAuth token exchange#900

Open
rubenvp8510 wants to merge 1 commit intoobservatorium:mainfrom
rubenvp8510:fix/use-system-cert-pool-for-openshift-oauth
Open

Use SystemCertPool for OpenShift OAuth token exchange#900
rubenvp8510 wants to merge 1 commit intoobservatorium:mainfrom
rubenvp8510:fix/use-system-cert-pool-for-openshift-oauth

Conversation

@rubenvp8510
Copy link
Copy Markdown
Contributor

The OAuth HTTP client used x509.NewCertPool() which creates an empty certificate pool, then only adds the Kubernetes service account CA. This excludes all system-trusted CAs (Let's Encrypt, DigiCert, etc.).

On regular OpenShift this works by coincidence because the ingress CA is part of the service account CA bundle. On HyperShift/HostedCluster environments (e.g. ROSA) the OAuth endpoint uses a publicly-trusted certificate (Let's Encrypt) that is not in the SA CA bundle, causing "x509: certificate signed by unknown authority" errors during the OAuth callback token exchange.

Switch to x509.SystemCertPool() so that system-trusted CAs are included alongside the service account CA. Falls back to an empty pool if SystemCertPool() is unavailable.

The OAuth HTTP client used x509.NewCertPool() which creates an empty
certificate pool, then only adds the Kubernetes service account CA.
This excludes all system-trusted CAs (Let's Encrypt, DigiCert, etc.).

On regular OpenShift this works by coincidence because the ingress CA
is part of the service account CA bundle. On HyperShift/HostedCluster
environments (e.g. ROSA) the OAuth endpoint uses a publicly-trusted
certificate (Let's Encrypt) that is not in the SA CA bundle, causing
"x509: certificate signed by unknown authority" errors during the
OAuth callback token exchange.

Switch to x509.SystemCertPool() so that system-trusted CAs are
included alongside the service account CA. Falls back to an empty
pool if SystemCertPool() is unavailable.

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
@rubenvp8510 rubenvp8510 force-pushed the fix/use-system-cert-pool-for-openshift-oauth branch from 8261ae9 to faee945 Compare April 13, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant