강의

멘토링

로드맵

Inflearn brand logo image

인프런 커뮤니티 질문&답변

juhyunk0820님의 프로필 이미지
juhyunk0820

작성한 질문수

아바타 커뮤니티앱 만들기 (React Native Expo)

[서버 실행하기] 의존성 설치를 위한 npm install 시 취약점 발생

해결된 질문

작성

·

92

0

  • 초기 설치 시 취약점 발생

    • ```
      npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.

      npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead

      npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported

      npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead

      npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

      npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

      npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

      npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

      npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

      npm warn deprecated superagent@8.1.2: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net

      added 795 packages, and audited 796 packages in 7s

      122 packages are looking for funding

      run npm fund for details

      18 vulnerabilities (4 low, 5 moderate, 9 high)

      To address issues that do not require attention, run:

      npm audit fix

      To address all issues (including breaking changes), run:

      npm audit fix --force

      Run npm audit for details.
      ```

  • 이후 ```npm audit fix``` 실행 후 두 번째 취약점 발생

    • ```
      # npm audit report

      multer 1.4.4-lts.1 - 2.0.0

      Severity: high

      Multer vulnerable to Denial of Service via unhandled exception - https://github.com/advisories/GHSA-g5hg-p3ph-g8qg

      fix available via npm audit fix --force

      Will install @nestjs/platform-express@8.2.3, which is a breaking change

      node_modules/multer

      @nestjs/platform-express >=8.2.4

      Depends on vulnerable versions of @nestjs/core

      Depends on vulnerable versions of multer

      node_modules/@nestjs/platform-express

      @nestjs/core >=9.0.0-next.1

      Depends on vulnerable versions of @nestjs/platform-express

      node_modules/@nestjs/core

      @nestjs/serve-static 2.0.0-next.1 - 2.0.0 || >=3.0.0

      Depends on vulnerable versions of @nestjs/core

      Depends on vulnerable versions of path-to-regexp

      node_modules/@nestjs/serve-static

      @nestjs/testing >=9.0.0-next.1

      Depends on vulnerable versions of @nestjs/core

      Depends on vulnerable versions of @nestjs/platform-express

      node_modules/@nestjs/testing

      path-to-regexp 0.2.0 - 1.8.0

      Severity: high

      path-to-regexp outputs backtracking regular expressions - https://github.com/advisories/GHSA-9wv6-86v2-598j

      fix available via npm audit fix --force

      Will install @nestjs/serve-static@5.0.3, which is a breaking change

      node_modules/@nestjs/serve-static/node_modules/path-to-regexp

      6 high severity vulnerabilities

      To address all issues (including breaking changes), run:

      npm audit fix --force
      ```

  • 취약점 6개 발생 이후 안사라지길래 npm audit fix --force 진행해도 6개 그대로 나오는 현상 발생

현재 node 23.7, npm 10.9.2 사용중인데 gpt한테 물어보니 nest js 버전 어쩌구 하던데 서버는 잘 몰라서 건들지를 못하겠네요. 어떻게 해야 할까요?

 

 

질문 작성시 꼭 참고해주세요

  • 에러 메세지에서 단서를 찾을 수 있는 경우가 많습니다. 에러 메세지를 읽고 한번 검색해보시는것을 추천드립니다.

  • 질문글을 작성하실때는, 현재 문제(또는 에러)와 코드나 github을 첨부해주세요.

  • 개발중인 OS, ReactNative, Node 버전 등의 개발환경을 알려주셔야합니다.

  • 에러메세지는 일부분이 아닌 전체 상황을 올려주세요. 일부만 보여주시면 답변이 어렵습니다.

  • 에러 잘라서 올리시면 안됩니다!

(에러 일부만 자르거나 일부만 복사하지말아주세요)

 

답변 2

0

Kyo님의 프로필 이미지
Kyo
지식공유자

서버실행에 문제가 있는게 아니라면 그냥 무시하셔도 괜찮습니다.

0

안녕하세요, 인프런 AI 인턴입니다. juhyunk0820님께서 겪고 있는 문제는 의존성 관리와 관련된 것입니다. 특정 라이브러리의 취약점과 오래된 버전으로 인해 문제를 겪고 있는 것 같습니다. 문제 해결을 위해 몇 가지 방법을 제안드립니다.

취약점 및 해결 방법

  1. 패키지 버전 업데이트:

    • npm과 node의 최선 버전을 사용하는 것이 좋습니다. 하지만 특정 라이브러리 간 버전 충돌이 발생할 수 있기 때문에, 패키지 각각의 최신 안정 버전의 호환성을 확인해야 합니다. 즉, 사용 중인 Nest.js 라이브러리의 버전을 확인하고 해당 버전에 맞는 다른 의존 패키지들을 업데이트하는 것이 필요합니다.
  2. 의존성 취약점 분석:

    • npm audit 명령어를 통해 정확한 취약점을 분석할 수 있습니다. Node.js나 npm 버전과 관련된 문제라면, LTS 버전으로 돌아가는 것도 하나의 방법입니다.
  3. Breaking Change 주의:

    • npm audit fix --force는 잠재적으로 나쁜 영향을 줄 수 있는 변경 사항을 강제로 적용하는 것이므로 세심하게 사용해야 합니다. 가능하면 직접 dependencies 버전을 관리하여 업데이트하세요.
  4. @nestjs 관련 문제 해결:

    • NestJS에서 상위 버전을 요구하거나 의존성 트리에 다른 문제가 발생할 경우, 의존성 하나씩 모듈을 확인하면서 수동으로 업데이트합니다.
    • 이에 대한 예로 @nestjs/platform-express 버전을 최신으로 유지하고, 다른 취약점이 있는 의존 라이브러리들도 최신으로 업데이트하세요.

참고 링크 및 문서

  • npm audit 문서: 취약성 분석의 사용 방법을 더 배울 수 있습니다.
  • NestJS 문서: 특정 @nestjs 관련 문제가 발생했을 때 참조하세요.

문제가 계속 될 경우, 코드베이스를 재설정하거나 새로운 React Native 프로젝트를 생성하여 점진적으로 패키지를 확인하면서 의존성을 관리하는 방법도 고려할 수 있습니다.

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다. 현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏 추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

juhyunk0820님의 프로필 이미지
juhyunk0820

작성한 질문수

질문하기