[Proposal] Allow GET routes on API without CSRF #7071

Closed
opened 2025-11-02 07:15:04 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @kasbah on GitHub (Mar 25, 2021).

Gitea has some GET requests that make changes and thus these are protected with CSRF (see e.g. https://github.com/go-gitea/gitea/issues/4838). I don't think any API GET requests make changes though so can we open this up to be queried without needing a csrf token?

This would allow for easier querying of the API from e.g. /api/swagger and other web pages served from the same domain as Gitea.

Originally created by @kasbah on GitHub (Mar 25, 2021). Gitea has some GET requests that make changes and thus these are protected with CSRF (see e.g. https://github.com/go-gitea/gitea/issues/4838). I don't think any API GET requests make changes though so can we open this up to be queried without needing a csrf token? This would allow for easier querying of the API from e.g. /api/swagger and other web pages served from the same domain as Gitea.
Author
Owner

@kasbah commented on GitHub (Mar 28, 2021):

I noticed now that you can do some GET requests e.g. /user/search. The one I was wondering about is actually GET /user for the currently logged in user and there is probably a reason for needing csrf on that one.

@kasbah commented on GitHub (Mar 28, 2021): I noticed now that you can do _some_ GET requests e.g. `/user/search`. The one I was wondering about is actually GET `/user` for the currently logged in user and there is probably a reason for needing csrf on that one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7071