Commit graph

197 commits

Author SHA1 Message Date
Daimona Eaytoy 3b63127624 Fix messages displayed in history
With https://gerrit.wikimedia.org/r/#/c/412892/ I introduced an error
with action display in history: every action except for block would have
been displayed without parameters.

Change-Id: I273cd908b698c49056c176de9ead5a78d818c7be
2018-03-14 17:50:58 +01:00
Reedy 16d599c1b8 Merge "Add missing use in hooks" 2018-03-12 15:27:02 +00:00
WMDE-Fisch 9af25447a0 Add missing use in hooks
Change-Id: I8e6fa3211868b984248d9414bdbc6970392b2189
2018-03-12 15:00:58 +01:00
Matěj Suchánek 3a0f6a48ba Use OOUI datetime selectors on Special:AbuseFilter/examine
Bug: T58367
Bug: T58368
Change-Id: Ic7882e86c1cadd2501eca9a63623f0db3a0c614a
2018-03-10 10:39:43 +00:00
Daimona Eaytoy e0d7f6a388 Fix issue with custom blocks patch
I had unwillingly substed a variable with a string in the wrong case. It
needs to be fixed before .25 is deployed, otherwise in history there
might be actions != block which'll be displayed as 'block'.

Change-Id: I6d251fa011238509a8fdf264e865573140e7a20d
2018-03-10 10:02:11 +01:00
jenkins-bot 2fe3b18dea Merge "Convert Special:AbuseFilter/history and /examine to use OOUI" 2018-03-10 01:11:57 +00:00
Brad Jorsch 3014871cb5 Update for the actor table change
Core change I8d825eb0 begins the process of changing core database
tables from using xx_user and xx_user_text fields to using xx_actor.
This updates the extension to continue to function during and after the
transition.

Bug: T167246
Change-Id: I4065716022aa60c0fa1a258659db22be2b7f43de
2018-03-09 16:34:24 -05:00
Brad Jorsch 7399cd4348 Update CommentStore usage
CommentStore's calling conventions changed in I3abb62a5c.

Change-Id: I80012f82b39e5054ee40a44b5a8e92dec46c2962
2018-03-09 16:22:32 -05:00
jenkins-bot c02133ac08 Merge "Fix supposedly nullable argument" 2018-03-09 15:55:26 +00:00
Matěj Suchánek 5ae26bb5c6 Fix supposedly nullable argument
Change-Id: I81c467ce3483096c98041412a664b3a26735118a
2018-03-09 16:16:12 +01:00
jenkins-bot f86ef894b6 Merge "Fix typo in wgAbuseFilterActions" 2018-03-09 14:41:47 +00:00
Matěj Suchánek ff281fa2e3 Fix typo in wgAbuseFilterActions
Bug: T189299
Change-Id: Ie87d6f31e00408a2226547ee810cfbab27a439ed
2018-03-09 15:20:53 +01:00
jenkins-bot cd7e6541ac Merge "Fix Special:AbuseLog::getUserLinks call" 2018-03-09 14:19:25 +00:00
Matěj Suchánek 38f56d1dd2 Convert Special:AbuseFilter/history and /examine to use OOUI
Bug: T132284
Change-Id: Ib61e0ce8f3f8481cdaf9ee7f521f73f314fcded2
2018-03-09 11:35:47 +00:00
Matěj Suchánek 4637d19f69 Fix Special:AbuseLog::getUserLinks call
IP addresses have no user id, reusing af_user for them was a complete nonsense.

Change-Id: Iaebf5e57c445452896dce6b3edf0018ebbb6e3dc
2018-03-09 09:26:58 +01:00
jenkins-bot e24c025670 Merge "Allow customizing block durations for each filter" 2018-03-09 03:27:15 +00:00
Daimona Eaytoy 2dd8d27c34 Allow customizing block durations for each filter
This is part of a project to enchance blocking in AF. With this patch,
users are allowed to specify two block durations for each filter, one
for anonymous and one for registered users. For backward compatibility,
default values are set to the global variables.

