Skip to content

Commit 4a06c10

Browse files
authored
Fix decoding Attestation auth data with extentions (#243)
1 parent 8ab4ff5 commit 4a06c10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cdk/custom-auth/fido2-credentials-api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
UpdateCommand,
2727
PutCommand,
2828
} from "@aws-sdk/lib-dynamodb";
29-
import { decodeFirstSync } from "cbor";
29+
import { decodeAllSync } from "cbor";
3030
import {
3131
determineUserHandle,
3232
logger,
@@ -870,8 +870,9 @@ function parseBody(event: { body?: string | null; isBase64Encoded: boolean }) {
870870

871871
function cborDecode(b: Buffer, name: string) {
872872
try {
873+
const decoded = decodeAllSync(b);
873874
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
874-
return decodeFirstSync(b) as unknown;
875+
return decoded[0] as unknown;
875876
} catch (err) {
876877
logger.error(err);
877878
throw new UserFacingError(`Invalid ${name}`);

0 commit comments

Comments
 (0)