Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: accept Safari's unrequested appid=false on passkey assertions (#4208)
Kyle Mendella7db1aeafd3a
diff --git a/backend/internal/passkey/service.go b/backend/internal/passkey/service.goindex 5c97285ad..83085491a 100644--- a/backend/internal/passkey/service.go+++ b/backend/internal/passkey/service.go@@ -24,6 +24,7 @@ import ("emperror.dev/errors""github.com/getarcaneapp/arcane/backend/v2/internal/config""github.com/getarcaneapp/arcane/backend/v2/internal/database"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/utils""github.com/getarcaneapp/arcane/backend/v2/resources""github.com/getarcaneapp/arcane/types/v2/auth""github.com/go-webauthn/webauthn/protocol"@@ -561,6 +562,7 @@ func (s *passkeyService) FinishPasskeyLogin(ctx context.Context, ceremonyID strislog.WarnContext(ctx, "passkey login validation failed", "stage", "parse", "error", err)return nil, ErrPasskeyResponse}+ utils.NormalizePasskeyAssertionExtensions(session.Extensions, parsed)var resolved *webAuthnUseruser, credential, err := s.webAuthn.ValidatePasskeyLogin(func(_ []byte, userHandle []byte) (webauthn.User, error) {@@ -1151,6 +1153,7 @@ func (s *passkeyService) finishKnownUserAssertionInternal(ctx context.Context, tif err != nil {return nil, ErrPasskeyResponse}+ utils.NormalizePasskeyAssertionExtensions(session.Extensions, parsed)credential, err := s.webAuthn.ValidateLogin(adapter, session, parsed)if err != nil || credential == nil {return nil, ErrPasskeyResponsediff --git a/backend/pkg/utils/webauthn.go b/backend/pkg/utils/webauthn.gonew file mode 100644index 000000000..4f7cd2389--- /dev/null+++ b/backend/pkg/utils/webauthn.go@@ -0,0 +1,23 @@+package utils++import (+ "slices"++ "github.com/go-webauthn/webauthn/protocol"+)++// NormalizePasskeyAssertionExtensions drops an unrequested appid=false output, which Safari+// reports even though it means the legacy AppID was not used.+func NormalizePasskeyAssertionExtensions(session protocol.SessionExtensions, assertion *protocol.ParsedCredentialAssertionData) {+ if assertion == nil {+ return+ }+ appID := assertion.ClientExtensionResults.AppID+ if appID == nil || *appID {+ return+ }+ if session.AppID != "" || slices.Contains(session.Requested, protocol.ExtensionAppID) {+ return+ }+ assertion.ClientExtensionResults.AppID = nil+}