Bug: T32024
Change-Id: Ib072433d19dabae48d8514e08be9893135b5d63c
2018-03-08 14:57:16 +01:00
Daimona Eaytoy 21c268e2f0 Add logging for preventEditOwnTalk blocks
Blocks preventing edit of own talk currently don't show "cannot edit own
talk page". Added it to the flags to make it display properly.

Bug: T188970
Change-Id: Ia8d1c2b93038c3c43bb224a8cae073b694d74cbe
2018-03-06 17:07:49 +01:00
jenkins-bot 04b1d121c9 Merge "Tag actions which hit the condition limit" 2018-03-06 02:08:08 +00:00
jenkins-bot 0afe787935 Merge "Allow preloading text areas using URL parameter" 2018-03-05 16:08:56 +00:00
jenkins-bot 7f4b69df1e Merge "Add userLinks in private details page" 2018-03-05 16:03:25 +00:00
Daimona Eaytoy 6e42340af9 Add userLinks in private details page
The IP is currently displayed as plain text. Add instead userLinks in
the usual way to provide some handy links for CUs.

Bug: T188600
Change-Id: I47ee007f450f06a1a19b4c7598373a952efbe06a
2018-03-05 11:52:41 +01:00
Matěj Suchánek 8f812a72e7 Allow preloading text areas using URL parameter
Bug: T58784
Change-Id: I5c4f870ad5653011453360d3a44b10820292f488
2018-03-05 08:40:59 +01:00
Daimona Eaytoy 603b020239 Duplicate check for array_diff
Currently, array_diff is only performed in one direction. This way, some
edits to tags (and, in future, to custom block durations) aren't catched
and the filter isn't saved.

Bug: T180194
Change-Id: I22fb9368208380c1a8205a566ac5ff07bbb6e05b
2018-03-04 19:26:50 +01:00
Matěj Suchánek d138b2877c Add form field to filter history by filter
So that users have no longer to modify the URL.
Links like "Special:AbuseFilter/history/1" will still
work but request parameters have higher priority.

Bug: T27897
Change-Id: I2d8c26d3350fdd4052b68c7bced10e3fae859d18
2018-03-04 18:11:21 +00:00
jenkins-bot cdad5f2a28 Merge "Add option to turn off logging IPs" 2018-03-03 23:33:15 +00:00
Dan Mattern fd3987baee Add option to turn off logging IPs
Adds option to stop logging IPs in afl_ip in the abuse_filter_log table.
Introduces a new global variable: $wgAbuseFilterLogIP

Bug: T187169
Change-Id: I1615ba6949c9f8bcdd6ee6aef580c87a05f43e6a
2018-03-03 23:16:24 +00:00
jenkins-bot 3a86dff502 Merge "Do not attempt to process tags if tagging is disabled" 2018-03-03 15:52:15 +00:00
rosalieper b1e2e158c8 Do not attempt to process tags if tagging is disabled
added a check for $wgAbusefilterActions['tag']

Bug: T179249
Change-Id: I03cf318d63e70c8c7cc7c91d7d9347f3f6cbbea0
2018-03-03 14:42:17 +01:00
Matěj Suchánek 7dfe4bfcfd Change message transformation method
The argument needs to be HTML safe.

Change-Id: Ifb0009feb9fdb40679bede917a53d52171a22166
2018-03-02 19:23:28 +00:00
jenkins-bot dda156d5e6 Merge "Wrap the throttled warning in a warningbox div" 2018-03-02 15:58:00 +00:00
James D. Forrester 1d348e148e Avoid calls to deprecated wfSetupSession, $_SESSION, and session_id
Bug: T124371
Bug: T162909
Change-Id: I3ac6a858f39282392631474b29251f090eff9040
2018-03-01 14:44:46 -08:00
jenkins-bot 030de289f4 Merge "Add option to block a user from editing their own talk page" 2018-02-27 20:12:30 +00:00
Huji Lee 43530957e7 Better order of form elements (dropdowns together, filter ID last)
Bug: T159061
Change-Id: I7ea1d30f4ed57f014b7df43fa04957b1348428e6
2018-02-27 17:09:17 +00:00
Huji Lee a83b10c5ed Add option to block a user from editing their own talk page
Bug: T170014
Change-Id: I74b7fd2e036111583e8b69c355e7fb0c51fe67fc
2018-02-27 17:07:51 +00:00
Matěj Suchánek d19ced4cef Filter AbuseLog by the "impact" of the change
Users can choose whether they want to see entries
that changed the wiki or didn't (or they can apply
no filter).

