New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix webhook validation bug for cert subjects #6767
Conversation
and use commonName variable value Signed-off-by: Yuedong Wu <dwcn22@outlook.com>
Hi @lunarwhite. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/assign @SgtCoDFish Thanks for your guidance. PTAL whenever you get a chance. Not sure if this fix should be cherry-picked. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Thank you for this! It's definitely an improvement 😁
Really appreciate your involvement here!
if len(crt.CommonName) != 0 { | ||
el = append(el, field.Invalid(fldPath.Child("commonName"), crt.CommonName, "When providing a `LiteralSubject` no `commonName` may be provided.")) | ||
if len(commonName) != 0 { | ||
el = append(el, field.Invalid(fldPath.Child("commonName"), commonName, "When providing a `LiteralSubject` no `commonName` may be provided.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I'm not sure about this change.
This is correct today, but it's possible to imagine that we might change the var commonName = crt.CommonName
line above somehow and forget to update this check. I don't think we need to change this back but I'd personally probably prefer not to make this specific change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to revert this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naah, we don't need to revert! If I'd thought it needed to change I wouldn't have approved 😁 It's all good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation!
el = append(el, field.TooLong(fldPath.Child("commonName"), crt.CommonName, 64)) | ||
el = append(el, field.TooLong(fldPath.Child("commonName"), commonName, 64)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pull Request Motivation
Fixes #6504
Changes:
Kind
/kind bug
Release Note