Skip to content

Invalid csrf token #4311

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

Closed
1 of 6 tasks
GoodERPJeff opened this issue Jun 25, 2018 · 12 comments
Closed
1 of 6 tasks

Invalid csrf token #4311

GoodERPJeff opened this issue Jun 25, 2018 · 12 comments

Comments

@GoodERPJeff
Copy link

GoodERPJeff commented Jun 25, 2018

  • Gitea version (or commit ref):1.4.2
  • Git version:2.17
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • [ x] No
    • Not relevant
  • Log gist:

Description

...
repo setting, uncheck the pull request options, save.

show blank page with " Invalid csrf token."

Screenshots

image

@GoodERPJeff
Copy link
Author

This happen on Chrome, but I change to firefox, settings are successfully saved.

I may close this issue and keep tracking.

@gruo
Copy link

gruo commented Feb 21, 2019

Happened to me while trying to comment on an still open issue. I had two tabs of this particular gitea instance open, which pointed to different repositories.

After going to issues home and opening the same issue and commenting afterwards the problem disappered and the comment was added.

@bohwaz
Copy link

bohwaz commented Jun 6, 2019

Same issue as @gruo, the page was in my browser cache, when I tried to submit it just showed this message.

It would be good to just show the page again and ask the user to re-submit!

@choucavalier
Copy link

I think this is still an issue. Gitea should work on all browsers. This happened to me on the qutebrowser.

@3F
Copy link

3F commented Apr 22, 2020

Same here with Firefox for issue tracker. I'm already used to the following combination: Backspace + F5 + click button again. But actually too many a broken csrf that I was seeing at least for 1.10.3, 1.11.0 - 1.11.4

@6543
Copy link
Member

6543 commented Apr 22, 2020

this is a caching problem of Chrome - just delete your cache

@choucavalier
Copy link

@6543 i don't think it's valid to just discard this issue by saying "Chrome is the problem". i personally don't have any issue with other websites i'm using that definitely use csrf tokens

@6543
Copy link
Member

6543 commented Apr 22, 2020

I would still say this is a feature request: #11182

you dont have to clean the cache you can logout and login afterwards to fix this

@3F
Copy link

3F commented Apr 22, 2020

@6543

  1. I think I mentioned exactly Firefox. Why Chrome?
  2. Why "detect and "logout" on old csrf token [Feature] detect and "logout" on old csrf token #11182" ? If I am still authorized ! I can easily interact with gitea after F5 (on the contrary, cache helps to restore missing data)

Moreover, token problems sometime appears every ~5/10 minutes. What I should to do after your amazing #11182 ? login after each ~5 minutes? If so, please leave it as is.

Sorry, but I'd prefer spend ~3 sec for just Backspace + F5 + click button again instead of your login/pass <_<

@zeripath
Copy link
Contributor

@3F this reads a little rude. @6543 is a volunteer like all of us here and has put a lot of hours in to make this project better overall.

Generally I'd argue against logging out here - you could be denied service that way - issuing a redirect may be better however there should be a document somewhere stating the recommended practice but my googlefu is failing me.

If we end up wanting to issue a redirect we will need to change the csrf library to give us access to the request in the errorfunc so we can send a proper redirect.

@3F
Copy link

3F commented Apr 22, 2020

@zeripath

this reads a little rude.

?? I'm sorry, but what and where I said "little rude"?

I simply shared about my problem where each ~5 minutes is invalid token and proposed logout for this method is just not a good idea. Isn't it?

Or I can not offer my thoughts for this project?! I'm sorry, I didn’t know that here is so severe censorship for this project o_o

@go-gitea go-gitea locked and limited conversation to collaborators Apr 22, 2020
@techknowlogick
Copy link
Member

I've locked this ticket as it has been closed since 2018. @6543 took the right approach to open a new ticket. An invalid token should not be treated as valid, as otherwise that is a security issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants