fix: 출시 전 보안 점검 P0/P1 이슈 수정 - #20
Open
manNomi wants to merge 2 commits into
Open
Conversation
- dev DB 테스트 라우트를 production에서 제거하고 비-production에서도 인증 필수화 - 업로드 사진 조회를 소유권/공개여부 기반 인증 엔드포인트(GET /v1/uploads/:fileId)로 전환, path traversal 차단, 매직바이트 기반 Content-Type 검증, 업로드 MIME 화이트리스트 적용 - 로그인/회원가입/refresh에 계정+IP 이중 rate limit 적용 - 이미지 교체 시 고아 업로드 파일 정리 로직 보강 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
/v1/dev/db-test-records)를 production에서 등록 자체를 막고, 비-production에서도 인증 필수로 전환 (무인증 DB 쓰기 차단)/uploads)을 제거하고, 소유권/공개여부를 서버가 판정하는GET /v1/uploads/:fileId로 교체. path traversal 전수 차단, 파일 매직바이트로 Content-Type 판별(확장자·클라이언트 MIME 불신), 업로드 단계 MIME 화이트리스트, 존재하지 않는 파일과 권한 없는 파일을 동일한 404로 응답해 존재 여부 비노출/v1/auth/login|register|refresh에 계정(ip+email) + IP 단독 이중 rate limit 적용 — 단일 계정 브루트포스와 크리덴셜 스터핑 모두 방어updateMomentLogPhoto) 트랜잭션 실패 시 새로 업로드된 파일이 정리되지 않던 버그 수정, 그 외 생성/삭제 경로의 고아 파일 정리 보강UPLOAD_PUBLIC_PATH등 사문화된 설정 제거Test plan
pnpm run typecheckpnpm test:api(mock DB, CI와 동일 조건) — 43 passed / 1 pre-existing failure(handles recap APIs, 이 브랜치 이전부터 실패, 무관) / 14 skipped(mock 모드에서 업로드 접근제어 테스트는 실 DB 필요)node scripts/check-production-env.mjs— 약한 프로덕션 설정(rate limit 비활성, HTTP 업로드 URL 등)을 정확히 거부하는지 확인Known follow-up (이 PR 범위 밖)
pr-check.yml)가USE_MOCK_DB=true로 돌아 업로드 접근제어 테스트가 mock 모드에서 skip됨 — 실 DB 대상 CI 잡 추가 권장POST /v1/travel-sessions에 idempotency 보호가 없어 네트워크 재시도 시 고아 세션 생성 가능성 남음(사용자 영향 없음, 별도 작업 필요)🤖 Generated with Claude Code