From f3a3a7be7c74e9a519d8ab5aed9ed1135de45dae Mon Sep 17 00:00:00 2001 From: Robin Thellend Date: Mon, 16 Nov 2026 19:02:44 -0800 Subject: [PATCH 1/2] Migrate to github.com/c2FmZQ/webauthn --- CHANGELOG.md | 11 + go/go.mod | 7 +- go/go.sum | 10 +- go/internal/app/keys.go | 2 +- go/internal/jsutil/webauthn.go | 158 ----- go/internal/webauthnsk/key.go | 243 -------- go/internal/webauthnsk/webauthn.go | 699 ---------------------- go/internal/webauthnsk/webauthn_test.go | 732 ------------------------ xterm/package-lock.json | 260 ++++----- 9 files changed, 152 insertions(+), 1970 deletions(-) delete mode 100644 go/internal/jsutil/webauthn.go delete mode 100644 go/internal/webauthnsk/key.go delete mode 100644 go/internal/webauthnsk/webauthn.go delete mode 100644 go/internal/webauthnsk/webauthn_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a8fc46c..5b3df7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # SSH Term Release Notes +## next + +### :wrench: Misc + +* Migrate to github.com/c2FmZQ/webauthn +* Update go dependencies: + * removed github.com/fxamacker/cbor/v2 v2.10.0 + * added github.com/c2FmZQ/webauthn v0.0.0-20261117022304-9643eefd1e03 + * upgraded github.com/chromedp/cdproto v0.159.3 => v0.160.3 + * upgraded github.com/chromedp/chromedp v0.23.0 => v0.23.1 + ## v0.12.0 ### :star2: New features diff --git a/go/go.mod b/go/go.mod index 8062b64..f40c21e 100644 --- a/go/go.mod +++ b/go/go.mod @@ -5,9 +5,9 @@ go 1.27.4 godebug multipathtcp=0 require ( - github.com/chromedp/cdproto v0.159.3 - github.com/chromedp/chromedp v0.23.0 - github.com/fxamacker/cbor/v2 v2.10.0 + github.com/c2FmZQ/webauthn v0.0.0-20261117022304-9643eefd1e03 + github.com/chromedp/cdproto v0.160.3 + github.com/chromedp/chromedp v0.23.1 github.com/gorilla/websocket v1.5.3 github.com/pkg/sftp v1.13.12 github.com/urfave/cli/v2 v2.27.7 @@ -17,6 +17,7 @@ require ( require ( github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect + github.com/fxamacker/cbor/v2 v2.10.0 // indirect github.com/go-json-experiment/json v1.27.2 // indirect github.com/kr/fs v0.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect diff --git a/go/go.sum b/go/go.sum index 8326626..3808e37 100644 --- a/go/go.sum +++ b/go/go.sum @@ -1,7 +1,9 @@ -github.com/chromedp/cdproto v0.159.3 h1:GQnqLDVD3WFBif2MpAXeCGCs3sfXqnHodh08q7ZisOI= -github.com/chromedp/cdproto v0.159.3/go.mod h1:h68JaIuFr9o3yiayxEYhBdvaxgYO3shDrPSYhNlyfu0= -github.com/chromedp/chromedp v0.23.0 h1:iNGzFz+exVgG4OynS2CnYzlAjHiOFW++fUPbbmSwy0w= -github.com/chromedp/chromedp v0.23.0/go.mod h1:hJcPsoPrgxu4ulIXhO1WmtKjosCD8jbZh0+TeVFsod8= +github.com/c2FmZQ/webauthn v0.0.0-20261117022304-9643eefd1e03 h1:vlBCrniYp+f995sGXTkJQl5353dX+JY5xbjTyukb4xc= +github.com/c2FmZQ/webauthn v0.0.0-20261117022304-9643eefd1e03/go.mod h1:wVitmVNeHvULhGba0yfU3DJUKh6u6c/6xnNpDfVfaF0= +github.com/chromedp/cdproto v0.160.3 h1:IpCgfMavg4heyk4detaGEUneXjAZ7hZDwqWwYMSgaVQ= +github.com/chromedp/cdproto v0.160.3/go.mod h1:h68JaIuFr9o3yiayxEYhBdvaxgYO3shDrPSYhNlyfu0= +github.com/chromedp/chromedp v0.23.1 h1:CbK1Knbhe9H/m/KT3qfmuSG1c6ErR8ZjmmpHb4Fadz8= +github.com/chromedp/chromedp v0.23.1/go.mod h1:cz9BPo2oR1YBCu7e+KTdO+7uMvTTuEYh11fErlxdCuQ= github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/go/internal/app/keys.go b/go/internal/app/keys.go index d59fcf0..1c75f42 100644 --- a/go/internal/app/keys.go +++ b/go/internal/app/keys.go @@ -50,7 +50,7 @@ import ( "github.com/c2FmZQ/sshterm/internal/jsutil" "github.com/c2FmZQ/sshterm/internal/termsafe" - "github.com/c2FmZQ/sshterm/internal/webauthnsk" + webauthnsk "github.com/c2FmZQ/webauthn/ssh" ) func (a *App) generateKey(name, passphrase, idp, typ string, bits int, resident bool) (*key, error) { diff --git a/go/internal/jsutil/webauthn.go b/go/internal/jsutil/webauthn.go deleted file mode 100644 index d77ff65..0000000 --- a/go/internal/jsutil/webauthn.go +++ /dev/null @@ -1,158 +0,0 @@ -// MIT License -// -// Copyright (c) 2025 TTBT Enterprises LLC -// Copyright (c) 2025 Robin Thellend -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -//go:build wasm - -package jsutil - -import ( - "errors" - "fmt" - "syscall/js" -) - -type CreateOptions struct { - Challenge []byte - Alg int - UserID []byte - UserName string - Resident bool -} - -type CreateResponse struct { - ClientDataJSON []byte - AttestationObject []byte -} - -func WebAuthnCreate(opts CreateOptions) (*CreateResponse, error) { - cc := js.Global().Get("navigator").Get("credentials") - if !cc.Truthy() { - return nil, errors.New("CredentialsContainer is unavailable") - } - // "required" rather than "preferred": with "preferred" an authenticator - // that cannot store a discoverable credential silently creates a - // non-discoverable one instead, and the caller would never learn that the - // key it just created can't be found again by WebAuthnGet. - residentKey := "discouraged" - if opts.Resident { - residentKey = "required" - } - // The spec requires user.id to be 1-64 bytes. - if len(opts.UserID) == 0 || len(opts.UserID) > 64 { - return nil, fmt.Errorf("invalid user ID length %d, want 1-64", len(opts.UserID)) - } - creds, err := Await(cc.Call("create", NewObject(map[string]any{ - "publicKey": NewObject(map[string]any{ - "attestation": "none", - "authenticatorSelection": NewObject(map[string]any{ - // requireResidentKey is the WebAuthn Level 1 field, only - // consulted by clients that don't understand residentKey. The - // spec says to set it true iff residentKey is "required". - "residentKey": residentKey, - "requireResidentKey": residentKey == "required", - "userVerification": "preferred", - }), - "challenge": Uint8ArrayFromBytes(opts.Challenge), - "pubKeyCredParams": NewArray([]any{ - NewObject(map[string]any{ - "alg": opts.Alg, - "type": "public-key", - }), - NewObject(map[string]any{ - "alg": -257, // RSA, just to remove a warning from chrome - "type": "public-key", - }), - }), - "rp": NewObject(map[string]any{ - "name": Hostname(), - }), - "timeout": 120000, - "user": NewObject(map[string]any{ - "displayName": "SSHTERM KEY: " + opts.UserName, - "id": Uint8ArrayFromBytes(opts.UserID), - "name": opts.UserName, - }), - }), - }))) - if err != nil { - return nil, err - } - pkc := creds.Get("response") - return &CreateResponse{ - ClientDataJSON: Uint8ArrayToBytes(Uint8Array.New(pkc.Get("clientDataJSON"))), - AttestationObject: Uint8ArrayToBytes(Uint8Array.New(pkc.Get("attestationObject"))), - }, nil -} - -type GetOptions struct { - Challenge []byte - Allow [][]byte -} - -type GetResponse struct { - ID []byte - AuthenticatorData []byte - ClientDataJSON []byte - Signature []byte - UserHandle []byte -} - -func WebAuthnGet(opts GetOptions) (*GetResponse, error) { - cc := js.Global().Get("navigator").Get("credentials") - if !cc.Truthy() { - return nil, errors.New("CredentialsContainer is unavailable") - } - - allow := make([]any, 0, len(opts.Allow)) - for _, v := range opts.Allow { - allow = append(allow, NewObject(map[string]any{ - "id": Uint8ArrayFromBytes(v), - "type": "public-key", - })) - } - creds, err := Await(cc.Call("get", - NewObject(map[string]any{ - "publicKey": NewObject(map[string]any{ - "allowCredentials": NewArray(allow), - "challenge": Uint8ArrayFromBytes(opts.Challenge), - "timeout": 120000, - "userVerification": "preferred", - }), - }), - )) - if err != nil { - return nil, err - } - pkc := creds.Get("response") - var userHandle []byte - if uh := pkc.Get("userHandle"); uh.Truthy() { - userHandle = Uint8ArrayToBytes(Uint8Array.New(uh)) - } - return &GetResponse{ - ID: Uint8ArrayToBytes(Uint8Array.New(creds.Get("rawId"))), - AuthenticatorData: Uint8ArrayToBytes(Uint8Array.New(pkc.Get("authenticatorData"))), - ClientDataJSON: Uint8ArrayToBytes(Uint8Array.New(pkc.Get("clientDataJSON"))), - Signature: Uint8ArrayToBytes(Uint8Array.New(pkc.Get("signature"))), - UserHandle: userHandle, - }, nil -} diff --git a/go/internal/webauthnsk/key.go b/go/internal/webauthnsk/key.go deleted file mode 100644 index db70ecb..0000000 --- a/go/internal/webauthnsk/key.go +++ /dev/null @@ -1,243 +0,0 @@ -// MIT License -// -// Copyright (c) 2025 TTBT Enterprises LLC -// Copyright (c) 2025 Robin Thellend -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -//go:build wasm - -package webauthnsk - -import ( - "bytes" - "crypto/ecdsa" - "crypto/rand" - "crypto/sha256" - "encoding/asn1" - "errors" - "fmt" - "io" - "math/big" - "strings" - - "golang.org/x/crypto/ssh" - - "github.com/c2FmZQ/sshterm/internal/jsutil" -) - -func Create(name string, resident bool) (*Key, error) { - challenge := make([]byte, 32) - if _, err := rand.Read(challenge); err != nil { - return nil, err - } - // user.id is the only field that an assertion returns (as userHandle), so - // for a discoverable credential it carries the key name and lets Discover - // restore it. The spec asks for an opaque value that doesn't identify the - // user, so this is limited to resident keys, where it buys something; - // everything else gets a random handle. - // - // Note that authenticators key discoverable credentials on - // (rpID, user.id), so creating a resident key replaces any existing one - // with the same name. Callers are expected to confirm overwrites. - var uid []byte - if resident && len(name) > 0 && len(name) <= 64 && isPrintableASCII(name) { - uid = []byte(name) - } else { - uid = make([]byte, 32) - if _, err := rand.Read(uid); err != nil { - return nil, err - } - } - resp, err := jsutil.WebAuthnCreate(jsutil.CreateOptions{ - Challenge: challenge, - Alg: algES256, - UserID: uid, - UserName: name, - Resident: resident, - }) - if err != nil { - return nil, fmt.Errorf("WebAuthnCreate: %w", err) - } - if _, err := verifyClientData(resp.ClientDataJSON, "webauthn.create", challenge); err != nil { - return nil, err - } - att, err := parseAttestationObject(resp.AttestationObject) - if err != nil { - return nil, fmt.Errorf("ParseAttestationObject: %w", err) - } - rpID := []byte(jsutil.Hostname()) - rpHash := sha256.Sum256(rpID) - if !bytes.Equal(att.AuthData.RPIDHash, rpHash[:]) { - return nil, errors.New("ParseAttestationObject: rpIdHash mismatch") - } - if !att.AuthData.UserPresence { - return nil, errors.New("ParseAttestationObject: missing user presence flag") - } - ac := att.AuthData.AttestedCredentials - if ac == nil { - return nil, errors.New("ParseAttestationObject: no attested credentials") - } - pk, err := ac.PublicKey() - if err != nil { - return nil, fmt.Errorf("PublicKey: %w", err) - } - ecpk, ok := pk.(*ecdsa.PublicKey) - if !ok { - return nil, fmt.Errorf("PublicKey: unexpected public key type %T", pk) - } - return &Key{ - typ: ecdsa256KeyType, - id: ac.ID, - pubKey: ecpk, - rpID: rpID, - }, nil -} - -// Discover discovers a resident key on an authenticator by performing -// two assertions to recover and verify the public key. -// It returns the Key, the username from userHandle (if available), and any error. -func Discover(promptTouch func(string)) (*Key, string, error) { - challenge1 := make([]byte, 32) - if _, err := rand.Read(challenge1); err != nil { - return nil, "", err - } - if promptTouch != nil { - promptTouch("Touch your security key to discover resident keys...\n") - } - resp1, err := jsutil.WebAuthnGet(jsutil.GetOptions{ - Challenge: challenge1, - Allow: nil, - }) - if err != nil { - return nil, "", fmt.Errorf("WebAuthnGet: %w", err) - } - if _, err := verifyClientData(resp1.ClientDataJSON, "webauthn.get", challenge1); err != nil { - return nil, "", fmt.Errorf("assertion 1: %w", err) - } - - challenge2 := make([]byte, 32) - if _, err := rand.Read(challenge2); err != nil { - return nil, "", err - } - if promptTouch != nil { - promptTouch("Touch your security key again to verify public key...\n") - } - resp2, err := jsutil.WebAuthnGet(jsutil.GetOptions{ - Challenge: challenge2, - Allow: [][]byte{resp1.ID}, - }) - if err != nil { - return nil, "", fmt.Errorf("WebAuthnGet: %w", err) - } - if _, err := verifyClientData(resp2.ClientDataJSON, "webauthn.get", challenge2); err != nil { - return nil, "", fmt.Errorf("assertion 2: %w", err) - } - if !bytes.Equal(resp1.ID, resp2.ID) { - return nil, "", errors.New("the authenticator returned a different credential for the second assertion") - } - - pk, err := RecoverPublicKey(resp1.AuthenticatorData, resp1.ClientDataJSON, resp1.Signature, resp2.AuthenticatorData, resp2.ClientDataJSON, resp2.Signature) - if err != nil { - // An assertion with an empty allow list can return any discoverable - // credential for this origin, including one that isn't an ES256 key. - // Those fail while parsing the ECDSA signature, which is worth - // translating into something the user can act on. - var structErr asn1.StructuralError - var syntaxErr asn1.SyntaxError - if errors.As(err, &structErr) || errors.As(err, &syntaxErr) { - return nil, "", errors.New("the selected credential is not an ECDSA P-256 key; only ecdsa-sk keys can be discovered") - } - return nil, "", fmt.Errorf("RecoverPublicKey: %w", err) - } - - // The user handle holds the key name when the credential was created by - // Create. Anything else is treated as not having a name. - var userName string - if cand := strings.TrimSpace(string(resp1.UserHandle)); cand != "" && isPrintableASCII(cand) { - userName = cand - } - - key := &Key{ - typ: ecdsa256KeyType, - id: resp1.ID, - pubKey: pk, - rpID: []byte(jsutil.Hostname()), - } - return key, userName, nil -} - -func (k *Key) Sign(_ io.Reader, data []byte) (*ssh.Signature, error) { - opts := jsutil.GetOptions{Challenge: data} - if len(k.id) > 0 { - opts.Allow = [][]byte{k.id} - } - resp, err := jsutil.WebAuthnGet(opts) - if err != nil { - return nil, fmt.Errorf("WebAuthnGet: %w", err) - } - var ad authenticatorData - if err := parseAuthenticatorData(resp.AuthenticatorData, &ad); err != nil { - return nil, fmt.Errorf("ParseAuthenticatorData: %w", err) - } - rpHash := sha256.Sum256(k.rpID) - if !bytes.Equal(ad.RPIDHash, rpHash[:]) { - return nil, fmt.Errorf("rpIdHash mismatch (key application %q does not match current origin)", k.rpID) - } - if !ad.UserPresence || ad.AttestedCredentialData { - return nil, errors.New("invalid authenticatorData flags in assertion") - } - cd, err := verifyClientData(resp.ClientDataJSON, "webauthn.get", data) - if err != nil { - return nil, err - } - - var sig struct { - R, S *big.Int - } - rest, err := asn1.Unmarshal(resp.Signature, &sig) - if err != nil { - return nil, fmt.Errorf("signature: %w", err) - } - if len(rest) != 0 { - return nil, errors.New("signature: unexpected trailing bytes") - } - n := k.pubKey.Curve.Params().N - if sig.R == nil || sig.S == nil || sig.R.Sign() <= 0 || sig.R.Cmp(n) >= 0 || sig.S.Sign() <= 0 || sig.S.Cmp(n) >= 0 { - return nil, errors.New("signature: value out of range") - } - - return &ssh.Signature{ - Format: webauthnSignatureFormat, - Blob: ssh.Marshal(sig), - Rest: ssh.Marshal(struct { - Flags byte - Counter uint32 - Origin string - ClientData string - Extensions string - }{ - Flags: ad.Flags, - Counter: ad.SignCount, - Origin: cd.Origin, - ClientData: string(resp.ClientDataJSON), - Extensions: string(ad.Extensions), - }), - }, nil -} diff --git a/go/internal/webauthnsk/webauthn.go b/go/internal/webauthnsk/webauthn.go deleted file mode 100644 index d6f50ae..0000000 --- a/go/internal/webauthnsk/webauthn.go +++ /dev/null @@ -1,699 +0,0 @@ -// MIT License -// -// Copyright (c) 2025 TTBT Enterprises LLC -// Copyright (c) 2025 Robin Thellend -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package webauthnsk - -import ( - "bytes" - "crypto" - "crypto/aes" - "crypto/cipher" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/sha256" - "encoding/asn1" - "encoding/base64" - "encoding/binary" - "encoding/json" - "encoding/pem" - "errors" - "fmt" - "math/big" - "strings" - - cbor "github.com/fxamacker/cbor/v2" - "golang.org/x/crypto/cryptobyte" - "golang.org/x/crypto/pbkdf2" - "golang.org/x/crypto/ssh" -) - -const algES256 = -7 - -var errTooShort = errors.New("too short") - -// ClientData is a decoded ClientDataJSON object. -type clientData struct { - Type string `json:"type"` - Challenge string `json:"challenge"` - Origin string `json:"origin"` - CrossOrigin bool `json:"crossOrigin"` -} - -// Attestation. https://w3c.github.io/webauthn/#sctn-attestation -type attestation struct { - Format string `cbor:"fmt"` - AttStmt cbor.RawMessage `cbor:"attStmt"` - RawAuthData []byte `cbor:"authData"` - - AuthData authenticatorData `cbor:"-"` -} - -// AuthenticatorData is the authenticator data provided during attestation and -// assertion. https://w3c.github.io/webauthn/#sctn-authenticator-data -type authenticatorData struct { - Flags byte - RPIDHash []byte `json:"rpIdHash"` - UserPresence bool `json:"up"` - BackupEligible bool `json:"be"` - BackupState bool `json:"bs"` - UserVerification bool `json:"uv"` - AttestedCredentialData bool `json:"at"` - ExtensionData bool `json:"ed"` - SignCount uint32 `json:"signCount"` - AttestedCredentials *attestedCredentials `json:"attestedCredentialData"` - Extensions []byte `json:"extensions,omitempty"` -} - -// AttestedCredentials. https://w3c.github.io/webauthn/#sctn-attested-credential-data -type attestedCredentials struct { - AAGUID []byte `json:"AAGUID"` - ID []byte `json:"credentialId"` - COSEKey []byte `json:"credentialPublicKey"` -} - -func (c attestedCredentials) PublicKey() (crypto.PublicKey, error) { - var kty struct { - KTY int `cbor:"1,keyasint"` - } - if err := cbor.Unmarshal(c.COSEKey, &kty); err != nil { - return nil, fmt.Errorf("cbor.Unmarshal(%v): %w", c.COSEKey, err) - } - switch kty.KTY { - case 2: // ECDSA public key - var ecKey struct { - KTY int `cbor:"1,keyasint"` - ALG int `cbor:"3,keyasint"` - Curve int `cbor:"-1,keyasint"` - X []byte `cbor:"-2,keyasint"` - Y []byte `cbor:"-3,keyasint"` - } - if err := cbor.Unmarshal(c.COSEKey, &ecKey); err != nil { - return nil, err - } - if ecKey.ALG != algES256 { - return nil, errors.New("unexpected EC key alg") - } - if ecKey.Curve != 1 { // P-256 - return nil, errors.New("unexpected EC key curve") - } - publicKey := &ecdsa.PublicKey{ - Curve: elliptic.P256(), - X: new(big.Int).SetBytes(ecKey.X), - Y: new(big.Int).SetBytes(ecKey.Y), - } - if !publicKey.Curve.IsOnCurve(publicKey.X, publicKey.Y) { - return nil, errors.New("invalid public key") - } - return publicKey, nil - - default: - return nil, errors.New("unsupported key type") - } -} - -// parseAttestationObject parses an attestationObject. Passkeys don't typically -// provide attestation statements. -func parseAttestationObject(attestationObject []byte) (*attestation, error) { - var att attestation - if err := cbor.Unmarshal(attestationObject, &att); err != nil { - return nil, fmt.Errorf("cbor.Unmarshal: %w", err) - } - if err := parseAuthenticatorData(att.RawAuthData, &att.AuthData); err != nil { - return nil, fmt.Errorf("parseAuthenticatorData: %w", err) - } - return &att, nil -} - -func parseAuthenticatorData(raw []byte, ad *authenticatorData) error { - // https://w3c.github.io/webauthn/#sctn-authenticator-data - if len(raw) < 37 { - return errTooShort - } - ad.RPIDHash = raw[:32] - raw = raw[32:] - ad.Flags = raw[0] - ad.UserPresence = raw[0]&1 != 0 - ad.UserVerification = (raw[0]>>2)&1 != 0 - ad.BackupEligible = (raw[0]>>3)&1 != 0 - ad.BackupState = (raw[0]>>4)&1 != 0 - ad.AttestedCredentialData = (raw[0]>>6)&1 != 0 - ad.ExtensionData = (raw[0]>>7)&1 != 0 - raw = raw[1:] - ad.SignCount = binary.BigEndian.Uint32(raw[:4]) - raw = raw[4:] - - if ad.AttestedCredentialData { - // https://w3c.github.io/webauthn/#sctn-attested-credential-data - if len(raw) < 18 { - return errTooShort - } - ad.AttestedCredentials = &attestedCredentials{} - ad.AttestedCredentials.AAGUID = raw[:16] - raw = raw[16:] - - sz := binary.BigEndian.Uint16(raw[:2]) - raw = raw[2:] - if sz > 1023 { - return errors.New("invalid credentialId length") - } - if len(raw) < int(sz) { - return errTooShort - } - ad.AttestedCredentials.ID = raw[:int(sz)] - raw = raw[int(sz):] - - var coseKey cbor.RawMessage - var err error - if raw, err = cbor.UnmarshalFirst(raw, &coseKey); err != nil { - return err - } - if len(coseKey) == 0 || coseKey[0]>>5 != 5 { - return errors.New("invalid COSEKey CBOR type") - } - ad.AttestedCredentials.COSEKey = []byte(coseKey) - } - if ad.ExtensionData { - if len(raw) == 0 { - return errTooShort - } - var ext cbor.RawMessage - var err error - if raw, err = cbor.UnmarshalFirst(raw, &ext); err != nil { - return err - } - if len(ext) == 0 || ext[0]>>5 != 5 { - return errors.New("invalid extensions CBOR type") - } - ad.Extensions = []byte(ext) - } - if len(raw) != 0 { - return errors.New("unexpected trailing bytes in authenticatorData") - } - return nil -} - -func parseClientData(js []byte) (*clientData, error) { - var out clientData - err := json.Unmarshal(js, &out) - return &out, err -} - -// verifyClientData checks that a ClientDataJSON blob belongs to the ceremony -// the caller just requested, i.e. that it has the expected type and echoes back -// the challenge that was sent. It returns the parsed client data. -func verifyClientData(js []byte, wantType string, wantChallenge []byte) (*clientData, error) { - cd, err := parseClientData(js) - if err != nil { - return nil, fmt.Errorf("ParseClientData: %w", err) - } - if cd.Type != wantType { - return nil, fmt.Errorf("unexpected client data type %q", cd.Type) - } - if cd.CrossOrigin { - return nil, errors.New("cross-origin client data not allowed") - } - challenge, err := base64.RawURLEncoding.Strict().DecodeString(cd.Challenge) - if err != nil { - return nil, fmt.Errorf("invalid client data challenge: %w", err) - } - if !bytes.Equal(challenge, wantChallenge) { - return nil, errors.New("client data challenge doesn't match") - } - return cd, nil -} - -// isPrintableASCII reports whether s consists only of printable ASCII -// characters. It deliberately works a byte at a time so that any non-ASCII -// byte, including a fragment of a truncated multi-byte rune, is rejected. -func isPrintableASCII(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] < 32 || s[i] > 126 { - return false - } - } - return true -} - -// recoverCandidatesP256 returns every ECDSA public key that could have produced -// the signature (r, s) over hash. There are up to four, and a second signature -// over a different hash is needed to tell them apart. -// -// The implementation is specific to P-256: it relies on the curve equation -// having a == -3, and on p ≡ 3 (mod 4) so that a square root modulo p can be -// computed as ySq^((p+1)/4). -func recoverCandidatesP256(hash []byte, r, s *big.Int) []*ecdsa.PublicKey { - curve := elliptic.P256() - params := curve.Params() - p := params.P - n := params.N - - // r and s are used below both as a curve coordinate and as scalars, and - // crypto/elliptic panics (rather than returning an error) when handed a - // point that is not on the curve. Callers validate these too; this guard - // keeps the panic unreachable if a new caller forgets. - if r.Sign() <= 0 || r.Cmp(n) >= 0 || s.Sign() <= 0 || s.Cmp(n) >= 0 { - return nil - } - - e := new(big.Int).SetBytes(hash) - e.Mod(e, n) - rInv := new(big.Int).ModInverse(r, n) - if rInv == nil { - return nil - } - - eGx, eGy := curve.ScalarBaseMult(e.Bytes()) - // Negate eG. crypto/elliptic represents the point at infinity as (0, 0), - // whose negation must stay (0, 0) rather than becoming (0, p). - neGy := new(big.Int) - if eGy.Sign() != 0 { - neGy.Sub(p, eGy) - } - - var res []*ecdsa.PublicKey - - xs := []*big.Int{r} - if rPlusN := new(big.Int).Add(r, n); rPlusN.Cmp(p) < 0 { - xs = append(xs, rPlusN) - } - - for _, x := range xs { - x3 := new(big.Int).Mul(x, x) - x3.Mul(x3, x) - threeX := new(big.Int).Mul(big.NewInt(3), x) - ySq := new(big.Int).Sub(x3, threeX) - ySq.Add(ySq, params.B) - ySq.Mod(ySq, p) - - exp := new(big.Int).Add(p, big.NewInt(1)) - exp.Div(exp, big.NewInt(4)) - y := new(big.Int).Exp(ySq, exp, p) - - check := new(big.Int).Exp(y, big.NewInt(2), p) - if check.Cmp(ySq) != 0 { - // ySq is not a quadratic residue, so this x is not on the curve. - continue - } - - yCands := []*big.Int{y} - if y.Sign() != 0 { - yCands = append(yCands, new(big.Int).Sub(p, y)) - } - - for _, yCand := range yCands { - sRx, sRy := curve.ScalarMult(x, yCand, s.Bytes()) - diffX, diffY := curve.Add(sRx, sRy, eGx, neGy) - qx, qy := curve.ScalarMult(diffX, diffY, rInv.Bytes()) - if qx.Sign() == 0 && qy.Sign() == 0 { - // Point at infinity; not a usable public key. - continue - } - res = append(res, &ecdsa.PublicKey{ - Curve: curve, - X: qx, - Y: qy, - }) - } - } - return res -} - -// RecoverPublicKey recovers the ECDSA P-256 public key from two WebAuthn assertions -// using different challenges. Two assertions are required to uniquely identify the -// public key among the mathematically possible ECDSA recovery candidates. -func RecoverPublicKey(authData1, clientDataJSON1, sig1Bytes, authData2, clientDataJSON2, sig2Bytes []byte) (*ecdsa.PublicKey, error) { - curve := elliptic.P256() - n := curve.Params().N - - var sig1, sig2 struct { - R, S *big.Int - } - if _, err := asn1.Unmarshal(sig1Bytes, &sig1); err != nil { - return nil, fmt.Errorf("sig1: %w", err) - } - if _, err := asn1.Unmarshal(sig2Bytes, &sig2); err != nil { - return nil, fmt.Errorf("sig2: %w", err) - } - // asn1.Unmarshal accepts negative integers and values larger than the group - // order. Both are out of range for ECDSA and would panic inside - // crypto/elliptic, so reject them here with a usable error message. - for i, sig := range []struct{ R, S *big.Int }{sig1, sig2} { - if sig.R.Sign() <= 0 || sig.R.Cmp(n) >= 0 || sig.S.Sign() <= 0 || sig.S.Cmp(n) >= 0 { - return nil, fmt.Errorf("sig%d: signature value out of range", i+1) - } - } - - h1 := sha256.Sum256(clientDataJSON1) - signed1 := append(append([]byte(nil), authData1...), h1[:]...) - hash1 := sha256.Sum256(signed1) - - h2 := sha256.Sum256(clientDataJSON2) - signed2 := append(append([]byte(nil), authData2...), h2[:]...) - hash2 := sha256.Sum256(signed2) - - cands1 := recoverCandidatesP256(hash1[:], sig1.R, sig1.S) - cands2 := recoverCandidatesP256(hash2[:], sig2.R, sig2.S) - - seen := make(map[string]bool) - var matches []*ecdsa.PublicKey - for _, c1 := range cands1 { - for _, c2 := range cands2 { - if c1.X.Cmp(c2.X) != 0 || c1.Y.Cmp(c2.Y) != 0 { - continue - } - k := string(elliptic.Marshal(curve, c1.X, c1.Y)) - if seen[k] { - continue - } - seen[k] = true - matches = append(matches, c1) - } - } - - if len(matches) == 0 { - return nil, errors.New("no matching public key found from assertions") - } - if len(matches) > 1 { - return nil, fmt.Errorf("multiple matching public keys found (%d)", len(matches)) - } - pk := matches[0] - if !ecdsa.Verify(pk, hash1[:], sig1.R, sig1.S) || !ecdsa.Verify(pk, hash2[:], sig2.R, sig2.S) { - return nil, errors.New("recovered public key failed signature verification") - } - return pk, nil -} - -const ( - ecdsa256KeyType = ssh.KeyAlgoSKECDSA256 - webauthnSignatureFormat = "webauthn-sk-ecdsa-sha2-nistp256@openssh.com" -) - -type Key struct { - typ string - id []byte - pubKey *ecdsa.PublicKey - rpID []byte -} - -const ( - // minIter is the minimum number of PBKDF2 iterations accepted when - // decrypting keys. - minIter = 1000 - // defaultIter is the number of PBKDF2 iterations used to encrypt keys. - defaultIter = 100000 - // maxIter is the maximum number of PBKDF2 iterations accepted when - // decrypting keys. It protects against crafted files that would hang - // the app. - maxIter = 1000000 -) - -func Unmarshal(priv []byte, name string, rp func(string) (string, error)) (*Key, error) { - if !bytes.HasPrefix(priv, []byte("-----BEGIN WEBAUTHN ")) { - return nil, errors.New("unexpected key format") - } - block, _ := pem.Decode(priv) - if block == nil { - return nil, errors.New("invalid PEM data") - } - str := cryptobyte.String(block.Bytes) - var ver uint8 - if !str.ReadUint8(&ver) { - return nil, errTooShort - } - if ver != 1 && ver != 2 { - return nil, fmt.Errorf("unexpected version %d", ver) - } - var pubBytes cryptobyte.String - if !str.ReadUint16LengthPrefixed(&pubBytes) { - return nil, errTooShort - } - key, err := UnmarshalPublic(pubBytes) - if err != nil { - return nil, err - } - - var privBytes cryptobyte.String - if !str.ReadUint16LengthPrefixed(&privBytes) || !str.Empty() { - return nil, errTooShort - } - - switch block.Type { - case "WEBAUTHN KEY": - key.id = privBytes - - case "WEBAUTHN ENCRYPTED KEY": - salt := make([]byte, 16) - if !privBytes.ReadBytes(&salt, 16) { - return nil, errTooShort - } - var numIter uint32 - if !privBytes.ReadUint32(&numIter) { - return nil, errTooShort - } - if numIter < minIter || numIter > maxIter { - return nil, fmt.Errorf("invalid iteration count %d", numIter) - } - if rp == nil { - return nil, errors.New("passphrase required") - } - passphrase, err := rp("Enter the passphrase for " + name + ": ") - if err != nil { - return nil, err - } - dk := pbkdf2.Key([]byte(passphrase), salt, int(numIter), 32, sha256.New) - block, err := aes.NewCipher(dk) - if err != nil { - return nil, err - } - gcm, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - nonce := make([]byte, gcm.NonceSize()) - if !privBytes.ReadBytes(&nonce, len(nonce)) { - return nil, errTooShort - } - var aad []byte - if ver >= 2 { - aad = []byte(pubBytes) - } - keyID, err := gcm.Open(nil, nonce, []byte(privBytes), aad) - if err != nil { - return nil, errors.New("invalid passphrase") - } - key.id = keyID - default: - return nil, errors.New("invalid webauthn key ID") - } - return key, nil -} - -func UnmarshalPublic(pub []byte) (*Key, error) { - var data struct { - Name string - ID string - Key []byte - Application string - } - if err := ssh.Unmarshal(pub, &data); err != nil { - return nil, fmt.Errorf("Unmarshal: %w", err) - } - if (data.Name != ecdsa256KeyType && data.Name != webauthnSignatureFormat) || data.ID != "nistp256" { - return nil, fmt.Errorf("unexpected key type %q", data.Name) - } - x, y := elliptic.Unmarshal(elliptic.P256(), data.Key) - if x == nil { - return nil, errors.New("invalid public key") - } - return &Key{ - typ: ecdsa256KeyType, - rpID: []byte(data.Application), - pubKey: &ecdsa.PublicKey{ - Curve: elliptic.P256(), - X: x, - Y: y, - }, - }, nil -} - -func (k *Key) MarshalPrivate(passphrase string) (*pem.Block, error) { - pubBytes := k.Marshal() - if passphrase == "" { - buf := cryptobyte.NewBuilder([]byte{2}) - buf.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(pubBytes) - }) - buf.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(k.id) - }) - data, err := buf.Bytes() - if err != nil { - return nil, err - } - return &pem.Block{ - Type: "WEBAUTHN KEY", - Bytes: data, - }, nil - } - salt := make([]byte, 16) - rand.Read(salt) - numIter := defaultIter - dk := pbkdf2.Key([]byte(passphrase), salt, numIter, 32, sha256.New) - block, err := aes.NewCipher(dk) - if err != nil { - return nil, err - } - gcm, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - nonce := make([]byte, gcm.NonceSize()) - rand.Read(nonce) - encID := gcm.Seal(nonce, nonce, k.id, pubBytes) - buf := cryptobyte.NewBuilder([]byte{2}) - buf.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(pubBytes) - }) - buf.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(salt) - b.AddUint32(uint32(numIter)) - b.AddBytes(encID) - }) - data, err := buf.Bytes() - if err != nil { - return nil, err - } - return &pem.Block{ - Type: "WEBAUTHN ENCRYPTED KEY", - Bytes: data, - }, nil -} - -func (k *Key) Type() string { - return k.typ -} - -func (k *Key) Marshal() []byte { - w := struct { - Name string - ID string - Key []byte - Application string - }{ - k.Type(), - "nistp256", - elliptic.Marshal(k.pubKey.Curve, k.pubKey.X, k.pubKey.Y), - string(k.rpID), - } - return ssh.Marshal(&w) -} - -func (k *Key) Verify(data []byte, sig *ssh.Signature) error { - var ecSig struct { - R, S *big.Int - } - if err := ssh.Unmarshal(sig.Blob, &ecSig); err != nil { - return err - } - appHash := sha256.Sum256(k.rpID) - var signed cryptobyte.Builder - signed.AddBytes(appHash[:]) - - switch sig.Format { - case ecdsa256KeyType: - var extra struct { - Flags byte - Counter uint32 - } - if err := ssh.Unmarshal(sig.Rest, &extra); err != nil { - return err - } - if (extra.Flags & 0x01) == 0 { - return errors.New("ssh: missing user presence flag") - } - dataHash := sha256.Sum256(data) - signed.AddUint8(extra.Flags) - signed.AddUint32(extra.Counter) - signed.AddBytes(dataHash[:]) - - case webauthnSignatureFormat: - var extra struct { - Flags byte - Counter uint32 - Origin string - ClientData string - Extensions string - } - if err := ssh.Unmarshal(sig.Rest, &extra); err != nil { - return err - } - if (extra.Flags & 0x01) == 0 { - return errors.New("ssh: missing user presence flag") - } - if (extra.Flags & 0x40) != 0 { - return errors.New("ssh: unexpected attested credential data flag in assertion") - } - if ((extra.Flags & 0x80) != 0) != (len(extra.Extensions) != 0) { - return errors.New("ssh: extension data flag does not match extensions length") - } - if (!strings.HasPrefix(extra.Origin, "https://") && !strings.HasPrefix(extra.Origin, "http://")) || strings.IndexByte(extra.Origin, '"') != -1 { - return errors.New("ssh: invalid origin") - } - expectedPrefix := fmt.Sprintf(`{"type":"webauthn.get","challenge":"%s","origin":"%s"`, - base64.RawURLEncoding.EncodeToString(data), extra.Origin) - if len(extra.ClientData) <= len(expectedPrefix) || !strings.HasPrefix(extra.ClientData, expectedPrefix) || - (extra.ClientData[len(expectedPrefix)] != '}' && extra.ClientData[len(expectedPrefix)] != ',') { - return errors.New("ssh: clientData does not match expected WebAuthn format") - } - cd, err := verifyClientData([]byte(extra.ClientData), "webauthn.get", data) - if err != nil { - return err - } - if cd.Origin != extra.Origin { - return errors.New("ssh: invalid client data origin") - } - clientDataHash := sha256.Sum256([]byte(extra.ClientData)) - signed.AddUint8(extra.Flags) - signed.AddUint32(extra.Counter) - signed.AddBytes([]byte(extra.Extensions)) - signed.AddBytes(clientDataHash[:]) - - default: - return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type()) - } - - msg, err := signed.Bytes() - if err != nil { - return err - } - hash := sha256.Sum256(msg) - if !ecdsa.Verify(k.pubKey, hash[:], ecSig.R, ecSig.S) { - return errors.New("ssh: signature did not verify") - } - return nil -} - -func (k *Key) PublicKey() ssh.PublicKey { - return k -} diff --git a/go/internal/webauthnsk/webauthn_test.go b/go/internal/webauthnsk/webauthn_test.go deleted file mode 100644 index 210090b..0000000 --- a/go/internal/webauthnsk/webauthn_test.go +++ /dev/null @@ -1,732 +0,0 @@ -// MIT License -// -// Copyright (c) 2026 TTBT Enterprises LLC -// Copyright (c) 2026 Robin Thellend -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package webauthnsk - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/ecdsa" - "crypto/ed25519" - "crypto/elliptic" - "crypto/rand" - "crypto/sha256" - "encoding/asn1" - "encoding/base64" - "encoding/binary" - "encoding/pem" - "fmt" - "math/big" - "testing" - - "golang.org/x/crypto/cryptobyte" - "golang.org/x/crypto/pbkdf2" - "golang.org/x/crypto/ssh" -) - -func TestRecoverPublicKey(t *testing.T) { - curve := elliptic.P256() - - for iter := 0; iter < 50; iter++ { - priv, err := ecdsa.GenerateKey(curve, rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - - ad1 := []byte(fmt.Sprintf("authenticatorData1-%d", iter)) - cd1 := []byte(fmt.Sprintf(`{"type":"webauthn.get","challenge":"chal1-%d"}`, iter)) - h1 := sha256.Sum256(cd1) - signed1 := append(append([]byte(nil), ad1...), h1[:]...) - hash1 := sha256.Sum256(signed1) - r1, s1, err := ecdsa.Sign(rand.Reader, priv, hash1[:]) - if err != nil { - t.Fatalf("Sign 1: %v", err) - } - sig1, err := asn1.Marshal(struct{ R, S *big.Int }{r1, s1}) - if err != nil { - t.Fatalf("asn1.Marshal 1: %v", err) - } - - ad2 := []byte(fmt.Sprintf("authenticatorData2-%d", iter)) - cd2 := []byte(fmt.Sprintf(`{"type":"webauthn.get","challenge":"chal2-%d"}`, iter)) - h2 := sha256.Sum256(cd2) - signed2 := append(append([]byte(nil), ad2...), h2[:]...) - hash2 := sha256.Sum256(signed2) - r2, s2, err := ecdsa.Sign(rand.Reader, priv, hash2[:]) - if err != nil { - t.Fatalf("Sign 2: %v", err) - } - sig2, err := asn1.Marshal(struct{ R, S *big.Int }{r2, s2}) - if err != nil { - t.Fatalf("asn1.Marshal 2: %v", err) - } - - pk, err := RecoverPublicKey(ad1, cd1, sig1, ad2, cd2, sig2) - if err != nil { - t.Fatalf("iteration %d: RecoverPublicKey failed: %v", iter, err) - } - if pk.X.Cmp(priv.PublicKey.X) != 0 || pk.Y.Cmp(priv.PublicKey.Y) != 0 { - t.Fatalf("iteration %d: recovered public key does not match", iter) - } - } -} - -// signAssertion returns a DER ECDSA signature over the same bytes a WebAuthn -// authenticator signs, along with the authenticator data and client data. -func signAssertion(t *testing.T, priv *ecdsa.PrivateKey, tag string) (authData, clientDataJSON, sig []byte) { - t.Helper() - authData = []byte("authenticatorData-" + tag) - clientDataJSON = []byte(`{"type":"webauthn.get","challenge":"` + tag + `"}`) - h := sha256.Sum256(clientDataJSON) - hash := sha256.Sum256(append(append([]byte(nil), authData...), h[:]...)) - r, s, err := ecdsa.Sign(rand.Reader, priv, hash[:]) - if err != nil { - t.Fatalf("Sign: %v", err) - } - if sig, err = asn1.Marshal(struct{ R, S *big.Int }{r, s}); err != nil { - t.Fatalf("asn1.Marshal: %v", err) - } - return authData, clientDataJSON, sig -} - -func TestRecoverPublicKeyRejectsOutOfRangeSignature(t *testing.T) { - curve := elliptic.P256() - p := curve.Params().P - n := curve.Params().N - - priv, err := ecdsa.GenerateKey(curve, rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - ad, cd, good := signAssertion(t, priv, "good") - - for _, tc := range []struct { - name string - r, s *big.Int - }{ - {"negative r", big.NewInt(-5), big.NewInt(7)}, - {"negative s", big.NewInt(7), big.NewInt(-5)}, - {"zero r", big.NewInt(0), big.NewInt(7)}, - {"zero s", big.NewInt(7), big.NewInt(0)}, - {"r >= n", new(big.Int).Add(n, big.NewInt(1)), big.NewInt(7)}, - {"s >= n", big.NewInt(7), new(big.Int).Add(n, big.NewInt(1))}, - {"r > p", new(big.Int).Add(p, big.NewInt(12345)), big.NewInt(7)}, - } { - t.Run(tc.name, func(t *testing.T) { - bad, err := asn1.Marshal(struct{ R, S *big.Int }{tc.r, tc.s}) - if err != nil { - t.Fatalf("asn1.Marshal: %v", err) - } - // Must return an error rather than panicking: an unrecovered panic - // under wasm takes down the whole app. - for _, args := range [][2][]byte{{bad, good}, {good, bad}, {bad, bad}} { - if _, err := RecoverPublicKey(ad, cd, args[0], ad, cd, args[1]); err == nil { - t.Errorf("RecoverPublicKey(%v) = nil error, want error", tc.name) - } - } - }) - } -} - -func TestRecoverPublicKeyRejectsMalformedSignature(t *testing.T) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - ad, cd, good := signAssertion(t, priv, "good") - - for _, tc := range []struct { - name string - sig []byte - }{ - {"empty", nil}, - {"garbage", []byte{0xff, 0xff, 0xff, 0xff}}, - {"truncated", good[:len(good)/2]}, - // An Ed25519 or RS256 credential produces a raw signature, not DER. - {"not DER", make([]byte, 64)}, - } { - t.Run(tc.name, func(t *testing.T) { - if _, err := RecoverPublicKey(ad, cd, tc.sig, ad, cd, good); err == nil { - t.Errorf("RecoverPublicKey(%v) = nil error, want error", tc.name) - } - }) - } -} - -func TestRecoverPublicKeyRejectsMismatchedKeys(t *testing.T) { - privA, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - privB, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - ad1, cd1, sig1 := signAssertion(t, privA, "one") - ad2, cd2, sig2 := signAssertion(t, privB, "two") - - // Two valid assertions from two different keys must not resolve to either. - if _, err := RecoverPublicKey(ad1, cd1, sig1, ad2, cd2, sig2); err == nil { - t.Error("RecoverPublicKey with two different keys = nil error, want error") - } -} - -func TestRecoverPublicKeyRejectsTamperedAuthData(t *testing.T) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - ad1, cd1, sig1 := signAssertion(t, priv, "one") - ad2, cd2, sig2 := signAssertion(t, priv, "two") - - // A signature that doesn't cover the data it is presented with recovers - // some other public key, which then can't match the second assertion. - if _, err := RecoverPublicKey(append(ad1, 'x'), cd1, sig1, ad2, cd2, sig2); err == nil { - t.Error("RecoverPublicKey with tampered authData = nil error, want error") - } -} - -func TestVerifyClientData(t *testing.T) { - challenge := []byte("0123456789abcdef") - encoded := base64.RawURLEncoding.EncodeToString(challenge) - // Mutate the last character's unused padding bits so standard RawURLEncoding - // would decode it to the same bytes, but Strict() rejects it. - nonCanonical := encoded[:len(encoded)-1] + "h" - - for _, tc := range []struct { - name string - js string - wantErr bool - }{ - {"ok", `{"type":"webauthn.get","challenge":"` + encoded + `"}`, false}, - {"ok crossOrigin false", `{"type":"webauthn.get","challenge":"` + encoded + `","crossOrigin":false}`, false}, - {"crossOrigin true", `{"type":"webauthn.get","challenge":"` + encoded + `","crossOrigin":true}`, true}, - {"non-canonical base64url", `{"type":"webauthn.get","challenge":"` + nonCanonical + `"}`, true}, - {"wrong type", `{"type":"webauthn.create","challenge":"` + encoded + `"}`, true}, - {"wrong challenge", `{"type":"webauthn.get","challenge":"` + base64.RawURLEncoding.EncodeToString([]byte("nope")) + `"}`, true}, - {"missing challenge", `{"type":"webauthn.get"}`, true}, - {"unparsable challenge", `{"type":"webauthn.get","challenge":"!!!!"}`, true}, - {"not json", `nope`, true}, - } { - t.Run(tc.name, func(t *testing.T) { - _, err := verifyClientData([]byte(tc.js), "webauthn.get", challenge) - if got := err != nil; got != tc.wantErr { - t.Errorf("verifyClientData() error = %v, wantErr %v", err, tc.wantErr) - } - }) - } -} - -func TestParseAuthenticatorData(t *testing.T) { - rpHash := sha256.Sum256([]byte("example.com")) - makeAuthData := func(flags byte, counter uint32, tail []byte) []byte { - var b cryptobyte.Builder - b.AddBytes(rpHash[:]) - b.AddUint8(flags) - b.AddUint32(counter) - b.AddBytes(tail) - return b.BytesOrPanic() - } - - // Valid minimal authenticatorData (UP=1) - var ad authenticatorData - if err := parseAuthenticatorData(makeAuthData(0x01, 7, nil), &ad); err != nil { - t.Fatalf("parseAuthenticatorData(minimal) failed: %v", err) - } - if !ad.UserPresence || ad.SignCount != 7 || len(ad.Extensions) != 0 { - t.Errorf("unexpected parsed authenticatorData: %+v", ad) - } - - // Trailing bytes without ED/AT flags must be rejected - if err := parseAuthenticatorData(makeAuthData(0x01, 7, []byte{0x00}), &ad); err == nil { - t.Error("parseAuthenticatorData with trailing bytes succeeded; want error") - } - - // Valid CBOR extension map {1: true} -> 0xa1 0x01 0xf5 - cborExt := []byte{0xa1, 0x01, 0xf5} - var adExt authenticatorData - if err := parseAuthenticatorData(makeAuthData(0x81, 8, cborExt), &adExt); err != nil { - t.Fatalf("parseAuthenticatorData(with extensions) failed: %v", err) - } - if !adExt.ExtensionData || !bytes.Equal(adExt.Extensions, cborExt) { - t.Errorf("parseAuthenticatorData extensions = %x, want %x", adExt.Extensions, cborExt) - } - - // ED flag set but no extension bytes - if err := parseAuthenticatorData(makeAuthData(0x81, 8, nil), &adExt); err == nil { - t.Error("parseAuthenticatorData(ED=1, empty) succeeded; want error") - } - - // ED flag set with trailing bytes after CBOR object - if err := parseAuthenticatorData(makeAuthData(0x81, 8, append(append([]byte(nil), cborExt...), 0x00)), &adExt); err == nil { - t.Error("parseAuthenticatorData(ED=1, trailing bytes) succeeded; want error") - } - - // ED flag set with non-map CBOR item (e.g., integer 1 -> 0x01) must be rejected - if err := parseAuthenticatorData(makeAuthData(0x81, 8, []byte{0x01}), &adExt); err == nil { - t.Error("parseAuthenticatorData(ED=1, non-map CBOR) succeeded; want error") - } -} - -func TestIsPrintableASCII(t *testing.T) { - for _, tc := range []struct { - in string - want bool - }{ - {"", true}, - {"default", true}, - {"my key 1", true}, - {"~!@#$%^&*()", true}, - {"caf\xc3\xa9", false}, - {"caf\xc3", false}, // truncated multi-byte rune - {"tab\there", false}, - {"nl\n", false}, - {"nul\x00", false}, - {"del\x7f", false}, - } { - if got := isPrintableASCII(tc.in); got != tc.want { - t.Errorf("isPrintableASCII(%q) = %v, want %v", tc.in, got, tc.want) - } - } -} - -func TestKeyMarshalUnmarshal(t *testing.T) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - orig := &Key{ - typ: ecdsa256KeyType, - id: []byte("credential-id-12345"), - rpID: []byte("ssh:default"), - pubKey: &priv.PublicKey, - } - passphrase := "secret-passphrase" - rp := func(string) (string, error) { return passphrase, nil } - - // Round-trip without passphrase - block, err := orig.MarshalPrivate("") - if err != nil { - t.Fatalf("MarshalPrivate(\"\"): %v", err) - } - got, err := Unmarshal(pem.EncodeToMemory(block), "test", rp) - if err != nil { - t.Fatalf("Unmarshal(unencrypted): %v", err) - } - if got.typ != orig.typ || !bytes.Equal(got.rpID, orig.rpID) || !bytes.Equal(got.id, orig.id) { - t.Errorf("Unmarshal(unencrypted) mismatch: got %+v, want %+v", got, orig) - } - - // Round-trip with passphrase - block, err = orig.MarshalPrivate(passphrase) - if err != nil { - t.Fatalf("MarshalPrivate(passphrase): %v", err) - } - got, err = Unmarshal(pem.EncodeToMemory(block), "test", rp) - if err != nil { - t.Fatalf("Unmarshal(passphrase): %v", err) - } - if got.typ != orig.typ || !bytes.Equal(got.rpID, orig.rpID) || !bytes.Equal(got.id, orig.id) { - t.Errorf("Unmarshal(passphrase) mismatch: got %+v, want %+v", got, orig) - } - - // Tampered pubBytes must fail AES-GCM authentication (AAD binding) - pubLen := int(binary.BigEndian.Uint16(block.Bytes[1:3])) - // Flip a bit in the application string at the end of pubBytes so UnmarshalPublic still succeeds - tampered := append([]byte(nil), block.Bytes...) - tampered[1+2+pubLen-1] ^= 0x01 - tamperedPEM := pem.EncodeToMemory(&pem.Block{Type: block.Type, Bytes: tampered}) - if _, err := Unmarshal(tamperedPEM, "test", rp); err == nil { - t.Error("Unmarshal with tampered pubBytes succeeded; want AAD failure") - } - - // Downgrading a v2 key to v1 must also fail AES-GCM authentication - downgraded := append([]byte(nil), block.Bytes...) - downgraded[0] = 1 - downgradedPEM := pem.EncodeToMemory(&pem.Block{Type: block.Type, Bytes: downgraded}) - if _, err := Unmarshal(downgradedPEM, "test", rp); err == nil { - t.Error("Unmarshal with v2->v1 version downgrade succeeded; want AAD failure") - } - - // Backward compatibility: a legacy v1 encrypted key (sealed with nil AAD) still unmarshals - pubBytes := orig.Marshal() - salt := make([]byte, 16) - rand.Read(salt) - dk := pbkdf2.Key([]byte(passphrase), salt, minIter, 32, sha256.New) - cBlock, err := aes.NewCipher(dk) - if err != nil { - t.Fatalf("aes.NewCipher: %v", err) - } - gcm, err := cipher.NewGCM(cBlock) - if err != nil { - t.Fatalf("cipher.NewGCM: %v", err) - } - nonce := make([]byte, gcm.NonceSize()) - rand.Read(nonce) - encIDv1 := gcm.Seal(nonce, nonce, orig.id, nil) - v1Buf := cryptobyte.NewBuilder([]byte{1}) - v1Buf.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(pubBytes) - }) - v1Buf.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(salt) - b.AddUint32(uint32(minIter)) - b.AddBytes(encIDv1) - }) - v1PEM := pem.EncodeToMemory(&pem.Block{Type: "WEBAUTHN ENCRYPTED KEY", Bytes: v1Buf.BytesOrPanic()}) - gotV1, err := Unmarshal(v1PEM, "test", rp) - if err != nil { - t.Fatalf("Unmarshal(legacy v1): %v", err) - } - if gotV1.typ != orig.typ || !bytes.Equal(gotV1.rpID, orig.rpID) || !bytes.Equal(gotV1.id, orig.id) { - t.Errorf("Unmarshal(legacy v1) mismatch: got %+v, want %+v", gotV1, orig) - } - - // Backward compatibility: a legacy v2 encrypted key whose pubBytes used - // "webauthn-sk-ecdsa-sha2-nistp256@openssh.com" as the public key type - // still unmarshals (preserving AAD verification) and normalizes its Type() - // to "sk-ecdsa-sha2-nistp256@openssh.com". - legacyKey := &Key{ - typ: webauthnSignatureFormat, - id: orig.id, - rpID: orig.rpID, - pubKey: orig.pubKey, - } - legacyBlock, err := legacyKey.MarshalPrivate(passphrase) - if err != nil { - t.Fatalf("legacyKey.MarshalPrivate: %v", err) - } - gotLegacy, err := Unmarshal(pem.EncodeToMemory(legacyBlock), "test", rp) - if err != nil { - t.Fatalf("Unmarshal(legacy v2 key type): %v", err) - } - if gotLegacy.Type() != ecdsa256KeyType || !bytes.Equal(gotLegacy.rpID, orig.rpID) || !bytes.Equal(gotLegacy.id, orig.id) { - t.Errorf("Unmarshal(legacy v2 key type) mismatch: got %+v, want %+v", gotLegacy, orig) - } - - // Iteration count below minIter or above maxIter must be rejected - iterOffset := 1 + 2 + pubLen + 2 + 16 - for _, badIter := range []uint32{0, 1, 999, maxIter + 1} { - badBytes := append([]byte(nil), block.Bytes...) - binary.BigEndian.PutUint32(badBytes[iterOffset:iterOffset+4], badIter) - badPEM := pem.EncodeToMemory(&pem.Block{Type: block.Type, Bytes: badBytes}) - if _, err := Unmarshal(badPEM, "test", rp); err == nil { - t.Errorf("Unmarshal with numIter=%d succeeded; want error", badIter) - } - } - - // Encrypted key with nil passphrase callback must return an error, not panic - if _, err := Unmarshal(pem.EncodeToMemory(block), "test", nil); err == nil { - t.Error("Unmarshal(encrypted, nil rp) succeeded; want error") - } - - // Trailing bytes after privBytes in outer binary container must be rejected - trailingPEM := pem.EncodeToMemory(&pem.Block{ - Type: block.Type, - Bytes: append(append([]byte(nil), block.Bytes...), 0x00), - }) - if _, err := Unmarshal(trailingPEM, "test", rp); err == nil { - t.Error("Unmarshal with trailing container bytes succeeded; want error") - } -} - -func TestCertificateSigning(t *testing.T) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - key := &Key{ - typ: ecdsa256KeyType, - id: []byte("credential-id-12345"), - rpID: []byte("example.com"), - pubKey: &priv.PublicKey, - } - - // Marshal as authorized_keys line and parse with standard golang.org/x/crypto/ssh. - authKey := ssh.MarshalAuthorizedKey(key) - parsedPub, _, _, _, err := ssh.ParseAuthorizedKey(authKey) - if err != nil { - t.Fatalf("ssh.ParseAuthorizedKey: %v", err) - } - if !bytes.Equal(parsedPub.Marshal(), key.Marshal()) { - t.Fatalf("parsed public key bytes do not match key.Marshal()") - } - - // Sign an SSH user certificate for the WebAuthn public key. - _, caPriv, err := ed25519.GenerateKey(rand.Reader) - if err != nil { - t.Fatalf("ed25519.GenerateKey: %v", err) - } - caSigner, err := ssh.NewSignerFromKey(caPriv) - if err != nil { - t.Fatalf("ssh.NewSignerFromKey: %v", err) - } - cert := &ssh.Certificate{ - Key: parsedPub, - Serial: 1, - CertType: ssh.UserCert, - KeyId: "testuser", - ValidPrincipals: []string{"testuser"}, - ValidBefore: ssh.CertTimeInfinity, - } - if err := cert.SignCert(rand.Reader, caSigner); err != nil { - t.Fatalf("cert.SignCert: %v", err) - } - if got, want := cert.Type(), ssh.CertAlgoSKECDSA256v01; got != want { - t.Errorf("cert.Type() = %q, want %q", got, want) - } - - // Verify the marshaled certificate parses back and matches key.Marshal(). - parsedCertKey, _, _, _, err := ssh.ParseAuthorizedKey(ssh.MarshalAuthorizedKey(cert)) - if err != nil { - t.Fatalf("ssh.ParseAuthorizedKey(cert): %v", err) - } - parsedCert, ok := parsedCertKey.(*ssh.Certificate) - if !ok { - t.Fatalf("parsed key is %T, want *ssh.Certificate", parsedCertKey) - } - if !bytes.Equal(parsedCert.Key.Marshal(), key.Marshal()) { - t.Errorf("parsedCert.Key.Marshal() does not match key.Marshal()") - } -} - -func TestKeyVerify(t *testing.T) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - key := &Key{ - typ: ecdsa256KeyType, - id: []byte("credential-id-12345"), - rpID: []byte("example.com"), - pubKey: &priv.PublicKey, - } - data := []byte("ssh-session-data-to-sign") - appHash := sha256.Sum256(key.rpID) - flags := byte(0x05) - counter := uint32(42) - - // 1. Verify webauthn-sk-ecdsa-sha2-nistp256@openssh.com signature. - origin := "https://example.com" - clientData := fmt.Sprintf(`{"type":"webauthn.get","challenge":%q,"origin":%q}`, - base64.RawURLEncoding.EncodeToString(data), origin) - cdHash := sha256.Sum256([]byte(clientData)) - - var webauthnSigned cryptobyte.Builder - webauthnSigned.AddBytes(appHash[:]) - webauthnSigned.AddUint8(flags) - webauthnSigned.AddUint32(counter) - webauthnSigned.AddBytes(cdHash[:]) - webauthnHash := sha256.Sum256(webauthnSigned.BytesOrPanic()) - r, s, err := ecdsa.Sign(rand.Reader, priv, webauthnHash[:]) - if err != nil { - t.Fatalf("ecdsa.Sign: %v", err) - } - webauthnSig := &ssh.Signature{ - Format: webauthnSignatureFormat, - Blob: ssh.Marshal(struct{ R, S *big.Int }{r, s}), - Rest: ssh.Marshal(struct { - Flags byte - Counter uint32 - Origin string - ClientData string - Extensions string - }{ - Flags: flags, - Counter: counter, - Origin: origin, - ClientData: clientData, - }), - } - if err := key.Verify(data, webauthnSig); err != nil { - t.Errorf("key.Verify(webauthnSig) failed: %v", err) - } - if err := key.Verify([]byte("wrong-data"), webauthnSig); err == nil { - t.Error("key.Verify(wrong-data) succeeded; want error") - } - - // 2. Verify sk-ecdsa-sha2-nistp256@openssh.com signature. - dataHash := sha256.Sum256(data) - var skSigned cryptobyte.Builder - skSigned.AddBytes(appHash[:]) - skSigned.AddUint8(flags) - skSigned.AddUint32(counter) - skSigned.AddBytes(dataHash[:]) - skHash := sha256.Sum256(skSigned.BytesOrPanic()) - r2, s2, err := ecdsa.Sign(rand.Reader, priv, skHash[:]) - if err != nil { - t.Fatalf("ecdsa.Sign: %v", err) - } - skSig := &ssh.Signature{ - Format: ecdsa256KeyType, - Blob: ssh.Marshal(struct{ R, S *big.Int }{r2, s2}), - Rest: ssh.Marshal(struct { - Flags byte - Counter uint32 - }{ - Flags: flags, - Counter: counter, - }), - } - if err := key.Verify(data, skSig); err != nil { - t.Errorf("key.Verify(skSig) failed: %v", err) - } - if err := key.Verify([]byte("wrong-data"), skSig); err == nil { - t.Error("key.Verify(wrong-data) succeeded; want error") - } - - // 3. Verify WebAuthn signature with extensions (flags 0x85) succeeds. - extBytes := string([]byte{0xa1, 0x01, 0xf5}) - var extSigned cryptobyte.Builder - extSigned.AddBytes(appHash[:]) - extSigned.AddUint8(0x85) - extSigned.AddUint32(counter) - extSigned.AddBytes([]byte(extBytes)) - extSigned.AddBytes(cdHash[:]) - extHash := sha256.Sum256(extSigned.BytesOrPanic()) - rExt, sExt, err := ecdsa.Sign(rand.Reader, priv, extHash[:]) - if err != nil { - t.Fatalf("ecdsa.Sign: %v", err) - } - extSig := &ssh.Signature{ - Format: webauthnSignatureFormat, - Blob: ssh.Marshal(struct{ R, S *big.Int }{rExt, sExt}), - Rest: ssh.Marshal(struct { - Flags byte - Counter uint32 - Origin string - ClientData string - Extensions string - }{ - Flags: 0x85, - Counter: counter, - Origin: origin, - ClientData: clientData, - Extensions: extBytes, - }), - } - if err := key.Verify(data, extSig); err != nil { - t.Errorf("key.Verify(extSig) failed: %v", err) - } - - // 4. Negative cases for WebAuthn & SK signature flags, origin, and clientData. - signWebAuthn := func(f byte, orig, cd, ext string) *ssh.Signature { - h := sha256.Sum256([]byte(cd)) - var b cryptobyte.Builder - b.AddBytes(appHash[:]) - b.AddUint8(f) - b.AddUint32(counter) - b.AddBytes([]byte(ext)) - b.AddBytes(h[:]) - digest := sha256.Sum256(b.BytesOrPanic()) - rr, ss, err := ecdsa.Sign(rand.Reader, priv, digest[:]) - if err != nil { - t.Fatalf("ecdsa.Sign: %v", err) - } - return &ssh.Signature{ - Format: webauthnSignatureFormat, - Blob: ssh.Marshal(struct{ R, S *big.Int }{rr, ss}), - Rest: ssh.Marshal(struct { - Flags byte - Counter uint32 - Origin string - ClientData string - Extensions string - }{ - Flags: f, - Counter: counter, - Origin: orig, - ClientData: cd, - Extensions: ext, - }), - } - } - - b64Chall := base64.RawURLEncoding.EncodeToString(data) - for _, tc := range []struct { - name string - sig *ssh.Signature - }{ - { - name: "webauthn missing UP flag", - sig: signWebAuthn(0x04, origin, clientData, ""), - }, - { - name: "webauthn AT flag set", - sig: signWebAuthn(0x41, origin, clientData, ""), - }, - { - name: "webauthn ED flag set with empty extensions", - sig: signWebAuthn(0x81, origin, clientData, ""), - }, - { - name: "webauthn ED flag clear with non-empty extensions", - sig: signWebAuthn(0x01, origin, clientData, extBytes), - }, - { - name: "webauthn invalid origin scheme", - sig: signWebAuthn(0x01, "ftp://example.com", fmt.Sprintf(`{"type":"webauthn.get","challenge":%q,"origin":"ftp://example.com"}`, b64Chall), ""), - }, - { - name: "webauthn crossOrigin true", - sig: signWebAuthn(0x01, origin, fmt.Sprintf(`{"type":"webauthn.get","challenge":%q,"origin":%q,"crossOrigin":true}`, b64Chall, origin), ""), - }, - { - name: "webauthn reordered clientData fields", - sig: signWebAuthn(0x01, origin, fmt.Sprintf(`{"origin":%q,"type":"webauthn.get","challenge":%q}`, origin, b64Chall), ""), - }, - } { - t.Run(tc.name, func(t *testing.T) { - if err := key.Verify(data, tc.sig); err == nil { - t.Errorf("key.Verify(%s) succeeded; want error", tc.name) - } - }) - } - - // SK signature missing UP flag (0x00) must also fail - var skNoUP cryptobyte.Builder - skNoUP.AddBytes(appHash[:]) - skNoUP.AddUint8(0x00) - skNoUP.AddUint32(counter) - skNoUP.AddBytes(dataHash[:]) - skNoUPHash := sha256.Sum256(skNoUP.BytesOrPanic()) - rNoUP, sNoUP, err := ecdsa.Sign(rand.Reader, priv, skNoUPHash[:]) - if err != nil { - t.Fatalf("ecdsa.Sign: %v", err) - } - skNoUPSig := &ssh.Signature{ - Format: ecdsa256KeyType, - Blob: ssh.Marshal(struct{ R, S *big.Int }{rNoUP, sNoUP}), - Rest: ssh.Marshal(struct { - Flags byte - Counter uint32 - }{ - Flags: 0x00, - Counter: counter, - }), - } - if err := key.Verify(data, skNoUPSig); err == nil { - t.Error("key.Verify(sk missing UP flag) succeeded; want error") - } -} diff --git a/xterm/package-lock.json b/xterm/package-lock.json index 85df688..5b2be03 100644 --- a/xterm/package-lock.json +++ b/xterm/package-lock.json @@ -1573,9 +1573,9 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", "dev": true, "license": "MIT", "engines": { @@ -1702,9 +1702,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.68.2.tgz", - "integrity": "sha512-ItKrNMkEL3hy85kLBXwB0+M6CWWVI8vr7RV+Eb7oDlQIMXLaiEhGfdaj5jAUadYn2v3nwzAhIRl/nLyjAqV9vQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.68.4.tgz", + "integrity": "sha512-8AfICPTDNFpsRltDrWzlX3iVEwHubamhXc10bjOJRCl4eZXj+BE25uCVMYzFpbcqfuxSfrt4VkSVL5QqiHoVDQ==", "cpu": [ "arm" ], @@ -1716,9 +1716,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.68.2.tgz", - "integrity": "sha512-dCkT8BMPLo6X6GCFVtuzrnr981PpJSeK4ZO/d/mZdJ/ao61Qa1Usd/OHIQ69MQgw4qQclR/X6uRRUONiWwD8cw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.68.4.tgz", + "integrity": "sha512-Vs4CxDXeCrCVNZ9jPnicohYT7aX7cxLzjMepkno/7f1zFhC80OUsKHM03BJsusLfYnjKrUe7D8vPvQNdD+rjCg==", "cpu": [ "arm64" ], @@ -1730,9 +1730,9 @@ ] }, "node_modules/@rollup/rollup-android-x64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-x64/-/rollup-android-x64-4.68.2.tgz", - "integrity": "sha512-p2jkKiscqQOGmyL6qu+KvJctvBc3SQTd+Xi2lQYn5QvFLEWz+QI8Z9iI+xcIjez6vKRsSnWP56Y3Ep7g3Stiug==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-x64/-/rollup-android-x64-4.68.4.tgz", + "integrity": "sha512-EEytXPqw9k5OIyx1Cou+Xg8XhTwtWW31WIGq1cWTpX05ek6STIprxJ5wY6cOEZAk5sjXM/mE2/JohNhtUiPukg==", "cpu": [ "x64" ], @@ -1744,9 +1744,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.68.2.tgz", - "integrity": "sha512-aVIfOteo5zoX8aL742H/S3QsyN6aokNYjdzrLnQBKxgRVoh4cibTErpi61RzSmrv2hBzDB1i751hwwdc8QK0vQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.68.4.tgz", + "integrity": "sha512-eRYMGvFdL3TKnaXlacxifKMltpLxehT0XghbV5pPfzJUNCc+psia9rg/scZZPfeDK+VKpSZx9VoMz236yeYEaQ==", "cpu": [ "arm64" ], @@ -1758,9 +1758,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.68.2.tgz", - "integrity": "sha512-+Wuf4TFTHiE/WnjKgH1SkNf/9D5ddoed1UR0p3jxjNAGemdeeQRL+r1bJ1LlZyha0VKDBYLB2U/a9a9KlSw4Kw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.68.4.tgz", + "integrity": "sha512-w+E1P+Ul1PgoAiH22tcONSEyx+3VjUcSIZeqr1QSOSC5vvawduMVtgD1ZtfQsPHkpTN/VJekrgN3JL2+YKhaDQ==", "cpu": [ "x64" ], @@ -1772,9 +1772,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.68.2.tgz", - "integrity": "sha512-feKK2dc13j/6D9mAp7XKhBM/VUqn0N/xRgP6rT7/mdRVVJUaeZ4lsJ9hN90aTi0k3OD+mkjlcN01vQ96Ac9VzQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.68.4.tgz", + "integrity": "sha512-nukgdVNAx7X07qu8nZjJwuCRW/yDjLIio83yXhKUkuUUXTlmEGjVRN+XxrzxnkhiTRfHnqC/OYAga3t7vMQkAw==", "cpu": [ "arm64" ], @@ -1786,9 +1786,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.68.2.tgz", - "integrity": "sha512-s1oGXPGX1PNqdi9TLWD+RwtPEYf/BOTbCcq4anJBqNbzyjucti86ldYH37eKvsyTP7Bl5/Hf8XmbIxCz/iafTA==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.68.4.tgz", + "integrity": "sha512-o5vn+twqv2XwxEpseC76YCNXpCXoRlPmr+ZYpSnmlxbFh5kdHysap9V93cS1hzAXtK6xuXa5kdtS+/8rkUfs4Q==", "cpu": [ "x64" ], @@ -1800,9 +1800,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.68.2.tgz", - "integrity": "sha512-ksR3ZmzHrm6HOUP8UlDBy5hNTcG9cEIa3EyGnxn5BjorLRjBh4ucxhwjwwVEm0dqcIN4Egc/XjDUiPQwN1ic9A==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.68.4.tgz", + "integrity": "sha512-b2w9laiL8oWofYqGF+ABzin9wNMPxzHRD21EIPJ5A0iniq19d3flE4UP7uZKl1gj+d3Kv/bt1htVUSzI0bE1TQ==", "cpu": [ "arm" ], @@ -1814,9 +1814,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.68.2.tgz", - "integrity": "sha512-STZVVBM35wULVsQah0xKfCBQMPpHliOfjnRaUNT35jrbpfapUrD8ix6Yhl7tLHW0xQSWotXSSghjUi/DclwRSw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.68.4.tgz", + "integrity": "sha512-Ao858LxFnvGrn4qbin3rr+LmEhOrF9pQKgzEnT14f9KjOpytd5smOuj7OOtkejJ7YVb5cBdPpYdT1zjwNcNq9g==", "cpu": [ "arm" ], @@ -1828,9 +1828,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.68.2.tgz", - "integrity": "sha512-Fm/GPC2R0zlJYQIp9aY9L1lO2z+P+UrcvXG6fhubfo/BbMOLZlLXshnbECOTqr3pxfZFb6nNn0QgDETDtrX7TQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.68.4.tgz", + "integrity": "sha512-B78SoWLJeAleSOIDFZ+twb+7DoBla0g73LrdkxlkNwicAsrLfHeYX+NcPlOmxZ3Z8vKVvj0J/kmIMzEaqbQNGg==", "cpu": [ "arm64" ], @@ -1842,9 +1842,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.68.2.tgz", - "integrity": "sha512-VoqlckWcwNF3WqsUkLZg91zYFgBvrC37Lc5e8AU+BKdCUFDMPoN0Rsin/LvF+rBVF527gWo5KT0oHkaAZaL1GA==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.68.4.tgz", + "integrity": "sha512-IK0JVhVLGer5AlmgU0eMbfuldxO1wNACZBwyq+ot9UW899hhkWPcO3k0eIrNlqmuWrySvMtzr7GK9xkbNekOTQ==", "cpu": [ "arm64" ], @@ -1856,9 +1856,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.68.2.tgz", - "integrity": "sha512-Zr8X/SUf7Jjwxt99BqPDF/Wq+sz4oUBIP6HBaFQWwb8wO1nV6LBIpD6jB9cMybLho93Z+B8rrN0uXEL6oNOUJQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.68.4.tgz", + "integrity": "sha512-6MoYXMYy+6eqtVesSNehfsS3LY4A0P8MpHfhcnMkVsWVhaLv0vvuCj2EGkanchIoyHxAmxY+aR3ankaTkokC2A==", "cpu": [ "loong64" ], @@ -1870,9 +1870,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.68.2.tgz", - "integrity": "sha512-2EhrYEJNXIyhSZESwm/kCke1tiH7QAPOU3v3MsLM9J+Nfn2QCDe/pGROUAvYFK0BL2MEbzNgfrqrbnE5CFXkLw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.68.4.tgz", + "integrity": "sha512-mo+MC3fHiG4EOdtp7uGSvBv/4hKpqxhV16QGpXn2D0mTBBiOW6hGIOXUK7nck8THlURRWjYdtUPvvJfxHKZ/2w==", "cpu": [ "loong64" ], @@ -1884,9 +1884,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.68.2.tgz", - "integrity": "sha512-IC0dYuEQknw0m2FYBNBKlbrgBJBH5OMRiaRfCc4CFSpYnmDnqTpNSv+TgX+loezGTdRjBNZuYZi3t+Oc5NxNYg==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.68.4.tgz", + "integrity": "sha512-uBRu6ztHsmoW/10bPsOVbhW8ie4Puw6+CQD/XLRGqr3ugv6pRNm3b4vebiwouhCgkjJ/ItJdqHKJ3mVhpr/wQA==", "cpu": [ "ppc64" ], @@ -1898,9 +1898,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.68.2.tgz", - "integrity": "sha512-Zlzm6fGuDvtAqMEl071/g17vxq6u2Y2v/rON/gDY4NvzWLJ41BGAlwhF3QuAzwq05zIPo4LYzdqwhx3oisYCUw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.68.4.tgz", + "integrity": "sha512-XNY+QlYWmhqzeiMdOKjziVnx6aP5cXSxbk4rDqbb+MH2IcNiIZWX1wPRfAVV6ntiM17XHJJ2WUNcxnglDNH69A==", "cpu": [ "ppc64" ], @@ -1912,9 +1912,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.68.2.tgz", - "integrity": "sha512-KhEpYRtHZ3Kj4shavjXeH+K1bQlA6UbP6MJ45rMPF/11JlZb1SRNLeuWCdigUEoMMaFO4+LwwcS+ew1SoLJu/g==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.68.4.tgz", + "integrity": "sha512-agahuMApMIOQgJMNEaJNtQRD+iUllqAvkF/V7WutWaBLTSeMgFd0urEo6m1scFmG0Cd+2zIPvnu2SWcKeuSB1Q==", "cpu": [ "riscv64" ], @@ -1926,9 +1926,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.68.2.tgz", - "integrity": "sha512-LPn9qvPsM/Ofd6Ekq3im6nB8Tk1ruJhTd3x/2bJkTR8m/XTsfxA+EU0RJ23WJqgJg123kitHAqbEK7B4cL1uPg==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.68.4.tgz", + "integrity": "sha512-1N+ysuGmcw/PAC4E5/vpotbjC7zHBMqOMJ+kdjkuvVGbj4Mkzu1/cNI4IMaU27VP6MWded1fQAU9ME2m/JmiUA==", "cpu": [ "riscv64" ], @@ -1940,9 +1940,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.68.2.tgz", - "integrity": "sha512-Q1+E+pzSP+FiXuIZtxKR+pK7l2KQ9gsM+VaFPv1LR277kp7l61crG46WGLKLLay3Js5cvyU9Keqdzxa1EcFO+g==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.68.4.tgz", + "integrity": "sha512-ZO0fVys5Rtut3W0FcpKl/T/CTuTgaujErjanLJHVSmqhWaXnPr1u1VAinHPb8ash+cHA8yMX4QnRbmXhrrXfAg==", "cpu": [ "s390x" ], @@ -1954,9 +1954,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.68.2.tgz", - "integrity": "sha512-3Btp4Lca/WzsmbaKu9Lh9d/XwyRDIegd/5khRBusHGw/Ll6SoF5Shn63OrjPdkLcpNi2PGDApXzNmxriRxGYjA==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.68.4.tgz", + "integrity": "sha512-a4T4Ji3Is/TCh4rUuV6ehDdSMp3hxLH/v7mP4VT0kVB90Hfr9GUHVAiJhiJ3iy+tJ4qpvIG4haP+HpivOyWYpw==", "cpu": [ "x64" ], @@ -1968,9 +1968,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.68.2.tgz", - "integrity": "sha512-5SKVaUiVs18+DGBnpg0mORGxgq/0udczngGxV/vf2nvK1djqpOKIxY/+8rBWxAbWGRE4RnnwxWabDwJN3pCwIQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.68.4.tgz", + "integrity": "sha512-I4FcDk1+t2w7/JwKakDbhOKvtP07Q8Y/jqaTTdgVklmfqTqmTwtIk254iSP4iCgXgQWThKm8CN67mDzPGDnpqw==", "cpu": [ "x64" ], @@ -1982,9 +1982,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.68.2.tgz", - "integrity": "sha512-KBpm48/lESsHgWd+dRlcy18APBYhXU4Jb6VlJoqbpWNwfpztFXwP22qVv9aHd3k1quSrmLeJwYLc7rpQ+BFZrw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.68.4.tgz", + "integrity": "sha512-kpekXvZs3E/21ps5tUiPbQggi4C8bCx4jBl2eAIaVTerC7eDLWJunZ6nRw3/K4r20E5Z5f1bmbrfSS6H8GRv+A==", "cpu": [ "x64" ], @@ -1996,9 +1996,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.68.2.tgz", - "integrity": "sha512-o0D0bfRW8QGA1Ph6OzqVHMq5LRu1xkr1iM7qQIXUSFuR60ddXeDhN9UR4bUBPLYsrT46sZwwgQa51TWtBV3r5g==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.68.4.tgz", + "integrity": "sha512-mrnM4nr22FidljIL4vGK1htFcxPNCjLK/g2LQvgpBbq8pKL/zHY1czntTDbtYjoaYWVFu+XX0P2r2h/7zwWlIw==", "cpu": [ "arm64" ], @@ -2010,9 +2010,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.68.2.tgz", - "integrity": "sha512-r17kcu5kmd6WQwokYmfBnfwM/icureCWCPjpJVALcrSv5Lfy6Ggk9azxXor6hILhCHbc/4IfEiv+L5RXaOHinA==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.68.4.tgz", + "integrity": "sha512-xKF6HKrBdrb3jpGFlGAGtNF6nMu/TGdnVO38durZTMQUaduIqH/aDIjyi7SXmXNDUXTfTMUEIGVwPQ5FuMhCLQ==", "cpu": [ "arm64" ], @@ -2024,9 +2024,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.68.2.tgz", - "integrity": "sha512-yUtOqq7ZrQoZ3WiHSR6QGTdOl4YgMHqXIYSBYU6siIcC0YF0pEwx7aGsPTm2mRwrmW6SMJkxzEdFm6wqXpmbNw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.68.4.tgz", + "integrity": "sha512-uu45X0jgiXEab6vcoWuPQLqhBPKUCZkXc+gv0oTI78mhn5DnQC2WGvNJ/s6Cnc68PvB/8vAtlE2dIHrpx/wySw==", "cpu": [ "ia32" ], @@ -2038,9 +2038,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.68.2.tgz", - "integrity": "sha512-5IYoWxQGo5WECbJbImIf2w33uCHJNLv4o/FQtSyeYDed7AC6zx84NsEcGYccoI2geDEYkrxUXcsYK/6EhwVSIg==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.68.4.tgz", + "integrity": "sha512-+sVn72CSCbAemlPieSHWpBsJR5vkWH/xQM0Px0loHUhscMNl3CuH0UwTHuzCIaamlv+ZTi1V44jEKQ45FUaNwg==", "cpu": [ "x64" ], @@ -2052,9 +2052,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.68.2.tgz", - "integrity": "sha512-ee+c14ggUiM7lg4PtCjSBYU9O9dHp4FFespRnd5yj7SilUBJCL3x3aHlB+sIqbGjcPo3pEyODASnfKJuZ26YBw==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.68.4.tgz", + "integrity": "sha512-/eMzhxPPUGd5vjHdaNtvxHbblmoe+DyvPnJkZ4uQrDlVq9PQSd8br4pWwamycwRcLoNEzXwFy2mzcGoZTYqU5A==", "cpu": [ "x64" ], @@ -2144,9 +2144,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.11.36", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.36.tgz", - "integrity": "sha512-AbPFGS4K9S3meMRCLTM0Zas+e9X7b5ygUBOboDT5zevCZt9ByKSbMtKhwyVqW+oL8WemPVsbP7X3rdZcIyOa0w==", + "version": "2.11.38", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.38.tgz", + "integrity": "sha512-rMgy5YW7x28SMfXHLlVZDBqlWzYZ0x2rVR/6FWrNBF0chjigARK1H6nM0hKA1Um3kPOlkQFVtjJs00d2N1ezuw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2167,9 +2167,9 @@ } }, "node_modules/browserslist": { - "version": "4.29.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz", - "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==", + "version": "4.29.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.6.tgz", + "integrity": "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w==", "dev": true, "funding": [ { @@ -2187,11 +2187,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.11.33", - "caniuse-lite": "^1.0.30001819", - "electron-to-chromium": "^1.5.464", - "node-releases": "^2.0.60", - "update-browserslist-db": "^1.3.4" + "baseline-browser-mapping": "^2.11.37", + "caniuse-lite": "^1.0.30001826", + "electron-to-chromium": "^1.5.486", + "node-releases": "^2.0.64", + "update-browserslist-db": "^1.4.0" }, "bin": { "browserslist": "cli.js" @@ -2281,9 +2281,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.481", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.481.tgz", - "integrity": "sha512-dNUsbAP6E2S1dHIYEuN3cQ0dViThjMtpVRheGdvv5HgHFtzLi4Cu4Mbzms85YggP3Eh2VVZTl5+XxEN8ofCbmQ==", + "version": "1.5.487", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.487.tgz", + "integrity": "sha512-qWotOhQYeYEj+DK4+Y+cfPj44qiC6ETIiWtJLfmDJydED2BJJ7loPA4SfBbbrMI6X/X3tryJgxnY9nxsO545Zw==", "dev": true, "license": "ISC" }, @@ -2533,9 +2533,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.63", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.63.tgz", - "integrity": "sha512-6li2QanLsAXpIH2R6j77MzRyvOyrvdTqlKtO4CgBdHGNvN99ZZfyxszHc5o5+IZBWD5u6Hzwg83JoGXmqZNG9Q==", + "version": "2.0.64", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.64.tgz", + "integrity": "sha512-zAPCKqMcnqs2nGy6nlkm7JduFseiBJy3EXHGLh+8pFR+TxGCBxxiEN21+UROU5CKwX/f4TlUcYjiM+vs/tsyxw==", "dev": true, "license": "MIT", "engines": { @@ -2660,9 +2660,9 @@ } }, "node_modules/rollup": { - "version": "4.68.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.68.2.tgz", - "integrity": "sha512-xzt45rKOxzEuqjTdkGTIEaePcq9xRELlFI1uoazlKap8T6bENJkONSCfhK51P6XFTixa4rosPcDHihSdduXndQ==", + "version": "4.68.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.68.4.tgz", + "integrity": "sha512-5acdO1/M9urvHQuZVkoOt8JWQH6XxCnFnox1qodE39qkXaML67S2E7MhHDgx3pQYycM1A5dRJwahYMDLO9a3Yg==", "dev": true, "license": "MIT", "dependencies": { @@ -2676,32 +2676,32 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.68.2", - "@rollup/rollup-android-arm64": "4.68.2", - "@rollup/rollup-android-x64": "4.68.2", - "@rollup/rollup-darwin-arm64": "4.68.2", - "@rollup/rollup-darwin-x64": "4.68.2", - "@rollup/rollup-freebsd-arm64": "4.68.2", - "@rollup/rollup-freebsd-x64": "4.68.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.68.2", - "@rollup/rollup-linux-arm-musleabihf": "4.68.2", - "@rollup/rollup-linux-arm64-gnu": "4.68.2", - "@rollup/rollup-linux-arm64-musl": "4.68.2", - "@rollup/rollup-linux-loong64-gnu": "4.68.2", - "@rollup/rollup-linux-loong64-musl": "4.68.2", - "@rollup/rollup-linux-ppc64-gnu": "4.68.2", - "@rollup/rollup-linux-ppc64-musl": "4.68.2", - "@rollup/rollup-linux-riscv64-gnu": "4.68.2", - "@rollup/rollup-linux-riscv64-musl": "4.68.2", - "@rollup/rollup-linux-s390x-gnu": "4.68.2", - "@rollup/rollup-linux-x64-gnu": "4.68.2", - "@rollup/rollup-linux-x64-musl": "4.68.2", - "@rollup/rollup-openbsd-x64": "4.68.2", - "@rollup/rollup-openharmony-arm64": "4.68.2", - "@rollup/rollup-win32-arm64-msvc": "4.68.2", - "@rollup/rollup-win32-ia32-msvc": "4.68.2", - "@rollup/rollup-win32-x64-gnu": "4.68.2", - "@rollup/rollup-win32-x64-msvc": "4.68.2", + "@rollup/rollup-android-arm-eabi": "4.68.4", + "@rollup/rollup-android-arm64": "4.68.4", + "@rollup/rollup-android-x64": "4.68.4", + "@rollup/rollup-darwin-arm64": "4.68.4", + "@rollup/rollup-darwin-x64": "4.68.4", + "@rollup/rollup-freebsd-arm64": "4.68.4", + "@rollup/rollup-freebsd-x64": "4.68.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.68.4", + "@rollup/rollup-linux-arm-musleabihf": "4.68.4", + "@rollup/rollup-linux-arm64-gnu": "4.68.4", + "@rollup/rollup-linux-arm64-musl": "4.68.4", + "@rollup/rollup-linux-loong64-gnu": "4.68.4", + "@rollup/rollup-linux-loong64-musl": "4.68.4", + "@rollup/rollup-linux-ppc64-gnu": "4.68.4", + "@rollup/rollup-linux-ppc64-musl": "4.68.4", + "@rollup/rollup-linux-riscv64-gnu": "4.68.4", + "@rollup/rollup-linux-riscv64-musl": "4.68.4", + "@rollup/rollup-linux-s390x-gnu": "4.68.4", + "@rollup/rollup-linux-x64-gnu": "4.68.4", + "@rollup/rollup-linux-x64-musl": "4.68.4", + "@rollup/rollup-openbsd-x64": "4.68.4", + "@rollup/rollup-openharmony-arm64": "4.68.4", + "@rollup/rollup-win32-arm64-msvc": "4.68.4", + "@rollup/rollup-win32-ia32-msvc": "4.68.4", + "@rollup/rollup-win32-x64-gnu": "4.68.4", + "@rollup/rollup-win32-x64-msvc": "4.68.4", "fsevents": "~2.3.2" } }, @@ -2773,9 +2773,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz", - "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.4.0.tgz", + "integrity": "sha512-WPJuOnjI9FWDct4fB+ej4Mz8opLaw5CDcZ2t44tFZ0vIQVYWzBhWR3mkixuUj/A7+vY4V9+ApOZ2YYLwdgq46w==", "dev": true, "funding": [ { From 85a3917c2fdabb362e8b73f58f5a90ae715f7d7f Mon Sep 17 00:00:00 2001 From: Robin Thellend Date: Tue, 17 Nov 2026 06:45:19 -0800 Subject: [PATCH 2/2] cbor is still there --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b3df7d..ecf31d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ * Migrate to github.com/c2FmZQ/webauthn * Update go dependencies: - * removed github.com/fxamacker/cbor/v2 v2.10.0 * added github.com/c2FmZQ/webauthn v0.0.0-20261117022304-9643eefd1e03 * upgraded github.com/chromedp/cdproto v0.159.3 => v0.160.3 * upgraded github.com/chromedp/chromedp v0.23.0 => v0.23.1