Page MenuHomePhabricator

CentralAuth locks should disable linked Phabricator account
Open, LowPublicFeature

Description

Feature summary (what you would like to be able to do and where):
When a CentralAuth account is locked, the Phabricator account associated with the locked CA account should be logged out.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Some spammers/vandals will spam/vandalize both the wikis and Phabricator. When this happens, their accounts are often locked. However, those users are still able to continue spamming/vandalizing on Phabricator until they are blocked on Phabricator as well.

Benefits (why should this be implemented?):

[19:13:38] <RhinosF1>	 And disabled the account via phab-ban
[19:27:05] <Nemo_bis>	 Hmm. Most of the comments happened after the account had already been locked on Meta. I guess that doesn't help if one has already logged in.
[19:31:14] <RhinosF1>	 Nope
[19:31:19] <AntiComposite>	 yeah, unfortunately locks don't kill the phab session
[19:31:38] <RhinosF1>	 Unlike with ldap, disabling linked account doesn't invalidate anything
[19:31:41] <RhinosF1>	 Maybe it should
[20:18:41] <bd808>	 RhinosF1: it could actually... we would basically just need to write the same kind of block/unblock hook handlers that are active for wikitech to fire when folks are blocked on mediawiki.org and/or globally. That might be worth a ticket and discussion. The code is a bit of work but mostly "easy" to put together.
[20:22:38] <RhinosF1>	 bd808: the code is the easy bit
[20:22:48] <RhinosF1>	 The discussion is the hard part
[20:23:32] <bd808>	 In this particular case the group to discuss the change is relatively small and technical I think, but I agree
[20:25:29] <RhinosF1>	 bd808: it's wikimedia

Event Timeline

I suspect most of the code can be used verbatim (ideally some refactoring to reduce duplication, some common class, that probably still lives in wmf-config, but whatever).

Really, the only part that probably needs updating is this, as we don't want to do an ldapname look up (I'd guess):

		$username = $block->getTargetName();
		$resp = wmfPhabClient( $wmgPhabricatorApiToken, 'user.ldapquery', [
			'ldapnames' => [ $username ],
			'offset' => 0,
			'limit' => 1,
		] );

Yeah. And a check to only process users that have a mediawikiwiki should deal with most performance concerns I have.

Is there a suitable hook in CentralAuth already?

[21:44:43] <bd808> Reedy: https://phabricator.wikimedia.org/conduit/method/user.mediawikiquery/
[21:44:51] <Reedy> oh look at that, so simple ;P
		$username = $block->getTargetName();
		$resp = wmfPhabClient( $wmgPhabricatorApiToken, 'user.mediawikiquery', [
			'names' => [ $username ],
			'offset' => 0,
			'limit' => 1,
		] );

Is there a suitable hook in CentralAuth already?

Doesn't seem so.

But then if there is a risk of abuse of technical spaces, wouldn't you want to block the user on wikitech (which does log them out from Phabricator) anyway?

kostajh renamed this task from CentralAuth locks should logged linked users out of Phabricator to CentralAuth locks should log linked users out of Phabricator.Oct 5 2023, 6:22 AM

wouldn't you want to block the user on wikitech (which does log them out from Phabricator) anyway?

If an LDAP/wikitech account was linked to the Phabricator account that would probably make sense; most of the time there is not (but only a SUL account).

Bugreporter renamed this task from CentralAuth locks should log linked users out of Phabricator to CentralAuth locks should disable linked Phabricator account.Mar 5 2024, 7:34 PM

Note:

Update:

  • Unlike disabling LDAP accounts and global locks (which Tgr suggest to completely migrate to global blocks), local and global blocks can be time-limited and MediaWiki currently does not provide ways to notify block expiration. In addition if account is to be reenabled once block expired, we should make sure not to reenable accounts disabled before such blocks, otherwise any MediaWiki admins (if we disable account based on MediaWiki.org block, currently we does not) can reenable a WMF banned user.

If this "disables" the phab account, will a new story of "CentralAuth unlocks should enable linked Phabricator account" be also addressed?