docs: React/Next.js 취약점 감사 및 정리 트러블슈팅 추가

This commit is contained in:
happybell80 2025-12-17 00:11:56 +09:00
parent d6dc38bd4a
commit bb78cc11f3

View File

@ -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 라우팅)”가 핵심이라, 배포 경로를 먼저 확인해야 함.