From 300f30eca99d2d36b625bc32b56cb56dd9b92d96 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:58:59 +0000 Subject: [PATCH] Update dependency oidc-client-ts to v3 (#12223) * Mock subtle crypto in OIDC test To unblock upgrade to oidc-client-ts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update dependency oidc-client-ts to v3 * delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Ensure oidc-client-ts 3.0.1 to drop crypto-js Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 8 +++++--- test/utils/oidc/authorize-test.ts | 11 ++++++++++ yarn.lock | 34 ++++++++++++++----------------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 7c9e85c55d..f7aa02b909 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,9 @@ }, "resolutions": { "@types/react-dom": "17.0.21", - "@types/react": "17.0.68" + "@types/react": "17.0.68", + "oidc-client-ts": "3.0.1", + "jwt-decode": "4.0.0" }, "dependencies": { "@babel/runtime": "^7.12.5", @@ -110,7 +112,7 @@ "matrix-widget-api": "^1.5.0", "memoize-one": "^6.0.0", "minimist": "^1.2.5", - "oidc-client-ts": "^2.2.4", + "oidc-client-ts": "^3.0.1", "opus-recorder": "^8.0.3", "pako": "^2.0.3", "png-chunks-extract": "^1.0.0", @@ -170,7 +172,7 @@ "@types/katex": "^0.16.0", "@types/lodash": "^4.14.168", "@types/modernizr": "^3.5.3", - "@types/node": "^16", + "@types/node": "18", "@types/node-fetch": "^2.6.2", "@types/pako": "^2.0.0", "@types/qrcode": "^1.3.5", diff --git a/test/utils/oidc/authorize-test.ts b/test/utils/oidc/authorize-test.ts index 509429ee76..2b95dd15fb 100644 --- a/test/utils/oidc/authorize-test.ts +++ b/test/utils/oidc/authorize-test.ts @@ -19,6 +19,8 @@ import { completeAuthorizationCodeGrant } from "matrix-js-sdk/src/oidc/authorize import * as randomStringUtils from "matrix-js-sdk/src/randomstring"; import { BearerTokenResponse } from "matrix-js-sdk/src/oidc/validate"; import { mocked } from "jest-mock"; +import { Crypto } from "@peculiar/webcrypto"; +import { getRandomValues } from "node:crypto"; import { completeOidcLogin, startOidcLogin } from "../../../src/utils/oidc/authorize"; import { makeDelegatedAuthConfig } from "../../test-utils/oidc"; @@ -32,6 +34,8 @@ jest.mock("matrix-js-sdk/src/oidc/authorize", () => ({ completeAuthorizationCodeGrant: jest.fn(), })); +const webCrypto = new Crypto(); + describe("OIDC authorization", () => { const issuer = "https://auth.com/"; const homeserverUrl = "https://matrix.org"; @@ -55,6 +59,13 @@ describe("OIDC authorization", () => { jest.spyOn(randomStringUtils, "randomString").mockRestore(); mockPlatformPeg(); + Object.defineProperty(window, "crypto", { + value: { + getRandomValues, + randomUUID: jest.fn().mockReturnValue("not-random-uuid"), + subtle: webCrypto.subtle, + }, + }); }); beforeAll(() => { diff --git a/yarn.lock b/yarn.lock index d8945e1f69..471e20dbd2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2689,10 +2689,12 @@ dependencies: undici-types "~5.26.4" -"@types/node@^16": - version "16.18.79" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.79.tgz#153e25561b271cf87dc1b28d38f98cebd514d788" - integrity sha512-Qd7jdLR5zmnIyMhfDrfPqN5tUCvreVpP3Qrf2oSM+F7SNzlb/MwHISGUkdFHtevfkPJ3iAGyeQI/jsbh9EStgQ== +"@types/node@18": + version "18.19.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.17.tgz#a581a9fb4b2cfdbc61f008804f4436b2d5c40354" + integrity sha512-SzyGKgwPzuWp2SHhlpXKzCX0pIOfcI4V2eF37nNBJOhwlegQ83omtVQ1XxZpDE06V/d6AQvfQdPfnw0tRC//Ng== + dependencies: + undici-types "~5.26.4" "@types/normalize-package-data@^2.4.0": version "2.4.4" @@ -3910,11 +3912,6 @@ crypt@0.0.2: resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== -crypto-js@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" - integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== - css-box-model@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/css-box-model/-/css-box-model-1.2.1.tgz#59951d3b81fd6b2074a62d49444415b0d2b4d7c1" @@ -6459,10 +6456,10 @@ jszip@^3.7.0: readable-stream "~2.3.6" setimmediate "^1.0.5" -jwt-decode@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59" - integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A== +jwt-decode@4.0.0, jwt-decode@^3.1.2, jwt-decode@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-4.0.0.tgz#2270352425fd413785b2faf11f6e755c5151bd4b" + integrity sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA== katex@^0.16.0: version "0.16.9" @@ -7101,13 +7098,12 @@ object.values@^1.1.6, object.values@^1.1.7: define-properties "^1.2.0" es-abstract "^1.22.1" -oidc-client-ts@^2.2.4: - version "2.4.0" - resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-2.4.0.tgz#764c8a33de542026e2798de9849ce8049047d7e5" - integrity sha512-WijhkTrlXK2VvgGoakWJiBdfIsVGz6CFzgjNNqZU1hPKV2kyeEaJgLs7RwuiSp2WhLfWBQuLvr2SxVlZnk3N1w== +oidc-client-ts@3.0.1, oidc-client-ts@^2.2.4, oidc-client-ts@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-3.0.1.tgz#be264fb87c89f74f73863646431c32cd06f5ceb7" + integrity sha512-xX8unZNtmtw3sOz4FPSqDhkLFnxCDsdo2qhFEH2opgWnF/iXMFoYdBQzkwCxAZVgt3FT3DnuBY3k80EZHT0RYg== dependencies: - crypto-js "^4.2.0" - jwt-decode "^3.1.2" + jwt-decode "^4.0.0" on-finished@2.4.1: version "2.4.1"