Skip to content

Invalid CSRF token issues - unable to recover submitted data #17850

Closed
@fnetX

Description

@fnetX

Feature Description

If you have an issue / pull comment open for a long time, submitting it will yield Bad Request: Invalid CSRF token, which is fine from a security perspective, but very annoying to users.

It seems there is currently no way to restore the submitted data. I encountered this two times very recently with pull review comments, the content is gone if you go back in your history, and you can't re-send (and maybe get via the browser console, although this is already very unintuitive, because Gitea uses a redirect to the dashboard to display this warning, instead of directly showing it on the next page).

This is very annoying to me, and I think it might be annoying to all users ever encountering this.

I can think of some "naive solutions", but I doubt all work or are secure:

  • rework the error forward or WIP: Replace easymde with textarea #15394 so that the usual browser-internal restoring of text fields works (it doesn't for me with Gitea, I think it might be related to one of these things)
  • if the user is still logged in, allow to re-submit the data in the GUI, either with an "authorize" button on the page with the valid CSRF token, or by filling back the form the user wanted to submit
  • consider allowing to disable CSRF tokens as of Replace CRSF token with SameSite=strict #11188

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions