# npm audit report
nth-check <2.0.1
Severity: high
Inefficient Regular Expression Complexity in nth-check - https://github.com/advisories/GHSA-rp65-9cf3-cjxr
fix available via `npm audit fix --force`
Will install react-scripts@2.1.3, which is a breaking change
node_modules/svgo/node_modules/nth-check
css-select <=3.1.0
Depends on vulnerable versions of nth-check
node_modules/svgo/node_modules/css-select
svgo 1.0.0 - 1.3.2
Depends on vulnerable versions of css-select
node_modules/svgo
@svgr/plugin-svgo <=5.5.0
Depends on vulnerable versions of svgo
node_modules/@svgr/plugin-svgo
@svgr/webpack 4.0.0 - 5.5.0
Depends on vulnerable versions of @svgr/plugin-svgo
node_modules/@svgr/webpack
react-scripts >=2.1.4
Depends on vulnerable versions of @svgr/webpack
node_modules/react-scripts
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
create-react-app으로 프로젝트 폴더를 만들자마자 npm에 오류가 감지됐다.
뭐가 문젠지 알 수 없어서 npm audit fix --force
를 입력해 봤는데 오히려 파일이 더 깨진 것 같았다.
아마 중요한 키워드는 nth-check
이지 싶었다. 구글링해보니... 다행히 이슈가 작성되어 있더라. 꽤 상세하게. (근데 영어를 곁들인)
package.json
을 열어서 다음과 같이 수정한다.
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1"
}
이걸 찾아서
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"react-scripts": "5.0.1"
},
이렇게 바꿔주면 된다.
이후 npm audit
대신 npm audit --production
을 사용한다.
깃허브 이슈에도 설명되어 있는데, npm은 Node.js 앱을 위한 툴이다. 때문에 npm은 이 코드로 Node.js 앱을 돌릴 때 생기는 취약점을 경고해준다. 하지만 CRA는 정적 빌드 툴이고, Node.js와 같은 방식으로 작동하지 않는다. 때문에, npm audit
에 감지되는 취약점은 CRA에서 대부분 유효하지 않다. 따라서 크게 신경쓰지 않아도 된다!
아직 문제의 원인과 해결법을 100% 이해하진 못했다. 깃허브 이슈 글을 완벽히 이해할 만큼의 코딩 실력과 영어 실력이 아직 없다... 더 꼼꼼히 읽어봐야 할 것 같다.