Extension talk:AbuseFilter
Add topic![]() Archives
| ||
---|---|---|
| ||
Edit filter on Whitespace edits?
[edit]I've wanted to make a filter to stop whitespace edits from new and anonymous users, but it doesn't seem to be working at all. Here's the code I have:
action == "edit" & old_wikitext == new_wikitext & (edit_delta < -2 | edit_delta > 2) & !page_recent_contributors
Any suggestions on how to fix this? 67.146.11.202 19:21, 26 December 2024 (UTC)
old_wikitext == new_wikitext
means the old and new wikitext are the same, including whitespace changes, which cannot be achieved (the system won't allow such an edit). To disregard whitespace, you will need something likermwhitespace(old_wikitext) == rmwhitespace(new_wikitext)
.!page_recent_contributors
means "there are no recent contributors to the page." Which is true when creating a new page. You probably want something like! user_name in page_recent_contributors
.- You will also need a definition for a "new user", like
! 'confirmed' in user_groups
. --Matěj Suchánek (talk) 11:04, 27 December 2024 (UTC)- I substituted the "confirmed" part for users with less than 10 edits and the
old_wikitext == new wikitext
for thermwhitespace(old_wikitext) == rmwhitespace(new_wikitext)
. Does theedit_delta
section matter in any way? 67.146.11.202 01:57, 1 January 2025 (UTC)- Depends. You may want allow newbies to fix a typo ("likethis") by adding a space.
edit_delta > 2
means you allow edits where at most 2 such typos are fixed (with no other change made). IMHO this is reasonable. --Matěj Suchánek (talk) 09:16, 1 January 2025 (UTC)- I made some changes and played around with what you suggested, and came up with this:
action == "edit" & rmwhitespace(old_wikitext) == rmwhitespace(new_wikitext) & (edit_delta < -2 | edit_delta > 2) & ! user_name in page_recent_contributors & (user_editcount < 10 | user_age < 345600)
- This still doesn't quite solve it, but it's getting closer to what I'd like my final product to be. 67.146.11.202 16:54, 1 January 2025 (UTC)
- I'm still looking for advice on using the
rmwhitespace(old_wikitext) == rmwhitespace(new_wikitext)
because I tested the filter and it couldn't find any results (checked over the last 3 months; there should've been a couple according to the recent changes history there) and still didn't catch them. Any fixes for this? - Not sure if this still applies but I did try out the autoconfirmed part the
(user_editcount < 10 | user_age < 345600)
will work (IE account has less than 10 edits or is less than 4 days old). I feel like this will work but is a side thing to the main issue I'm dealing with. 67.146.11.202 03:53, 5 January 2025 (UTC)- Weird. When use the test tools on my wiki, it finds a fresh edit with only whitespace changes. And the expression evaluates true for other recent changes like [1][2]. Not sure what is wrong. --Matěj Suchánek (talk) 10:15, 5 January 2025 (UTC)
- I'm curious on whether or not I need to "define" if a user in is what group (either not logged in or a new editor). I'll come back in a few days with any updates if I do get the filter working. 67.146.11.202 03:46, 6 January 2025 (UTC)
- It's been just over a week, and I haven't been able to look at this too much, but I've been playing around with removing certain parameters from the existing code that I have and adding some parentheses from
rmwhitespace(old_wikitext)
to the edit_delta parameters. I also looked at the other changes from CS wiki that had whitespaces, I'm not sure what I'm doing wrong as the filter still isn't recognizing the whitespace edits. Edits like 1, 2, 3, 4 and 5 are whitespace ones but there are several that predate the filter so therefore wouldn't be tagged anyway. - Note: breaking up links so it doesn't trigger the external links filter (likely for spam purpose) 67.146.11.202 19:06, 14 January 2025 (UTC)
- It should be made clear that the condition
rmwhitespace(old_wikitext) == rmwhitespace(new_wikitext)
itself would, in my opinion, have caught all the edits you linked. But obviously not the filter. Because(edit_delta < -2 | edit_delta > 2)
withedit_delta = 1
evaluates to(1 < -2 | 1 > 2)
→(false | false)
→false
. Matěj Suchánek (talk) 08:44, 15 January 2025 (UTC)- I see now, thanks. I'll tweak the filter and come back on here tomorrow morning (for me) on if there are any updates and if I have fixed it yet. 67.146.11.202 00:56, 16 January 2025 (UTC)
- So I've split the code into segments to try and pick out where it's going wrong. I changed the expression to
edit_delta > -2) | (edit_delta < 2
with parentheses around the expression to make it specific. Maybe it'srmwhitespace(old_wikitext) == rmwhitespace(new_wikitext)
looking for the article text being the exact same. I'm getting close to a solution, but the second expression still seems to be getting me. Is that the issue or something else? 67.146.11.202 03:21, 19 January 2025 (UTC)- If you expect the filter to catch these five edits, the
edit_delta
condition is wrong either way. When you open the history page of any of these pages, you will see (+1) indicator at every edit in question. So your condition onedit_delta
must be satisfied (at least) for one. - Note that
(edit_delta > -2) | (edit_delta < 2)
is always satisfied. If the delta is less than 2, it is satisfied. If it's greater than or equal to 2, then it must be greater than 1, 0, -1, -2, etc., therefore it's satisfied, too. --Matěj Suchánek (talk) 20:17, 19 January 2025 (UTC)- There was only one change that should come up once I get the filter
edit_delta
paramaters fixed so it looks for greater than -2 OR less than +2 in terms of size (maybe looking an AND instead). I'm still playing around with the filter now and will come back in a few days again if I have made any progress in terms of fixes or not. 67.146.11.202 21:49, 19 January 2025 (UTC) - Also, on an unrelated note, I was able to partially fix it by removing
! user_name in page_recent_contributors
in the filter. Not sure if that detected all edits there but it did on the most recent whitespace edit by an IP, but not to a logged-in account. 67.146.11.202 21:59, 19 January 2025 (UTC)
- There was only one change that should come up once I get the filter
- If you expect the filter to catch these five edits, the
- It should be made clear that the condition
- It's been just over a week, and I haven't been able to look at this too much, but I've been playing around with removing certain parameters from the existing code that I have and adding some parentheses from
- I'm curious on whether or not I need to "define" if a user in is what group (either not logged in or a new editor). I'll come back in a few days with any updates if I do get the filter working. 67.146.11.202 03:46, 6 January 2025 (UTC)
- Weird. When use the test tools on my wiki, it finds a fresh edit with only whitespace changes. And the expression evaluates true for other recent changes like [1][2]. Not sure what is wrong. --Matěj Suchánek (talk) 10:15, 5 January 2025 (UTC)
- I'm still looking for advice on using the
- I made some changes and played around with what you suggested, and came up with this:
- Depends. You may want allow newbies to fix a typo ("likethis") by adding a space.
- I substituted the "confirmed" part for users with less than 10 edits and the
How do I use AbuseFilter?
[edit]I downloaded the abusefilter and is in my file explorers but I don't know how to use it I am a noob at this thing so can you tell me how I use it? Thrusterboosts (talk) 03:48, 14 January 2025 (UTC)
- After you have finished Extension:AbuseFilter#Installation, go to Special:AbuseFilter/new and create a new filter at your will.
- Extension:AbuseFilter/Rules format, Extension:AbuseFilter/Actions and w:Wikipedia:Edit filter/Documentation can be particularly helpful. --Matěj Suchánek (talk) 08:55, 14 January 2025 (UTC)
The data you tried to import is not valid
[edit]Tried to import a script from another wiki but it gives me the following error:
"The data you tried to import is not valid"
the script in question:
{"data":{"rules":"action == \"edit\"\r\n\u0026 user_editcount == 0\r\n\u0026 old_size == 0\r\n\u0026 user_age \u003C 432000\r\n\u0026 ( count(all_links) \u003E= 1\r\n| contains_any( lcase(added_lines), \"my homepage\", \"my home page\", \"my home-page\", \"my weblog\", \"my web blog\", \"my blog\", \"my web page\", \"my webpage\", \"my web-page\", \"my site\", \"my website\", \"my web-site\", \"my web site\", \"my essay\", \"my paper\", \"research paper\", \"contrast essay\", \"synthesis essay\", \"our customers\", \"cv\", \"real estate\", \"loan\", \"insurance\", \"for sale\", \"service\", \"porn\", \"OnlyFans\", \"pornstars\", \"Tiktok.Pornstars\", \"carpet cleaning\", \"carpetcleaning\") )\r\n\u0026 !contains_any( lcase(added_lines), \"sonic\", \"video games\", \"game\", \"guide\", \"walkthrough\", \"nintendo\", \"sony\", \"playstation\", \"microsoft\", \"wiki\", \"editor\", \"task\", \"tasks\")","name":"No Spam In Our House","comments":"Prevents spam page creation\u2014particularly those advertising unsavory services\u2014from brand new accounts with no other edits. There's a slew of false-positive-preventing phrases in the fold, so it really should only impact bad actors.","group":"default","actions":{"block":["noTalkBlockSet","3 days","3 days"],"disallow":["abusefilter-disallowed"]},"enabled":true,"deleted":false,"hidden":true,"global":false},"actions":{"block":["noTalkBlockSet","3 days","3 days"],"disallow":["abusefilter-disallowed"]}}
AdmiralJuicy (talk) 14:01, 24 January 2025 (UTC)
- @AdmiralJuicy: Is "block" action enabled on your wiki? --Matěj Suchánek (talk) 17:22, 27 January 2025 (UTC)
- Yes 149.90.91.9 17:27, 27 January 2025 (UTC)
- I see the problem now. The export lacks the "privacylevel" key under "data". You are likely exporting from wiki running an older version. See https://phabricator.wikimedia.org/T365740. --Matěj Suchánek (talk) 19:40, 27 January 2025 (UTC)
- Yes 149.90.91.9 17:27, 27 January 2025 (UTC)