Repository navigation
Conversation
When Vault issues a cross-signed intermediate CA signed by multiple root CAs, cert-manager failed with 'certificate chain is malformed or broken'. Fall back to using raw Vault data when the chain cannot be linearized. Fixes cert-manager#7645 Signed-off-by: kouzi99 <[email protected]>
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Kouzi99. Thanks for your PR. I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
also running into this. cross-signing and using |
There was a problem hiding this comment.
Pull request overview
Adds Vault support for certificate bundles containing cross-signed intermediate CAs.
Changes:
- Falls back to raw Vault certificate data for non-linear chains.
- Adds cross-signed certificate fixtures and regression coverage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/vault/vault.go |
Adds raw certificate-chain fallback. |
internal/vault/vault_test.go |
Tests Vault cross-signed bundles. |
pkg/util/pki/parse_certificate_chain_test.go |
Documents parser behavior for branching chains. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if len(cert) == 0 { | ||
| t.Error("expected non-empty cert chain") | ||
| } |
| if err != nil { | ||
| return nil, nil, fmt.Errorf("failed to parse certificate chain from vault: %w", err) | ||
| // Vault may return a cross-signed intermediate CA signed by multiple root CAs. | ||
| // The parser requires a single linear chain and fails in that case. | ||
| // Fall back to using the raw Vault data directly. | ||
| chainPEM := strings.Join(append([]string{vbundle.Certificate}, vbundle.CAChain...), "\n") |
wallrj
left a comment
There was a problem hiding this comment.
Thanks @Kouzi99 for this PR and for the clear write-up — the motivation is spot on: cross-signing is exactly what Vault recommends for root rotation, and cert-manager should handle it.
After looking closely, we've decided to concentrate on fixing the root cause rather than working around it here. The rejection comes from ParseSingleCertificateChain's single-linear-chain model, which affects the Venafi and CA issuers as well as Vault. A raw-response fallback in the Vault issuer would also bypass the parser's validation and size limits, so a genuinely malformed chain from Vault would be returned as a successful issuance.
I've opened #9150, which teaches the shared parser to accept cross-signed bundles by deterministically selecting one path — that fixes all issuers with no Vault-specific changes, and keeps broken chains rejected. I'm going to close this PR in favour of that one. Reviews and testing on #9150 would be very welcome, particularly against a real Vault mount with a cross-signed intermediate.
Thanks again for pushing this forward!
with claude fable-5
Pull Request Motivation
When Vault issues a cross-signed intermediate CA (an intermediate certificate
signed by multiple root CAs simultaneously), cert-manager failed with
certificate chain is malformed or broken. This is because the chain parserrequires a single linear chain, but cross-signing creates a branching graph.
Cross-signing is the recommended approach for root CA rotation in Vault PKI:
https://developer.hashicorp.com/vault/docs/secrets/pki/rotation-primitives
Fix: fall back to using raw Vault certificate data when the chain cannot be
linearized, so cross-signed intermediates pass through correctly.
Fixes #7645
Kind
/kind bug
Release Note