Skip to content

fix the CSRF token on delete files and directories#2829

Open
samialfattani wants to merge 12 commits intopallets-eco:masterfrom
samialfattani:fix/csrf-fileadmin
Open

fix the CSRF token on delete files and directories#2829
samialfattani wants to merge 12 commits intopallets-eco:masterfrom
samialfattani:fix/csrf-fileadmin

Conversation

@samialfattani
Copy link
Copy Markdown
Contributor

@samialfattani samialfattani commented Mar 11, 2026

CSRF token is not generated in the file/list.html page for both file and directory delete <form>. This PR uses csrf_token() to generate the token and put them in a hidden field to be submitted within the delete action.

Why this PR: it supports CSRF in file/list.html if the user useed flask_wtf.csrf.CSRFProtect

Test: This PR adds many test cases that covers all pages of FileAdmin() including list, rename, upload, ...etc. also there are some tests that include the csrf_token in the post request and assert the response to be 200 not 400.

@samialfattani samialfattani marked this pull request as ready for review March 18, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant