Web: add request tokens to thread status, host venue and member removal

AL
2h ago
+10-5

Three scripts changed state on behalf of the logged-in user without checking the request tokens that other state-changing scripts use (see the comment above url_tokens() in util.inc), so a link or form on another site could trigger them:

  • forum_thread_status.php: the thread owner's "answered" / notice-export status (GET links)
  • host_venue_action.php: the location (venue) of the user's computer (GET)
  • team_remove_inactive_action.php: removal of members from a team by its founder (POST)

Each now calls check_tokens(), and the links and forms that lead to them add url_tokens() or form_tokens(): forum_thread.php, location_form() in host.inc (only shown to the logged-in owner of the computer) and team_remove_inactive_form.php. The two GET scripts also list tnow and ttok in check_get_args().

AI assistance

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

Testing

php -l is clean for all six files. Host venue, on a test project with a logged-in test user and a computer record: a request without tokens is refused with "Link has timed out" and the venue stays unchanged. The location form on the computer's page contains tnow and ttok, and a request with those values sets the venue. The thread status and member removal changes follow the same pattern; I did not run them.


Summary by cubic

Adds request token checks to three state-changing scripts so that cross-site request forgery can no longer trigger them. Previously, a link or form on another site could change the user's thread status, computer venue, or team membership.

  • forum_thread_status.php, host_venue_action.php, and team_remove_inactive_action.php now call check_tokens() and require tnow/ttok arguments.
  • The links and forms in forum_thread.php, host.inc, and team_remove_inactive_form.php now include the appropriate tokens.