Bug: T159061
Change-Id: I6cee9b001c26c4bbc837131781deef27d5e3ef1a
2018-02-24 15:25:50 -05:00
Matěj Suchánek 6f1e15c5ff Filter Special:AbuseLog by action taken by filters
Bug: T187971
Change-Id: I4c786ac312b9095f3055622677b78c2ce7be6b0c
2018-02-24 14:49:39 +01:00
Matěj Suchánek 2ec2868ffd Remove unused argument
Change-Id: I0429f8227293790195d314fc4560f0aa6af7ba7f
2018-02-24 11:33:10 +00:00
Daimona Eaytoy c7d87182b4 Wrap the throttled warning in a warningbox div
Currently, the message informing that some actions have been disabled is
quite impossible to notice at a first glance, since it's a bit confused
with other form elements. However it actually is a warning and needs to
be treated as that.

Change-Id: I0d851333f8da200fb0b9b0c7d05ccd1f63e9e948
2018-02-21 18:30:49 +01:00
Jeff Janes d7fccb57ed PostgreSQL: Add missing columns for AbuseFilter
Change I758795f01eaf3ff56c5720d660cd989ef95764a7, first released
in 1.20, added columns to AbuseFilter tables for MySQL, but not for
PostgreSQL.

This adds those columns for PostgreSQL, both for the installer and
for the updater.

Combined with already-merged change 192002, this change closes
bug T89514.

Bug: T89514
Change-Id: Ie33a5a932ffd85fa8a4111b949bd0a4d07a2af91
2018-02-16 19:26:34 +01:00
Aaron Schulz 8d40f43a50 Fix some minor IDEA code warnings
Change-Id: Ia7855906c8993ccea6127f2144b308179e669b3a
2018-02-15 22:54:25 +00:00
Matěj Suchánek 3f34308f96 Tag actions which hit the condition limit
When an action reaches the limit, the remaining filters are not executed.
But there is no way find out which one it was.

Bug: T71492
Change-Id: I28fac76d4e9ca341bed25cd35e1249b19586b773
2018-02-15 10:06:08 +01:00
Jayprakash12345 4f176dad83 Up at-ease calls in extensions
Bug: T187037
Change-Id: I4efbbbd1929baeb0410d820eb2a91c3d3c027e9c
2018-02-12 10:31:55 +00:00
Matěj Suchánek 35373155a1 Select only needed columns in queries
Change-Id: I6338906eede533fda76ce96fe10b9c4de314135c
2018-02-10 20:35:05 +00:00
jenkins-bot b74c12ecc0 Merge "API: Fix "Undefined index: wiki" warnings" 2018-02-09 20:13:52 +00:00
Kunal Mehta 2633839630 API: Fix "Undefined index: wiki" warnings
Bug: T186914
Change-Id: I7e9d5524302f5f90d0e82f0f4d41a542e2990ed5
2018-02-09 12:00:07 -08:00
jenkins-bot ac83ad1d90 Merge "Add contains_all and ccnorm_contains_all functions" 2018-02-09 18:08:35 +00:00
Daimona Eaytoy a0de056299 Add contains_all and ccnorm_contains_all functions
Added the contains_all function, with basically the same role as
contains_any but using logic AND instead of OR. Also added
ccnorm_contains_all, that is the same of ccnorm_contains_any but with
AND mode. Finally, fixed three wrong task IDs.
Co-authored with Valerio Bozzolan.

