grada-run 0.41.5 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +17 -7
- package/package.json +1 -1
- package/src/commands/alerts.js +3 -1
- package/src/commands/apply.js +1 -1
- package/src/commands/db/connect.js +20 -13
- package/src/commands/db/migrate.js +1 -1
- package/src/commands/destroy.js +50 -5
- package/src/commands/diagnose.js +17 -11
- package/src/commands/doctor.js +1 -1
- package/src/commands/domain.js +35 -5
- package/src/commands/exec.js +9 -4
- package/src/commands/gc.js +36 -4
- package/src/commands/logs.js +124 -37
- package/src/commands/mcp.js +1 -1
- package/src/commands/rollback.js +180 -73
- package/src/commands/secrets.js +29 -6
- package/src/commands/status.js +13 -7
- package/src/utils/generator.js +12 -3
- package/src/utils/resolvers.js +65 -4
- package/templates/github/deploy-lambda.yml +19 -0
- package/templates/github/deploy.yml +19 -0
- package/templates/terraform/addons/bedrock.tf +6 -2
- package/templates/terraform/cloudfront-lambda.tf +125 -6
- package/templates/terraform/cloudfront.tf +137 -10
- package/templates/terraform/main.tf +36 -1
- package/templates/terraform/network.tf +5 -2
|
@@ -150,7 +150,7 @@ resource "aws_ecs_task_definition" "app" {
|
|
|
150
150
|
lifecycle {
|
|
151
151
|
precondition {
|
|
152
152
|
condition = length(setintersection(toset(local.secret_keys), toset(local.managed_env_names))) == 0
|
|
153
|
-
error_message = "secret_keys.json collides with container environment: ${join(", ", setintersection(toset(local.secret_keys), toset(local.managed_env_names)))}. Remove the key(s) from .env and re-push (push skips them automatically)."
|
|
153
|
+
error_message = "secret_keys.json collides with container environment: ${join(", ", setintersection(toset(local.secret_keys), toset(local.managed_env_names)))}. Remove the key(s) from .env and re-push (push skips them automatically). If push does not skip the key, this guard list is stale — remove the entry from managed_env_names in terraform/main.tf."
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -228,6 +228,16 @@ resource "aws_lb_target_group" "app" {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
# Origin secret (BUG-91): only requests bearing the header CloudFront
|
|
232
|
+
# injects may reach the app. The CloudFront edge-IP security group alone
|
|
233
|
+
# cannot prove WHICH distribution sent a request — any tenant's distro
|
|
234
|
+
# could point at this ALB — so the listener forwards solely on a header
|
|
235
|
+
# match and 403s everything else (including direct ALB hits).
|
|
236
|
+
resource "random_password" "origin_secret" {
|
|
237
|
+
length = 32
|
|
238
|
+
special = false
|
|
239
|
+
}
|
|
240
|
+
|
|
231
241
|
# trivy:ignore:AVD-AWS-0054 - CloudFront handles HTTPS edge termination; ALB uses HTTP to avoid complex ACM DNS validation for users
|
|
232
242
|
resource "aws_lb_listener" "http" {
|
|
233
243
|
load_balancer_arn = aws_lb.main.arn
|
|
@@ -235,9 +245,30 @@ resource "aws_lb_listener" "http" {
|
|
|
235
245
|
protocol = "HTTP"
|
|
236
246
|
|
|
237
247
|
default_action {
|
|
248
|
+
type = "fixed-response"
|
|
249
|
+
fixed_response {
|
|
250
|
+
content_type = "text/plain"
|
|
251
|
+
message_body = "Forbidden"
|
|
252
|
+
status_code = "403"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
resource "aws_lb_listener_rule" "origin_secret" {
|
|
258
|
+
listener_arn = aws_lb_listener.http.arn
|
|
259
|
+
priority = 1
|
|
260
|
+
|
|
261
|
+
action {
|
|
238
262
|
type = "forward"
|
|
239
263
|
target_group_arn = aws_lb_target_group.app.arn
|
|
240
264
|
}
|
|
265
|
+
|
|
266
|
+
condition {
|
|
267
|
+
http_header {
|
|
268
|
+
http_header_name = "X-Grada-Origin-Secret"
|
|
269
|
+
values = [random_password.origin_secret.result]
|
|
270
|
+
}
|
|
271
|
+
}
|
|
241
272
|
}
|
|
242
273
|
|
|
243
274
|
# --- ECS Service ---
|
|
@@ -307,6 +338,10 @@ output "ecr_repository_url" {
|
|
|
307
338
|
}
|
|
308
339
|
|
|
309
340
|
# --- CloudWatch Alarms ---
|
|
341
|
+
# State-only alarm: visible in the console, notifies nobody. There is no
|
|
342
|
+
# notification destination at scaffold time; `grada alerts` provisions
|
|
343
|
+
# separate alarms wired to SNS, and this one stays as a console signal so
|
|
344
|
+
# quiet trees still show red (BUG-101).
|
|
310
345
|
resource "aws_cloudwatch_metric_alarm" "alb_5xx_errors" {
|
|
311
346
|
alarm_name = "${local.app_name}-high-5xx-errors"
|
|
312
347
|
comparison_operator = "GreaterThanThreshold"
|
|
@@ -80,8 +80,11 @@ resource "aws_security_group" "alb" {
|
|
|
80
80
|
to_port = 80
|
|
81
81
|
protocol = "tcp"
|
|
82
82
|
# CloudFront-only: the origin speaks plaintext HTTP, so direct browser
|
|
83
|
-
# access would bypass the CDN (and TLS on domained trees).
|
|
84
|
-
#
|
|
83
|
+
# access would bypass the CDN (and TLS on domained trees). The origin
|
|
84
|
+
# secret (random_password.origin_secret) proves WHICH distribution sent
|
|
85
|
+
# a request — the listener 403s anything without it. Debugging via the
|
|
86
|
+
# direct URL needs both a temporary personal-IP rule and the
|
|
87
|
+
# X-Grada-Origin-Secret header value from the Terraform state.
|
|
85
88
|
prefix_list_ids = [data.aws_ec2_managed_prefix_list.cloudfront.id]
|
|
86
89
|
}
|
|
87
90
|
|