-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
CSRF Token expiration on PR review during several minutes after page is created #26250
Comments
Are you using multiple accounts? |
No, this is only from 1 user with 1 account. |
It looks weird. I haven't got an idea for it. Could you help:
|
|
The code is #26266 (you can also build it by yourself: The binary (for linux amd64 only, no sqlite support) is: https://github.com/wxiaoguang/gitea-test-release/releases/tag/v1.20-CsrfTest You can Then you will see a startup log: If the bad CSRF problem happens again, you will see some logs like:
|
Could you paste some of your configuration? ROOT_URL and which url are you visiting in your webbrowser? |
Browser - https://gitea.devos.club/
|
I have figured out from the user with this problem, that he has a pined tab in his browser when he work with gitea. So, there is a pined tab and another tabs, where he do his work and where he got CSRF token problem. Could this pinned tab in browser be an issue? |
Hmm, I also consider it as the key problem. The "pinned" tab might have been there for long time, the CSRF token in that tab might have been expired. At the moment, there is no clear solution for this problem, but I think 1.21 (refactoring more forms to "form-fetch-action", like #25219) could avoid such problem as much as possible. |
No more feedbacks. Feel free to provide more clues and some reproducible steps and reopen. |
Description
Sometimes i face the issue, when starting review of PR i got error "Bad Request: invalid CSRF token". This happens when i try to post some comments to the PR. The web-page can be opened not more then for 20 minutes before i got this error.
As i understood from docs and other posts, CSRF token should be valid for more then 24hours before expiration and it is more, than user session exist. In my case the token expiration happens in less then 1 hour.
Gitea Version
1.20.0
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
Git Version
No response
Operating System
No response
How are you running Gitea?
docker
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: