From bb78cc11f38eae0913ad807a32f1c1a291754d78 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Wed, 17 Dec 2025 00:11:56 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20React/Next.js=20=EC=B7=A8=EC=95=BD?= =?UTF-8?q?=EC=A0=90=20=EA=B0=90=EC=82=AC=20=EB=B0=8F=20=EC=A0=95=EB=A6=AC?= =?UTF-8?q?=20=ED=8A=B8=EB=9F=AC=EB=B8=94=EC=8A=88=ED=8C=85=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._nextjs_vulnerability_audit_and_cleanup.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 journey/troubleshooting/251215_react_nextjs_vulnerability_audit_and_cleanup.md diff --git a/journey/troubleshooting/251215_react_nextjs_vulnerability_audit_and_cleanup.md b/journey/troubleshooting/251215_react_nextjs_vulnerability_audit_and_cleanup.md new file mode 100644 index 0000000..cabbd5b --- /dev/null +++ b/journey/troubleshooting/251215_react_nextjs_vulnerability_audit_and_cleanup.md @@ -0,0 +1,37 @@ +# React/Next.js 취약점 점검 및 정리 (51123) + +**날짜**: 2025-12-15 +**작성자**: happybell80 +**관련 파일**: `frontend-customer/package.json`, `frontend-customer/package-lock.json`, `/etc/nginx/sites-enabled/default`, `nginx-infra/server-nginx-default` + +--- + +## 문제 상황 +- React/Next.js 취약점 이슈(특히 Next App Router/RSC 계열 DoS) 관련해 서버(51123) 내 실제 사용 여부와 영향 범위를 확인해야 했음. +- 로컬 `npm audit`에서 프론트 의존성 취약점이 일부 검출됨. + +## 해결 방안 +### 1) Next.js 사용 여부 확인 → 미사용 백업 제거 +- nginx는 `/goosefarm`을 정적 파일로 서빙: `/etc/nginx/sites-enabled/default:87`, `:238` (alias `/var/www/html/goosefarm/`) +- `:3001` 리스닝/`next start` 프로세스 없음 → Next 런타임 미사용으로 판단 +- `goosefarminvesting/frontend-nextjs-backup/` 디렉터리 삭제(미사용 백업, 용량 약 767MB) + +### 2) `frontend-customer` 취약점 제거(의존성 업데이트) +- 초기: `npm audit --omit=dev`에서 `glob`(HIGH), `mdast-util-to-hast`(MODERATE) 검출 +- 조치: `npm audit fix` 수행 후, `esbuild`(vite 하위) 경고가 남아 `vite`/`@vitejs/plugin-react`를 업데이트 + - `frontend-customer/package.json:84-91` + +### 3) 다른 프론트 프로젝트도 `npm audit` 정리 +- `space-times`: `npm audit fix`로 `glob`/`js-yaml` 취약점 정리 후 빌드 성공 +- `goosefarminvesting/frontend`: `npm audit fix`로 취약점 정리 후 빌드 성공 + +## 검증 +- `frontend-customer`: `npm audit` → `found 0 vulnerabilities`, `npm run build` 성공 +- `frontend-ir-valuation`: `npm audit --omit=dev` → `found 0 vulnerabilities` +- `space-times`: `npm audit` → `found 0 vulnerabilities`, `npm run build` 성공 +- `goosefarminvesting/frontend`: `npm audit` → `found 0 vulnerabilities`, `npm run build` 성공 +- nginx: `sudo -n nginx -t` 성공, `curl -I http://localhost/goosefarm/` → 200 OK + +## 교훈 +- `npm audit --omit=dev`만으로 “안전” 판단 금지: 운영과 무관해 보여도(`devDependencies`) CI/빌드 경로에선 실제로 실행될 수 있음. +- Next.js 류 취약점은 “코드 존재”보다 “런타임 사용 여부(포트/프로세스/nginx 라우팅)”가 핵심이라, 배포 경로를 먼저 확인해야 함.