Skip to content

Commit 06c5b24

Browse files
committed
OCSP should fail open
1 parent 731f863 commit 06c5b24

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

Sources/PackageCollectionsSigning/Certificate/CertificatePolicy.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -372,22 +372,11 @@ private struct BoringSSLOCSPClient {
372372
}
373373

374374
group.notify(queue: callbackQueue) {
375-
// If there's no result then something must have gone wrong
376-
guard !results.isEmpty else {
377-
return wrappedCallback(.failure(CertificatePolicyError.ocspFailure))
378-
}
379-
380-
let statuses = results.compactMap { $0.success }
381-
// We got results but they are all failures
382-
guard !statuses.isEmpty else {
383-
diagnosticsEngine.emit(error: "OCSP failed. All results: \(results)")
384-
return wrappedCallback(.failure(CertificatePolicyError.ocspFailure))
385-
}
386-
// If at least one response is "bad status" then the chain is invalid
375+
// Fail open: As long as no one says the cert is revoked we assume it's ok. If we receive no responses or
376+
// all of them are failures we'd still assume the cert is not revoked.
387377
guard results.compactMap({ $0.success }).first(where: { !$0 }) == nil else {
388378
return wrappedCallback(.failure(CertificatePolicyError.invalidCertChain))
389379
}
390-
// Good status
391380
wrappedCallback(.success(()))
392381
}
393382
}
@@ -542,7 +531,6 @@ enum CertificatePolicyError: Error, Equatable {
542531
case unhandledCriticalException
543532
case noTrustedRootCertsConfigured
544533
case ocspSetupFailure
545-
case ocspFailure
546534
}
547535

548536
private enum OCSPError: Error {

0 commit comments

Comments
 (0)