Skip to content

SLVS-3039 [TEST] Disable certificate revocation check - #6788

Draft
georgii-borovinskikh-sonarsource wants to merge 1 commit into
masterfrom
gb/test-certificate-no-revoke
Draft

SLVS-3039 [TEST] Disable certificate revocation check#6788
georgii-borovinskikh-sonarsource wants to merge 1 commit into
masterfrom
gb/test-certificate-no-revoke

Conversation

@georgii-borovinskikh-sonarsource

Copy link
Copy Markdown
Member

Part of DEX-16

@georgii-borovinskikh-sonarsource
georgii-borovinskikh-sonarsource marked this pull request as draft September 1, 2026 11:36
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title [TEST] Disable certificate revocation check SLVS-3039 [TEST] Disable certificate revocation check Sep 1, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Sep 1, 2026

Copy link
Copy Markdown

SLVS-3039

Comment on lines 49 to +50
using var x509Chain = new X509Chain();
x509Chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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 👍 / 👎

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This PR is blocked due to unresolved code review findings.

Comment gitar unblock to override this block and allow merging.

Configure merge blocking · Maintainers can dismiss this review.

@gitar-bot

gitar-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Code Review 🚫 Blocked 0 resolved / 1 findings

Disables 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

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.

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;
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;
🤖 Prompt for agents
Code Review: Disables 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.

1. 🚨 Security: Revoked server certificates now accepted as trusted (TLS MITM)
   Files: src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:49-50, src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:59-70, src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:45, src/SLCore.Listeners/Implementation/Http/ICertificateChainValidator.cs:50

   `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 (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;

   Fix (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;

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant