Skip to content

Commit

Permalink
feat: add optional web acl configuration for cloudfront (#396)
Browse files Browse the repository at this point in the history
### Issue

[GSD-3535 Ensure CloudFront distributions have WAF enabled
](NASA-IMPACT/veda-architecture#448)
### What?

- Added env var and construct changes to incorporate optional web acl

### Why?

- security requirement

### Testing?

- tested using mcp-test and checked that setting
`VEDA_SHARED_WEB_ACL_ID` works as expected and omitting
`VEDA_SHARED_WEB_ACL_ID` does not enable firewall to cloudfront
  • Loading branch information
botanical authored Jul 15, 2024
2 parents a98fe29 + b36fc7c commit 13b229f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ CERT_ARN=
VEDA_CLOUDFRONT=
VEDA_CLOUDFRONT_OAC=[OPTIONAL, CONFIGURES ORIGIN ACCESS CONTROL, DEFAULTS TO TRUE]
VEDA_CUSTOM_HOST=
VEDA_SHARED_WEB_ACL_ID=[OPTIONAL ID ARN for WEB ACL]
4 changes: 4 additions & 0 deletions routes/infrastructure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class vedaRouteSettings(BaseSettings):
description="Certificate’s ARN",
)

shared_web_acl_id: Optional[str] = Field(
None, description="Shared Web ACL ID ARN for CloudFront Distribution"
)

class Config:
"""model config"""

Expand Down
1 change: 1 addition & 0 deletions routes/infrastructure/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def __init__(
certificate=domain_cert,
default_root_object="index.html",
enable_logging=True,
web_acl_id=veda_route_settings.shared_web_acl_id,
domain_names=[
f"{stage}.{veda_route_settings.domain_hosted_zone_name}"
]
Expand Down

0 comments on commit 13b229f

Please sign in to comment.