Snyk reports high risk severity for acorn in react-scripts
Describe the bug
Snyk reports high severity issue with react-scripts. See details below:
Regular Expression Denial of Service (ReDoS)
Vulnerable module: acorn
Introduced through: [email protected]
Exploit maturity: No known exploit
Fixed in: 7.1.1
Detailed paths
Introduced through: [email protected] › [email protected] › [email protected] › [email protected]
Remediation: No remediation path available.
Introduced through: [email protected] › [email protected] › [email protected] › [email protected] › [email protected]
Remediation: No remediation path available.
Introduced through: [email protected] › [email protected] › [email protected] › [email protected] › [email protected] › [email protected]
Remediation: No remediation path available.
…and 14 more Overview
acorn is a tiny, fast JavaScript parser written in JavaScript.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via a regex in the form of /[x-\ud800]/u, which causes the parser to enter an infinite loop.
This string is not a valid UTF16 and is therefore not sanitized before reaching the parser. An application which processes untrusted input and passes it directly to acorn, will allow attackers to leverage the vulnerability leading to a Denial of Service.
Did you try recovering your dependencies?
Yes.
Please paste the output of npm --version and/or yarn --version to confirm.
6.13.7
Which terms did you search for in User Guide?
Not applicable.
Environment
Environment Info:
System: OS: Windows 7 6.1.7601 CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz Binaries: Node: 12.16.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.21.1 - C:\Program Files (x86)\Yarn x\bin\yarn.CMD npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD Browsers: Internet Explorer: 11.0.9600.19301 npmPackages: react: ^16.13.0 => 16.13.0 react-dom: ^16.13.0 => 16.13.0 react-scripts: 3.4.0 => 3.4.0 npmGlobalPackages: create-react-app: Not Found
Steps to reproduce
Install new version of React.
(Write your steps here:)
- npx create-react-app my-app
- Test with Snyk.io
I also have the same issue
As do I! Feeling less lonely now
I also have this issue.
npm audit throws that the acorn vuln is patched in version >=7.1.1. I don't know if installing directly the acorn module to the latest version with npm install acorn@latest will solve it. Gonna give it a try and share my results.
@SirMauri any results?
Setting resolutions in package.json is the better approach if using yarn as you don’t explicitly set a dependency on acorn in your project.
@bpedersen thanks for the recommendation, this clears the warnings in yarn audit.
"resolutions": {
"acorn": "^7.1.1"
},
Adding the resolution worked. I came across this issue while working on a very small project using create-react-app. I'm pretty new to coding but I couldn't find a way to address this with npm. I just switched over to yarn but I'm still curious, what can be done about this in projects set up with node package manager?
@dusty @bpedersen @BMD-518
It may remove the warning to manually set the resolution, but does it affect anything in the Create React App in any way? Like, any functionality?
I haven't noticed any build issues with the patched acorn.
@dusty And no visible bugs in any React apps?
Are there fix for this ?
Any fix for npm? I've found 17 moderate severity vulnerabilities related to react-scripts using acorn.
This needs to be fixed asap because it affect developers using create-react-app.
resolution worked for me
Running npm, I was able to fix it temporarily by
adding to package.json scripts:
"preinstall": "npx npm-force-resolutions",
and adding to package.json
"resolutions": {
"acorn": "^7.1.1"
}
waiting for react-scripts update though.
Running npm, I was able to fix it temporarily by adding to package.json
scripts:"preinstall": "npx npm-force-resolutions",and adding to package.json
"resolutions": { "acorn": "^7.1.1" }waiting for react-scripts update though.
For others attempting this fix, please be mindful of your other dependencies that uses acorn. Tried this solution and sadly 7.1.1 broke some of my other modules.
shrugs, guess I'll have to wait on actual fixes.
Solved it temporary by using npm-audit-resolver
Any updates ?
"resolutions": {
"acorn": "^7.1.1"
},
did not work for me.
any updates on the fix?
same here :
Moderate Regular Expression Denial of Service Package acorn Patched in >=6.4.1 <7.0.0 || >=7.1.1 Dependency of react-scripts Path react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > acorn More info https://npmjs.com/advisories/1488
any updates ?