Page MenuHomePhabricator

Login authevents should include the username
Open, Needs TriagePublic

Description

ApiLogin.php:

		LoggerFactory::getInstance( 'authevents' )->info( 'Login attempt', [
			'event' => 'login',
			'successful' => $authRes === 'Success',
			'loginType' => $loginType,
			'status' => $authRes,
		] );

SpecialUserLogin.php:

	protected function logAuthResult( $success, $status = null ) {
		LoggerFactory::getInstance( 'authevents' )->info( 'Login attempt', [
			'event' => 'login',
			'successful' => $success,
			'status' => $status,
		] );
	}

See also: T246462: SpecialCreateAccount::logAuthResult() should include the username

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy renamed this task from Login authevents should should tell the username to Login authevents should include the username.Feb 28 2020, 6:37 PM
WDoranWMF subscribed.

@Reedy Is this blocking for anything or what would you say the level or severity is?

@Reedy Is this blocking for anything or what would you say the level or severity is?

Nope, it'd just be useful to have when looking at audit trails etc.

It's low priority, but it's probably also good first task (ie easy). I more filed the tasks because I didn't want to look at resolving them at the time, but wanted to get some followup

I don't think the username even needs to be in the messages, just in the parameters below. I haven't looked where the easiest place to necessarily get the username is from.

I don't know if we want to run it by @Tgr and/or @Anomie to check (as authors of most of the auth rewrite stuff) if there's any reason these events shouldn't have that information in these log events

eprodromou subscribed.

This is interesting, but I don't think we're going to work on directly as a team. If you need advice from @Anomie , please let him know directly.

I note that these log events were created specifically for T91701: Create dashboard to track key authentication metrics before, during and after AuthManager rollout. AuthManager has more general-purpose logs including the username (but not differentiating by API vs web UI) sent to the 'authentication' log channel.

I don't know anything about those dashboards to guess if they'd be negatively affected by adding in usernames.

The dashboard (more specifically, the log handler which turns these log events into statsd hits) will ignore unknown fields. But in general I agree it's better to use the normal log events where possible.