Skip to content

SLOP-397: require edit token for clearNotification action (CSRF) - #9

Open
tosfos wants to merge 1 commit into
masterfrom
SLOP-397-csrf-clearnotification
Open

SLOP-397: require edit token for clearNotification action (CSRF)#9
tosfos wants to merge 1 commit into
masterfrom
SLOP-397-csrf-clearnotification

Conversation

@tosfos

@tosfos tosfos commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Special:PendingReviews performs a state change on any GET request carrying clearNotificationTitle / clearNotificationNS: handleClearNotification()PendingReview::clearByUserAndTitle() resets the victim's wl_notificationtimestamp, with no token check. A forged cross-site link or <img> tag silently marks the victim's pending reviews as reviewed.

Fix:

  • handleClearNotification() now requires the user's edit token (matchEditToken), throwing PermissionsError('editmywatchlist') when absent/invalid.
  • getClearNotificationButton() embeds the token in the generated links, so normal UI flow is unchanged.

Verification

  • php -l clean on php:7.4-cli and php:8.2-cli.
  • Harness (both 7.4 and 8.2): forged tokenless request → write performed under OLD code, PermissionsError under NEW; legit tokened request → write succeeds.

Note: SLOP-384 covers the same pattern for the unreview parameter on Special:PageStatistics — fixed separately since it needs its own link-builder update in ReviewHandler::getTemplate().

Closes SLOP-397.

Special:PendingReviews cleared a watchlist notification timestamp on
any GET carrying clearNotificationTitle/clearNotificationNS, with no
token check — a forged cross-site link or image could silently mark
the victim\x27s pages as reviewed. Require the user\x27s edit token and
embed it in the buttons that generate these links.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15c8a915-251d-4b34-b9e3-8ad8cd0f9900


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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