Page MenuHomePhabricator

Set up anti abuse measures
Closed, ResolvedPublic

Assigned To
Authored By
Madalina
Oct 6 2023, 12:42 PM
Referenced Files
F40667082: image.png
Nov 2 2023, 10:59 PM
F40667069: image.png
Nov 2 2023, 10:59 PM
F40667048: image.png
Nov 2 2023, 10:59 PM
F40667035: image.png
Nov 2 2023, 10:59 PM
F40666934: image.png
Nov 2 2023, 10:59 PM
F40666894: image.png
Nov 2 2023, 10:59 PM
F40666856: image.png
Nov 2 2023, 10:59 PM
F41153299: image.png
Nov 2 2023, 10:59 PM

Description

Background
As we’re trying to build a reporting system that is easily accessible to all types of users and victims of harassment there’s a risk malicious users will try to exploit it. We need to set up some anti-abuse measures in order to prevent bad actors from abusing the system . We will optimize these measures as we progress.

User Stories
As a responder I want to only receive valid reports so that I don’t waste a lot of time going through spam or unactionable reports.

Description
Only named users who meet the following criteria should be able to file reports:

  • User account is > 3 hours old
  • User account has > 0 edits
  • User account is under rate limits (T345813)
  • User account is not under any block
  • User account has verified email

Acceptance Criteria

  • In order to be able to submit a form, the reporting user account needs to meet ALL of the following criteria:
    • User is named (not temporary)
    • User account is > 3 hours old
    • User account has > 0 edits
    • User account is under rate limits
    • User account is not under any block
    • User account has verified email
  • If at least one of the above criteria is not met:
    • the form cannot be submitted and
    • a generic error message is shown - This will be done in T338804

Event Timeline

Change 964002 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] form: Show dialog to visit Special:ChangeEmail

https://gerrit.wikimedia.org/r/964002

Change 965510 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] extension: Define rights and permissions for reportincident

https://gerrit.wikimedia.org/r/965510

Change 965510 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] extension: Define rights and permissions for reportincident

https://gerrit.wikimedia.org/r/965510

@JSengupta-WMF @Madalina just to double-check: for the use cases in the task description, should we show the form to the user, allow them to fill it out, then show the error? Or should we show an error state when they open the form? Or should we not show the entrypoint at all (don't add the link in the overflow menu or in the tool menu)?

Change 964002 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] form: Show dialog to visit Special:ChangeEmail

https://gerrit.wikimedia.org/r/964002

Change 967294 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude temporary users

https://gerrit.wikimedia.org/r/967294

Change 967297 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude users with zero edits

https://gerrit.wikimedia.org/r/967297

Change 967300 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude blocked users

https://gerrit.wikimedia.org/r/967300

Change 967305 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude users under account age threshold

https://gerrit.wikimedia.org/r/967305

Showing the error when user clicks the link is a better UX and less hassle for the user than letting them fill up the form and then throwing an error.

Showing the error when user clicks the link is a better UX and less hassle for the user than letting them fill up the form and then throwing an error.

I agree. In that case, we'll need an error state dialog to show, similar to the screen we show if the user doesn't have a confirmed email. @Madalina @JSengupta-WMF could you make a separate task for that, please, for the MVP epic?

Change 967418 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ReportIncident@master] ReportHandler: Don't throw exception for temp users

https://gerrit.wikimedia.org/r/967418

Change 967294 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude temporary users

https://gerrit.wikimedia.org/r/967294

Change 967418 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] ReportHandler: Move logging to temp users

https://gerrit.wikimedia.org/r/967418

Change 967297 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude users with zero edits

https://gerrit.wikimedia.org/r/967297

Change 967300 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude blocked users

https://gerrit.wikimedia.org/r/967300

Change 967305 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] ReportHandler: Exclude users under account age threshold

https://gerrit.wikimedia.org/r/967305

Dreamy_Jazz subscribed.

Suggested QA steps:

  1. First test using betawikis
  2. Create a new account
  3. Add an email to the account
  4. Click on Report in the Tools menu
  5. Fill out the form on the second step with valid data, and submit the form
  6. Verification step: Verify that the API responds with the status code 403
  7. Make an edit
  8. Repeat steps 8 to 10 (including the verification step)
  9. Create a new wiki with the ReportIncident extension and check the Enable temporary user account creation (IP Masking) option, and use this patchdemo wiki for the remaining steps
  10. Don't log into an account
  11. Go to any page and make an edit
  12. Verify that you are now logged into a temporary account (the username should look like *Unregistered ...)
  13. Go to an existing user talk page
  14. Verify that no Report link appears in the Tools menu
  15. Run the following in the browser console, replacing https://patchdemo.wmflabs.org/wikis/5687649aaa with the URL to your patchdemo wiki. This will attempt to submit a incident report as a temporary account.
await fetch("https://patchdemo.wmflabs.org/wikis/5687649aaa/w/rest.php/reportincident/v0/report", {
    "credentials": "include",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0",
        "Accept": "application/json, text/javascript, */*; q=0.01",
        "Accept-Language": "en-GB,en;q=0.5",
        "Content-Type": "application/json",
        "X-Requested-With": "XMLHttpRequest",
        "Sec-Fetch-Dest": "empty",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Site": "same-origin",
        "Pragma": "no-cache",
        "Cache-Control": "no-cache"
    },
    "referrer": "https://patchdemo.wmflabs.org/wikis/5687649aaa/wiki/User_talk:Alice",
    "body": "{\"reportedUser\":\"Alice\",\"details\":\"test\",\"behaviors\":[\"threats-or-violence\"],\"revisionId\":1}",
    "method": "POST",
    "mode": "cors"
});
  1. Verification step: Verify that the response has the status code 403
  2. Login to User:Alice
  3. Make an edit
  4. Logout and then login to User:Patch Demo.
  5. Go to Special:Block
  6. Block the User:Alice
  7. Logout and then login to User:Alice
  8. Go to a user talk page
  9. Click on Report in the Tools menu
  10. Fill in the form with valid data and press submit
  11. Verification step: Verify that response has the status code 403.

Testing the rate limit is skipped as this has already been QA'd in T345813, and testing the email dialog is skipped as this was done in QA of T339276.

Test wiki created on Patch demo by DJacksonA using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/716b4d9ced/w

Test wiki created on Patch demo by DJacksonA using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/c6508c125e/w

Djackson-ctr subscribed.

Per the ticket Description and QA Steps, I have verified the new code has been implemented and is functioning and displaying as expected...
@Dreamy_Jazz you did an outstanding job with this ticket and the detailed QA Steps, Thank you sir.


Testing was executed at the following urls:
https://cs.wikipedia.beta.wmflabs.org/
https://ca.wikipedia.beta.wmflabs.org/
https://es.wikipedia.beta.wmflabs.org/
https://ru.wikipedia.beta.wmflabs.org/
https://patchdemo.wmflabs.org/wikis/c6508c125e/w
https://patchdemo.wmflabs.org/wikis/716b4d9ced/w


Verification step: Verify that the API responds with the status code 403

image.png (935×1 px, 312 KB)

image.png (928×1 px, 647 KB)

image.png (777×1 px, 388 KB)

image.png (955×1 px, 285 KB)


Verify that you are now logged into a temporary account (the username should look like *Unregistered ...)

image.png (660×1 px, 89 KB)


Verify that no Report link appears in the Tools menu

image.png (631×1 px, 92 KB)


Run the following in the browser console, replacing https://patchdemo.wmflabs.org/wikis/5687649aaa with the URL to your patchdemo wiki. This will attempt to submit a incident report as a temporary account.
Verification step: Verify that the response has the status code 403

image.png (612×1 px, 155 KB)


Block the User:Alice
Verification step: Verify that response has the status code 403.

image.png (991×1 px, 98 KB)

image.png (716×1 px, 92 KB)

image.png (819×1 px, 124 KB)

image.png (805×1 px, 117 KB)

Dreamy_Jazz updated the task description. (Show Details)

Test wiki on Patch demo by DJacksonA using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/716b4d9ced/w/

Test wiki on Patch demo by DJacksonA using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/c6508c125e/w/