Create a file with too many lines from web ui will get Invalid CSRF token. error #13609

Closed
opened 2025-11-02 10:48:06 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @yp05327 on GitHub (Oct 17, 2024).

Description

Reproduce:
Create a new file in browser, then input some texts, and copy paste them, if there's several million lines, it maybe very slow, but you can click commit. then you will see Invalid CSRF token. error

Gitea Version

latest

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

build

Database

None

Originally created by @yp05327 on GitHub (Oct 17, 2024). ### Description Reproduce: Create a new file in browser, then input some texts, and copy paste them, if there's several million lines, it maybe very slow, but you can click commit. then you will see `Invalid CSRF token.` error ### Gitea Version latest ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? build ### Database None
GiteaMirror added the issue/needs-feedbacktype/bug labels 2025-11-02 10:48:06 -06:00
Author
Owner

@yp05327 commented on GitHub (Oct 17, 2024):

error log:
image

@yp05327 commented on GitHub (Oct 17, 2024): error log: ![image](https://github.com/user-attachments/assets/124ed2df-ce54-47a8-894c-1272e45f18a7)
Author
Owner

@wxiaoguang commented on GitHub (Oct 17, 2024):

Well, does it make sense? If there were billions or even more of lines, your browser could also crash, your disk could be full-filled, your OS could stop responding, etc.

@wxiaoguang commented on GitHub (Oct 17, 2024): Well, does it make sense? If there were billions or even more of lines, your browser could also crash, your disk could be full-filled, your OS could stop responding, etc.
Author
Owner

@yp05327 commented on GitHub (Oct 17, 2024):

I can not find out what happened, as the dev tools crashed. So, for recording it, I created this issue.
Is it a way to improve or can we do something better. e.g. limit the max lines?

@yp05327 commented on GitHub (Oct 17, 2024): I can not find out what happened, as the dev tools crashed. So, for recording it, I created this issue. Is it a way to improve or can we do something better. e.g. limit the max lines?
Author
Owner

@wxiaoguang commented on GitHub (Oct 17, 2024):

Most likely that the form is too big (or corrupted) then backend fails to parse it correctly to get csrf.


IIRC there are many size limits in Golang HTTP package when parsing request body

image

@wxiaoguang commented on GitHub (Oct 17, 2024): Most likely that the form is too big (or corrupted) then backend fails to parse it correctly to get csrf. ---- IIRC there are many size limits in Golang HTTP package when parsing request body ![image](https://github.com/user-attachments/assets/ccfdbe1d-1cf3-4520-b9a7-da434a9d7bb2)
Author
Owner

@wxiaoguang commented on GitHub (Oct 21, 2024):

Anything need to keep this issue open?

@wxiaoguang commented on GitHub (Oct 21, 2024): Anything need to keep this issue open?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13609