Skip to content

Babel-Loader Fails on FIPS: Digest method not supported #910

Open
@BurntCoffee543

Description

@BurntCoffee543

I'm submitting a bug report

Webpack Version:
5.40.0

Babel Core Version:
7.14.6

Babel Loader Version:
8.2.2

Please tell us about your environment:
RHEL

Current behavior:

Error: Digest method not supported
    at new Hash (internal/crypto/hash.js:46:19)
    at Object.createHash (crypto.js:115:10)
    at filename (/omitted_project_path/node_modules/babel-loader/lib/cache.js:94:23)
    at /omitted_project_path/node_modules/babel-loader/lib/cache.js:120:39
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/omitted_project_path/node_modules/babel-loader/lib/cache.js:3:103)
    at _next (/omitted_project_path/node_modules/babel-loader/lib/cache.js:5:194)
    at /omitted_project_path/node_modules/babel-loader/lib/cache.js:5:364
    at new Promise (<anonymous>)
    at /omitted_project_path/node_modules/babel-loader/lib/cache.js:5:97

Expected/desired behavior:

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
    I cannot easily link a StackBlitz or GitHub repo as fips has to be enabled on the Node distribution. The error occurs when doing a build of a Node application on a FIPS-enabled system.
    Webpack Config (used to splice out the md4 hashes in Webpack)
const webpack = require('webpack');
module.exports = {
  output: {
    hashFunction: 'sha256'
  },
  optimization: {
    concatenateModules: false
  },
  plugins: [
    new webpack.ids.HashedModuleIdsPlugin({
      hashFunction: 'sha256'
    })
  ]
};
  • What is the expected behavior?
    The hash changes from Use md4 instead of sha1 for filename hashes #638 and Use MD4 instead of SHA1 for filename hashes #639 use md4 which is not a supported hashing algorithm for FIPS-compliant systems. Although md4 is a faster hashing algorithm, a configuration option should be provided for those building in a FIPS-compliant environment to specify an alternative hash, such as sha-256.

  • What is the motivation / use case for changing the behavior?
    Allowing builds to use a compliant hashing algorithm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions