Commit graph

622 commits

Author SHA1 Message Date
Umherirrender 70703bdce3 build: Add @phan-var to handle varying return value of hash_hmac
Since php8.0 hash_hmac throws exception and does not return false
Reported by phan running with php8.1

Change-Id: I2374daf5e0954bef91da65454d973ef3d1eb2183
2023-10-06 19:25:35 +02:00
Translation updater bot 2f4996cf14 Localisation updates from https://translatewiki.net.
Change-Id: Ia5de941b15cc8279af27e79746a423dee466a126
2023-10-02 10:57:39 +02:00
jenkins-bot fac8b00395 Merge "Don't notify of failed logins for system or temporary users" 2023-09-13 09:54:54 +00:00
jenkins-bot 79f766d525 Merge "LoginNotify seen subnets table" 2023-09-13 09:54:52 +00:00
Translation updater bot 923c328594 Localisation updates from https://translatewiki.net.
Change-Id: I0527c9666dabc3c4cfe2db9f8722d3fb62f04d1b
2023-09-06 08:42:32 +02:00
Tim Starling a0a387d195 Don't notify of failed logins for system or temporary users
Bug: T329774
Change-Id: I65fa3da22f45002e013d3bd5c8b0efda5f8b5edb
2023-09-04 17:01:52 +10:00
Tim Starling 534e3ce4b3 LoginNotify seen subnets table
Add a table which stores a summary of each user's IP address subnet in
each time bucket, defaulting to 15 days. On edit (and other changes
causing a recentchanges row) and successful login update the table.

On attempted login, check whether the subnet is in the table in any
time bucket back to the expiry time.

Add a job and a maintenance script for purging expired rows.

Disabled by default for now. The idea is to enable it by default after
we have some experience with using it in WMF production.

If CheckUser integration is disabled (the future intended state), the
cache and LoginNotifyChecks job are suppressed since they are
unnecessary.

Details:

* Rename setCurrentAddressAsKnown() to recordKnownWithCookie() and
  split off recordKnown() which does the same thing except without
  sending the cookie. We use recordKnown() to store the IP address
  without sending the cookie, on non-login changes.
* Reorganise isKnownSystemFast() for clarity, and return emphatic
  USER_NOT_KNOWN if the user is not in the table, cache or cookie
  and CheckUser integration is disabled.
* Replace time() calls with a mockable method.

Bug: T345052
Change-Id: Iea716e660353f16c47f873fe42edc2aeec1b4346
2023-09-04 15:04:36 +10:00
Tim Starling 4c369696cc ServiceWiring, dependency injection
* Make LoginNotify into a service. Use a static getInstance() method
  instead of a services container class, since there is only one
  service.
* Removed references to $wgLoginNotifyEnableForPriv. The feature was
  removed in I888c6009fffad1712.

Change-Id: I9120b470d27a0d09e508bd4e12eb2bde2f38d34d
2023-09-04 15:04:36 +10:00
Tim Starling 8521667df9 Doc review and general cleanup
* Remove notification attributes such as title-message, unused since the
  initial commit since it used the new (2015) formatter system.
* isKnownSystemSlow() is always called with a third parameter, and it
  doesn't seem to be nullable in callers.
* Yes, most of the things make sense.
* Add reason why CheckUser has no cuc_ip_hex index.
* Use foreach
* Too late to truncate the hash now

Change-Id: I310bc53ba881842845b9358309954f89c355f81c
2023-09-04 15:04:36 +10:00
Ammarpad 3cd669d148 Hooks: Do not attempt user creation when there's no username
Bug: T345373
Change-Id: I9b7d8dbb67eb9277e121e52a6140773302d74734
2023-08-31 19:00:04 +01:00
Translation updater bot f81e1a7e9d Localisation updates from https://translatewiki.net.
Change-Id: Ieb92fd4c485446cd8534336939c8ec4e3f877bb0
2023-08-28 09:30:22 +02:00
Tim Starling a47af7c73d Fix deprecations and non-static providers
Change-Id: Ia267a93a13191a2289aff70d47c31b2afcb1647b
2023-08-25 15:10:07 +10:00
Tim Starling 40024f461d Updates for new Echo namespace
Change-Id: I6f83b0353bd33a06b2c9c9506c4114de60b9132f
2023-08-24 10:55:15 +10:00
Tim Starling 3560438921 Add integration tests
Bug: T344785
Change-Id: I6d2d2502599938747aef0f02106afbea33c24e41
2023-08-24 10:38:49 +10:00
Tim Starling a247ba5c79 If the user is known in the slow path, don't forget to notify
If the IP address associated with a failed login is found in CheckUser
for the relevant user, the notification was previously omitted.
Notification of failure with a known IP was only possible when the IP
was in the cache or cookie. So, fix that.

Change-Id: I498e6b71d0fab9dd9af63c9c5f88fbcaf6a53fc3
2023-08-24 10:32:05 +10:00
Tim Starling c524ee65a4 Fix incorrect locator
Bug: T344785
Change-Id: I71f4433896b2758d1a5d8984192bf06fddc89468
2023-08-24 10:28:33 +10:00
jenkins-bot f9a8169b84 Merge "Replace some moved Title class uses, now MediaWiki\Title\Title" 2023-08-19 16:48:24 +00:00
James D. Forrester 7b6daae158 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I9941a4f13c1ac7093bc136b611e8a618dbc8920d
2023-08-19 13:29:57 +08:00
gerritbot 9057082c99 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I20b5e7eda88aacee80f0c82e4bd360ca4524ab8c
2023-08-19 04:17:24 +00:00
Umherirrender 4edd893fcc Use HookHandlers for Echo hook
Bug: T344297
Depends-On: Iffa2b409502b4269c9746e0304feb4aaee37a86e
Change-Id: I38fd96f2c4a5913b89d5dd760efb68273cb344a1
2023-08-16 00:59:03 +02:00
Umherirrender f02ff3ab36 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T344297
Change-Id: Icfa49dc56848c9b375f09d67ed839d0e10f57bfb
2023-08-16 00:34:21 +02:00
gerritbot eb79e7b8b8 Migrate ILB::getConnectionRef() calls to ILB::getMaintenanceConnectionRef()
Deprecated since 1.39 (I6e7544763bd)

Remove deprecated ILB::reuseConnection() calls as well

Bug: T343277
Change-Id: I477c216fe75bb393fc892ded13f3d117b6fda4aa
2023-08-03 22:27:44 +00:00
Translation updater bot 02e4e6ac72 Localisation updates from https://translatewiki.net.
Change-Id: I93b1ea338835ecc791ce092336915bf693cf74a3
2023-07-31 08:58:58 +02:00
Translation updater bot 64c57047e6 Localisation updates from https://translatewiki.net.
Change-Id: I81f156f349a5d36872eb8e3388d3fcada0a01c12
2023-07-24 09:38:32 +02:00
Translation updater bot 275d760177 Localisation updates from https://translatewiki.net.
Change-Id: I3ebd783fdb8f311a2bc1f7ff8c8c606f439c623c
2023-06-08 10:39:40 +02:00
Umherirrender 222b7475fb Create HookRunner class
Only core hooks are run, but own HookRunner is recommended

Bug: T263353
Change-Id: I2506f4af21ef955a7feeb145d5173f46ca11b334
2023-06-05 22:47:00 +02:00
libraryupgrader 122d47d87d build: Updating grunt-banana-checker to 0.11.0
Change-Id: I2b9ba2b446f9e5ee51e2430aa303ec64c13b634d
2023-06-01 19:26:20 +00:00
Translation updater bot acfa62bafb Localisation updates from https://translatewiki.net.
Change-Id: I0cecf8fb87c210f9ca9d3732e0d24f305aced219
2023-05-30 08:56:56 +02:00
Translation updater bot 5575acaae5 Localisation updates from https://translatewiki.net.
Change-Id: I7b57d9dda76f82f8dab124dfd6b12525ad091c52
2023-05-22 08:45:47 +02:00
Umherirrender 76bf0ed8e3 tests: Make some PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: I659c128532ac8350ef8bac85141ffc71329f71b0
2023-05-21 00:12:25 +02:00
gerritbot b20e68feb7 Update moved class RawMessage
See T321882. Moved in I195cf4c67bd514

