-
Notifications
You must be signed in to change notification settings - Fork 0
[Fix] 취약점 스캐닝, 크롤링 방지 장기 대응 작업 #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough이 변경은 Terraform에 WAF 모듈을 추가하고 ALB에 연동했으며, WAF 로그를 위한 CloudWatch Log Group과 로깅 구성을 생성했다. WAF 규칙과 변수를 포함한 신규 모듈 디렉터리가 추가되었고, 공통 locals에 변수들이 보강되었다. Prod tfvars에서 Datadog ECS 서비스 설정과 환경 변수가 수정되었다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant TF as Terraform
participant WAF as AWS WAFv2
participant ALB as AWS ALB
participant CW as CloudWatch Logs
Dev->>TF: terraform apply
TF->>WAF: Create Web ACL (rules + visibility_config)
TF->>ALB: Ensure ALB exists (pre-existing)
TF->>WAF: Associate Web ACL with ALB
TF->>CW: Create Log Group for WAF
TF->>WAF: Configure Logging to CW Log Group
rect rgba(230,245,255,0.6)
note over WAF,ALB: Runtime traffic filtering
ALB->>WAF: HTTP(S) requests
alt Rate limit exceeded
WAF-->>ALB: Block
else Allowed by rules
WAF-->>ALB: Allow
end
WAF-->>CW: Emit logs
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests
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 Summary🛡️ Common InfrastructureStatus: ✅ No Changes 🛠️ Development EnvironmentStatus: ✅ No Changes 📋 Full Results: View in Actions |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
terraform/common/locals.tf(2 hunks)terraform/common/main.tf(1 hunks)terraform/common/waf/main.tf(1 hunks)terraform/common/waf/outputs.tf(1 hunks)terraform/common/waf/variables.tf(1 hunks)terraform/prod/terraform.tfvars(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (14)
terraform/prod/terraform.tfvars (2)
14-14: Datadog 에이전트 스케줄링 전략 변경을 확인합니다.REPLICA에서 DAEMON으로 변경하면 각 EC2 인스턴스마다 하나씩의 Datadog 에이전트가 실행되어 인프라 메트릭 수집이 개선됩니다. 이는 PR 목표에서 언급한 "Datadog AMP Prod 환경에서 Infrastructure Metrics가 정상적으로 보이지 않는 현상"을 해결하는 데 적절한 변경입니다.
52-54: Datadog EC2 메타데이터 수집 설정을 승인합니다.추가된 환경 변수들이 인프라 메트릭 문제 해결에 도움이 될 것입니다:
DD_EC2_USE_IMDSV2: IMDSv2 사용으로 보안 강화DD_COLLECT_EC2_TAGS,DD_COLLECT_EC2_METADATA: EC2 태그 및 메타데이터 수집 활성화terraform/common/waf/variables.tf (1)
1-12: WAF 모듈 변수 정의가 적절합니다.변수들이 명확하게 정의되어 있고,
request_threshold의 한국어 설명도 이해하기 쉽습니다. 타입 정의도 올바르게 되어 있습니다.terraform/common/waf/outputs.tf (1)
1-3: WAF ACL ARN 출력이 올바르게 정의되었습니다.WAF 웹 ACL의 ARN을 출력하여 다른 모듈에서 참조할 수 있도록 하는 표준적인 패턴입니다.
terraform/common/locals.tf (2)
7-7: 관리자 이메일 추가를 승인합니다.WAF 관련 알림이나 관리 목적으로 사용될 것으로 보이며, 적절한 위치에 정의되어 있습니다.
253-255: 요청 임계값 설정을 확인합니다.5분당 IP별 200 요청 제한은 일반적인 웹 애플리케이션에 적절한 수준입니다. 그러나 실제 트래픽 패턴에 따라 조정이 필요할 수 있습니다.
실제 운영 환경의 트래픽 패턴을 모니터링하여 이 임계값이 적절한지 확인하시기 바랍니다. 정상적인 사용자가 차단되지 않도록 주의가 필요합니다.
terraform/common/main.tf (4)
55-60: WAF 모듈 설정을 승인합니다.WAF 모듈이 적절한 변수들과 함께 올바르게 구성되어 있습니다.
62-65: ALB와 WAF 연결이 올바르게 구성되었습니다.ALB ARN과 WAF ACL ARN을 사용한 연결 설정이 정확합니다.
67-72: WAF 로그 그룹 설정을 승인합니다.7일 보존 기간은 디버깅과 분석에 적절하며, 비용 효율적입니다.
74-77: WAF 로깅 구성을 승인합니다.
trimsuffix를 사용하여 CloudWatch 로그 그룹 ARN에서:*접미사를 제거하는 것이 올바른 패턴입니다.terraform/common/waf/main.tf (4)
1-7: WAF 웹 ACL 기본 설정을 승인합니다.지역 범위(REGIONAL)와 기본 허용 동작이 ALB와 함께 사용하기에 적절합니다.
9-27: Rate-based 규칙 설정을 승인합니다.IP당 5분간 200 요청 제한과 차단 동작이 적절하게 구성되어 있습니다. 우선순위 1로 설정하여 다른 규칙보다 먼저 평가되도록 한 것도 좋은 설계입니다.
29-47: AWS 관리형 규칙 세트가 포괄적으로 설정되었습니다.다음과 같은 보안 위협에 대한 적절한 보호를 제공합니다:
- 공통 웹 공격 (OWASP Top 10)
- 악성 입력 및 스캐닝 시도
- IP 평판 기반 차단
- 익명 IP 차단
- SQL 인젝션 공격
각 규칙의 우선순위가 논리적으로 설정되어 있고, CloudWatch 메트릭도 활성화되어 모니터링이 가능합니다.
Also applies to: 49-67, 69-87, 109-127, 129-147
149-156: 전체 WAF ACL 가시성 설정을 승인합니다.CloudWatch 메트릭과 샘플 요청이 활성화되어 있어 모니터링과 디버깅에 도움이 됩니다. 태그 적용도 적절합니다.
| # Bad Bot Protection | ||
| rule { | ||
| name = "AWS-Managed-Bot-Control-Rule-Set" | ||
| priority = 40 | ||
| override_action { | ||
| none {} | ||
| } | ||
| statement { | ||
| managed_rule_group_statement { | ||
| vendor_name = "AWS" | ||
| name = "AWSManagedRulesBotControlRuleSet" | ||
| } | ||
| } | ||
| visibility_config { | ||
| cloudwatch_metrics_enabled = true | ||
| metric_name = "aws-managed-bot-control" | ||
| sampled_requests_enabled = true | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Verification inconclusive
Bot Control 규칙의 비용 영향을 고려하세요.
Bot Control은 추가 비용이 발생하는 기능으로, 월 $1의 구독료 외에도 요청당 추가 요금이 부과됩니다. Common Bot Control은 첫 1천만 요청이 무료이지만, Targeted Bot Control은 첫 100만 요청만 무료입니다.
Bot Control 기능의 필요성과 예상 비용을 검토하시기 바랍니다. 트래픽 볼륨에 따라 상당한 비용이 발생할 수 있습니다:
🌐 Web query:
AWS WAF Bot Control pricing 2025 common vs targeted costs
💡 Result:
Short answer — pricing (as of AWS pricing page):
- Monthly subscription: Bot Control rule group = $10.00 per Web ACL (prorated hourly). [1]
- Common Bot Control: first 10 million requests per month free; additional requests billed at $1.00 per million requests. [1]
- Targeted Bot Control: first 1 million requests per month free; additional requests billed at $10.00 per million requests. [1]
Practical notes:
- Use a scope‑down statement to limit what Bot Control inspects to reduce costs (e.g., apply to login paths only). [2]
- Region pricing may vary — always confirm the AWS WAF pricing page for your region and month. [1][2]
Sources: AWS WAF pricing and AWS WAF cost guidance. [1][2]
Bot Control 규칙 비용 검토
File: terraform/common/waf/main.tf (Lines 89–107)
AWS WAF Bot Control은 Web ACL당 월 구독료 $10(시간 단위 비례 청구)과 다음 요청당 요금을 부과합니다:
- Common Bot Control: 매월 첫 1천만 요청 무료, 초과분은 백만 요청당 $1
- Targeted Bot Control: 매월 첫 100만 요청 무료, 초과분은 백만 요청당 $10
트래픽 규모에 따라 비용이 크게 증가할 수 있으므로 scope-down statement를 도입해 검사 대상을 제한하는 등 Bot Control 기능의 필요성과 예상 비용을 꼼꼼히 검토하세요.
🤖 Prompt for AI Agents
In terraform/common/waf/main.tf around lines 89 to 107, the
AWSManagedRulesBotControlRuleSet is added without a scope-down statement or
limiting conditions which may incur significant Bot Control subscription and
per-request costs; update the managed_rule_group_statement to include an
appropriate scope_down_statement (e.g., a statement that restricts inspection to
specific paths, IP sets, or headers) to limit which requests are evaluated,
and/or add a variable to toggle Bot Control on/off and document expected
usage/costs so the rule is only enabled for intended traffic patterns.
leegwichan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다! 앞으로도 개선점이 보인다면 추가 부탁드려요!
|
🎉 This PR is included in version 1.8.0-develop.14 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |



✨ 개요
취약점 스캐닝, 크롤링 방지 장기 대응 작업
기타 버그 수정 작업
🧾 관련 이슈
Close #199
🔍 참고 사항 (선택)
Summary by CodeRabbit