Page MenuHomePhabricator

TOB: checkFriendlyName concatenates instead of assigning
Closed, ResolvedPublic

Description

checkFriendlyName concatenates instead of assigning (figure C.3) and produces invalid names on collision with an existing key. For instance, "MyKey" becomes "MyKeyMyKey #2", then "MyKeyMyKey #2MyKey #3", and so on.

private function checkFriendlyName(): void {
	// (...)
	while ( in_array( strtolower( $this->friendlyName ), $friendlyNames ) ) {
		$this->friendlyName .= "$original #$inc";
		$inc++;
	}
}

Figure C.3: Excerpt of WebAuthnKey.php (mediawiki-extensions-OATHAuth/src/Key/WebAuthnKey.php#L252–L271)

Related Objects

StatusSubtypeAssignedTask
ResolvedReedy

Event Timeline

Reedy renamed this task from checkFriendlyName concatenates instead of assigning to TOB: checkFriendlyName concatenates instead of assigning.Apr 15 2026, 5:37 PM
Reedy triaged this task as Low priority.Apr 20 2026, 1:12 PM
Reedy updated the task description. (Show Details)

Change #1275402 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@master] WebAuthnKey: Stop concatenating in checkFriendlyName()

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

Change #1275402 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] WebAuthnKey: Stop concatenating in checkFriendlyName()

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

Reedy claimed this task.