diff --git a/apps/meerkat/src/app/database/entry/addAttributes.ts b/apps/meerkat/src/app/database/entry/addAttributes.ts index c8ff3af14..552ee31c3 100644 --- a/apps/meerkat/src/app/database/entry/addAttributes.ts +++ b/apps/meerkat/src/app/database/entry/addAttributes.ts @@ -101,8 +101,9 @@ async function addAttributes ( value.value.byteOffset, value.value.byteLength, ), - // TODO: Should you just get rid of this column? Or at least not fill it in? - jer: value.toJSON() as Prisma.InputJsonValue, + jer: (value.construction === ASN1Construction.primitive) + ? value.toJSON() as Prisma.InputJsonValue + : undefined, normalized_str: normalizer?.(ctx, value), }); } @@ -120,7 +121,9 @@ async function addAttributes ( vwc.value.value.byteOffset, vwc.value.value.byteLength, ), - jer: vwc.value.toJSON() as Prisma.InputJsonValue, + jer: (vwc.value.construction === ASN1Construction.primitive) + ? vwc.value.toJSON() as Prisma.InputJsonValue + : undefined, normalized_str: normalizer?.(ctx, vwc.value), ContextValue: { createMany: { diff --git a/apps/meerkat/src/app/database/entry/addValues.ts b/apps/meerkat/src/app/database/entry/addValues.ts index 396d5ae24..f8af0e5df 100644 --- a/apps/meerkat/src/app/database/entry/addValues.ts +++ b/apps/meerkat/src/app/database/entry/addValues.ts @@ -355,7 +355,9 @@ async function addValues( attr.value.value.byteOffset, attr.value.value.byteLength, ), - jer: attr.value.toJSON() as Prisma.InputJsonValue, + jer: (attr.value.construction === ASN1Construction.primitive) + ? attr.value.toJSON() as Prisma.InputJsonValue + : undefined, normalized_str: normalizerGetter(attr.type)?.(ctx, attr.value), })), }), @@ -373,7 +375,9 @@ async function addValues( attr.value.value.byteOffset, attr.value.value.byteLength, ), - jer: attr.value.toJSON() as Prisma.InputJsonValue, + jer: (attr.value.construction === ASN1Construction.primitive) + ? attr.value.toJSON() as Prisma.InputJsonValue + : undefined, normalized_str: normalizerGetter(attr.type)?.(ctx, attr.value), ContextValue: { createMany: { diff --git a/apps/meerkat/src/app/password/checkPasswordQuality.ts b/apps/meerkat/src/app/password/checkPasswordQuality.ts index 758582401..1f6a96b88 100644 --- a/apps/meerkat/src/app/password/checkPasswordQuality.ts +++ b/apps/meerkat/src/app/password/checkPasswordQuality.ts @@ -80,15 +80,21 @@ async function checkPasswordQuality ( return CHECK_PWD_QUALITY_LENGTH; } - const alphabet: string[] = (await ctx.db.attributeValue.findFirst({ + const alphabetResult = await ctx.db.attributeValue.findFirst({ where: { entry_id: subentry.dse.id, type_oid: pwdAlphabet["&id"].toBytes(), }, select: { - jer: true, + tag_class: true, + tag_number: true, + constructed: true, + content_octets: true, }, - }))?.jer as string[] ?? []; + }); + const alphabet = alphabetResult + ? pwdAlphabet.decoderFor["&Type"]!(attributeValueFromDB(alphabetResult)) + : []; const passwordCharacters: Set = new Set(Array.from(password)); // TODO: Unit testing to ensure the continue-to-label works as expected. diff --git a/apps/meerkat/src/prisma/schema.prisma b/apps/meerkat/src/prisma/schema.prisma index 515abe97e..54dd8a13b 100644 --- a/apps/meerkat/src/prisma/schema.prisma +++ b/apps/meerkat/src/prisma/schema.prisma @@ -16,6 +16,7 @@ datasource db { generator client { provider = "prisma-client-js" + previewFeatures = ["relationJoins"] } // Subentry attributes, such as those documented in X.501, Section 14.4.3, diff --git a/package-lock.json b/package-lock.json index ed2671750..97ec1f659 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@nestjs/swagger": "^6.1.4", "@nestjs/terminus": "^9.1.4", "@nx/webpack": "^16.7.4", - "@prisma/client": "^5.2.0", + "@prisma/client": "^5.11.0", "@wildboar/acse": "^1.0.7", "@wildboar/cms": "^1.0.6", "@wildboar/copp": "^1.0.4", @@ -122,7 +122,7 @@ "nx-cloud": "16.3.0", "prettier": "2.8.3", "prettier-plugin-organize-imports": "^3.2.2", - "prisma": "^5.2.0", + "prisma": "^5.11.0", "sloc": "^0.2.1", "ts-jest": "29.1.1", "ts-node": "10.9.1", @@ -7051,13 +7051,10 @@ "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==" }, "node_modules/@prisma/client": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.2.0.tgz", - "integrity": "sha512-AiTjJwR4J5Rh6Z/9ZKrBBLel3/5DzUNntMohOy7yObVnVoTNVFi2kvpLZlFuKO50d7yDspOtW6XBpiAd0BVXbQ==", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.11.0.tgz", + "integrity": "sha512-SWshvS5FDXvgJKM/a0y9nDC1rqd7KG0Q6ZVzd+U7ZXK5soe73DJxJJgbNBt2GNXOa+ysWB4suTpdK5zfFPhwiw==", "hasInstallScript": true, - "dependencies": { - "@prisma/engines-version": "5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f" - }, "engines": { "node": ">=16.13" }, @@ -7070,17 +7067,50 @@ } } }, + "node_modules/@prisma/debug": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.11.0.tgz", + "integrity": "sha512-N6yYr3AbQqaiUg+OgjkdPp3KPW1vMTAgtKX6+BiB/qB2i1TjLYCrweKcUjzOoRM5BriA4idrkTej9A9QqTfl3A==", + "devOptional": true + }, "node_modules/@prisma/engines": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.2.0.tgz", - "integrity": "sha512-dT7FOLUCdZmq+AunLqB1Iz+ZH/IIS1Fz2THmKZQ6aFONrQD/BQ5ecJ7g2wGS2OgyUFf4OaLam6/bxmgdOBDqig==", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.11.0.tgz", + "integrity": "sha512-gbrpQoBTYWXDRqD+iTYMirDlF9MMlQdxskQXbhARhG6A/uFQjB7DZMYocMQLoiZXO/IskfDOZpPoZE8TBQKtEw==", "devOptional": true, - "hasInstallScript": true + "hasInstallScript": true, + "dependencies": { + "@prisma/debug": "5.11.0", + "@prisma/engines-version": "5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102", + "@prisma/fetch-engine": "5.11.0", + "@prisma/get-platform": "5.11.0" + } }, "node_modules/@prisma/engines-version": { - "version": "5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f.tgz", - "integrity": "sha512-jsnKT5JIDIE01lAeCj2ghY9IwxkedhKNvxQeoyLs6dr4ZXynetD0vTy7u6wMJt8vVPv8I5DPy/I4CFaoXAgbtg==" + "version": "5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102.tgz", + "integrity": "sha512-WXCuyoymvrS4zLz4wQagSsc3/nE6CHy8znyiMv8RKazKymOMd5o9FP5RGwGHAtgoxd+aB/BWqxuP/Ckfu7/3MA==", + "devOptional": true + }, + "node_modules/@prisma/fetch-engine": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.11.0.tgz", + "integrity": "sha512-994viazmHTJ1ymzvWugXod7dZ42T2ROeFuH6zHPcUfp/69+6cl5r9u3NFb6bW8lLdNjwLYEVPeu3hWzxpZeC0w==", + "devOptional": true, + "dependencies": { + "@prisma/debug": "5.11.0", + "@prisma/engines-version": "5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102", + "@prisma/get-platform": "5.11.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.11.0.tgz", + "integrity": "sha512-rxtHpMLxNTHxqWuGOLzR2QOyQi79rK1u1XYAVLZxDGTLz/A+uoDnjz9veBFlicrpWjwuieM4N6jcnjj/DDoidw==", + "devOptional": true, + "dependencies": { + "@prisma/debug": "5.11.0" + } }, "node_modules/@rollup/plugin-babel": { "version": "5.3.1", @@ -19923,13 +19953,13 @@ } }, "node_modules/prisma": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.2.0.tgz", - "integrity": "sha512-FfFlpjVCkZwrqxDnP4smlNYSH1so+CbfjgdpioFzGGqlQAEm6VHAYSzV7jJgC3ebtY9dNOhDMS2+4/1DDSM7bQ==", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.11.0.tgz", + "integrity": "sha512-KCLiug2cs0Je7kGkQBN9jDWoZ90ogE/kvZTUTgz2h94FEo8pczCkPH7fPNXkD1sGU7Yh65risGGD1HQ5DF3r3g==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/engines": "5.2.0" + "@prisma/engines": "5.11.0" }, "bin": { "prisma": "build/index.js" @@ -30724,23 +30754,54 @@ "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==" }, "@prisma/client": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.2.0.tgz", - "integrity": "sha512-AiTjJwR4J5Rh6Z/9ZKrBBLel3/5DzUNntMohOy7yObVnVoTNVFi2kvpLZlFuKO50d7yDspOtW6XBpiAd0BVXbQ==", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.11.0.tgz", + "integrity": "sha512-SWshvS5FDXvgJKM/a0y9nDC1rqd7KG0Q6ZVzd+U7ZXK5soe73DJxJJgbNBt2GNXOa+ysWB4suTpdK5zfFPhwiw==", + "requires": {} + }, + "@prisma/debug": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.11.0.tgz", + "integrity": "sha512-N6yYr3AbQqaiUg+OgjkdPp3KPW1vMTAgtKX6+BiB/qB2i1TjLYCrweKcUjzOoRM5BriA4idrkTej9A9QqTfl3A==", + "devOptional": true + }, + "@prisma/engines": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.11.0.tgz", + "integrity": "sha512-gbrpQoBTYWXDRqD+iTYMirDlF9MMlQdxskQXbhARhG6A/uFQjB7DZMYocMQLoiZXO/IskfDOZpPoZE8TBQKtEw==", + "devOptional": true, "requires": { - "@prisma/engines-version": "5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f" + "@prisma/debug": "5.11.0", + "@prisma/engines-version": "5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102", + "@prisma/fetch-engine": "5.11.0", + "@prisma/get-platform": "5.11.0" } }, - "@prisma/engines": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.2.0.tgz", - "integrity": "sha512-dT7FOLUCdZmq+AunLqB1Iz+ZH/IIS1Fz2THmKZQ6aFONrQD/BQ5ecJ7g2wGS2OgyUFf4OaLam6/bxmgdOBDqig==", + "@prisma/engines-version": { + "version": "5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102.tgz", + "integrity": "sha512-WXCuyoymvrS4zLz4wQagSsc3/nE6CHy8znyiMv8RKazKymOMd5o9FP5RGwGHAtgoxd+aB/BWqxuP/Ckfu7/3MA==", "devOptional": true }, - "@prisma/engines-version": { - "version": "5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f.tgz", - "integrity": "sha512-jsnKT5JIDIE01lAeCj2ghY9IwxkedhKNvxQeoyLs6dr4ZXynetD0vTy7u6wMJt8vVPv8I5DPy/I4CFaoXAgbtg==" + "@prisma/fetch-engine": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.11.0.tgz", + "integrity": "sha512-994viazmHTJ1ymzvWugXod7dZ42T2ROeFuH6zHPcUfp/69+6cl5r9u3NFb6bW8lLdNjwLYEVPeu3hWzxpZeC0w==", + "devOptional": true, + "requires": { + "@prisma/debug": "5.11.0", + "@prisma/engines-version": "5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102", + "@prisma/get-platform": "5.11.0" + } + }, + "@prisma/get-platform": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.11.0.tgz", + "integrity": "sha512-rxtHpMLxNTHxqWuGOLzR2QOyQi79rK1u1XYAVLZxDGTLz/A+uoDnjz9veBFlicrpWjwuieM4N6jcnjj/DDoidw==", + "devOptional": true, + "requires": { + "@prisma/debug": "5.11.0" + } }, "@rollup/plugin-babel": { "version": "5.3.1", @@ -40272,12 +40333,12 @@ "requires": {} }, "prisma": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.2.0.tgz", - "integrity": "sha512-FfFlpjVCkZwrqxDnP4smlNYSH1so+CbfjgdpioFzGGqlQAEm6VHAYSzV7jJgC3ebtY9dNOhDMS2+4/1DDSM7bQ==", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.11.0.tgz", + "integrity": "sha512-KCLiug2cs0Je7kGkQBN9jDWoZ90ogE/kvZTUTgz2h94FEo8pczCkPH7fPNXkD1sGU7Yh65risGGD1HQ5DF3r3g==", "devOptional": true, "requires": { - "@prisma/engines": "5.2.0" + "@prisma/engines": "5.11.0" } }, "prismjs": { diff --git a/package.json b/package.json index b9f7f7da8..0c8eaabc4 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@nestjs/swagger": "^6.1.4", "@nestjs/terminus": "^9.1.4", "@nx/webpack": "^16.7.4", - "@prisma/client": "^5.2.0", + "@prisma/client": "^5.11.0", "@wildboar/acse": "^1.0.7", "@wildboar/cms": "^1.0.6", "@wildboar/copp": "^1.0.4", @@ -143,7 +143,7 @@ "nx-cloud": "16.3.0", "prettier": "2.8.3", "prettier-plugin-organize-imports": "^3.2.2", - "prisma": "^5.2.0", + "prisma": "^5.11.0", "sloc": "^0.2.1", "ts-jest": "29.1.1", "ts-node": "10.9.1",