-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Validate OAuth Redirect URIs #32643
base: main
Are you sure you want to change the base?
Validate OAuth Redirect URIs #32643
Conversation
modules/validation/binding.go
Outdated
// URL validation rule | ||
binding.AddRule(&binding.Rule{ | ||
IsMatch: func(rule string) bool { | ||
return strings.HasPrefix(rule, "ValidUrlList") |
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.
return strings.HasPrefix(rule, "ValidUrlList") | |
return strings.EqualFold(rule, "ValidUrlList") |
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.
Addressed in e536a9d
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.
But "why"?
Shouldn't we be strict for names?
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.
If we want a strict name, it should be ==
here. But I don't think HasPrefix
is right here. For other examples, some maybe also not be right and some are for xxx(
so they use HasPrefix
.
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.
I agree, but why it was changed to EqualFold
?
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.
I misunderstood how other rules implemented. I thought case insensitive seems reasonable. Now I think we should follow the old styles to keep consistency.
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.
Feel free to discard my change request if the concern is addressed, in case I am not at computer. |
This fixes a TODO in the code to validate the RedirectURIs when adding or editing an OAuth application in user settings.
This also includes a refactor of the user settings tests to only create the DB once per top-level test to avoid reloading fixtures.