Bug: T21176
Change-Id: Ib0a8b783db6ce0d5db64771c8e0c70f0f8d13d36
2018-02-09 17:33:24 +01:00
Huji Lee 146820185c Log accessing private information in abuse filter logs
Bug: T152934
Change-Id: I8049df3b2b9343a6877e9a306d2781d3f27ec657
2018-02-07 18:35:36 +00:00
Matěj Suchánek 767d450f73 Don't show link to AbuseLog for IP ranges
Bug: T175915
Change-Id: I16fe71ad3eb37eefb5c710026e4de2ce1a976f30
2018-02-05 10:19:06 +01:00
jenkins-bot 8015489986 Merge "Normalize IPv6 addresses in Special:AbuseFilter/examine" 2018-02-05 05:10:02 +00:00
Matěj Suchánek 10aea65219 Allow filtering AbuseLog in API by wiki
Bug: T113414
Change-Id: I833f223b160810d69f084ae4b060adbdd956aa83
2018-02-03 17:45:37 +00:00
jenkins-bot 0475b02bec Merge "Use ExtensionRegistry to check if CheckUser is installed" 2018-02-03 14:17:55 +00:00
jenkins-bot b43a042fb0 Merge "Compatible with PHP 7.2, avoid passing null to count()" 2018-02-03 14:12:56 +00:00
Huji Lee 8beedb2544 Use ExtensionRegistry to check if CheckUser is installed
Bug: T183096
Change-Id: If52fa24e5fb50033092e0c15f08aa7b28c16261a
2018-02-03 14:02:24 +00:00
RazeSoldier 088ca53685 Compatible with PHP 7.2, avoid passing null to count()
Bug: T185981
Change-Id: I2ee2f79124935426ee06b6e0bcb987d1676fdba1
2018-01-31 15:30:23 +00:00
Reedy 459673c9c7 Set default when changing afl_namespace on pg
Bug: T185335
Change-Id: I91fa0bf316a920b21b541eed1d2a837d34ad5683
2018-01-19 20:13:58 +00:00
MarcoAurelio 59ff4aed5d Actually mark abusefilter creations as such in the AbuseFilter log
Bug: T178283
Co-Authored-By: Matěj Suchánek <matejsuchanek97@gmail.com>
Change-Id: I89776eff2fc420b1fe3e2c3b88671749fadb57b4
2018-01-12 17:03:13 +00:00
Umherirrender 80418b1f93 Move classes to own files
Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass

Change-Id: I3b08a69fe7990d6fe5f71cda51d6ac01f11aad2d
2017-12-23 13:43:37 +00:00
Umherirrender cbb7415c5a Change doc type from DatabaseBase to IDatabase
Change-Id: I2657188040aacb758ae5b7048b477776eacf4a2e
2017-12-22 22:09:52 +00:00
jenkins-bot 76cc8802ee Merge "Add PageContentSaveComplete WikiPage typehint" 2017-12-10 01:25:46 +00:00
addshore 142350bde2 Add PageContentSaveComplete WikiPage typehint
Change-Id: If7d3a72cec935de0f54063a1c375962a45eea34e
2017-12-10 00:51:58 +00:00
jenkins-bot 2085dafb5f Merge "Format filter IDs as numbers" 2017-12-03 21:29:20 +00:00
Reedy 7316825155 Replace MimeMagic::singleton() call
Change-Id: Ib01a23b909cb3e19c6d5ea9a8cf03d06ff8dab99
2017-11-27 01:46:00 +00:00
Matěj Suchánek a7ac1f2b3f Normalize IPv6 addresses in Special:AbuseFilter/examine
This is re-application of I0b4a5468c.

Change-Id: Ifad191f460717e70203f1740103f3af77b21b03d
2017-11-17 16:24:42 +01:00
jenkins-bot 94c7a1ea82 Merge "Add get_matches function" 2017-11-13 16:52:13 +00:00
Daimona Eaytoy 4e20c933f4 Add get_matches function
Added the get_matches function to store a regex match.

Bug: T179957
Change-Id: I19366ebcaa4d0f007dd675a61c91457dde57f604
2017-11-13 17:32:45 +01:00
Matěj Suchánek f29c053378 Remove unused parameter from the message
This parameter was never documented. It was just
a leftover from migrating to the current message API
in Id69a9d603. Note that the same message pair further up
in this file does not use it.

Change-Id: I38caa1611d78b6cb182861c8f5d731b27379f62a
2017-11-11 13:35:21 +01:00
Matěj Suchánek 957598261c Format filter IDs as numbers
Follows up I2bd833c35.

Change-Id: I3f2241fe791e9918750ef06805f9c4e5d52ee3b4
2017-11-11 12:38:12 +01:00
jenkins-bot f7fe5834dc Merge "AbuseFilter block range should not exceed $wgBlockCIDRLimit" 2017-11-05 05:36:10 +00:00
jenkins-bot b7b04cb830 Merge "Avoid Call Stack warning when there is an error in the regex pattern" 2017-11-03 20:01:30 +00:00
Huji Lee 7b7be07957 AbuseFilter block range should not exceed $wgBlockCIDRLimit
This patch introduces a config variable for the range block sizes.
It changes the default IPv6 block size from /16 to /19 using the
same reasoning as  Ia25e156fd8234519c4d74f1d41d93f94a313ce14

Using a config var (as opposed to hardcoded range size) allows
future changes proposed in T179454 to make the range size vary
for different IPs, based on the actual subnet they belong to.

Bug: T179455
Bug: T179456
Change-Id: I8dfa17f553a7af524f0a11c0fd51c48773e27be5
2017-11-02 12:08:49 +00:00
Huji Lee 0f7f4ad917 Add missing documentation for protected functions
Bug: T178007
Change-Id: Ia1ae78b30b889b7a8965354ae0a404bf9a520917
2017-11-02 03:20:34 +00:00
Huji Lee ace1822575 Filter ID should always go through formatNum()
Change-Id: I2bd833c35128b3c39c7882321747837184095bef
2017-10-31 22:11:55 -04:00
jenkins-bot 689b7abaff Merge "Remove back-compat code paths" 2017-10-31 16:12:40 +00:00
jenkins-bot f5536f964e Merge "Update for deprecation of selectFields() methods" 2017-10-31 16:08:46 +00:00
Brad Jorsch 6071e7a43f Remove back-compat code paths
Per T178092, AbuseFilter now maintains compatibility with older versions
of MediaWiki using release branches. Thus, various back-compat code
paths may be removed from the master branch.

Change-Id: Ia1b5eade30d7486e3b1b386b15a7db4e5c8cfead
2017-10-31 09:37:54 -04:00
Brad Jorsch 7ed9160ea9 Update for deprecation of selectFields() methods
Various selectFields() methods were deprecated in MediaWiki core change
Idcfd1556, replaced with getQueryInfo() methods.

Change-Id: If75d2e76c2f166bc40a544dd502da43171ce1e7b
Depends-On: Idcfd15568489d9f03a7ba4460e96610d33bc4089
2017-10-31 09:27:27 -04:00
Max Semenik 32598c18bb Drop FastStringSearch support
This PHP extension doesn't have any speed benefits over our minimum
required PHP and so isn't used in WMF production anymore.

Change-Id: I4883643908f765eee5db6b3ca88eed179264e93f
2017-10-26 00:51:07 +00:00
David Barratt 5335b6c811 Use Equivset library intead of AntiSpoof
Use the new equivset library instead of AntiSpoof.

Bug: T175413
Change-Id: I439387deeba99543e194c210953ac73ff98bc5b7
Depends-On: I977d3498b2084a426e2ab4d85c000d1b9dcfe824
2017-10-21 21:55:18 -07:00
jenkins-bot 83d67e4a12 Merge "Restore accidentally deleted code" 2017-10-22 04:09:59 +00:00
jenkins-bot 82ce683000 Merge "Pass LinkRenderer instance to AbuseFilter::addNavigationLinks" 2017-10-22 04:09:59 +00:00
jenkins-bot 610cfa8662 Merge "Normalize IPv6 addresses in Special:AbuseFilter/test" 2017-10-22 04:09:14 +00:00
Matěj Suchánek 5839b7c412 Restore accidentally deleted code
I have noticed I accidentally dropped this code during
Iec237b288 (apologize!).

Change-Id: Ifbd53575ddf8dd1014de19afea395d0eb537c6ee
2017-10-21 08:09:36 +02:00
Simeon Dahl 4c0636bc0a Cleanup, added spaces
Added spaces in some classes so it follow the same style as the others.
Edit is pure cleanup.

