-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
WebGUI: Escape character in folder or file name prevents access #17938
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
Comments
Maybe this is a bug for path processing. However Expected URL Unfortunately, at this moment, the URL can open the target is: I am not sure it is correct or not. @zeripath can you help to take a look for this? |
OK so this used to work in 1.14.7 but is broken from 1.15.0 This is going to be related to the chi migration. |
This is interesting the ctx.Params("*") appears to be "" even though the requestURI is correct... |
Right the problem is: gitea/modules/context/context.go Line 484 in f58e687
This is double unescaping the Params("*") value. Now I need to double check that this is always the case. Yup it is. Therefore we should just drop this. Nope that's not the solution. The problem is with the routeParams. I think I've solved this now. |
There was an unfortunate regression in go-gitea#14293 which has led to the double decoding of url parameter elements if they contain a '%'. This is due to an issue with the way chi decodes its RoutePath. In detail the problem lies in mux.go where the routeHTTP path uses the URL.RawPath or even the URL.Path instead of the escaped path to do routing. This PR simply forcibly sets the routePath to that of the EscapedPath. Fix go-gitea#17938 Signed-off-by: Andrew Thornton <[email protected]>
There was an unfortunate regression in #14293 which has led to the double decoding of url parameter elements if they contain a '%'. This is due to an issue with the way chi decodes its RoutePath. In detail the problem lies in mux.go where the routeHTTP path uses the URL.RawPath or even the URL.Path instead of the escaped path to do routing. This PR simply forcibly sets the routePath to that of the EscapedPath. Fix #17938 Signed-off-by: Andrew Thornton <[email protected]>
There was an unfortunate regression in go-gitea#14293 which has led to the double decoding of url parameter elements if they contain a '%'. This is due to an issue with the way chi decodes its RoutePath. In detail the problem lies in mux.go where the routeHTTP path uses the URL.RawPath or even the URL.Path instead of the escaped path to do routing. This PR simply forcibly sets the routePath to that of the EscapedPath. Fix go-gitea#17938 Signed-off-by: Andrew Thornton <[email protected]>
A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing go-gitea#18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviours too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix go-gitea#17938 Fix go-gitea#18060 Replace go-gitea#18062 Replace go-gitea#17997 Signed-off-by: Andrew Thornton <[email protected]>
A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing #18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix #17938 Fix #18060 Replace #18062 Replace #17997 Signed-off-by: Andrew Thornton <[email protected]>
…ea#18086) Backport go-gitea#18086 A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing go-gitea#18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix go-gitea#17938 Fix go-gitea#18060 Replace go-gitea#18062 Replace go-gitea#17997 Signed-off-by: Andrew Thornton <[email protected]>
#18098) Backport #18086 A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing #18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix #17938 Fix #18060 Replace #18062 Replace #17997 Signed-off-by: Andrew Thornton <[email protected]>
There was an unfortunate regression in go-gitea#14293 which has led to the double decoding of url parameter elements if they contain a '%'. This is due to an issue with the way chi decodes its RoutePath. In detail the problem lies in mux.go where the routeHTTP path uses the URL.RawPath or even the URL.Path instead of the escaped path to do routing. This PR simply forcibly sets the routePath to that of the EscapedPath. Fix go-gitea#17938 Signed-off-by: Andrew Thornton <[email protected]>
…ea#18086) A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing go-gitea#18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix go-gitea#17938 Fix go-gitea#18060 Replace go-gitea#18062 Replace go-gitea#17997 Signed-off-by: Andrew Thornton <[email protected]>
Description
I've cloned a repository from GitHub that uses the percentage character (%) in file and folder names a lot. This %-char prevents the access, via the web GUI of Gitea, to the file or folder containing this char in its name.
It looks like Gitea is displaying the %-char correctly but fails to provide the correct URL when clicking on it.
When I modify the URL and try to access it, nginx answers with
400 Bad Request
.Example
Expected URL: https://try.gitea.io/sebveit/meta-openwrt/src/branch/master/recipes-tweaks/busybox/busybox_%.bbappend
Actual URL: https://try.gitea.io/sebveit/meta-openwrt/src/branch/master/recipes-tweaks/busybox/busybox_%25.bbappend
Reverse Proxy
I'm using nginx (1.18) as a reverse proxy for Gitea. My config for nginx is the following:
I hope that helps pinpointing the bug. Let me know if you need additional information.
BTW, Gitea is really nice and slim compared to the bloated GitLab.
The text was updated successfully, but these errors were encountered: