You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: parallelize trust verification and default to mozilla root store (#183)
* perf: parallelize trust verification and default to mozilla root store
On macOS, x509.Certificate.Verify with the system cert pool calls
SecTrustEvaluateWithError — a blocking syscall that can take seconds
per certificate for OCSP/CRL checks. With large certificate stores
(2500+ certs), scan+export operations hung indefinitely because every
certificate was verified sequentially against the system trust store.
Three changes fix this:
1. Default TrustStore from "system" to "mozilla". The embedded Mozilla
root pool uses pure-Go verification — no syscalls, no network I/O.
This alone eliminates the hang for the common case.
2. Parallelize trust verification in ScanSummary, dump-certs, and
countAIAUnresolvedIssuers. All mozilla checks fire concurrently
via goroutines, then only certs that mozilla didn't trust fall
through to the (slower) system trust check.
3. Add TrustStore label to VerifyChainTrustInput and debug-log every
trust verification call with subject, store name, and result.
This makes future performance diagnosis trivial with -l debug.
Before: scan of ~2500 certs hung indefinitely (>10 minutes, killed)
After: same scan completes in ~45 seconds
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* perf: bound system trust concurrency, fix nil panic, lint fixes
- Add semaphore (runtime.NumCPU) for system trust goroutines to avoid
overwhelming macOS SecTrust with unbounded concurrent syscalls
- Guard VerifyChainTrust against nil cert before debug logging
- Retry bundle export with system trust store when mozilla fails, so
certs trusted only by the host OS (corporate roots) export without
requiring --force
- Fix golangci-lint modernize: use atomic.Int32 in verify_test.go
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: preserve export system trust retry errors
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
21
21
### Changed
22
22
23
+
-**Breaking:** Default `TrustStore` in `DefaultOptions()` changed from `"system"` to `"mozilla"` — pure-Go Mozilla root verification is used by default instead of macOS `SecTrustEvaluateWithError` syscalls, eliminating multi-minute hangs on large certificate stores
24
+
- Parallelize trust verification in scan summary, dump-certs, and AIA resolution — mozilla checks run concurrently, system checks only run for certs mozilla didn't trust
25
+
- Add `TrustStore` label to `VerifyChainTrustInput` and debug-log every trust verification call with subject, store, and result
23
26
- Normalize all exported private key PEM output (`.key`, K8s `tls.key`, YAML `key`) to PKCS#8 (`PRIVATE KEY`) regardless of input format ([#167])
24
27
- Bundle export warns when Kubernetes TLS secret contains an unencrypted private key alongside encrypted outputs ([#167])
25
28
- Use browser Web Crypto API for PBKDF2 key derivation in WASM builds to avoid blocking the main thread during encrypted key export ([#167])
0 commit comments