Skip to content

fix: account deletion is a CSRF POST, not a GET with the secret in the URL - #527

Open
t0ma5 wants to merge 1 commit into
mindstellar:developfrom
t0ma5:fix/user-delete-post-csrf
Open

fix: account deletion is a CSRF POST, not a GET with the secret in the URL#527
t0ma5 wants to merge 1 commit into
mindstellar:developfrom
t0ma5:fix/user-delete-post-csrf

Conversation

@t0ma5

@t0ma5 t0ma5 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ?page=user&action=delete&id=&secret= used to delete the signed-in account on GET. A mail scanner, prefetch, or leaked referrer was enough.
  • GET now shows a confirm form. The mutation is POST delete_post with a CSRF token and the current password. The session user is used; query id/secret are ignored.
  • Existing theme links that still carry id and secret land on the confirm page and no longer delete. Themes may ship user-delete_account.php; core falls back to oc-includes/osclass/gui/ when they do not.
  • osc_user_delete_url() is the helper to print (no secret). .pot refs stay POSIX on Windows so npm run i18n does not rewrite every path.

Test plan

  • php tests/user-delete-get.php
  • Signed in, open ?page=user&action=delete&id=YOUR_ID&secret=YOUR_SECRET (old theme link): confirm page, account still exists
  • Submit without password: stays on confirm, not deleted
  • Submit with wrong password: error, not deleted
  • Submit with CSRF + correct password: account gone, signed out, flash on home
  • GET delete_post does not delete
  • Theme without user-delete_account.php still renders the core fallback inside header/footer

…e URL

GET ?page=user&action=delete used to remove the account as soon as the page was requested. It now shows a confirm form; delete_post requires CSRF and the current password. Existing theme links with id and secret land on the confirm page.

Co-authored-by: Cursor <cursoragent@cursor.com>
@t0ma5
t0ma5 requested a review from navjottomer as a code owner August 30, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant