-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Disabling /api and /api/swagger endpoints #3498
Comments
What is use case for disabling API? |
When one doesn't want to expose it at all, eg. to reduce attack surface. |
You can use nginx in front of gitea and than disable everything starting with |
Yes, but the link to API will remain in footer. |
It will not work anyway ;) not the best option but you can change template if that is really needed |
Yes, but IMHO it's a bit too dirty to change template and server configuration to achieve that. |
Of course option to hide swagger link can be added |
Cool. Thanks for your input. |
resolved by #3502 |
The other PR doesn't actually disable /api, right? Only /api/swagger (which is the documentation endpoint and try it out interface??) is disabled in that PR afaict. Thus this is not quite resolved with that option. To work around this, you can disable access to /api in the reverse proxy setup link nginx on the node. The /api/internal endpoints should stay unaffected with this because gitea by default tries to build the internal API calls' urls via HTTP_ADDR:HTTP_PORT specified in the settings, which doesn't go through the reverse proxy locally. Just ensure that you only bind with HTTP_ADDR = 127.0.0.1. |
@shuhaowu not true, gitea also uses API for some functionality so it can not be disabled fully without loosing some functionality |
Yeah but my work around shouldn't impact it? As I can see in the code, any API calls gitea does uses LocalURL, which is HTTP_ADDR:HTTP_PORT if running in the regular server mode, correct? |
I just realized that non users can get user names without signed in, I do not know how this is not a security issue. Here is from non public repo, using from terminal without any form of login indication. There is not even an API key involved.
|
@gerroon you can get the same information from the webapp itself example: https://try.gitea.io/explore/users This ticket is closed, if you have a feature request please create a new issue, however disabling the API is not possible as mentioned above the web interface makes use of it. |
It would be nice, if there were options to disable /api and /api/swagger endpoints.
The text was updated successfully, but these errors were encountered: