Commit graph

46 commits

Author SHA1 Message Date
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
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
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
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
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 8beedb2544 Use ExtensionRegistry to check if CheckUser is installed
Bug: T183096
Change-Id: If52fa24e5fb50033092e0c15f08aa7b28c16261a
2018-02-03 14:02:24 +00:00
Umherirrender cbb7415c5a Change doc type from DatabaseBase to IDatabase
Change-Id: I2657188040aacb758ae5b7048b477776eacf4a2e
2017-12-22 22:09:52 +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
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
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
jenkins-bot 82ce683000 Merge "Pass LinkRenderer instance to AbuseFilter::addNavigationLinks" 2017-10-22 04:09:59 +00: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
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
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
jenkins-bot 13b60c5e35 Merge "Support delete action in retrospective testing" 2017-08-29 18:02:55 +00:00
Matěj Suchánek 2c9af794fd Support delete action in retrospective testing
Bug: T170576
Change-Id: Ied9b6446ea5edccd902d6a88b2601b545d4a6910
2017-08-29 17:48:58 +00:00
Dayllan Maza c07294cc9c Add runtime metrics to statsd
Metrics per edit:
    - Execution time of all filters
    - Number of filters executed
    - Number of conditions executed

Due to the current structure of abuse filter there was not
a clean way to include filter actions and abuselog creation
as part of the runtime metrics.

Bug: T161059
Change-Id: I6208b620453863133c6623aa419775f63c7d3eb1
2017-08-24 15:58:52 -04:00
Matěj Suchánek 748978fda5 Pass LinkRenderer instance to AbuseFilter::addNavigationLinks
Change-Id: I1de60955344d06e5b55f4d2cfdfa8f2d13df831a
2017-08-20 14:38:40 +02:00
jenkins-bot 391966dec4 Merge "Fix the order of conditions when choosing the correct method" 2017-08-14 20:04:42 +00:00
matejsuchanek 3b29498f21 Migrate abusefilter/modify log
Bug: T32553
Change-Id: I7e33d1064329124755c77ffe6efbd5d572f43cb9
2017-08-12 10:00:42 +02:00
Matěj Suchánek 79c25e5583 Improve documentation of methods
Change-Id: I231d6a3e095324ae1509fdf028bcc352148a0dbe
2017-08-11 23:26:29 +00:00
Kunal Mehta 72427ec974 build: Updating mediawiki/mediawiki-codesniffer to 0.11.0
Change-Id: I26adebde9fcb2894804ab705402d05d9de745cb1
2017-08-10 22:57:33 -04:00
Matěj Suchánek 55c27a8f6b Require MediaWiki 1.29
After I544cdfa75c7472f2d98b2561bc6f6f9c2d2ad639 (dieWithError
and checkUserRightsAny), this is the oldest MediaWiki version
AbuseFilter can be run on.

AbortMove was removed from MediaWiki in 1.25, UploadVerifyFile
is only relevant for 1.27 and older.

(Replaces I1e962217c3b20d901a5742cf76339a3f488a6e97.)

Change-Id: Iec237b2887f72b115fdcef78d2d7a944ba82c784
2017-08-10 11:01:34 +02:00
Umherirrender eaa1e9fb25 Improve some parameter docs
Change-Id: I03fa9b58c72bcd28985c5a3467b82d8b98f3a0fc
2017-08-08 15:05:06 +02:00
Max Semenik de7389e19a Fix class and function name case
Change-Id: I55ed3b26ee457863372ec063b7c3ff27bc849b8b
2017-08-07 16:22:48 -07:00
Max Semenik a6c87eca7a Get rid of deprecated manual profiling
Change-Id: Iefbfb4b9937ed265156fb1b644889fd9e2b29a2e
2017-08-07 16:14:31 -07:00
Kunal Mehta 3a58875637 build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment

Change-Id: I0874c547ef2bc8a7c3fa4ca72738aa3320f2bdbe
2017-07-23 00:03:40 -07:00
Matěj Suchánek 014f0adda1 Fix the order of conditions when choosing the correct method
It seems that move actions have rc_this_oldid set. rc_log_type
should have higher priority.

Bug: T170586
Change-Id: I9bb4ea599f12ef01fad823ac3232330966b0d281
2017-07-13 17:31:19 +02:00
Umherirrender 1a58507870 build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
Change-Id: I5f37c45d748d5f0da21aceaef32cc89367e312ff
2017-07-08 20:49:30 +02:00
Matěj Suchánek a1aa09d31c Cache global filter names
AbuseLog fetches the names in an additional query for each line but the
result is always same.

Change-Id: Ie12f909727ae82ab60781ccedfdf1b241c105388
2017-06-17 20:50:18 +02:00
Umherirrender a063e33ee8 Use short array syntax
Done by phpcbf over composer fix

Change-Id: I53fd1fc8d056b9b60194d2d630852cfca37aadea
2017-06-15 17:02:57 +02:00
Tim Starling 525b6c064c Fix usage of $db->nextSequenceValue()
The return value from the method is only suitable for passing to
$db->insert(). To get the inserted ID, you need to call $db->insertId()
even if $db->nextSequenceValue() returned non-null.

Change-Id: Id5a0df17c77445e9f29564a55fb850c3ecad2630
2017-05-11 10:03:49 +10:00
Kunal Mehta 1392aa05d6 Only add 'sysop' group to filter user if not in it
This should avoid repeated, unnecessary calls to User::addGroup().

Bug: T163032
Change-Id: I010e6eb45c4fbf984a3b5e5df2671117ca4e0136
2017-04-17 10:34:47 -07:00
Timo Tijhof f95e5dd086 Update getStashKey() to use $cache parameter
Follows-up e4ac1ef. A lot of this class gets its own cache object
in key-generation methods because of legacy compat with public
methods and because of how wfMemcKey used to be.

However where possible, we should encourage passing $cache
so that makeKey() can be used on the same instance that uses
the key.

This is a no-op since it's exactly the same object.

Change-Id: Ib3c31110176659a9175679eb716369e7f0a1d3b2
2017-03-09 14:08:04 -08:00
Matěj Suchánek e4ac1efb7a Remove unused argument from a private method
Change-Id: I2f34bb04a90c2535fbeb0e515714aa4a71779f50
2017-03-02 16:34:23 +00:00
Matěj Suchánek de1c2af0e1 Unify global filters decoding across AbuseFilter
Change-Id: I3c97c24b5d0e4818b36e233a8bb3b205cbb2c7d0
2017-01-02 12:14:02 +00:00
Matěj Suchánek 9379a0c767 Add GENDER to the message logentry-abusefilter-hit
As far as I can see, this parameter is already supported.

Bug: T153607
Change-Id: If3eed341ef2f2e7bbad103c2738a7eae59886faa
2016-12-26 09:32:31 +00:00
Aaron Schulz 9b1021b055 Move various classes to their own files
Change-Id: I5d418b3fa27aa6e04b9a680922e5eab2439ffb20
2016-12-17 11:40:10 -08:00
Renamed from AbuseFilter.class.php (Browse further)