mirror of
https://github.com/gopasspw/gopass.git
synced 2026-11-30 16:14:28 +01:00
* feat(passkey): implement a WebAuthn authenticator and passkey storage pkg/passkey could create a credential and sign an assertion in memory. It could not store a credential, and neither the client data nor the authenticator data it signed were what a relying party verifies. Rework the package into a software authenticator in the synced passkey model, along the lines of the RFC in #3565: * Credential: keys for ES256, EdDSA and RS256, authenticator data, attested credential data and COSE keys in CTAP2 canonical CBOR, the "none" attestation statement format and assertion signatures. * Store: one "passkey: <json>" line per credential in a secret named passkeys/<rp id>/<account>, using the schema of the RFC. * Authenticator: the registration and authentication ceremonies on top of the JSON option and response types of WebAuthn, including the serialization of the client data and the binding of the RP ID to the origin of a request. * Import and export in the FIDO Credential Exchange Format. The signature counter stays at zero unless passkey.signcount is set. A ceremony the user confirmed is reported as user present. It is reported as user verified only if passkey.user-verification is set. New passkeys are written below passkey.prefix. No dependency is added. The CBOR encoder covers what is needed. Refs #3565 PKG-BREAK: pkg/passkey: CreateCredential, Credential.GetAssertion, CredentialFlags and Response are replaced by Authenticator, Store, New, Credential.Attest and Credential.Assert Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * feat(passkey): add the passkey command Add "gopass passkey" to manage and use the passkeys in the store: * list shows the stored passkeys, optionally of one relying party. * create creates a passkey for a user account at a relying party and prints the registration response, which holds the public key. * assert signs a challenge with a passkey and prints the authentication response. The passkey is selected by its RP ID or by its secret. * import and export exchange passkeys with other credential managers in the FIDO Credential Exchange Format. Creating and using a passkey has to be confirmed on the terminal. The responses are the JSON a browser returns from PublicKeyCredential.toJSON, so that they can be handed to a relying party as they are. The line holding a passkey is hidden by "gopass show" if show.safecontent is enabled, like an OTP secret. Using a passkey to sign in to a web site needs a browser extension. The requests for that are added to gopass-jsonapi separately. Refs #3565 Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): address review findings Read the passkey.* config keys only from the environment, the per-user and the system config. The config of a store is versioned with it, and whoever can push to the store could otherwise claim user verification or have new passkeys written to a folder they can read. Read each secret at most once per ceremony. AuthenticateWith signs with a passkey the caller has read already, Store.Load reads a single named secret, and Register reads the secrets of the relying party once. "passkey assert" uses these, so naming a secret decrypts only that one. "passkey assert" no longer fails for an RP ID that is also the name of a secret without passkeys, and accepts a secret outside of the passkeys folders. Add "passkey remove". Show the creation date and the start of the ID when choosing a passkey, so that two passkeys of an account can be told apart. Keep the members of a stored passkey this version does not know when the secret is rewritten. Describe a copy of a Credential without its private key in fmt and encoding/json. Count each exported passkey once and use the same CXF account ID in every export. Refs #3565 Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): preserve unchanged secrets and allow localhost subdomains Treat YAML secrets without a passkey field as empty rather than malformed. Skip writes when an existing credential has not changed, and recognize localhost subdomains over HTTP without weakening RP ID validation. Refs #3565 Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): handle Windows export modes and expose name matching Keep the export permission assertion on POSIX. Expose the existing passkey layout check so native messaging can omit passkey entries from password autofill without decrypting them. Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): batch imports and validate passkey inputs Stage imported credentials before committing and pushing once per affected store. Keep earlier writes committed if a later import fails. Normalize relying party lookups, reject malformed RSA exponents, and prevent passkey settings from being written to store config. Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): isolate mount writes and recover pending imports Keep case-insensitive discovery without reusing write targets in other mounts. Stage and commit pending Git files on import retry without rewriting their ciphertext. Reject invalid RSA public exponents and display effective per-user passkey settings. Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): enforce recipient scope and protect import retries Constrain path reuse to the same mount and recipient file. Keep updates to counters and removals on the exact selected path. Preserve divergent Git index entries, honor read-only mode during recovery, and recover split cryptfs mappings without staging unrelated name changes. Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * fix(passkey): verify import staging and registration targets Validate fresh and retried import paths before changing the index, compare exact Git blobs, and stage validated cryptfs mappings with their ciphertext. Prefer verified personal copies over shared duplicates and resolve the exact registration destination before requesting consent. Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> * revert(passkey): use native staging for imports Remove custom Git index writes and automatic CryptFS recovery. Stage exact paths through the storage backend and commit once per affected store. Refuse ambiguous pending changes and leave recovery to the user. Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com> --------- Signed-off-by: Pedro Sanchez <pedro.sanchez.jozic@gmail.com>