-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Auth TLS: Improve redirect RegEx. #12249
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: strongjz 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 |
✅ Deploy Preview for kubernetes-ingress-nginx canceled.
|
Signed-off-by: James Strong <[email protected]>
45770fb
to
7bc06ce
Compare
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.
/retitle Auth TLS: Improve redirect RegEx.
/triage accepted
/kind bug
/priority backlog
@@ -42,7 +42,7 @@ const ( | |||
|
|||
var ( | |||
authVerifyClientRegex = regexp.MustCompile(`^(on|off|optional|optional_no_ca)$`) | |||
redirectRegex = regexp.MustCompile(`^((https?://)?[A-Za-z0-9\-.]*(:\d+)?/[A-Za-z0-9\-.]*)?$`) | |||
redirectRegex = regexp.MustCompile(`^(?:https?://)?(?:\b\w+\b)?(?:/\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.
Can you explain the use of ?:
here? As far as I can tell we are not capturing anything here, just checking if the value matches.
Also \w
is not the same as [A-Za-z0-9\-.]
. The former does not include dashes nor periods, it only matches [a-zA-Z0-9_]
. Additionally the new RegEx does not cover ports in the host part.
What this PR does / why we need it:
fixes #12205
Types of changes
Which issue/s this PR fixes
How Has This Been Tested?
Checklist: