Add CSRF protection to every form that changes data.

The logout link carries the token too, and the cookies get SameSite=Lax.
This commit is contained in:
tim
2026-09-25 21:38:22 +02:00
parent f6bdf10228
commit 41c46a43c6
9 changed files with 53 additions and 5 deletions
+6
View File
@@ -64,6 +64,12 @@ if (isset($_POST['action']))
else
$action = NULL;
// A POST without a valid CSRF token only gets a preview
if ($action && !csrf_valid()) {
$validate['csrf'] = 'Your session has expired. Please check your story, then send it again.';
$action = 'preview';
}
switch ($action) {
case 'post': // post to database
case 'save': // post to queue