java-topology/defects/trezor-0001/patch/trezor-0001.patch

24 lines
1.1 KiB
Diff

# UNDF: UNDF-2026-000000933
--- a/core/src/apps/webauthn/fido2.py
+++ b/core/src/apps/webauthn/fido2.py
@@ -1473,13 +1473,16 @@ def _distinguishable_cred_list(credentials: Iterable[Credential]) -> list[Creden
"""Reduces the input to a list of credentials which can be distinguished by
the user. It is assumed that all input credentials share the same RP ID."""
cred_list: list[Credential] = []
+ seen: dict[str, int] = {}
for cred in credentials:
- for i, prev_cred in enumerate(cred_list):
- if prev_cred.account_name() == cred.account_name():
+ name = cred.account_name()
+ if name in seen:
+ i = seen[name]
+ prev_cred = cred_list[i]
+ if True:
# Among indistinguishable FIDO2 credentials prefer the newest.
# Among U2F credentials prefer the first in the input.
if isinstance(cred, Fido2Credential) and cred < prev_cred:
cred_list[i] = cred
- break
else:
cred_list.append(cred)
+ seen[name] = len(cred_list) - 1