Bug: T321681
Change-Id: I68df612983a9b3cb49d6be44168a889429d474f9
2023-05-19 14:55:32 +03:00
gerritbot 4974e8c1e9 Update moved class FauxRequest
See T321882. Moved in I832b133aaf61ee

Bug: T321681
Change-Id: I82d99b9826a5790a2f6a04db9298d732edb34293
2023-05-19 10:24:50 +00:00
Translation updater bot aea5d6e765 Localisation updates from https://translatewiki.net.
Change-Id: Iaa773160fae6560d2eb593f6e7a882a9a2a3e252
2023-05-05 10:39:46 +02:00
libraryupgrader 92c37c72f9 build: Updating eslint-config-wikimedia to 0.25.0
Change-Id: Ic7f844243feae65dc7e4ec290ae670471b6d9e48
2023-05-04 05:39:29 +00:00
jenkins-bot 883abaf7a5 Merge "Replace deprecated Hooks::run" 2023-05-02 14:11:50 +00:00
libraryupgrader caa5e172fb build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.0 → 0.12.1

npm:
* grunt-eslint: 24.0.0 → 24.0.1

Change-Id: I6fecc733fac0da96457c36184317dcdfa3f0ef29
2023-04-29 06:45:20 +00:00
Umherirrender 3261b8ebd2 Replace deprecated Hooks::run
Bug: T335536
Change-Id: I8d3e2e1da24379c6f963c9f2e01770bf383b32d4
2023-04-27 22:36:41 +02:00
gerritbot 0ecf7ee302 Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: I1fdefa8f3eee67758a59d36a38209b1e418d9281
2023-04-25 09:54:12 +00:00
Translation updater bot 0627a31e5e Localisation updates from https://translatewiki.net.
Change-Id: I98dab5ae7c95cda24c2d8ff394de5ea73d001186
2023-04-24 09:16:32 +02:00
Translation updater bot 052132078d Localisation updates from https://translatewiki.net.
Change-Id: I239acdb0c6f2d7e0b18ba6fcf883ec146e82d81f
2023-04-12 08:44:15 +02:00
Translation updater bot b82be27d3a Localisation updates from https://translatewiki.net.
Change-Id: Ieddbdc982ae74e980c559c5d3d75f915d4b1a6f7
2023-04-10 09:21:59 +02:00
Translation updater bot 9e1d9518a9 Localisation updates from https://translatewiki.net.
Change-Id: I47815f98f0bb366d50b280ae3adbdeaad2fc8e41
2023-04-03 09:18:23 +02:00
Translation updater bot a0ae16fabe Localisation updates from https://translatewiki.net.
Change-Id: I6001cde3556f492a21b7461ae6c285c7b32bff8a
2023-03-20 09:01:36 +01:00
libraryupgrader c241a7106a build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0
* grunt: 1.5.3 → 1.6.1

Change-Id: I67a99992290cc198fae96648434469cc0bd677b7
2023-03-15 18:11:45 +00:00
libraryupgrader 82c1b20591 build: Updating mediawiki/mediawiki-codesniffer to 41.0.0
Change-Id: I566a67649fdf0318be1109133c10a93ddbc995d7
2023-03-12 05:32:27 +00:00
Translation updater bot eff0fc7514 Localisation updates from https://translatewiki.net.
Change-Id: I08b8841e011b2fac803c95293de78bcdff96a74a
2023-02-08 08:40:11 +01:00
Translation updater bot 1d7584f1b2 Localisation updates from https://translatewiki.net.
Change-Id: I5f828d69996ad0ce8dd94eb07a2e86b9fdec56e1
2023-01-30 08:30:22 +01:00
Alexander Vorwerk d5e7ca063a Update for CheckUser actor migration
Bug: T233004
Change-Id: I13a8d94f405cde255f9fd15aaf98d75819985786
2023-01-23 01:04:05 +01:00
Reedy bc6e531aa2 Hooks: Use better callable with EchoAttributeManager::ATTR_LOCATORS
Bug: T325950
Change-Id: Iaf7f51453802e4ca9ffae786129bb402994adc03
2022-12-27 01:16:08 +00:00
Umherirrender f1610a37a1 Avoid use of deprecated User::idFromName
Use the User object directly

Bug: T325687
Change-Id: Id719e33f860204f912429631b50391edce8e56ec
2022-12-21 22:34:26 +01:00