Change-Id: If5d5e6e4e99eed83aa69dfb4a224fbcc7c077d43
2017-10-19 09:40:22 +02:00
jenkins-bot 22e68a61ca Merge "Add slow filters debug data to the logs." 2017-10-12 23:11:50 +00:00
Dayllan Maza 3e1c5b9099 Add slow filters debug data to the logs.
When $wgAbuseFilterRuntimeProfile is true, all filters taking
longer than $wgAbuseFilterRuntimeLimit will be logged for
later analysis

Bug: T174205
Change-Id: Id81833afa8421476a6cee47eb3393acdb3a38d65
2017-10-12 17:41:49 -04:00
melos 9eb99b1dc9 Avoid Call Stack warning when there is an error in the regex pattern
When you are in Specia:AbuseFilter/test and you test a filter
against RC if the filter has a regex with a rlike condition
you receive a Call Stack warning for a wrong regex.

Bug: T177744

Change-Id: I2bc62b5709d2863eb355a249610b3e80fab55448
2017-10-09 10:48:20 +02:00
Umherirrender a2ebd0c70a Improve some parameter docs
Change-Id: Ibac10a20243a4eedd826485d56eddd5234da6fec
2017-10-07 00:54:58 +02:00
Dayllan Maza 2bc8873c30 Add ccnorm_contains_any function
Normalize and search a string for multiple substrings

Bug: T65242
Change-Id: I4034c0054a6849babbf2d96ea13dc97d3660d5b4
2017-10-06 11:32:45 -04:00
Matěj Suchánek 08899056d2 Normalize IPv6 addresses in Special:AbuseFilter/test
Forcing user namespace will handle IPv6 correctly as well
as possible "User:" prefix supported by the former code.

Bug: T176045
Change-Id: I0b4a5468ca44799cade0b0774d749e05d4ff5865
2017-09-29 21:02:52 +02:00
libraryupgrader 781f6c2554 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
The following sniffs are failing and were disabled:
* MediaWiki.VariableAnalysis.ForbiddenGlobalVariables.ForbiddenGlobal$wgTitle

Change-Id: I7163cd8f97a7d2fe5b4410245a72eb416302f4f6
2017-09-24 05:19:01 +00:00
jenkins-bot f00de10b24 Merge "Fix confusing warning message on throtthled filters" 2017-09-14 21:10:47 +00:00
Dayllan Maza 539884f428 Fix confusing warning message on throtthled filters
A confusing warning message was displayed when filters
have af_throttled = true. That message was replaced with a
new one reflecting the behavior that is actually ocurring and
how to solve it

Bug: T54525
Change-Id: I5c6e434249d5c9649eb2d7c5b16b9ecb1f530c8a
2017-09-10 01:26:24 -03:00
Antoine Musso 3efdc518da Select proper db fields in AbuseFilterExaminePager
It queried the 'recentchanges' table with the fields from the 'revision'
table.

Bug: T175338
Change-Id: Ib232e49e3f59285c7f66cdb48c51fe4c97b53e15
2017-09-08 14:41:19 +02:00
Chad Horohoe 3f4ba191f6 Avoid CommentStore errors by selecting correct set of columns
Change-Id: I7d83a45fbf86dc0144d50e8b6258b97f1b0c7188
2017-09-07 17:21:50 -07:00
jenkins-bot f238148fec Merge "Use CommentStore to access core comment fields when available" 2017-09-05 19:02:26 +00:00
Matěj Suchánek d59e62a7b2 Get LinkRenderer instance from special page
Just use SpecialPage::getLinkRenderer().

Change-Id: I7c6e839ed8005e666e7c3c1c08dada8aaadbd28f
2017-09-02 19:04:20 +02:00
Brad Jorsch cfa98448c3 Use CommentStore to access core comment fields when available
See core change Ic3a434c0.

Bug: T166732
Change-Id: I130510381ef97d8a2d29686843e2710cb5f72195
2017-08-30 13:27:46 -04:00
Max Semenik 0686f99653 DB_SLAVE -> DB_REPLICA
Change-Id: I371e092b3cd7f0af3770bf4e64b01a630e23ff92
2017-08-29 19:51:39 -07:00