You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finding: CORS is wide open for the S3 bucket
Location: Lines 206-213 in wa_genai_stack.py
python
cors=[
s3.CorsRule(
allowed_methods=[s3.HttpMethods.GET, s3.HttpMethods.PUT],
allowed_origins=["*"], # ⚠️ SECURITY RISK
allowed_headers=["*"], # ⚠️ SECURITY RISK
)
]
1. allowed_origins=["*"] - Allows any website to make requests to this S3 bucket
2. allowed_headers=["*"] - Permits any HTTP headers in cross-origin requests
3. Data exposure - Malicious websites can potentially access stored analysis results
4. CSRF attacks - Enables cross-site request forgery from any domain
python
cors=[
s3.CorsRule(
allowed_methods=[s3.HttpMethods.GET, s3.HttpMethods.PUT],
allowed_origins=[
f"https://{alb_dns}", # Only allow the frontend ALB
"https://your-domain.com" # Add specific domains as needed
],
allowed_headers=[
"Content-Type",
"Authorization",
"x-amz-date",
"x-amz-security-token"
],
max_age=3600 # Cache preflight requests for 1 hour
)
]
• **SEC03-BP02**: Enforce encryption in transit
• **SEC05-BP01**: Reduce attack surface
• **SEC06-BP01**: Implement secure network controls
Severity: HIGH - This configuration exposes the S3 bucket to potential data access from any website on the internet.
0 commit comments