Skip to content

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

Merged

Conversation

zeripath
Copy link
Contributor

Fix #14984

Signed-off-by: Andrew Thornton [email protected]

@zeripath zeripath added this to the 1.14.0 milestone Mar 14, 2021
Signed-off-by: Andrew Thornton <[email protected]>
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 14, 2021
return nil
}

if u.Scheme == "git" && u.Port() != "" && (strings.Contains(remoteURL, "%0d") || strings.Contains(remoteURL, "%0a")) {
Copy link
Member

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

Copy link
Contributor Author

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.

@@ -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)
Copy link
Member

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?

Copy link
Member

@noerw noerw left a 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

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 15, 2021
@zeripath
Copy link
Contributor Author

I'm not sure what's happening on these tests because they work locally...

@noerw
Copy link
Member

noerw commented Mar 15, 2021

for me make test fails locally

@techknowlogick
Copy link
Member

🚀

@techknowlogick techknowlogick merged commit 6e423d5 into go-gitea:master Mar 15, 2021
Copy link
Member

@6543 6543 left a 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!

@6543 6543 mentioned this pull request Mar 15, 2021
1 task
@zeripath zeripath deleted the fix-14984-update-mirror-restrictions branch March 16, 2021 09:21
@zeripath zeripath added the topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! label Mar 21, 2021
@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mirror update does not respect restrictions
6 participants