mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
Only offer 'Proceed Anyway (Unsafe)' if the connected remote runtime advertises browser.certificate-trust.v1 support. Older runtimes cannot honor the request and would fail silently, creating a false affordance. Centralize certificate error normalization to prevent divergence between main and renderer certificate matching, and unify URL redaction for Kagi session token stripping across load-error paths.
20 lines
737 B
TypeScript
20 lines
737 B
TypeScript
// Why: use Chromium's exact certificate codes so unrelated network failures
|
|
// never receive certificate-specific recovery copy.
|
|
const CHROMIUM_CERTIFICATE_ERROR_CODES = new Set([
|
|
-200, -201, -202, -203, -204, -205, -206, -207, -208, -210, -211, -212, -213, -214, -217, -219
|
|
])
|
|
|
|
export function isChromiumCertificateErrorCode(code: number): boolean {
|
|
return CHROMIUM_CERTIFICATE_ERROR_CODES.has(code)
|
|
}
|
|
|
|
// Why: main (certificate-error handler) and the renderer overlay both compare
|
|
// Chromium error strings; keep one normalizer so their challenge-matching can
|
|
// never silently diverge.
|
|
export function normalizeCertificateError(error: string): string {
|
|
return error
|
|
.trim()
|
|
.replace(/^net::/i, '')
|
|
.toUpperCase()
|
|
}
|