Web: require tokens for deleting sandbox files

AL
2h ago
+1-0

sandbox.php?action=delete_files removed the named files from the user's sandbox without checking the request tokens, unlike upload_file, add_file, get_file, the tag actions and the others in that script. The file names are passed as query arguments, so a link on another site could delete files of a logged-in user who can use the sandbox (CSRF).

check_tokens() is now called for delete_files. The file list form already includes form_tokens(), so the "Delete selected files" button keeps working.

AI assistance

Found and written with Claude Code (claude-sonnet-5-5). I reviewed the change.

Testing

On a test project with a logged-in test user who has sandbox access and a file in the sandbox:

  • before the change, sandbox.php?action=delete_files&victim.txt=1 deleted the file;
  • after the change, the same request is refused with "Link has timed out" and the file stays.
    I did not click the button in the browser; the list form's hidden token fields are the ones check_tokens() reads.

Summary by cubic

Fixes a CSRF vulnerability in sandbox.php where action=delete_files deleted files without verifying request tokens, unlike other state-changing actions. check_tokens() is now called, and the existing file list form already includes form_tokens(), so the delete button continues to work.