mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
fix(auth): explain untrusted OIDC certificate failures
Classify private trust-chain failures with a stable error code and direct administrators to a mounted CA bundle without weakening TLS verification. Fixes #1346
This commit is contained in:
@@ -19,6 +19,7 @@ const { t } = useI18n()
|
||||
|
||||
const OIDC_TEST_ERROR_MESSAGE_KEYS: Record<string, string> = {
|
||||
[OidcErrorCode.PRIVATE_ISSUER_ADDRESS]: 'settings.oidc.test.privateIssuerAddress',
|
||||
[OidcErrorCode.TLS_CERTIFICATE_UNTRUSTED]: 'settings.oidc.test.tlsCertificateUntrusted',
|
||||
}
|
||||
|
||||
interface ProviderSummary {
|
||||
|
||||
@@ -65,6 +65,23 @@ describe('OidcSettings', () => {
|
||||
expect(wrapper.text()).not.toContain('Server copy must not be rendered')
|
||||
})
|
||||
|
||||
it('localizes an untrusted TLS certificate error without rendering server copy', async () => {
|
||||
apiMock.mockImplementation(async (input: RequestInfo | URL) => {
|
||||
if (String(input) === '/api/v1/app-settings/oidc/providers') return response(true, [])
|
||||
return response(false, {
|
||||
errorCode: OidcErrorCode.TLS_CERTIFICATE_UNTRUSTED,
|
||||
message: 'Server copy must not be rendered',
|
||||
})
|
||||
})
|
||||
const wrapper = await mountCreateForm()
|
||||
|
||||
await testConnection(wrapper)
|
||||
|
||||
expect(wrapper.text()).toContain('private certificate authority')
|
||||
expect(wrapper.text()).toContain('NODE_EXTRA_CA_CERTS')
|
||||
expect(wrapper.text()).not.toContain('Server copy must not be rendered')
|
||||
})
|
||||
|
||||
it('uses localized generic copy for an unknown server error code', async () => {
|
||||
apiMock.mockImplementation(async (input: RequestInfo | URL) => {
|
||||
if (String(input) === '/api/v1/app-settings/oidc/providers') return response(true, [])
|
||||
|
||||
@@ -734,6 +734,7 @@
|
||||
"connected": "Connected - {issuer}",
|
||||
"connectionFailed": "Connection failed",
|
||||
"privateIssuerAddress": "The issuer URL resolves to a private or local network address, so the server refused to connect. Set OIDC_ALLOW_LOCAL_ISSUERS=true on the BookOrbit server to allow it.",
|
||||
"tlsCertificateUntrusted": "BookOrbit could not verify the OIDC provider's TLS certificate. If the provider uses a private certificate authority, mount its PEM CA bundle, set NODE_EXTRA_CA_CERTS to the bundle's in-container path, and restart BookOrbit.",
|
||||
"hide": "Hide",
|
||||
"details": "Details",
|
||||
"supported": "supported",
|
||||
|
||||
Reference in New Issue
Block a user