@simplewebauthn/server 8.2.0 → 8.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/deps.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationResponseJSON, AuthenticatorDevice, AuthenticatorSelectionCriteria, Base64URLString, COSEAlgorithmIdentifier, CredentialDeviceType, Crypto, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialDescriptorFuture, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON, UserVerificationRequirement, } from '@simplewebauthn/typescript-types';
2
- export * as cborx from 'cbor-x';
2
+ export * as cborx from 'cbor-x/encode';
3
3
  export { default as base64 } from '@hexagon/base64';
4
4
  export { fetch as crossFetch } from 'cross-fetch';
5
5
  export { AsnParser, AsnSerializer } from '@peculiar/asn1-schema';
package/esm/deps.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // cbor (a.k.a. cbor-x in Node land)
2
- export * as cborx from 'cbor-x';
2
+ export * as cborx from 'cbor-x/encode';
3
3
  // b64 (a.k.a. @hexagon/base64 in Node land)
4
4
  export { default as base64 } from '@hexagon/base64';
5
5
  // cross-fetch
@@ -46,13 +46,20 @@ export function parseAuthenticatorData(authData) {
46
46
  // Bytes decode to `{ 1: "OKP", 3: -8, -1: "Ed25519" }` (it's missing key -2 a.k.a. COSEKEYS.x)
47
47
  const badEdDSACBOR = isoUint8Array.fromHex('a301634f4b500327206745643235353139');
48
48
  const bytesAtCurrentPosition = authData.slice(pointer, pointer + badEdDSACBOR.byteLength);
49
+ let foundBadCBOR = false;
49
50
  if (isoUint8Array.areEqual(badEdDSACBOR, bytesAtCurrentPosition)) {
50
51
  // Change the bad CBOR 0xa3 to 0xa4 so that the credential public key can be recognized
52
+ foundBadCBOR = true;
51
53
  authData[pointer] = 0xa4;
52
54
  }
53
55
  // Decode the next CBOR item in the buffer, then re-encode it back to a Buffer
54
56
  const firstDecoded = isoCBOR.decodeFirst(authData.slice(pointer));
55
57
  const firstEncoded = Uint8Array.from(isoCBOR.encode(firstDecoded));
58
+ if (foundBadCBOR) {
59
+ // Restore the bit we changed so that `authData` is the same as it came in and won't break
60
+ // signature verification.
61
+ authData[pointer] = 0xa3;
62
+ }
56
63
  credentialPublicKey = firstEncoded;
57
64
  pointer += firstEncoded.byteLength;
58
65
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/index.js",
3
3
  "main": "./script/index.js",
4
4
  "name": "@simplewebauthn/server",
5
- "version": "8.2.0",
5
+ "version": "8.3.3",
6
6
  "description": "SimpleWebAuthn for Servers",
7
7
  "license": "MIT",
8
8
  "author": "Matthew Miller <matthew@millerti.me>",
@@ -55,7 +55,7 @@
55
55
  "@peculiar/asn1-rsa": "^2.3.6",
56
56
  "@peculiar/asn1-schema": "^2.3.6",
57
57
  "@peculiar/asn1-x509": "^2.3.6",
58
- "@simplewebauthn/typescript-types": "^8.0.0",
58
+ "@simplewebauthn/typescript-types": "^8.3.3",
59
59
  "cbor-x": "^1.5.2",
60
60
  "cross-fetch": "^4.0.0"
61
61
  },
package/script/deps.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationResponseJSON, AuthenticatorDevice, AuthenticatorSelectionCriteria, Base64URLString, COSEAlgorithmIdentifier, CredentialDeviceType, Crypto, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialDescriptorFuture, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON, UserVerificationRequirement, } from '@simplewebauthn/typescript-types';
2
- export * as cborx from 'cbor-x';
2
+ export * as cborx from 'cbor-x/encode';
3
3
  export { default as base64 } from '@hexagon/base64';
4
4
  export { fetch as crossFetch } from 'cross-fetch';
5
5
  export { AsnParser, AsnSerializer } from '@peculiar/asn1-schema';
package/script/deps.js CHANGED
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.KeyDescription = exports.id_ce_keyDescription = exports.RSAPublicKey = exports.id_secp384r1 = exports.id_secp256r1 = exports.id_ecPublicKey = exports.ECParameters = exports.ECDSASigValue = exports.SubjectKeyIdentifier = exports.SubjectAlternativeName = exports.Name = exports.id_ce_subjectKeyIdentifier = exports.id_ce_subjectAltName = exports.id_ce_extKeyUsage = exports.id_ce_cRLDistributionPoints = exports.id_ce_basicConstraints = exports.id_ce_authorityKeyIdentifier = exports.ExtendedKeyUsage = exports.CRLDistributionPoints = exports.CertificateList = exports.Certificate = exports.BasicConstraints = exports.AuthorityKeyIdentifier = exports.AsnSerializer = exports.AsnParser = exports.crossFetch = exports.base64 = exports.cborx = void 0;
30
30
  // cbor (a.k.a. cbor-x in Node land)
31
- exports.cborx = __importStar(require("cbor-x"));
31
+ exports.cborx = __importStar(require("cbor-x/encode"));
32
32
  // b64 (a.k.a. @hexagon/base64 in Node land)
33
33
  var base64_1 = require("@hexagon/base64");
34
34
  Object.defineProperty(exports, "base64", { enumerable: true, get: function () { return __importDefault(base64_1).default; } });
@@ -49,13 +49,20 @@ function parseAuthenticatorData(authData) {
49
49
  // Bytes decode to `{ 1: "OKP", 3: -8, -1: "Ed25519" }` (it's missing key -2 a.k.a. COSEKEYS.x)
50
50
  const badEdDSACBOR = index_js_1.isoUint8Array.fromHex('a301634f4b500327206745643235353139');
51
51
  const bytesAtCurrentPosition = authData.slice(pointer, pointer + badEdDSACBOR.byteLength);
52
+ let foundBadCBOR = false;
52
53
  if (index_js_1.isoUint8Array.areEqual(badEdDSACBOR, bytesAtCurrentPosition)) {
53
54
  // Change the bad CBOR 0xa3 to 0xa4 so that the credential public key can be recognized
55
+ foundBadCBOR = true;
54
56
  authData[pointer] = 0xa4;
55
57
  }
56
58
  // Decode the next CBOR item in the buffer, then re-encode it back to a Buffer
57
59
  const firstDecoded = index_js_1.isoCBOR.decodeFirst(authData.slice(pointer));
58
60
  const firstEncoded = Uint8Array.from(index_js_1.isoCBOR.encode(firstDecoded));
61
+ if (foundBadCBOR) {
62
+ // Restore the bit we changed so that `authData` is the same as it came in and won't break
63
+ // signature verification.
64
+ authData[pointer] = 0xa3;
65
+ }
59
66
  credentialPublicKey = firstEncoded;
60
67
  pointer += firstEncoded.byteLength;
61
68
  }