Closed mickelsonmichael closed 2 years ago
I attempted to use the suggested answer here: https://stackoverflow.com/a/73027407/3338349
However, I got a different exception because I was working with Nasdaq's Nexus implementation, and received the following exception
> npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm WARN audit 400 Bad Request - POST https://nexus.exchsys.nasdaq.com/repository/npm/-/npm/v1/security/audits/quick
==================================================================
Nexus Lifecycle or Nexus Firewall must be configured. Please contact your NXRM administrator.
==================================================================
npm ERR! audit endpoint returned an error
The final solution was a multi-part solution.
You can run the npm audit
command if you add the --registry
flag and point it to the public registry. Then, with that report generated, search through the vulnerabilities until you find one that mentions the cryptographic signatures. In my case, it was the elliptic
package which was reporting Use of a Broken or Risky Cryptographic Algorithm
.
> npm audit --registry=https://registry.npmjs.org
# npm audit report
.
.
.
elliptic <6.5.4
Severity: moderate
Use of a Broken or Risky Cryptographic Algorithm - https://github.com/advisories/GHSA-r9p9-mrjm-926w
fix available via `npm audit fix`
node_modules/elliptic
.
.
.
50 vulnerabilities (1 low, 14 moderate, 27 high, 8 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues possible (including breaking changes), run:
npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Simply update the offending package, either by manually updating the package.json or by using the npm update
command. In my case, I had to bump the elliptic
version to a version greater than 6.5.4
, which was only a single minor version less than I had already (6.5.3
).
Apparently, a workaround line I had added earlier to my pipeline was holding everything together without my realizing it. I was setting NODE_OPTIONS: '--openssl-legacy-provider'
in my .gitlab-ci.yml
file, which didn't initially work but worked when I updated my elliptic
version. However, removing the line re-introduced the error.
A keen observer in this StackOverflow comment pointed out that the MD4 algorithm is hard-coded into older versions of Webpack and does not utilize the version specified by the hashFunction
option.
The proper solution would be to update to create-react-app
which utilizes a more recent version of Webpack. However, if that is not possible, then the --openssl-legacy-provider
workaround may be required in the meantime.
I want to stress, however, that this is not a permanent fix, because it leaves your code vulnerable. OpenSSL removed MD4 for a reason, and creating workarounds to subvert that removal seems antithetical to secure practices.
In my particular scenario, we aren't able to easily convert to Webpack 5 because of the way the webworkers were configured to use the worker-loader
library, which no longer exists in Webpack. In order to upgrade, we will need to modify the workers to align more with what Webpack expects web workers to look like.
Summary
While attempting to build a React application with a Node backend, I was getting an exception during the pipeline segement
Notes
CI
environmental variable