Skip to content

CertPool should not error when input adds no certificates - #624

Merged
cert-manager-prow[bot] merged 1 commit into
cert-manager:mainfrom
erikgb:fix-cert-pool
May 30, 2025
Merged

cert-manager-prow[bot] merged 1 commit into
cert-manager:mainfrom
erikgb:fix-cert-pool

Conversation

@erikgb

@erikgb erikgb commented May 4, 2025

Copy link
Copy Markdown
Member

While working on #623, I discovered that CertPool skips invalid input data. This results in an error (no non-expired certificates found in input bundle) only if the input adds no certificates to the pool. This does not seem right to me, and I would at least prefer consistent behavior. As a first step, I suggest removing the check requiring the input to add at least one certificate to the pool. This will also fix #276, which I wrongly closed as fixed.

As a second step, to address #434, I would prefer if CertPool didn't just ignore invalid PEM data. But there might be a reason for doing it this way? The used function to decode, pem.Decode, seems pretty ignorant.

Fixes #276

@cert-manager-prow cert-manager-prow Bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 4, 2025
@erikgb erikgb changed the title CertPool should not error input contains no certificates CertPool should not error when input adds no certificates May 4, 2025
@erikgb
erikgb requested review from SgtCoDFish and inteon May 4, 2025 19:26

@SgtCoDFish SgtCoDFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

I see no reason for this to not merge! Thanks!

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label May 30, 2025
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SgtCoDFish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 30, 2025
@cert-manager-prow
cert-manager-prow Bot merged commit 84f7ea8 into cert-manager:main May 30, 2025
Comment thread pkg/util/cert_pool.go
@@ -90,13 +90,11 @@ func NewCertPool(options ...Option) *CertPool {
// https://www.rfc-editor.org/rfc/rfc7468
//
// Additionally, if the input PEM bundle contains no non-expired certificates, an error is returned.

@farazkhawaja farazkhawaja Jun 28, 2025 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does this line also needs to go away? @erikgb

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve filtered certs error reporting

3 participants