-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Ensure validation occurs on clone addresses too #14994
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
Ensure validation occurs on clone addresses too #14994
Conversation
Fix go-gitea#14984 Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
return nil | ||
} | ||
|
||
if u.Scheme == "git" && u.Port() != "" && (strings.Contains(remoteURL, "%0d") || strings.Contains(remoteURL, "%0a")) { |
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 seems subtle, might make sense to separate this condition into its own func so it's less likely to occur again that checks for the same thing are implemented differently
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 in its own function that wasn't being used! The point is to make sure that there really is only place where this is done.
modules/migrations/migrate_test.go
Outdated
@@ -16,30 +16,30 @@ func TestMigrateWhiteBlocklist(t *testing.T) { | |||
setting.Migrations.AllowedDomains = []string{"github.com"} | |||
assert.NoError(t, Init()) | |||
|
|||
err := isMigrateURLAllowed("https://gitlab.com/gitlab/gitlab.git") | |||
err := IsMigrateURLAllowed("https://gitlab.com/gitlab/gitlab.git", nil) |
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.
Maybe also add tests for behaviour when doer is set?
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.
2 nits, but otherwise this looks good.
(re your comment; I couldn't test on windows)
also, test fail is related
I'm not sure what's happening on these tests because they work locally... |
for me |
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
🚀 |
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 & cleanup!
Fix #14984
Signed-off-by: Andrew Thornton [email protected]