From 8d54f8d5954c3dc8305de673d5b33b37e65f0e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=9Al=C4=99zak?= Date: Wed, 21 Oct 2026 12:05:39 +0200 Subject: [PATCH] dont recommend fido2 key name during registration --- .../ConfigureFido2Step/ConfigureFido2Step.tsx | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/new-ui/src/pages/full/ConfigureMfaPage/wizard/ConfigureFido2Step/ConfigureFido2Step.tsx b/new-ui/src/pages/full/ConfigureMfaPage/wizard/ConfigureFido2Step/ConfigureFido2Step.tsx index 3b85619c2..7b0960b91 100644 --- a/new-ui/src/pages/full/ConfigureMfaPage/wizard/ConfigureFido2Step/ConfigureFido2Step.tsx +++ b/new-ui/src/pages/full/ConfigureMfaPage/wizard/ConfigureFido2Step/ConfigureFido2Step.tsx @@ -2,8 +2,7 @@ import './style.scss'; import { Enter } from '@fluentui/keyboard-keys'; import { useMutation } from '@tanstack/react-query'; import { listen } from '@tauri-apps/api/event'; -import { hostname } from '@tauri-apps/plugin-os'; -import { Fragment, useCallback, useEffect, useState } from 'react'; +import { Fragment, useCallback, useState } from 'react'; import { Button } from '../../../../../shared/components/Button/Button'; import { ButtonVariant } from '../../../../../shared/components/Button/types'; import { Controls } from '../../../../../shared/components/Controls/Controls'; @@ -22,15 +21,6 @@ import { } from '../../hooks/useConfigureMfaStore'; import { useMfaConfigErrorHandler } from '../../hooks/useMfaConfigErrorHandler'; -const DEFAULT_KEY_NAME = 'Security key'; - -/** A second key registered from the same machine would otherwise propose the name the first one - * took, leaving two entries the user cannot tell apart in Defguard. */ -const defaultKeyName = (host: string | null | undefined, hasKey: boolean): string => { - const base = isPresent(host) ? `${host} key` : DEFAULT_KEY_NAME; - return hasKey ? `${base} (${new Date().toISOString().slice(0, 10)})` : base; -}; - interface Props { onCancel: () => void; /** The session outlived its deadline, so the whole flow has to start over. */ @@ -40,11 +30,6 @@ interface Props { /** Registers a security key, offered however many the account already holds. */ export const ConfigureFido2Step = ({ onCancel, onSessionExpired }: Props) => { const sessionId = useConfigureMfaStore((s) => s.sessionId); - // The snapshot is frozen at the start of the session, so this still reads false on the first - // key even after it is registered. - const hasKeyAlready = useConfigureMfaStore((s) => - s.configuredMethods.includes(MfaMethod.Fido2), - ); const [name, setName] = useState(null); const [pin, setPin] = useState(null); @@ -52,13 +37,6 @@ export const ConfigureFido2Step = ({ onCancel, onSessionExpired }: Props) => { const [isAwaitingTouch, setIsAwaitingTouch] = useState(false); const collectsPin = fido2CollectsPinInApp(); - // The machine's own name is what the user will recognize the key by in Defguard. - useEffect(() => { - void hostname().then((host) => { - setName((current) => current ?? defaultKeyName(host, hasKeyAlready)); - }); - }, [hasKeyAlready]); - const handleApiError = useMfaConfigErrorHandler({ context: 'Security key registration failed', setError,