Page MenuHomePhabricator

[IP Masking] Expire temporary accounts in 1 year
Closed, ResolvedPublic4 Estimated Story Points

Description

Temporary accounts should expire in 1 year from their first edit. Since there is no way to login into a temporary account, expiration can be implemented by logging the temporary account out. Account expiration can be implemented via a maintenance script, which would be regularly executed via a systemd timer.

See implementation notes at T300271#9106396.

Acceptance Criteria
  • A user's temporary account name expires after one year (365 days) since their first edit and the username is unassigned from the account.
    • A returning user will no longer see the temp account name in the personal bar.
    • Account expiration is implemented by logging the temporary account off.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 951967 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] [WIP] IP Masking: Expire temporary accounts in 1 year

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

Change 952396 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] Add User::getGlobalRegistration

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

Change 952397 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CentralAuth@master] Implement UserGetGlobalRegistrationHook

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

Change 952487 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CentralAuth@master] IP Masking: Add expireTemporaryAccounts.php

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

kostajh added subscribers: TAdeleye_WMF, Tchanders, kostajh.

cc @Tchanders @TAdeleye_WMF, I got a ping requesting code review for this, maybe we can fit it into the next sprint?

Change 973167 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/puppet@production] mediawiki: Run expireTemporaryAccounts.php daily

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

Change 951967 merged by jenkins-bot:

[mediawiki/core@master] IP Masking: Expire temporary accounts in 1 year

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

Change 952487 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] IP Masking: Add expireTemporaryAccounts.php

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

Change 973172 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/mediawiki-config@master] IP Masking: Set expiryAfterDays to 10 days

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

This now needs to wait for wmf.5 to be live on the production cluster. Then, we can ask SREs to merge and deploy https://gerrit.wikimedia.org/r/973167 and then, we can move this to QA. Moving to Blocked in the meantime.

Urbanecm_WMF changed the task status from In Progress to Stalled.Nov 9 2023, 2:48 PM

Change 973881 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/mediawiki-config@master] IP Masking: Set expiryAfterDays to a year

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

Change 973172 merged by jenkins-bot:

[operations/mediawiki-config@master] IP Masking: Set expiryAfterDays to 1 day

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

Change 974143 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@wmf/1.42.0-wmf.4] IP Masking: Expire temporary accounts in 1 year

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

Change 974144 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CentralAuth@wmf/1.42.0-wmf.4] IP Masking: Add expireTemporaryAccounts.php

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

Change 974143 merged by jenkins-bot:

[mediawiki/core@wmf/1.42.0-wmf.4] IP Masking: Expire temporary accounts in 1 year

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

Change 974144 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@wmf/1.42.0-wmf.4] IP Masking: Add expireTemporaryAccounts.php

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

Mentioned in SAL (#wikimedia-operations) [2023-11-14T14:25:14Z] <urbanecm@deploy2002> Started scap: Backport for [[gerrit:974143|IP Masking: Expire temporary accounts in 1 year (T344695)]], [[gerrit:974191|TempUser: Fix unchecked array access for optional key]], [[gerrit:974144|IP Masking: Add expireTemporaryAccounts.php (T344695)]]

Mentioned in SAL (#wikimedia-operations) [2023-11-14T14:26:39Z] <urbanecm@deploy2002> urbanecm: Backport for [[gerrit:974143|IP Masking: Expire temporary accounts in 1 year (T344695)]], [[gerrit:974191|TempUser: Fix unchecked array access for optional key]], [[gerrit:974144|IP Masking: Add expireTemporaryAccounts.php (T344695)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2023-11-14T14:32:17Z] <urbanecm@deploy2002> Finished scap: Backport for [[gerrit:974143|IP Masking: Expire temporary accounts in 1 year (T344695)]], [[gerrit:974191|TempUser: Fix unchecked array access for optional key]], [[gerrit:974144|IP Masking: Add expireTemporaryAccounts.php (T344695)]] (duration: 07m 03s)

Urbanecm_WMF changed the task status from Stalled to Open.Nov 14 2023, 3:43 PM
Urbanecm_WMF moved this task from Incoming to Doing on the Growth-Team (Sprint 3 (Growth Team)) board.

I ended up backporting the code, so that we can test this in the wild sooner. I've scheduled the puppet patch for deployment later today, and then we can move this to QA.

Change 973167 merged by Jbond:

[operations/puppet@production] mediawiki: Run expireTemporaryAccounts.php daily

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

@Etonkovidova This is now testable at beta wikis where IP Masking is enabled. I set the expiry to 1 day as requested. Please let me know what you think and whether it is OK to increase the expiry to a year, as requested. For now, moving to QA. The other part (T344694) is still in CR.

Urbanecm_WMF set the point value for this task to 4.Nov 14 2023, 11:34 PM

Change 974726 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/puppet@production] mediawiki: Add missing frequency param to the purge_temporary_accounts job

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

Change 974728 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/mediawiki-config@master] IP Masking temp account expiry: Fix a typo

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

Change 974728 merged by jenkins-bot:

[operations/mediawiki-config@master] IP Masking temp account expiry: Fix a typo

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

Change 974726 merged by RLazarus:

[operations/puppet@production] mediawiki: Add missing frequency param to the purge_temporary_accounts job

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

@Etonkovidova This is now testable at beta wikis where IP Masking is enabled. I set the expiry to 1 day as requested. Please let me know what you think and whether it is OK to increase the expiry to a year, as requested. For now, moving to QA. The other part (T344694) is still in CR.

Checked with Special:Contributions/*Unregistered_41470; there was a slight extension of the expiration period (1 day): a user was able to make an edit after two hours after 24-hour period:

Screen Shot 2023-11-18 at 9.20.45 AM.png (1×2 px, 248 KB)

Thanks @Etonkovidova for the tests. I think this is caused by the fact that the expiry logic runs daily at a specific time (14:27 UTC, to be precise), which means the account expires once it is at least a day old at 14:27 UTC. I personally don't think this is a problem (there'd be at most a day delay over a year) though. If @KStoller-WMF thinks this is problematic behaviour, we can certainly revisit.

Thanks @Etonkovidova for the tests. I think this is caused by the fact that the expiry logic runs daily at a specific time (14:27 UTC, to be precise), which means the account expires once it is at least a day old at 14:27 UTC. I personally don't think this is a problem (there'd be at most a day delay over a year) though. If @KStoller-WMF thinks this is problematic behaviour, we can certainly revisit.

I don't see the problem with expiration being slightly off, especially if the expiration will happen after a year.

I re-tested it (e.g. Special:Contributions for *Unregistered 10454 for the purposes of 1) having more testing data 2) see how from a temp user point of view the transition happens after the temp user session gets expired.
The results:

  • the edits spanned from 18. 11. 2023, 18:22 to 20. 11. 2023, 06:57
  • when temp user account is expired, and a temp user attempts to edits, a temp user will see the initial warning (for the first edit). Upon publishing an edit, a new temp user name will be assigned.

{F41523270}
https://phabricator.wikimedia.org/T300271#9106396 (notifying a user 10 days before expiration date) will mitigate it. Preferably, it'd be great a specific warning when a expired temp user will attempt to edit or to visibly sign out (the tool bar will display the fact that a temp user was signed out), but it's probably quite problematic.

Change 973881 abandoned by Urbanecm:

[operations/mediawiki-config@master] IP Masking: Set expiryAfterDays to a year

Reason:

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

Change 990248 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/mediawiki-config@master] [beta] Temporary accounts: Set expiry to 1 year

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

Change 990248 merged by jenkins-bot:

[operations/mediawiki-config@master] [beta] Temporary accounts: Set expiry to 1 year

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

Set expiry to 1 year (received a 👍 from Elena and Kirsten via Slack) and resolving.