The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(auth): move passkeys to SimpleWebAuthn 14, which no longer fetches a CRL a client names
Mauricec65e9bf76e6e
diff --git a/client/package.json b/client/package.jsonindex ff656e548..d1139f40c 100644--- a/client/package.json+++ b/client/package.json@@ -103,7 +103,7 @@"@fontsource/yellowtail": "^5.3.0","@maplibre/maplibre-gl-leaflet": "0.1.4","@noble/hashes": "^1.8.0",- "@simplewebauthn/browser": "^13.3.0",+ "@simplewebauthn/browser": "^14.0.0","@trek/shared": "*","axios": "^1.21.0","dexie": "^4.4.7",@@ -163,7 +163,7 @@"sharp": "^0.35.5","tailwindcss": "^3.4.19","typescript": "^6.0.3",- "typescript-eslint": "^8.72.1",+ "typescript-eslint": "^8.73.0","vite": "8.3.8","vite-plugin-pwa": "^2.0.0","vitest": "^4.1.12"diff --git a/package-lock.json b/package-lock.jsonindex 6b41e7906..82e3c8f77 100644--- a/package-lock.json+++ b/package-lock.json@@ -82,7 +82,7 @@"@fontsource/yellowtail": "^5.3.0","@maplibre/maplibre-gl-leaflet": "0.1.4","@noble/hashes": "^1.8.0",- "@simplewebauthn/browser": "^13.3.0",+ "@simplewebauthn/browser": "^14.0.0","@trek/shared": "*","axios": "^1.21.0","dexie": "^4.4.7",@@ -142,7 +142,7 @@"sharp": "^0.35.5","tailwindcss": "^3.4.19","typescript": "^6.0.3",- "typescript-eslint": "^8.72.1",+ "typescript-eslint": "^8.73.0","vite": "8.3.8","vite-plugin-pwa": "^2.0.0","vitest": "^4.1.12"@@ -4935,6 +4935,13 @@"node": ">=18.0.0"}},+ "node_modules/@isaacs/nonrecursive-glob-match": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",+ "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",+ "dev": true,+ "license": "BlueOak-1.0.0"+ },"node_modules/@istanbuljs/schema": {"version": "0.1.6","resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz",@@ -7664,130 +7671,192 @@"tslib": "^2.8.1"}},+ "node_modules/@peculiar/asn1-asym-key": {+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-asym-key/-/asn1-asym-key-2.11.1.tgz",+ "integrity": "sha512-YtXR0FbDtjHuNGvWXD4HFE7th5xYwG67O+ApDH/FZsjj5MOrWHzDvqwZ1vm6uFUJtMAkUDcF6VMPGOJ5gnLyUA==",+ "license": "MIT",+ "dependencies": {+ "@peculiar/asn1-pkcs8": "^2.11.1",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1",+ "asn1js": "^3.0.10",+ "tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"+ }+ },"node_modules/@peculiar/asn1-cms": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.8.0.tgz",- "integrity": "sha512-NgekZOrSJFSBFLFoLfwePguAWAx7z1+f2TEsWFUMyiqqfntZ4+S/S5hzqME3q4pCA0iOsFKdwiQ35dwY24eVqA==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.11.1.tgz",+ "integrity": "sha512-Bk+oatE62dW0Tzzpfk6vdQxfGGEfvuGdWgmijnKjcv7HqZCJISs85z4zw2uDArrk+R1Oel1wts/BBl7HHrtAcA==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",- "@peculiar/asn1-x509-attr": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1",+ "@peculiar/asn1-x509-attr": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-csr": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.8.0.tgz",- "integrity": "sha512-akbF8+uvleHs8sejNPQxwmVFuInAg6FMNHOwMILXfP518YfFJwdR3jr6oNUPOaEJfuEhn/vkNOCIT6ASUd4mbg==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.11.1.tgz",+ "integrity": "sha512-KVfbXaKng8886/tOPG55t5K1XkTkGbR4amjIJzytXWobFU5nZgw/sKnSpa1hxP17nUSsrOF/7Mt9WUYeyLsi6Q==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-ecc": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.8.0.tgz",- "integrity": "sha512-ohwlk+u9Rv2NOAY1c6MfHj45ATVF8R1DUN/WCgABiRtLi2ZftlZWZX7KvpAbU8v9xPcmoILfELeEABj/rn18AQ==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.11.1.tgz",+ "integrity": "sha512-7MSNji77fQa/oN3WAfwagMy8EoJFg50sW4hZ1dtr0zU1BSugit0I2DGpIdPhvkNplopQhz5bogxpn1077eaamA==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-pfx": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.8.0.tgz",- "integrity": "sha512-5yof1ytoB++RQtaFbqSUJ8pxDJtZT6vbVqZ8XoJ61ph7UjNVvfFwAilnCodqkNsAodpy13gDhoxZXw00pghnyg==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.11.1.tgz",+ "integrity": "sha512-2SN2z8qkc2hk/GgTYA8RN54wtsCDZShg9gI2Mq1vLhdj1adcv5fhTbiEmExZUaAMqlizxiEpULQDfHM5iYtn1g==","license": "MIT","dependencies": {- "@peculiar/asn1-cms": "^2.8.0",- "@peculiar/asn1-pkcs8": "^2.8.0",- "@peculiar/asn1-rsa": "^2.8.0",- "@peculiar/asn1-schema": "^2.8.0",+ "@peculiar/asn1-cms": "^2.11.1",+ "@peculiar/asn1-pkcs8": "^2.11.1",+ "@peculiar/asn1-rsa": "^2.11.1",+ "@peculiar/asn1-schema": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-pkcs8": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.8.0.tgz",- "integrity": "sha512-qAKXtLpBEw9LqhKpjw3ajZSXlBur+ipW+y2ivVBQAG6F6qRx94yO+1ZR4mvw+YaCfKSaOzLeYEzsPaBp4SJELA==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.11.1.tgz",+ "integrity": "sha512-HqsSrnpQghRp9SM9QSmR6fa4z/BNktnKq7928+oq4qF0VAnuHZ4cyePKvcxh9fP4taBCP/WHNItlVNsYaQm2qw==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-pkcs9": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.8.0.tgz",- "integrity": "sha512-b5nDWCnkV60+cQ141D6sVVwK9nz64R5n3zSVnklGd+ECdkW2Ol3U1a6yYFlalpSOaD557yuJB64A+q42jG7lUQ==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.11.1.tgz",+ "integrity": "sha512-OHFkTg8D2zYafILqFE4KPbqX8srpvd3diGDc2h2cduumawc765mOHGcuFMGvLWlL2bbCMWMmMSCtlXptsOuiPA==","license": "MIT","dependencies": {- "@peculiar/asn1-cms": "^2.8.0",- "@peculiar/asn1-pfx": "^2.8.0",- "@peculiar/asn1-pkcs8": "^2.8.0",- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",- "@peculiar/asn1-x509-attr": "^2.8.0",+ "@peculiar/asn1-cms": "^2.11.1",+ "@peculiar/asn1-pfx": "^2.11.1",+ "@peculiar/asn1-pkcs8": "^2.11.1",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1",+ "@peculiar/asn1-x509-attr": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-rsa": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.8.0.tgz",- "integrity": "sha512-zHEUlCqB2mk7x2lxDwHHJy7hWZOPdGHVlsmITWKB5/PbQo61atbu9PJ/0r9dQNMwFzbKPXZ8uK8/91eUhRznSg==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.11.1.tgz",+ "integrity": "sha512-6KwKGjulF489CpidZqkogNgLj6oGzgC4BL2FClM8PuJQ4t5NqT4q4a6A4vrSxBIBhMnL8hGYkLOpbVw0Vq38Tw==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-schema": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.8.0.tgz",- "integrity": "sha512-7YT0U/ze0tF2QOBbE15gKZwy5tvgGyLRiRHLzhlbOpf7BT032oBSd0haZqXn5W6l26WLlu3dyxzjM+2638/z2Q==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.11.1.tgz",+ "integrity": "sha512-jaU9OaCcbZUdyXx9hMETZB9xoNmxTGjOGFqd3cOwKFkpKnyKd9WxF3uqj4PvX4cyOMP9bSdHg5YyML2qtx/d/g==","license": "MIT","dependencies": {"@peculiar/utils": "^2.0.2","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-x509": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.8.0.tgz",- "integrity": "sha512-N0CMuhWUzsWEVq6F1q9X6+VKUnWzSW+cSVg+aPaGGwDdbFoFWTYgin5MHwXgpWd6y9COMBxnfy/Qc+Xc7F0Zwg==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.11.1.tgz",+ "integrity": "sha512-SXU4/X6B3FquqQAN6ARI0bFDUV7+L1WlvPEPMKzEMkstd2D7UyM0r93fv241+OjdhqAKYGx5MvV3gzZMAp0APA==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1","@peculiar/utils": "^2.0.2","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/asn1-x509-attr": {- "version": "2.8.0",- "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.8.0.tgz",- "integrity": "sha512-tHjkfS/qhMnmrlB2J9NhflQlQ7In3khO3CfmVrriOlpTeErY9ZIKOso1hQ5JQiyrJ7ShvqVPk7E5fQmbclkSKA==",+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.11.1.tgz",+ "integrity": "sha512-n7RKFrbTzt8pGBlZ90kmKEn1qsLTTyw7lrvHMK0xsA42kQugPk/GXYpNbEcl7DkkdVsU/one5UX7KQPfxLj8vQ==","license": "MIT","dependencies": {- "@peculiar/asn1-schema": "^2.8.0",- "@peculiar/asn1-x509": "^2.8.0",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1","asn1js": "^3.0.10","tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"+ }+ },+ "node_modules/@peculiar/asn1-x509-post-quantum": {+ "version": "2.11.1",+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-post-quantum/-/asn1-x509-post-quantum-2.11.1.tgz",+ "integrity": "sha512-yD/pxCQ97nzwF7MGAW4kRd1WVLiMPhD39HxOnAr38DfGFwbpVhPnMbq+r6WX0XUrxn4w8ulsTdUafwVl46igLA==",+ "license": "MIT",+ "dependencies": {+ "@peculiar/asn1-asym-key": "^2.11.1",+ "@peculiar/asn1-schema": "^2.11.1",+ "@peculiar/asn1-x509": "^2.11.1",+ "asn1js": "^3.0.10",+ "tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14"}},"node_modules/@peculiar/utils": {@@ -7800,20 +7869,20 @@}},"node_modules/@peculiar/x509": {- "version": "1.14.3",- "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",- "integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",- "license": "MIT",- "dependencies": {- "@peculiar/asn1-cms": "^2.6.0",- "@peculiar/asn1-csr": "^2.6.0",- "@peculiar/asn1-ecc": "^2.6.0",- "@peculiar/asn1-pkcs9": "^2.6.0",- "@peculiar/asn1-rsa": "^2.6.0",- "@peculiar/asn1-schema": "^2.6.0",- "@peculiar/asn1-x509": "^2.6.0",+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-2.2.0.tgz",+ "integrity": "sha512-adpW58ySPQMOUPv8pTKT3RIyCFqfUFt8X05ukPdtkQToXDVr8dMtxuenik1yx8tNFTbpApWsM/Hi5SzlIx48+Q==",+ "license": "MIT",+ "dependencies": {+ "@peculiar/asn1-cms": "^2.11.0",+ "@peculiar/asn1-csr": "^2.11.0",+ "@peculiar/asn1-ecc": "^2.11.0",+ "@peculiar/asn1-pkcs9": "^2.11.0",+ "@peculiar/asn1-rsa": "^2.11.0",+ "@peculiar/asn1-schema": "^2.11.0",+ "@peculiar/asn1-x509": "^2.11.0",+ "@peculiar/asn1-x509-post-quantum": "^2.11.0","pvtsutils": "^1.3.6",- "reflect-metadata": "^0.2.2","tslib": "^2.8.1","tsyringe": "^4.10.0"},@@ -10170,15 +10239,15 @@"license": "Apache-2.0"},"node_modules/@simplewebauthn/browser": {- "version": "13.3.0",- "resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-13.3.0.tgz",- "integrity": "sha512-BE/UWv6FOToAdVk0EokzkqQQDOWtNydYlY6+OrmiZ5SCNmb41VehttboTetUM3T/fr6EAFYVXjz4My2wg230rQ==",+ "version": "14.0.0",+ "resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-14.0.0.tgz",+ "integrity": "sha512-1odWVqeEBTl7lJ9zMKLEsmTlnyrDO5iRcTvfMKKk1WThUnp/i8JJdffdj2icP+tty159s4PgwE3BiMoEW9NFow==","license": "MIT"},"node_modules/@simplewebauthn/server": {- "version": "13.3.3",- "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-13.3.3.tgz",- "integrity": "sha512-LelX/lcy5cjc15A86i/aNxHhB5eU7dd20QsbP0VLAf9e38+SLlsnqCCyecx3xqfGofhmX05h1J9fKRYWxw+luA==",+ "version": "14.1.0",+ "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-14.1.0.tgz",+ "integrity": "sha512-HPRRBR4Vzr45+RVvbmf6JuCfGdYYcSs4Pnnnp9YSY2IABa4JKnG+wxybczoB7rmdLCOMS/mbBa2ZL/Bcz58UlA==","license": "MIT","dependencies": {"@hexagon/base64": "^1.1.27",@@ -10188,10 +10257,12 @@"@peculiar/asn1-rsa": "^2.6.1","@peculiar/asn1-schema": "^2.6.0","@peculiar/asn1-x509": "^2.6.1",- "@peculiar/x509": "^1.14.3"+ "@peculiar/asn1-x509-post-quantum": "^2.9.4",+ "@peculiar/x509": "^2.1.0",+ "reflect-metadata": "^0.2.2"},"engines": {- "node": ">=20.0.0"+ "node": ">=22.0.0"}},"node_modules/@smithy/core": {@@ -11220,17 +11291,17 @@}},"node_modules/@typescript-eslint/eslint-plugin": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.2.tgz",- "integrity": "sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.73.0.tgz",+ "integrity": "sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==","dev": true,"license": "MIT","dependencies": {"@eslint-community/regexpp": "^4.12.2",- "@typescript-eslint/scope-manager": "8.72.2",- "@typescript-eslint/type-utils": "8.72.2",- "@typescript-eslint/utils": "8.72.2",- "@typescript-eslint/visitor-keys": "8.72.2",+ "@typescript-eslint/scope-manager": "8.73.0",+ "@typescript-eslint/type-utils": "8.73.0",+ "@typescript-eslint/utils": "8.73.0",+ "@typescript-eslint/visitor-keys": "8.73.0","ignore": "^7.0.5","natural-compare": "^1.4.0","ts-api-utils": "^2.5.0"@@ -11243,15 +11314,15 @@"url": "https://opencollective.com/typescript-eslint"},"peerDependencies": {- "@typescript-eslint/parser": "^8.72.2",+ "@typescript-eslint/parser": "^8.73.0","eslint": "^8.57.0 || ^9.0.0 || ^10.0.0","typescript": ">=4.8.4 <6.1.0"}},"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {- "version": "7.0.14",- "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.14.tgz",- "integrity": "sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==",+ "version": "7.0.16",+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz",+ "integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==","dev": true,"license": "MIT","engines": {@@ -11259,16 +11330,16 @@}},"node_modules/@typescript-eslint/parser": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.2.tgz",- "integrity": "sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.73.0.tgz",+ "integrity": "sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/scope-manager": "8.72.2",- "@typescript-eslint/types": "8.72.2",- "@typescript-eslint/typescript-estree": "8.72.2",- "@typescript-eslint/visitor-keys": "8.72.2",+ "@typescript-eslint/scope-manager": "8.73.0",+ "@typescript-eslint/types": "8.73.0",+ "@typescript-eslint/typescript-estree": "8.73.0",+ "@typescript-eslint/visitor-keys": "8.73.0","debug": "^4.4.3"},"engines": {@@ -11284,14 +11355,14 @@}},"node_modules/@typescript-eslint/project-service": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.2.tgz",- "integrity": "sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.73.0.tgz",+ "integrity": "sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/tsconfig-utils": "^8.72.2",- "@typescript-eslint/types": "^8.72.2",+ "@typescript-eslint/tsconfig-utils": "^8.73.0",+ "@typescript-eslint/types": "^8.73.0","debug": "^4.4.3"},"engines": {@@ -11306,14 +11377,14 @@}},"node_modules/@typescript-eslint/scope-manager": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.2.tgz",- "integrity": "sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.73.0.tgz",+ "integrity": "sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/types": "8.72.2",- "@typescript-eslint/visitor-keys": "8.72.2"+ "@typescript-eslint/types": "8.73.0",+ "@typescript-eslint/visitor-keys": "8.73.0"},"engines": {"node": "^18.18.0 || ^20.9.0 || >=21.1.0"@@ -11324,9 +11395,9 @@}},"node_modules/@typescript-eslint/tsconfig-utils": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.2.tgz",- "integrity": "sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.73.0.tgz",+ "integrity": "sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==","dev": true,"license": "MIT","engines": {@@ -11341,15 +11412,15 @@}},"node_modules/@typescript-eslint/type-utils": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.2.tgz",- "integrity": "sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.73.0.tgz",+ "integrity": "sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/types": "8.72.2",- "@typescript-eslint/typescript-estree": "8.72.2",- "@typescript-eslint/utils": "8.72.2",+ "@typescript-eslint/types": "8.73.0",+ "@typescript-eslint/typescript-estree": "8.73.0",+ "@typescript-eslint/utils": "8.73.0","debug": "^4.4.3","ts-api-utils": "^2.5.0"},@@ -11366,9 +11437,9 @@}},"node_modules/@typescript-eslint/types": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.2.tgz",- "integrity": "sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.73.0.tgz",+ "integrity": "sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==","dev": true,"license": "MIT","engines": {@@ -11380,18 +11451,18 @@}},"node_modules/@typescript-eslint/typescript-estree": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.2.tgz",- "integrity": "sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.73.0.tgz",+ "integrity": "sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/project-service": "8.72.2",- "@typescript-eslint/tsconfig-utils": "8.72.2",- "@typescript-eslint/types": "8.72.2",- "@typescript-eslint/visitor-keys": "8.72.2",+ "@typescript-eslint/project-service": "8.73.0",+ "@typescript-eslint/tsconfig-utils": "8.73.0",+ "@typescript-eslint/types": "8.73.0",+ "@typescript-eslint/visitor-keys": "8.73.0","debug": "^4.4.3",- "minimatch": "^10.2.2",+ "minimatch": "^11.0.1","semver": "^7.7.3","tinyglobby": "^0.2.15","ts-api-utils": "^2.5.0"@@ -11404,7 +11475,13 @@"url": "https://opencollective.com/typescript-eslint"},"peerDependencies": {+ "@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev","typescript": ">=4.8.4 <6.1.0"+ },+ "peerDependenciesMeta": {+ "@typescript/native": {+ "optional": true+ }}},"node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": {@@ -11418,9 +11495,9 @@}},"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {- "version": "5.0.12",- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",- "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",+ "version": "5.1.0",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz",+ "integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==","dev": true,"license": "MIT","dependencies": {@@ -11431,32 +11508,33 @@}},"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {- "version": "10.2.6",- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",- "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",+ "version": "11.0.9",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz",+ "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==","dev": true,"license": "BlueOak-1.0.0","dependencies": {- "brace-expansion": "^5.0.8"+ "@isaacs/nonrecursive-glob-match": "^1.1.0",+ "brace-expansion": "^5.0.12"},"engines": {- "node": "18 || 20 || >=22"+ "node": "20 || >=22"},"funding": {"url": "https://github.com/sponsors/isaacs"}},"node_modules/@typescript-eslint/utils": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.2.tgz",- "integrity": "sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.73.0.tgz",+ "integrity": "sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==","dev": true,"license": "MIT","dependencies": {"@eslint-community/eslint-utils": "^4.9.1",- "@typescript-eslint/scope-manager": "8.72.2",- "@typescript-eslint/types": "8.72.2",- "@typescript-eslint/typescript-estree": "8.72.2"+ "@typescript-eslint/scope-manager": "8.73.0",+ "@typescript-eslint/types": "8.73.0",+ "@typescript-eslint/typescript-estree": "8.73.0"},"engines": {"node": "^18.18.0 || ^20.9.0 || >=21.1.0"@@ -11471,13 +11549,13 @@}},"node_modules/@typescript-eslint/visitor-keys": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.2.tgz",- "integrity": "sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.73.0.tgz",+ "integrity": "sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/types": "8.72.2",+ "@typescript-eslint/types": "8.73.0","eslint-visitor-keys": "^5.0.0"},"engines": {@@ -23881,16 +23959,16 @@}},"node_modules/typescript-eslint": {- "version": "8.72.2",- "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.72.2.tgz",- "integrity": "sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==",+ "version": "8.73.0",+ "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.73.0.tgz",+ "integrity": "sha512-+EnKy9rkYPun4l+kG2bDuYWQ6y1tGVgdR/tY1U9AC6h21CjEwOoc7gsjwe0FXB8uWFzk4QiCFbuRWgX758PiAg==","dev": true,"license": "MIT","dependencies": {- "@typescript-eslint/eslint-plugin": "8.72.2",- "@typescript-eslint/parser": "8.72.2",- "@typescript-eslint/typescript-estree": "8.72.2",- "@typescript-eslint/utils": "8.72.2"+ "@typescript-eslint/eslint-plugin": "8.73.0",+ "@typescript-eslint/parser": "8.73.0",+ "@typescript-eslint/typescript-estree": "8.73.0",+ "@typescript-eslint/utils": "8.73.0"},"engines": {"node": "^18.18.0 || ^20.9.0 || >=21.1.0"@@ -25934,7 +26012,7 @@"@nestjs/schedule": "^12.0.4","@nestjs/swagger": "^11.4.7","@nestjs/websockets": "^11.2.5",- "@simplewebauthn/server": "^13.3.3",+ "@simplewebauthn/server": "^14.1.0","@trek/shared": "*","archiver": "^6.0.2","bcryptjs": "^2.4.3",@@ -26003,7 +26081,7 @@"prettier": "^3.10.1","prettier-plugin-organize-imports": "^4.3.0","supertest": "^7.3.1",- "typescript-eslint": "^8.72.1",+ "typescript-eslint": "^8.73.0","unplugin-swc": "^1.6.0","vitest": "^4.1.11"},@@ -26346,7 +26424,7 @@"prettier-plugin-organize-imports": "^4.3.0","tsdown": "^0.23.7","typescript": "^6.0.3",- "typescript-eslint": "^8.72.1",+ "typescript-eslint": "^8.73.0","vitest": "^4.1.11"},"engines": {diff --git a/server/package.json b/server/package.jsonindex e107f5bff..387ff591a 100644--- a/server/package.json+++ b/server/package.json@@ -82,7 +82,7 @@"@nestjs/schedule": "^12.0.4","@nestjs/swagger": "^11.4.7","@nestjs/websockets": "^11.2.5",- "@simplewebauthn/server": "^13.3.3",+ "@simplewebauthn/server": "^14.1.0","@trek/shared": "*","archiver": "^6.0.2","bcryptjs": "^2.4.3",@@ -151,7 +151,7 @@"prettier": "^3.10.1","prettier-plugin-organize-imports": "^4.3.0","supertest": "^7.3.1",- "typescript-eslint": "^8.72.1",+ "typescript-eslint": "^8.73.0","unplugin-swc": "^1.6.0","vitest": "^4.1.11"}diff --git a/server/src/nest/auth/passkey.service.ts b/server/src/nest/auth/passkey.service.tsindex 338373c16..094c15511 100644--- a/server/src/nest/auth/passkey.service.ts+++ b/server/src/nest/auth/passkey.service.ts@@ -20,7 +20,6 @@ import {verifyRegistrationResponse,generateAuthenticationOptions,verifyAuthenticationResponse,- type AuthenticatorTransportFuture,} from '@simplewebauthn/server';import bcrypt from 'bcryptjs';@@ -72,11 +71,11 @@ function originFromResponse(resp: unknown): string | null {return typeof origin === 'string' ? origin : null;}-function parseTransports(raw: string | null): AuthenticatorTransportFuture[] | undefined {+function parseTransports(raw: string | null): string[] | undefined {if (!raw) return undefined;try {- const parsed = JSON.parse(raw);- return Array.isArray(parsed) ? (parsed as AuthenticatorTransportFuture[]) : undefined;+ const parsed: unknown = JSON.parse(raw);+ return Array.isArray(parsed) ? parsed.filter((t): t is string => typeof t === 'string') : undefined;} catch {return undefined;}@@ -308,6 +307,8 @@ export class PasskeyService {expectedOrigin,expectedRPID: cfg.rpID,requireUserVerification: true,+ // The same list the options offered, so the verifier never falls back to its own default.+ supportedAlgorithmIDs: SUPPORTED_ALGORITHM_IDS,});} catch (err) {// Body stays the generic 400 (parity), but the operator gets to see WHY —diff --git a/server/src/nest/auth/webauthn-config.service.ts b/server/src/nest/auth/webauthn-config.service.tsindex beafacb29..9439d6b68 100644--- a/server/src/nest/auth/webauthn-config.service.ts+++ b/server/src/nest/auth/webauthn-config.service.ts@@ -2,7 +2,7 @@ import { getAppUrl, readEnv } from '../../app-config';import { AppSettings } from '../../db/entities/AppSettings.entity';import type { AppSettingsRepository } from '../../db/repositories/AppSettings.repository';import { InjectRepository } from '@mikro-orm/nestjs';-import { Injectable } from '@nestjs/common';+import { Injectable, Logger } from '@nestjs/common';function hostOf(url: string): string | null {try {@@ -19,6 +19,23 @@ function isIpHost(host: string): boolean {return false;}+/**+ * An http(s) origin reduced to the scheme, host and port the browser reports+ * (`new URL(o).origin`), so a configured path, trailing slash or uppercase host+ * still matches. @simplewebauthn/server refuses such an expected origin+ * outright, where older releases only failed to match it. Any other scheme (an+ * app package origin) is kept as written. Null when the value does not parse.+ */+function normalizeOrigin(origin: string): string | null {+ let url: URL;+ try {+ url = new URL(origin);+ } catch {+ return null;+ }+ return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : origin;+}+/*** The scope rule WebAuthn itself applies when the browser runs a ceremony: the* origin's host must equal the RP ID or be a subdomain of it, over https@@ -70,8 +87,25 @@ export interface WebauthnConfig {*/@Injectable()export class WebauthnConfigService {+ private readonly logger = new Logger(WebauthnConfigService.name);+constructor(@InjectRepository(AppSettings) private readonly appSettings: AppSettingsRepository) {}+ /** Normalizes every origin, dropping (and naming) the ones that do not parse. */+ private normalizeOrigins(origins: string[]): string[] {+ const normalized: string[] = [];+ const unparseable: string[] = [];+ for (const origin of origins) {+ const value = normalizeOrigin(origin);+ if (value === null) unparseable.push(origin);+ else normalized.push(value);+ }+ if (unparseable.length > 0) {+ this.logger.warn(`Ignoring passkey origins that are not valid URLs: ${unparseable.join(', ')}`);+ }+ return Array.from(new Set(normalized));+ }+/** `SELECT value FROM app_settings WHERE key = ?` (WC1), through `AppSettingsRepository.getValue` (Plan 3a). */private async setting(key: string): Promise<string | null> {const raw = (await this.appSettings.getValue(key)) ?? undefined;@@ -85,14 +119,18 @@ export class WebauthnConfigService {* disabled so nobody can enrol a credential bound to the wrong origin.*/async resolve(): Promise<WebauthnConfig | null> {- // 1. Explicit operator config always wins.- const explicitRpId = (readEnv().webauthn.rpId || (await this.setting('webauthn_rp_id')))?.trim() || null;- const explicitOrigins = (readEnv().webauthn.origins || (await this.setting('webauthn_origins')) || '')+ // 1. Explicit operator config always wins. Host names compare without case,+ // and the verifier refuses an RP ID that is not in its lower-case form.+ const explicitRpId =+ (readEnv().webauthn.rpId || (await this.setting('webauthn_rp_id')))?.trim().toLowerCase() || null;+ const configuredOrigins = (readEnv().webauthn.origins || (await this.setting('webauthn_origins')) || '').split(',')// The lookbehind matches only the first slash of the trailing run. Without it the// engine retries from every slash, which is quadratic on a slash-heavy value..map((o) => o.trim().replace(/(?<!\/)\/+$/, '')).filter(Boolean);+ const explicitOrigins = this.normalizeOrigins(configuredOrigins);+ const hasExplicitOrigins = configuredOrigins.length > 0;const appUrl = getAppUrl();const appHost = hostOf(appUrl);@@ -104,12 +142,14 @@ export class WebauthnConfigService {}if (!rpID) return null; // bare IP / unresolved → WebAuthn cannot be used here- // 3. Resolve the allowed origins. Explicit list wins verbatim (operator's- // responsibility). Otherwise derive a SINGLE origin from APP_URL — we never- // silently union dev localhost origins into a production allow-list.+ // 3. Resolve the allowed origins. Explicit list wins (operator's+ // responsibility); a list whose every entry failed to parse stays explicit+ // and leaves the feature unconfigured rather than falling back to APP_URL.+ // Otherwise derive a SINGLE origin from APP_URL; we never silently union+ // dev localhost origins into a production allow-list.let origins = explicitOrigins;- if (origins.length === 0) {- if (appHost) origins = [appUrl.replace(/(?<!\/)\/+$/, '')];+ if (!hasExplicitOrigins) {+ if (appHost) origins = this.normalizeOrigins([appUrl.replace(/(?<!\/)\/+$/, '')]);if (rpID === 'localhost') {// Dev: the browser origin is the Vite dev server (:5173), not the API port.origins = Array.from(new Set([...origins, 'http://localhost:5173', 'http://localhost:3001']));@@ -117,7 +157,7 @@ export class WebauthnConfigService {}if (origins.length === 0) return null;- return { rpID, rpName: 'TREK', origins, explicitOrigins: explicitOrigins.length > 0 };+ return { rpID, rpName: 'TREK', origins, explicitOrigins: hasExplicitOrigins };}/** True when a usable RP ID resolves for this deployment (exposed as a pure boolean on app-config). */diff --git a/server/tests/integration/passkey-ceremony.test.ts b/server/tests/integration/passkey-ceremony.test.tsnew file mode 100644index 000000000..8c1a223a3--- /dev/null+++ b/server/tests/integration/passkey-ceremony.test.ts@@ -0,0 +1,457 @@+/**+ * Passkey ceremonies through the REAL @simplewebauthn/server, with no mock.+ *+ * Every other passkey suite mocks the library, so a release that changes what+ * it accepts (a stricter origin check, a new default) would pass them all and+ * still refuse every passkey in production. Here a software authenticator built+ * on node:crypto answers TREK's own options over HTTP: registration with+ * attestation format 'none', then a signed login, plus credentials stored the+ * way earlier releases stored them.+ */+import { buildApp } from '../../src/bootstrap';+import { WebauthnCredentials } from '../../src/db/entities/WebauthnCredentials.entity';+import { authCookie } from '../helpers/auth';+import { countRows, findRow, insertRow } from '../helpers/factories/rows';+import { setAppSetting } from '../helpers/factories/settings';+import { makeUser } from '../helpers/factories/users';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';+import { MikroORM } from '@mikro-orm/core';+import type { INestApplication } from '@nestjs/common';+import { isoBase64URL, isoCBOR, isoUint8Array } from '@simplewebauthn/server/helpers';++import type { Application } from 'express';+import { createHash, generateKeyPairSync, randomBytes, sign, type KeyObject } from 'node:crypto';+import request from 'supertest';+import { describe, it, expect, beforeAll, beforeEach, afterAll, afterEach, vi } from 'vitest';++type CborValue = Parameters<typeof isoCBOR.encode>[0];+// The byte array type the library helpers take and return.+type Bytes = ReturnType<typeof isoUint8Array.concat>;++const RP_ID = 'trek.example.com';+const ORIGIN = 'https://trek.example.com';++let nestApp: INestApplication;+let app: Application;+let orm: MikroORM;++beforeAll(async () => {+ nestApp = await buildApp();+ app = nestApp.getHttpAdapter().getInstance();+ orm = nestApp.get(MikroORM);+});++beforeEach(async () => {+ await resetDatabase(orm);+ await resetRateLimits(nestApp);+ await setAppSetting(orm, 'passkey_login', 'true');+ await setAppSetting(orm, 'webauthn_rp_id', RP_ID);+ await setAppSetting(orm, 'webauthn_origins', ORIGIN);+});++afterEach(() => {+ vi.restoreAllMocks();+});++afterAll(async () => {+ await nestApp.close();+});++// ---------------------------------------------------------------------------+// A software authenticator+// ---------------------------------------------------------------------------++type Alg = -7 | -8 | -257;++interface Authenticator {+ alg: Alg;+ privateKey: KeyObject;+ publicKey: KeyObject;+ credentialId: Bytes;+ cosePublicKey: Bytes;+}++function sha256(data: Bytes): Bytes {+ return new Uint8Array(createHash('sha256').update(data).digest());+}++function jwkBytes(value: string | undefined): Bytes {+ if (!value) throw new Error('JWK member missing');+ return isoBase64URL.toBuffer(value);+}++/** The credential public key in COSE form (RFC 9053), as an authenticator reports it. */+function coseKey(alg: Alg, publicKey: KeyObject): Bytes {+ const jwk = publicKey.export({ format: 'jwk' });+ const entries: Array<[number, CborValue]> =+ alg === -7+ ? [+ [1, 2],+ [3, -7],+ [-1, 1],+ [-2, jwkBytes(jwk.x)],+ [-3, jwkBytes(jwk.y)],+ ]+ : alg === -8+ ? [+ [1, 1],+ [3, -8],+ [-1, 6],+ [-2, jwkBytes(jwk.x)],+ ]+ : [+ [1, 3],+ [3, -257],+ [-1, jwkBytes(jwk.n)],+ [-2, jwkBytes(jwk.e)],+ ];+ return isoCBOR.encode(new Map<string | number, CborValue>(entries));+}++function makeAuthenticator(alg: Alg = -7): Authenticator {+ const { privateKey, publicKey } =+ alg === -7+ ? generateKeyPairSync('ec', { namedCurve: 'P-256' })+ : alg === -8+ ? generateKeyPairSync('ed25519')+ : generateKeyPairSync('rsa', { modulusLength: 2048 });+ return {+ alg,+ privateKey,+ publicKey,+ credentialId: new Uint8Array(randomBytes(32)),+ cosePublicKey: coseKey(alg, publicKey),+ };+}++function signWith(auth: Authenticator, data: Bytes): Bytes {+ // EdDSA signs the message itself; ES256 (DER encoded) and RS256 hash with SHA-256.+ return new Uint8Array(sign(auth.alg === -8 ? null : 'sha256', data, auth.privateKey));+}++function uint32(n: number): Bytes {+ const out = new Uint8Array(4);+ new DataView(out.buffer).setUint32(0, n);+ return out;+}++function clientData(type: 'webauthn.create' | 'webauthn.get', challenge: string, origin: string): Bytes {+ return isoUint8Array.fromUTF8String(JSON.stringify({ type, challenge, origin, crossOrigin: false }));+}++// Flags: UP (0x01) and UV (0x04), plus AT (0x40) when credential data follows.+const FLAGS_UP_UV = 0x05;+const FLAGS_UP_UV_AT = 0x45;++/** authData with attested credential data: rpIdHash, flags, counter, AAGUID, credential id, COSE key. */+function registrationAuthData(auth: Authenticator, rpId: string): Bytes {+ const idLength = new Uint8Array([auth.credentialId.length >> 8, auth.credentialId.length & 0xff]);+ return isoUint8Array.concat([+ sha256(isoUint8Array.fromASCIIString(rpId)),+ new Uint8Array([FLAGS_UP_UV_AT]),+ uint32(0),+ new Uint8Array(16),+ idLength,+ auth.credentialId,+ auth.cosePublicKey,+ ]);+}++function registrationResponse(+ auth: Authenticator,+ challenge: string,+ opts: { origin?: string; rpId?: string; fmt?: string; attStmt?: Map<string | number, CborValue> } = {},+) {+ const authData = registrationAuthData(auth, opts.rpId ?? RP_ID);+ const clientDataJSON = clientData('webauthn.create', challenge, opts.origin ?? ORIGIN);+ const attestationObject = isoCBOR.encode(+ new Map<string | number, CborValue>([+ ['fmt', opts.fmt ?? 'none'],+ ['attStmt', opts.attStmt ?? new Map<string | number, CborValue>()],+ ['authData', authData],+ ]),+ );+ const id = isoBase64URL.fromBuffer(auth.credentialId);+ return {+ id,+ rawId: id,+ type: 'public-key',+ response: {+ clientDataJSON: isoBase64URL.fromBuffer(clientDataJSON),+ attestationObject: isoBase64URL.fromBuffer(attestationObject),+ transports: ['internal', 'hybrid'],+ },+ clientExtensionResults: {},+ authenticatorAttachment: 'platform',+ };+}++function authenticationResponse(+ auth: Authenticator,+ challenge: string,+ counter: number,+ opts: { origin?: string; rpId?: string } = {},+) {+ const authData = isoUint8Array.concat([+ sha256(isoUint8Array.fromASCIIString(opts.rpId ?? RP_ID)),+ new Uint8Array([FLAGS_UP_UV]),+ uint32(counter),+ ]);+ const clientDataJSON = clientData('webauthn.get', challenge, opts.origin ?? ORIGIN);+ const signature = signWith(auth, isoUint8Array.concat([authData, sha256(clientDataJSON)]));+ const id = isoBase64URL.fromBuffer(auth.credentialId);+ return {+ id,+ rawId: id,+ type: 'public-key',+ response: {+ clientDataJSON: isoBase64URL.fromBuffer(clientDataJSON),+ authenticatorData: isoBase64URL.fromBuffer(authData),+ signature: isoBase64URL.fromBuffer(signature),+ },+ clientExtensionResults: {},+ };+}++// ---------------------------------------------------------------------------+// HTTP steps+// ---------------------------------------------------------------------------++async function registerOptions(userId: number, password: string) {+ const res = await request(app)+ .post('/api/auth/passkey/register/options')+ .set('Cookie', authCookie(userId))+ .send({ password });+ expect(res.status).toBe(200);+ return res.body as { challenge: string; rp: { id: string }; pubKeyCredParams: Array<{ alg: number }> };+}++async function registerVerify(userId: number, attestationResponse: unknown) {+ return request(app)+ .post('/api/auth/passkey/register/verify')+ .set('Cookie', authCookie(userId))+ .send({ attestationResponse, name: 'Test key' });+}++async function loginOptions() {+ const res = await request(app).post('/api/auth/passkey/login/options').send({});+ expect(res.status).toBe(200);+ return res.body as { challenge: string; rpId: string };+}++async function storedCredential(credentialId: string) {+ const row = await findRow(orm, WebauthnCredentials, { credential_id: credentialId });+ if (!row) throw new Error(`no stored credential ${credentialId}`);+ return row;+}++async function loginVerify(assertionResponse: unknown) {+ return request(app).post('/api/auth/passkey/login/verify').send({ assertionResponse });+}++// ---------------------------------------------------------------------------+// Ceremonies+// ---------------------------------------------------------------------------++describe('passkey ceremonies against the real @simplewebauthn/server', () => {+ it('PASSKEY-REAL-001: registers a credential and logs in with it, bumping the counter', async () => {+ const { user, password } = await makeUser(orm);+ const auth = makeAuthenticator();++ const options = await registerOptions(user.id, password);+ expect(options.rp.id).toBe(RP_ID);+ expect(options.pubKeyCredParams.map((p) => p.alg)).toEqual([-8, -7, -257]);++ const reg = await registerVerify(user.id, registrationResponse(auth, options.challenge));+ expect(reg.status).toBe(200);+ expect(reg.body.success).toBe(true);++ const credentialId = isoBase64URL.fromBuffer(auth.credentialId);+ const stored = await storedCredential(credentialId);+ expect(stored.user_id).toBe(user.id);+ expect(Buffer.from(stored.public_key).equals(Buffer.from(auth.cosePublicKey))).toBe(true);+ expect(stored.counter).toBe(0);+ expect(stored.transports).toBe(JSON.stringify(['internal', 'hybrid']));+ expect(stored.name).toBe('Test key');++ const login = await loginOptions();+ expect(login.rpId).toBe(RP_ID);+ const res = await loginVerify(authenticationResponse(auth, login.challenge, 1));+ expect(res.status).toBe(200);+ expect(res.body.user.id).toBe(user.id);+ expect(res.headers['set-cookie']?.[0]).toMatch(/^trek_session=/);++ const after = await storedCredential(credentialId);+ expect(after.counter).toBe(1);+ expect(after.last_used_at).toBeTruthy();+ });++ it.each([+ ['ES256', -7],+ ['EdDSA', -8],+ ['RS256', -257],+ ] as const)('PASSKEY-REAL-002: a %s credential stored by an earlier release still logs in', async (_name, alg) => {+ const { user } = await makeUser(orm);+ const auth = makeAuthenticator(alg);+ const credentialId = isoBase64URL.fromBuffer(auth.credentialId);+ // The row exactly as 13.x wrote it: base64url id, COSE key bytes, counter, JSON transports.+ await insertRow(orm, WebauthnCredentials, {+ user: user.id,+ credential_id: credentialId,+ public_key: Buffer.from(auth.cosePublicKey),+ counter: 5,+ transports: JSON.stringify(['usb', 'nfc']),+ device_type: 'singleDevice',+ backed_up: 0,+ name: 'Old key',+ });++ const login = await loginOptions();+ const res = await loginVerify(authenticationResponse(auth, login.challenge, 6));+ expect(res.status).toBe(200);+ expect(res.body.user.id).toBe(user.id);+ expect((await storedCredential(credentialId)).counter).toBe(6);+ });++ it.each([+ ['an uppercase RP ID and an origin with a path', 'Trek.Example.com', 'https://Trek.Example.com/trek/'],+ ['an origin with an uppercase host and a trailing slash', RP_ID, 'https://TREK.example.com/'],+ ])('PASSKEY-REAL-003: %s still verify', async (_case, rpId, origins) => {+ await setAppSetting(orm, 'webauthn_rp_id', rpId);+ await setAppSetting(orm, 'webauthn_origins', origins);+ const { user, password } = await makeUser(orm);+ const auth = makeAuthenticator();++ // What a browser reports: the serialized, lower-case origin and the hash of the RP ID it was given.+ const options = await registerOptions(user.id, password);+ const reg = await registerVerify(user.id, registrationResponse(auth, options.challenge, { rpId: options.rp.id }));+ expect(reg.status).toBe(200);++ const login = await loginOptions();+ const res = await loginVerify(authenticationResponse(auth, login.challenge, 1, { rpId: login.rpId }));+ expect(res.status).toBe(200);+ expect(options.rp.id).toBe(RP_ID);+ expect(login.rpId).toBe(RP_ID);+ });++ it('PASSKEY-REAL-004: a ceremony from a foreign origin is refused with the usual 400 and 401', async () => {+ const { user, password } = await makeUser(orm);+ const auth = makeAuthenticator();++ const options = await registerOptions(user.id, password);+ const reg = await registerVerify(+ user.id,+ registrationResponse(auth, options.challenge, { origin: 'https://evil.example.net' }),+ );+ expect(reg.status).toBe(400);+ expect(reg.body).toEqual({ error: 'Could not register this passkey.' });+ expect(await countRows(orm, WebauthnCredentials, { user: user.id })).toBe(0);++ // A stored credential signing for the wrong origin is refused like any other failed login.+ await insertRow(orm, WebauthnCredentials, {+ user: user.id,+ credential_id: isoBase64URL.fromBuffer(auth.credentialId),+ public_key: Buffer.from(auth.cosePublicKey),+ counter: 0,+ name: 'Key',+ });+ const login = await loginOptions();+ const res = await loginVerify(+ authenticationResponse(auth, login.challenge, 1, { origin: 'https://evil.example.net' }),+ );+ expect(res.status).toBe(401);+ expect(res.body).toEqual({ error: 'Authentication failed' });+ });+});++// ---------------------------------------------------------------------------+// A certificate carrying a CRL URL (DER written by hand: the library exports+// CBOR and base64url helpers, nothing for ASN.1)+// ---------------------------------------------------------------------------++function der(tag: number, ...parts: Bytes[]): Bytes {+ const body = isoUint8Array.concat(parts);+ const n = body.length;+ const length = n < 0x80 ? [n] : n < 0x100 ? [0x81, n] : [0x82, n >> 8, n & 0xff];+ return isoUint8Array.concat([new Uint8Array([tag, ...length]), body]);+}++const seq = (...parts: Bytes[]) => der(0x30, ...parts);+const smallInt = (n: number) => der(0x02, new Uint8Array([n]));+const octets = (bytes: Bytes) => der(0x04, bytes);+const ascii = (s: string) => isoUint8Array.fromASCIIString(s);++function oid(dotted: string): Bytes {+ const [a, b, ...rest] = dotted.split('.').map(Number);+ const bytes = [40 * a + b];+ for (const arc of rest) {+ const groups = [arc & 0x7f];+ for (let v = arc >> 7; v > 0; v >>= 7) groups.unshift((v & 0x7f) | 0x80);+ bytes.push(...groups);+ }+ return der(0x06, new Uint8Array(bytes));+}++const ECDSA_WITH_SHA256 = seq(oid('1.2.840.10045.4.3.2'));++/**+ * A self-signed certificate for the credential key, shaped like an Android key+ * attestation leaf (key description extension with the client data hash as its+ * challenge) and naming a CRL distribution point.+ */+function androidKeyCertificate(auth: Authenticator, clientDataHash: Bytes, crlUrl: string): Bytes {+ const name = seq(der(0x31, seq(oid('2.5.4.3'), der(0x0c, ascii('Passkey test')))));+ const validity = seq(der(0x17, ascii('250101000000Z')), der(0x17, ascii('491231235959Z')));+ const spki = new Uint8Array(auth.publicKey.export({ type: 'spki', format: 'der' }));+ // distributionPoint [0] { fullName [0] { uniformResourceIdentifier [6] } }+ const crlDistributionPoints = seq(seq(der(0xa0, der(0xa0, der(0x86, ascii(crlUrl))))));+ const keyDescription = seq(+ smallInt(3),+ der(0x0a, new Uint8Array([1])),+ smallInt(4),+ der(0x0a, new Uint8Array([1])),+ octets(clientDataHash),+ octets(new Uint8Array()),+ seq(),+ seq(),+ );+ const extensions = der(+ 0xa3,+ seq(+ seq(oid('2.5.29.31'), octets(crlDistributionPoints)),+ seq(oid('1.3.6.1.4.1.11129.2.1.17'), octets(keyDescription)),+ ),+ );+ const tbs = seq(der(0xa0, smallInt(2)), smallInt(1), ECDSA_WITH_SHA256, name, validity, name, spki, extensions);+ const signature = signWith(auth, tbs);+ return seq(tbs, ECDSA_WITH_SHA256, der(0x03, new Uint8Array([0]), signature));+}++describe('attestation certificates', () => {+ it('PASSKEY-REAL-005: an android-key attestation naming a CRL URL is refused without any outbound fetch', async () => {+ const { user, password } = await makeUser(orm);+ const auth = makeAuthenticator();+ const crlUrl = 'http://crl.attacker.invalid/revoked.crl';+ const fetchSpy = vi.spyOn(globalThis, 'fetch').mockRejectedValue(new Error('outbound fetch blocked in test'));++ const options = await registerOptions(user.id, password);+ const clientDataHash = sha256(clientData('webauthn.create', options.challenge, ORIGIN));+ const authData = registrationAuthData(auth, RP_ID);+ const attStmt = new Map<string | number, CborValue>([+ ['alg', -7],+ ['sig', signWith(auth, isoUint8Array.concat([authData, clientDataHash]))],+ ['x5c', [androidKeyCertificate(auth, clientDataHash, crlUrl)]],+ ]);++ const res = await registerVerify(+ user.id,+ registrationResponse(auth, options.challenge, { fmt: 'android-key', attStmt }),+ );++ expect(fetchSpy).not.toHaveBeenCalled();+ expect(res.status).toBe(400);+ expect(res.body).toEqual({ error: 'Could not register this passkey.' });+ expect(await countRows(orm, WebauthnCredentials, { user: user.id })).toBe(0);+ });+});diff --git a/server/tests/unit/nest/passkey.service.test.ts b/server/tests/unit/nest/passkey.service.test.tsindex ebe7289a3..ce21d8ea9 100644--- a/server/tests/unit/nest/passkey.service.test.ts+++ b/server/tests/unit/nest/passkey.service.test.ts@@ -329,6 +329,7 @@ describe('passkeyRegisterOptions', () => {const { user, password } = createUser(testDb);await insertCredential(user.id, { credential_id: 'cred-a', transports: JSON.stringify(['usb', 'nfc']) });await insertCredential(user.id, { credential_id: 'cred-b', transports: 'not-json' });+ await insertCredential(user.id, { credential_id: 'cred-c', transports: JSON.stringify(['usb', 7, null]) });await seedChallenge('stale', user.id, 'registration', Date.now() - 1000); // purged on the way inswMock.generateRegistrationOptions.mockResolvedValue({ challenge: 'reg-chal' });@@ -345,6 +346,7 @@ describe('passkeyRegisterOptions', () => {expect(call.excludeCredentials).toEqual([{ id: 'cred-a', transports: ['usb', 'nfc'] },{ id: 'cred-b', transports: undefined }, // unparseable transports degrade to undefined+ { id: 'cred-c', transports: ['usb'] }, // only string entries are transports]);const stored = await findRows(orm, WebauthnChallenges);@@ -505,6 +507,8 @@ describe('passkeyRegisterVerify', () => {aaguid: 'aaguid-1',});expect(Buffer.from(row?.public_key as Buffer)).toEqual(Buffer.from([9, 9, 9]));+ // Verification accepts exactly the algorithms the options offered.+ expect(swMock.verifyRegistrationResponse.mock.calls[0][0].supportedAlgorithmIDs).toEqual([-8, -7, -257]);});it('PASSKEY-SVC-012: defaults a blank name by device type and caps a long one at 60 chars', async () => {diff --git a/server/tests/unit/nest/webauthn-config.service.test.ts b/server/tests/unit/nest/webauthn-config.service.test.tsindex da41a188f..74f05c417 100644--- a/server/tests/unit/nest/webauthn-config.service.test.ts+++ b/server/tests/unit/nest/webauthn-config.service.test.ts@@ -1,5 +1,6 @@import type { AppSettingsRepository } from '../../../src/db/repositories/AppSettings.repository';import { WebauthnConfigService, originWithinRpScope } from '../../../src/nest/auth/webauthn-config.service';+import { Logger } from '@nestjs/common';import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';@@ -129,6 +130,56 @@ describe('WebauthnConfigService.resolve', () => {vi.stubEnv('WEBAUTHN_ORIGINS', 'https://env.example.org');expect((await svc.resolve())!.explicitOrigins).toBe(true);});++ // The verifier refuses an expected origin with a path, a trailing slash or an+ // uppercase host, and an RP ID that is not lower case. Each is reduced to the+ // form the browser reports, so a value that worked before keeps working.+ it('WAC-014: configured origins are reduced to scheme, host and port, deduplicated', async () => {+ settingsStore.set('webauthn_rp_id', 'example.org');+ settingsStore.set(+ 'webauthn_origins',+ 'https://A.Example.org/trek/, https://a.example.org, https://b.example.org:8443/x//, http://localhost:5173/',+ );+ expect(await svc.resolve()).toMatchObject({+ origins: ['https://a.example.org', 'https://b.example.org:8443', 'http://localhost:5173'],+ explicitOrigins: true,+ });+ });++ it('WAC-015: the RP ID is lower-cased, from the setting and from the env var', async () => {+ settingsStore.set('webauthn_rp_id', ' Trek.Example.ORG ');+ expect(await svc.resolve()).toMatchObject({ rpID: 'trek.example.org' });++ vi.stubEnv('WEBAUTHN_RP_ID', 'ENV.example.org');+ expect(await svc.resolve()).toMatchObject({ rpID: 'env.example.org' });+ });++ it('WAC-016: an APP_URL with a path, a trailing slash or an uppercase host derives its origin', async () => {+ appUrlRef.value = 'https://Trek.Example.org/app/';+ expect(await svc.resolve()).toMatchObject({+ rpID: 'trek.example.org',+ origins: ['https://trek.example.org'],+ explicitOrigins: false,+ });+ });++ it('WAC-017: an origin that does not parse is dropped and named in a warning; other schemes are kept', async () => {+ const warn = vi.spyOn(Logger.prototype, 'warn').mockImplementation(() => undefined);+ settingsStore.set('webauthn_rp_id', 'example.org');+ settingsStore.set('webauthn_origins', 'example.org, https://example.org, android:apk-key-hash:abc123');+ expect(await svc.resolve()).toMatchObject({ origins: ['https://example.org', 'android:apk-key-hash:abc123'] });+ expect(warn).toHaveBeenCalledWith('Ignoring passkey origins that are not valid URLs: example.org');+ warn.mockRestore();+ });++ it('WAC-018: an explicit list with no parseable origin leaves passkeys unconfigured instead of falling back', async () => {+ const warn = vi.spyOn(Logger.prototype, 'warn').mockImplementation(() => undefined);+ appUrlRef.value = 'https://trek.example.org';+ settingsStore.set('webauthn_origins', 'trek.example.org');+ expect(await svc.resolve()).toBeNull();+ expect(warn).toHaveBeenCalledTimes(1);+ warn.mockRestore();+ });});// The scope rule mirrors what the browser enforces for a ceremony: https-onlydiff --git a/shared/package.json b/shared/package.jsonindex 262ec86f2..75bc88ed4 100644--- a/shared/package.json+++ b/shared/package.json@@ -115,7 +115,7 @@"prettier-plugin-organize-imports": "^4.3.0","tsdown": "^0.23.7","typescript": "^6.0.3",- "typescript-eslint": "^8.72.1",+ "typescript-eslint": "^8.73.0","vitest": "^4.1.11"}}