SLVS-3039 [TEST] Disable certificate revocation check - #6788
SLVS-3039 [TEST] Disable certificate revocation check#6788georgii-borovinskikh-sonarsource wants to merge 1 commit into
Conversation
| using var x509Chain = new X509Chain(); | ||
| x509Chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; |
There was a problem hiding this comment.
🚨 Security: Revoked server certificates now accepted as trusted (TLS MITM)
ValidateChain is the only server-trust decision in the product: HttpConfigurationListener.CheckServerTrustedAsync returns its boolean straight back to SLCore as CheckServerTrustedResponse, and there is no secondary check or user confirmation anywhere (the notification is informational only). X509ChainPolicy.RevocationMode defaults to Online, so setting NoCheck means a server presenting a certificate whose issuer has already revoked it (stolen/compromised key, decommissioned host) now yields Build() == true and the connection to SonarQube is trusted — exactly the case revocation exists to stop. If the goal is to tolerate an unreachable CRL/OCSP endpoint (air-gapped or proxy-blocked machines, which produce RevocationStatusUnknown and a false result), keep revocation active and ignore only the unknown status instead of accepting revoked certificates.
Fix 1: Keep online revocation checking, but do not fail when the revocation status cannot be determined. Revoked certificates are still rejected.
using var x509Chain = new X509Chain();
// Tolerate unreachable CRL/OCSP endpoints (offline/proxied machines) without
// accepting certificates that are known to be revoked.
x509Chain.ChainPolicy.VerificationFlags |= X509VerificationFlags.IgnoreEndRevocationUnknown
| X509VerificationFlags.IgnoreCertificateAuthorityRevocationUnknown
| X509VerificationFlags.IgnoreRootRevocationUnknown;
- Apply fix
Fix 2: If the motivation is avoiding network calls/latency during validation, use Offline mode so cached CRLs are still honoured, rather than skipping revocation entirely.
using var x509Chain = new X509Chain();
// Use locally cached CRLs only - no network calls during chain building.
x509Chain.ChainPolicy.RevocationMode = X509RevocationMode.Offline;
- Apply fix
Check a box to apply a fix or reply for a change | Was this helpful? React with 👍 / 👎
There was a problem hiding this comment.
Comment gitar unblock to override this block and allow merging.
Configure merge blocking · Maintainers can dismiss this review.
Code Review 🚫 Blocked 0 resolved / 1 findingsDisables certificate revocation checking in the TLS validation path, but this creates a critical security vulnerability: revoked server certificates are now accepted as trusted, enabling potential MITM attacks. Additionally, the temporary test change lacks any marker, flag, or test guard to prevent accidental production deployment. Revocation checking should remain enabled; if the goal is to tolerate unreachable CRL/OCSP endpoints, keep revocation active and ignore only the unknown status instead of accepting revoked certificates. 🚨 Security: Revoked server certificates now accepted as trusted (TLS MITM)📄 src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:49-50 📄 src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:59-70 🔗 X509ChainPolicy.RevocationMode defaults to Online 🔗 X509VerificationFlags 📄 src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:45 📄 src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:50
Keep online revocation checking, but do not fail when the revocation status cannot be determined. Revoked certificates are still rejected.If the motivation is avoiding network calls/latency during validation, use Offline mode so cached CRLs are still honoured, rather than skipping revocation entirely.🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Part of DEX-16