Repository navigation
HDDS-17030. DefaultApprover.inspectCSR never completes its future when the CSR passes inspection - #11544
Conversation
…n the CSR passes inspection DefaultApprover.inspectCSR completes its future once every check passes and returns after the first failed check. DefaultCAServer.requestCertificate rejects a CSR whose inspection has not completed instead of signing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved issues were identified that would block approval.
0 open findings
What changed in this PR
Fixes CSR approval futures so valid inspections complete successfully, failed checks stop immediately, and unfinished inspections cannot result in certificate issuance.
Changes:
- Completes successful
DefaultApproverinspections. - Stops validation after the first failure.
- Rejects incomplete inspections in
DefaultCAServer.
| File | Description |
|---|---|
| hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/TestDefaultProfile.java | Updated as part of this pull request. |
| hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/TestDefaultCAServer.java | Updated as part of this pull request. |
| hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCAServer.java | Updated as part of this pull request. |
| hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultApprover.java | Updated as part of this pull request. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Reviewer notes (plain language)Simple examplesGood CSR (valid key, profile OK)
Bad CSR (e.g. signature does not match key)
Broken / unfinished inspection (e.g. future never completes)
Analogy: bouncer must say “OK” or “no”; the clerk used to stamp if they didn’t hear “no.” Now they require an explicit “OK” (completed success) or reject incomplete/failed inspection. Bottom lineThis is not a security risk on today’s production path with the synchronous |
jojochuang
left a comment
There was a problem hiding this comment.
LGTM. Fixes inspectCSR to complete successfully when all checks pass, fail fast on first error, and reject signing when inspection has not finished. Good unit coverage; behavior for sync DefaultApprover unchanged for normal valid/invalid CSRs — correctness and defense in depth, not a production security hotfix (see PR comment).
|
Merged. Thanks @smengcl |
|
Thanks @jojochuang for the review. |
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
CertificateApprover.inspectCSRreturns a future that should hold Void for a valid CSR and an exception otherwise.DefaultApprover.inspectCSRonly ever completed it exceptionally, so for a CSR that passed inspection the future stayed incomplete, andDefaultCAServer.requestCertificateread "incomplete" as approved. A failed check also did not stop the inspection: the remaining checks still ran on that CSR.This PR:
nullonce every check passesDefaultCAServer.requestCertificatereject a CSR whose inspection has not completed, instead of signing itDefaultApproveris the onlyCertificateApproverand its inspection is synchronous, so certificate issuance behaves as before for valid and invalid CSRs. The first failure is reported exactly as before; only the error logs of the checks that used to run after it are gone.Follow up from the review of #11486.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17030
How was this patch tested?
TestDefaultProfile.testInspectCsrCompletesWhenApproved,TestDefaultProfile.testInspectCsrStopsAtFirstFailureandTestDefaultCAServer.testRequestCertificateRejectsUnfinishedInspection. All three fail without the change insrc/main.TestDefaultCAServer,TestDefaultProfileandTestRootCARotationManagerpass, and checkstyle and PMD are clean onhdds-server-framework.🤖 Generated with Claude Code