From 1dad1ed5f382a3c925ef5580c36e0078a05b4e2d Mon Sep 17 00:00:00 2001 From: brave-builds Date: Tue, 13 Dec 2022 08:08:12 +0000 Subject: [PATCH] Uplift of #16344 (squashed) to beta --- .storybook/webpack.config.js | 9 +++++++++ components/webpack/webpack.config.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js index 5429277294a9..451fc5000bbe 100644 --- a/.storybook/webpack.config.js +++ b/.storybook/webpack.config.js @@ -4,6 +4,15 @@ const AliasPlugin = require('enhanced-resolve/lib/AliasPlugin') const buildConfigs = ['Component', 'Static', 'Debug', 'Release'] const extraArchitectures = ['arm64', 'x86'] +// OpenSSL 3 no longer supports the insecure md4 hash, but webpack < 5.54.0 +// hardcodes it. Work around by substituting a supported algorithm. +// https://github.com/webpack/webpack/issues/13572 +// https://github.com/webpack/webpack/issues/14532 +// TODO(petemill): Remove this patching when webpack > 5.54.0 is being used. +const crypto = require("crypto"); +const crypto_orig_createHash = crypto.createHash; +crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm); + function getBuildOuptutPathList(buildOutputRelativePath) { return buildConfigs.flatMap(config => [ path.resolve(__dirname, `../../out/${config}/${buildOutputRelativePath}`), diff --git a/components/webpack/webpack.config.js b/components/webpack/webpack.config.js index 57c4eaf000bb..d624b76dd992 100644 --- a/components/webpack/webpack.config.js +++ b/components/webpack/webpack.config.js @@ -11,10 +11,11 @@ const pathMap = require('./path-map') const tsConfigPath = path.join(process.env.ROOT_GEN_DIR, 'tsconfig-webpack.json') -// OpenSSL 3 no longer supports the insecure md4 hash, but webpack < 6 +// OpenSSL 3 no longer supports the insecure md4 hash, but webpack < 5.54.0 // hardcodes it. Work around by substituting a supported algorithm. // https://github.com/webpack/webpack/issues/13572 // https://github.com/webpack/webpack/issues/14532 +// TODO(petemill): Remove this patching when webpack > 5.54.0 is being used. const crypto = require("crypto"); const crypto_orig_createHash = crypto.createHash; crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);