mirror of
https://github.com/outline/outline.git
synced 2026-12-04 18:34:54 +03:00
fix: Passkey sign-in fails in Safari with security keys (#14727)
* fix: Accept form-encoded boolean extension results in passkey authentication * fix: Make passkey boolean string validation case-sensitive
This commit is contained in:
1 parent
578bf73e6b
commit
04e5efc51a
2 files changed
+33
-2
No files matched your search
@@ -358,4 +358,29 @@ describe("#passkeys.verifyAuthentication", () => {
|
||||
"No authentication challenge found or challenge expired"
|
||||
);
|
||||
});
|
||||
|
||||
it("should accept boolean extension results sent as form strings", async () => {
|
||||
const options = await server.post(
|
||||
"/auth/passkeys.generateAuthenticationOptions",
|
||||
{ body: {} }
|
||||
);
|
||||
const { data } = await options.json();
|
||||
const res = await server.post("/auth/passkeys.verifyAuthentication", {
|
||||
body: {
|
||||
challengeId: data.challengeId,
|
||||
id: "unknown",
|
||||
rawId: "unknown",
|
||||
response: {
|
||||
authenticatorData: "",
|
||||
clientDataJSON: "",
|
||||
signature: "",
|
||||
},
|
||||
type: "public-key",
|
||||
clientExtensionResults: { appid: "false", hmacCreateSecret: "true" },
|
||||
},
|
||||
});
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(400);
|
||||
expect(body.message).toContain("Passkey not found");
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,12 @@ import { z } from "zod";
|
||||
import { Client } from "@shared/types";
|
||||
import { BaseSchema } from "@server/routes/api/schema";
|
||||
|
||||
// Form posts send booleans as "true" or "false".
|
||||
const formBoolean = z.union([
|
||||
z.boolean(),
|
||||
z.stringbool({ truthy: ["true"], falsy: ["false"], case: "sensitive" }),
|
||||
]);
|
||||
|
||||
export const PasskeysGenerateAuthenticationOptionsSchema = BaseSchema.extend({
|
||||
body: z.object({}),
|
||||
query: z.object({
|
||||
@@ -29,8 +35,8 @@ export const PasskeysVerifyAuthenticationSchema = BaseSchema.extend({
|
||||
authenticatorAttachment: z.enum(["cross-platform", "platform"]).optional(),
|
||||
clientExtensionResults: z
|
||||
.object({
|
||||
appid: z.boolean().optional(),
|
||||
hmacCreateSecret: z.boolean().optional(),
|
||||
appid: formBoolean.optional(),
|
||||
hmacCreateSecret: formBoolean.optional(),
|
||||
})
|
||||
.prefault({}),
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user