feat: 보안 보강 1차 + 식당·메뉴 대량 등록 + 지도·메뉴 UI 개편 + EC2 운영 적용 준비#34
Merged
Conversation
…N/LOG_LEVEL 추가 - AWS_REGION/ACCESS_KEY_ID/SECRET_ACCESS_KEY/S3_BUCKET 모두 required → optional. S3 미사용 환경에서 API 부팅 실패 방지 - JWT_EXPIRES_IN 추가 (1d 기본, 1y 같은 과도값 정규식 차단) - NODE_ENV / LOG_LEVEL 명시 - CORS_ORIGIN URI 강제 제거 (쉼표 구분 multiple origin 지원)
- 7d 는 토큰 탈취 시 노출 윈도우가 길어 1d 로 단축 - 운영 정책은 .env 의 JWT_EXPIRES_IN 으로 무중단 조정 가능
- AppErrorCode: UNAUTHORIZED/FORBIDDEN/NOT_FOUND/VALIDATION_FAILED/CONFLICT/RATE_LIMITED 등 안정적 식별자
- AppError extends HttpException — code/message/status 한 번에 표현
- 서브클래스 5종 (NotFoundError, InvalidCredentialsError, ForbiddenError, ConflictError, ExternalDependencyError)
- 호출부에서 hrow new NotFoundError('식당...') 같은 가독성·일관성 확보
- @catch() 인자 없이 전역 catch (HttpException + 예측 못 한 런타임) - 응답 body 표준화: { code, message, requestId, timestamp, path } - AppError: code/message/status 그대로 - HttpException: status → code 매핑 (400 → BAD_REQUEST 등) - 그 외 런타임: production 에선 모호한 메시지 (스택은 서버 로그만) - Nginx X-Request-ID 헤더 echo → 사용자 신고 시 서버 로그 추적 1:1 - 5xx ERROR / 4xx WARN 레벨 분리
- access 로그 (method/path/elapsedMs/requestId) 자동 출력 - 민감 키워드 (password/token/jwt/secret/apiKey/authorization/cookie/cardNumber/cvv/ssn) lowercase 부분 일치 마스킹 - mask() 정적 메서드 노출 — 다른 로거에서도 재사용 가능 - 깊이 5 까지 재귀, 그 이상은 절단해 폭주 방지 - 본문(body) 자체 응답은 건드리지 않음 (UI 영향 X)
…wered-by 비활성 + Swagger production 비공개
- app.disable('x-powered-by') — Express 프레임워크 정보 노출 차단
- helmet({contentSecurityPolicy:false, crossOriginEmbedderPolicy:false}) — Nginx CSP·카카오맵 SDK 호환
- useGlobalFilters(new AllExceptionsFilter()) — 기존 HttpExceptionFilter 대체
- useGlobalInterceptors(new SensitiveFieldsInterceptor()) — access 로깅 + 마스킹
- Swagger UI: production 에선 SWAGGER_ENABLED=true 일 때만 노출
- NestExpressApplication 제네릭 타입 사용 (app.disable 호출 위해)
- 외부 보안 점검(ISMS-P) 9건 + 자체 점검 4건 항목별 정리 - 각 항목: 문제 / 해결 / 의도 / 검증 명령 - HTTP 보안 헤더 7종 (Nginx) · x-powered-by 차단 (다중 방어) · 에러 응답 정규화 · Rate Limit · JWT 만료 단축 · S3 optional · 민감 로깅 마스킹 · Swagger 비공개 · Request-ID 추적 - 적용 후 검증 체크리스트 + Phase 2/3 남은 작업 + 운영 환경 적용 절차
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major changes
🔒 보안 보강 1차 (9 commit)
AllExceptionsFilter: 전역 catch, 응답 포맷 통일({code, message, requestId, timestamp, path}), production 스택 차단AppError+ 코드 enum + 서브클래스 5종 (NotFoundError/InvalidCredentialsError/ForbiddenError/ConflictError/ExternalDependencyError)app.disable("x-powered-by")— 프레임워크 정보 노출 차단 (Nginx proxy_hide_header 와 다중 방어)JWT_EXPIRES_INenv 변수화 (정규식으로 과도값 차단)SensitiveFieldsInterceptor: access 로그 + 비밀번호·토큰·카드번호 등 마스킹 (mask()정적 메서드)SWAGGER_ENABLED=true로 토글)docs/보안_보강_2026-05-22.md(13개 항목 문제·해결·검증 절차)🛠 빌드·CI
packageManager: pnpm@10.33.2핀 (Dockerfile node:20-alpine 에서 corepack 의 pnpm 11 자동 다운로드 OOM 방지)pnpm/action-setup@v4의 version 필드 제거 (packageManager중복)apps/web/types/kakao.d.ts: Map.getBounds / Map.relayout / setLevel anchor / LatLngBounds.getSouthWest·getNorthEast 추가MenuList: Map.values for-of → forEach (downlevelIteration 미설정 환경 대응)Test plan
x-frame-options,content-security-policy,x-content-type-options,referrer-policy,permissions-policy,strict-transport-security,x-request-id보임.x-powered-by안 보임{code, message, requestId, timestamp, path}포맷/api/docs404 (Swagger 비공개)운영 환경 적용 절차
이 PR merge 후 docker 브랜치 동기화 + EC2 재배포 필요: