Problem/Motivation

Labels entered for custom AAGUIDs ("Additional AAGUIDs" textarea, format aaguid|Label) are lost the next time the settings form is saved. The AAGUIDs stay allowed, but they are displayed as "Unknown" in the user's passkey list and in the [wa:key:authenticator] token of the notification email.

Cause: PasskeyLabeler::buildProviderMap() adds every entry of custom_aaguid_labels to the provider map, so on the next form build those AAGUIDs are rendered as checkboxes in "Allowed authenticators" instead of in the textarea. PasskeySettingsForm::submitForm() then rebuilds custom_aaguid_labels only from the textarea (parsed_custom), so the labels of the checked custom AAGUIDs are discarded.

Steps to reproduce

  1. Go to /admin/config/people/wa.
  2. In "Additional AAGUIDs", enter 531126d6-e717-415c-9320-3d9aa6981239|Dashlane and save.
  3. Reload the form: "Dashlane" now appears as a checked checkbox in "Allowed authenticators", the textarea is empty.
  4. Save the form again without changing anything.
  5. drush cget wa.settings custom_aaguid_labels is now empty; the AAGUID is still in allowed_aaguids but labelled "Unknown".

Proposed resolution

In submitForm(), keep the existing label of every checked AAGUID that comes from custom_aaguid_labels, for example:

$previous = $this->config('wa.settings')->get('custom_aaguid_labels') ?? [];
$customLabels = array_intersect_key($previous, array_flip($allowedKnown));
foreach ($parsedCustom as $pair) {
  if ($pair['label'] !== '') {
    $customLabels[$pair['aaguid']] = $pair['label'];
  }
}

Alternatively, keep custom AAGUIDs in the textarea (with their labels) instead of turning them into checkboxes.

Issue fork wa-3641545

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

brihx created an issue. See original summary.

vinodhini.e made their first commit to this issue’s fork.

vinodhini.e’s picture

Status: Active » Needs review

mingsong made their first commit to this issue’s fork.

  • mingsong committed 30b8f5d9 on 2.1.x
    fix: #3641545 Saving the settings form drops labels of custom AAGUIDs
    
mingsong’s picture

Status: Needs review » Fixed

Fixed with 2.1.0-beta4.

Thanks.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.