refactor: 크롤링 봇에 대한 요청 차단 nginx 로직 추가#43
Conversation
|
Warning Review limit reached
More reviews will be available in 24 minutes and 23 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesNginx 보안 차단 설정
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Terraform Plan:
|
Terraform Plan:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@modules/app_stack/scripts/nginx_setup.sh.tftpl`:
- Around line 95-98: The nginx location block regex in nginx_setup.sh.tftpl
currently uses a `$` anchor that only matches if the blocked extensions appear
at the very end of the path, allowing scanners to bypass it with paths like
`/backup.sql/download` or `/.env.production`. Modify the regex pattern to match
these extensions even when followed by a forward slash, query string, or other
path segments. Replace the strict end-of-string anchor with a pattern that
catches extensions followed by `/`, `?`, or end of string, and add explicit
dotfile patterns (like `\.env` without requiring an extension) to handle variant
forms like `.env.production` that scanners commonly exploit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cb998afe-9b29-4a02-abc5-620c6c62bcdc
📒 Files selected for processing (1)
modules/app_stack/scripts/nginx_setup.sh.tftpl
관련 이슈
작업 내용
크롤링 봇의 취약점 탐색 요청을 Nginx 수준에서 차단하여 서버 로그 오염을 방지합니다.
변경 파일:
modules/app_stack/scripts/nginx_setup.sh.tftpl1차 차단 — IP 직접 접근 및 알 수 없는 Host 헤더 차단
default_server블록을 80/443 포트에 추가하여 도메인과 일치하지 않는 모든 요청을 444로 차단합니다.http://1.2.3.4/)444는 응답 body 없이 연결을 즉시 종료하는 nginx 전용 코드로, 봇 입장에서 포트가 닫힌 것처럼 인식됩니다.
2차 차단 — 취약점 탐색용 정적 파일 확장자 요청 차단
Spring Boot API 서버에 도달할 이유가 없는 정적 파일 확장자 요청을 location 블록으로 차단합니다.
차단 대상:
.php.asp.aspx.jsp.cgi.env.git.sql.bak.backup.config.ini.log.sh.xml.txt.html.htm특이 사항
terraform plan검증 완료 —null_resource.update_nginx1개 replace만 발생, 다른 리소스 변경 없음upstream.conf에if [ ! -f ]가드가 있어 재프로비저닝 시에도 현재 Blue/Green 슬롯이 유지됨리뷰 요구사항 (선택)
.txt,.html,.xml등)이 서비스 운영 상 문제없는지 프론트 담당자 확인이 필요합니다Summary by CodeRabbit
보안 개선