-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: Allow less strict validation of the Resolver Name during Webhook. #7990
Conversation
/assign @chitrangpatel |
/kind bug |
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 fix @Aleromerog !
/assign @JeromeJu |
@@ -91,6 +91,9 @@ func (ref *Ref) Validate(ctx context.Context) (errs *apis.FieldError) { | |||
|
|||
// RefNameLikeUrl checks if the name is url parsable and returns an error if it isn't. | |||
func RefNameLikeUrl(name string) error { | |||
_, err := url.ParseRequestURI(name) |
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.
This was a bit too strict where it didn't handle cases like:
<scheme>://foo:v0
@@ -91,6 +91,9 @@ func (ref *Ref) Validate(ctx context.Context) (errs *apis.FieldError) { | |||
|
|||
// RefNameLikeUrl checks if the name is url parsable and returns an error if it isn't. | |||
func RefNameLikeUrl(name string) error { | |||
_, err := url.ParseRequestURI(name) | |||
return err | |||
schemeRegex := regexp.MustCompile(`[\w-]+:\/\/*`) |
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.
The regex fixes this and limits the constraint to <a-scheme>://...
as required in the TEP. The detailed parsing is conducted by the resolver.
/cherry-pick release-v0.60.x |
@chitrangpatel: once the present PR merges, I will cherry-pick it on top of release-v0.60.x in a new PR and assign it to you. In response to this:
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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chitrangpatel, JeromeJu 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 |
Thanks for the bug fix @Aleromerog! /lgtm |
@chitrangpatel: new pull request created: #7996 In response to this:
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. |
Fix for issue #7986 Too Strict validation of the Resolver Name during Webhook Validation
Fixes #7986
/kind bug
Changes
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes