Skip to content

fix: allow disabling PKCS12 without password#642

Open
immanuwell wants to merge 1 commit into
cert-manager:mainfrom
immanuwell:fix-pkcs12-disabled-validation
Open

fix: allow disabling PKCS12 without password#642
immanuwell wants to merge 1 commit into
cert-manager:mainfrom
immanuwell:fix-pkcs12-disabled-validation

Conversation

@immanuwell
Copy link
Copy Markdown

What

Tiny PKCS12 papercut fix.

When csi.cert-manager.io/pkcs12-enable: "false" is set, the driver should treat PKCS12 as disabled. Before this, defaulting still added pkcs12-filename, and validation then asked for pkcs12-password. thats a bit awkward ngl.

Repro

Use volume attributes like:

csi.cert-manager.io/issuer-name: ca-issuer
csi.cert-manager.io/key-encoding: PKCS8
csi.cert-manager.io/pkcs12-enable: "false"

Before this change WriteKeypair fails with:

volumeAttributes.csi.cert-manager.io/pkcs12-password: Required value: required attribute when PKCS12 KeyStore is enabled

The new test covers that case. It also keeps the existing enabled path intact.

Test

go test -count=1 ./cmd/... ./pkg/...

Signed-off-by: immanuwell <pchpr.00@list.ru>
@cert-manager-prow cert-manager-prow Bot added the dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. label May 10, 2026
@cert-manager-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hjoshi123 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 10, 2026
@cert-manager-prow
Copy link
Copy Markdown
Contributor

Hi @immanuwell. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@cert-manager-prow cert-manager-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 10, 2026
// validation error will be picked up by validation.
func setDefaultKeyStorePKCS12(attr map[string]string) {
if _, ok := attr[csiapi.KeyStorePKCS12EnableKey]; ok {
if attr[csiapi.KeyStorePKCS12EnableKey] == "true" {
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.

suggestion: this is a sharp edge if anyone set the value to "TRUE" or similar. Could we lowercase the attribute?

Suggested change
if attr[csiapi.KeyStorePKCS12EnableKey] == "true" {
if strings.ToLower(attr[csiapi.KeyStorePKCS12EnableKey]) == "true" {

@SgtCoDFish
Copy link
Copy Markdown
Member

/ok-to-test

@cert-manager-prow cert-manager-prow Bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. ok-to-test size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants