@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.47

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.
Files changed (174) hide show
  1. package/generators.json +11 -1
  2. package/package.json +3 -3
  3. package/src/aws-authority/stage-authority.d.ts +30 -2
  4. package/src/aws-authority/stage-authority.js +220 -25
  5. package/src/developer-agent/generator-planning.js +99 -6
  6. package/src/developer-agent/model.d.ts +7 -3
  7. package/src/developer-agent/model.js +1 -0
  8. package/src/developer-agent/operation-registry.d.ts +1 -0
  9. package/src/developer-agent/operation-registry.js +43 -2
  10. package/src/developer-agent/planning.js +5 -2
  11. package/src/developer-agent/preview-changes.js +10 -0
  12. package/src/developer-agent/validation.js +7 -3
  13. package/src/developer-agent/workspace-inspection.js +51 -4
  14. package/src/executors/deployment-plan/deployment-plan.js +3 -0
  15. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  16. package/src/executors/dev-doctor/dev-doctor.js +136 -49
  17. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  18. package/src/executors/dev-setup/dev-setup.js +320 -196
  19. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  20. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  21. package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
  22. package/src/executors/local-deploy/local-deploy.d.ts +15 -0
  23. package/src/executors/local-deploy/local-deploy.js +96 -14
  24. package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
  25. package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
  26. package/src/foundation/cost-estimate.js +1 -1
  27. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  28. package/src/foundation/identity-domain-parent-ready.js +333 -0
  29. package/src/foundation/identity-domain.d.ts +94 -0
  30. package/src/foundation/identity-domain.js +115 -0
  31. package/src/foundation/index.d.ts +2 -0
  32. package/src/foundation/index.js +7 -0
  33. package/src/foundation/preflight.js +17 -1
  34. package/src/foundation/root-site-readiness.d.ts +27 -0
  35. package/src/foundation/root-site-readiness.js +78 -0
  36. package/src/foundation/root-site.d.ts +81 -0
  37. package/src/foundation/root-site.js +268 -0
  38. package/src/generators/framework-prerequisites.d.ts +2 -0
  39. package/src/generators/framework-prerequisites.js +34 -0
  40. package/src/generators/function/function-registration.d.ts +24 -0
  41. package/src/generators/function/function-registration.js +66 -0
  42. package/src/generators/function/function.d.ts +16 -1
  43. package/src/generators/function/function.js +101 -18
  44. package/src/generators/function/schema.d.ts +1 -0
  45. package/src/generators/function/schema.json +6 -0
  46. package/src/generators/function-access/function-access.d.ts +14 -0
  47. package/src/generators/function-access/function-access.js +141 -0
  48. package/src/generators/function-access/schema.d.ts +6 -0
  49. package/src/generators/function-access/schema.json +25 -0
  50. package/src/generators/post-generation-install.d.ts +1 -1
  51. package/src/generators/post-generation-install.js +1 -1
  52. package/src/generators/preset/dependency-overrides.d.ts +1 -1
  53. package/src/generators/preset/dependency-overrides.js +1 -1
  54. package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
  55. package/src/generators/preset/workspace-files-developer-agent.js +17 -11
  56. package/src/generators/preset/workspace-files-stage-authority.js +58 -1
  57. package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
  58. package/src/generators/preset/workspace-files-thin-deploy.js +47 -4
  59. package/src/generators/preset/workspace-files-thin-docs.js +33 -5
  60. package/src/generators/preset/workspace-files.js +207 -13
  61. package/src/generators/repository-policy/repository-policy.js +2 -1
  62. package/src/generators/repository-policy/schema.d.ts +2 -0
  63. package/src/generators/repository-policy/schema.json +7 -2
  64. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
  65. package/src/generators/site/built-in-site-documentation-files.js +92 -0
  66. package/src/generators/site/built-in-site-files.d.ts +8 -0
  67. package/src/generators/site/built-in-site-files.js +40 -0
  68. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
  69. package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
  70. package/src/generators/site/built-in-site-plan.d.ts +19 -0
  71. package/src/generators/site/built-in-site-plan.js +65 -0
  72. package/src/generators/site/built-in-site-project-files.d.ts +3 -0
  73. package/src/generators/site/built-in-site-project-files.js +258 -0
  74. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  75. package/src/generators/site/built-in-site-script-files.js +306 -0
  76. package/src/generators/site/built-in-site-shared.d.ts +9 -0
  77. package/src/generators/site/built-in-site-shared.js +21 -0
  78. package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
  79. package/src/generators/site/built-in-site-smoke-files.js +37 -0
  80. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
  81. package/src/generators/site/built-in-site-sst-config-files.js +39 -0
  82. package/src/generators/site/built-in-site-web-files.d.ts +2 -0
  83. package/src/generators/site/built-in-site-web-files.js +284 -0
  84. package/src/generators/site/schema.d.ts +4 -0
  85. package/src/generators/site/schema.json +20 -0
  86. package/src/generators/site/site.d.ts +13 -0
  87. package/src/generators/site/site.js +221 -0
  88. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
  89. package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
  90. package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
  91. package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
  92. package/src/generators/slice/built-in-plan-data-files.js +116 -11
  93. package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
  94. package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
  95. package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
  96. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
  97. package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
  98. package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
  99. package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
  100. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
  101. package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
  102. package/src/generators/slice/built-in-plan-metadata-files.js +21 -4
  103. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
  104. package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
  105. package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
  106. package/src/generators/slice/built-in-plan-operations-files.js +107 -219
  107. package/src/generators/slice/built-in-plan-performance-files.js +6 -1
  108. package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
  109. package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
  110. package/src/generators/slice/built-in-plan-shared.js +1 -1
  111. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  112. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  113. package/src/generators/slice/built-in-plan-testing-files.js +92 -49
  114. package/src/generators/slice/built-in-plan-verification-files.js +15 -4
  115. package/src/generators/slice/built-in-plan-web-files.js +65 -0
  116. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
  117. package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
  118. package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
  119. package/src/generators/slice/deployed-smoke-readiness.js +118 -23
  120. package/src/generators/slice/persistence-contract.js +2 -2
  121. package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
  122. package/src/generators/slice/pnpm-launch-script.js +28 -0
  123. package/src/generators/slice/slice.js +27 -0
  124. package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
  125. package/src/generators/upgrade/custom-domain-notice.js +38 -0
  126. package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
  127. package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
  128. package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
  129. package/src/generators/upgrade/framework-package-upgrade.js +78 -0
  130. package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
  131. package/src/generators/upgrade/function-authentication-notice.js +74 -0
  132. package/src/generators/upgrade/schema.json +2 -2
  133. package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
  134. package/src/generators/upgrade/upgrade-plan.js +406 -0
  135. package/src/generators/upgrade/upgrade.d.ts +1 -35
  136. package/src/generators/upgrade/upgrade.js +259 -593
  137. package/src/generators/workload/workload.js +60 -4
  138. package/src/git-policy/github-bootstrap.d.ts +6 -5
  139. package/src/git-policy/github-bootstrap.js +6 -4
  140. package/src/local-dev/fleet-process.d.ts +9 -2
  141. package/src/local-dev/fleet-process.js +27 -7
  142. package/src/local-dev/gateway-daemon.d.ts +1 -1
  143. package/src/local-dev/gateway-daemon.js +6 -4
  144. package/src/local-dev/portless.d.ts +5 -0
  145. package/src/local-dev/portless.js +5 -0
  146. package/src/local-dev/process-group.d.ts +10 -0
  147. package/src/local-dev/process-group.js +33 -0
  148. package/src/local-dev/tls.js +31 -2
  149. package/src/local-dev/trust-store.d.ts +42 -0
  150. package/src/local-dev/trust-store.js +87 -0
  151. package/src/ownership/composition.d.ts +7 -0
  152. package/src/ownership/composition.js +64 -56
  153. package/src/ownership/index.d.ts +1 -0
  154. package/src/ownership/index.js +1 -0
  155. package/src/ownership/record.d.ts +19 -0
  156. package/src/ownership/record.js +26 -2
  157. package/src/ownership/site-record.d.ts +18 -0
  158. package/src/ownership/site-record.js +105 -0
  159. package/src/repository-policy/deployment-plan.d.ts +3 -0
  160. package/src/repository-policy/deployment-plan.js +33 -4
  161. package/src/repository-policy/index.d.ts +1 -0
  162. package/src/repository-policy/index.js +1 -0
  163. package/src/repository-policy/policy.d.ts +13 -1
  164. package/src/repository-policy/policy.js +55 -1
  165. package/src/repository-policy/public-dns.d.ts +65 -0
  166. package/src/repository-policy/public-dns.js +168 -0
  167. package/src/schemas/generated-ownership-v2.json +6 -0
  168. package/src/schemas/repository-policy-v1.json +67 -1
  169. package/src/supply-chain/blueprint-trust-git.js +24 -0
  170. package/src/supply-chain/blueprint-verification-authority.js +21 -3
  171. package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
  172. package/src/work-markers/work-markers.js +4 -1
  173. package/src/workspace-deployment/ownership.d.ts +15 -0
  174. package/src/workspace-deployment/ownership.js +19 -3
package/generators.json CHANGED
@@ -10,6 +10,11 @@
10
10
  "schema": "./src/generators/function/schema.json",
11
11
  "description": "Add an HTTP Lambda function to an EBK v1 Product Slice."
12
12
  },
13
+ "function-access": {
14
+ "factory": "./src/generators/function-access/function-access",
15
+ "schema": "./src/generators/function-access/schema.json",
16
+ "description": "Change who may call an existing Function of an EBK v1 Product Slice: signed-in or anonymous. Rewrites only its managed infrastructure, its registration and its ownership entry, and prints the change."
17
+ },
13
18
  "job": {
14
19
  "factory": "./src/generators/job/job",
15
20
  "schema": "./src/generators/workload/schema.json",
@@ -20,6 +25,11 @@
20
25
  "schema": "./src/generators/workload/schema.json",
21
26
  "description": "Add a long-running TypeScript ECS Service to an EBK v1 Product Slice."
22
27
  },
28
+ "site": {
29
+ "factory": "./src/generators/site/site",
30
+ "schema": "./src/generators/site/schema.json",
31
+ "description": "Generate the workspace root site: the fixed packages/site Next.js app the Foundation Router serves at /, beside the Product Slices."
32
+ },
23
33
  "slice": {
24
34
  "factory": "./src/generators/slice/slice",
25
35
  "schema": "./src/generators/slice/schema.json",
@@ -38,7 +48,7 @@
38
48
  "upgrade": {
39
49
  "factory": "./src/generators/upgrade/upgrade",
40
50
  "schema": "./src/generators/upgrade/schema.json",
41
- "description": "Report or apply a v1 Standard Foundation or Product Slice upgrade."
51
+ "description": "Report or apply a v1 Standard Foundation, root site, or Product Slice upgrade."
42
52
  },
43
53
  "preset": {
44
54
  "factory": "./src/generators/preset/generator",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empire-builder-kit/nx",
3
- "version": "1.0.0-rc.46",
3
+ "version": "1.0.0-rc.47",
4
4
  "description": "Nx generators, executors, and Blueprint contracts for Empire Builder Kit",
5
5
  "keywords": [
6
6
  "aws",
@@ -145,7 +145,7 @@
145
145
  "provenance": false
146
146
  },
147
147
  "dependencies": {
148
- "@empire-builder-kit/runtime": "1.0.0-rc.46",
148
+ "@empire-builder-kit/runtime": "1.0.0-rc.47",
149
149
  "@aws-sdk/client-cloudfront": "^3.700.0",
150
150
  "@aws-sdk/client-cloudwatch": "^3.700.0",
151
151
  "@aws-sdk/client-cloudwatch-logs": "^3.700.0",
@@ -178,5 +178,5 @@
178
178
  "engines": {
179
179
  "node": ">=22.13.0"
180
180
  },
181
- "gitHead": "2165c67769556e404a2d0e9d2f5bcdd23413fce8"
181
+ "gitHead": "38ff785e2cbfa5343e5b6c4e08dacc726625d72c"
182
182
  }
@@ -5,7 +5,7 @@ export declare const STAGE_AUTHORITY_DEPLOYMENT_POLICY_KINDS: readonly ["read",
5
5
  export declare const STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_LIMIT = 6144;
6
6
  export declare const STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_HEADROOM = 200;
7
7
  export declare const STAGE_AUTHORITY_TEMPLATE_BODY_BYTE_LIMIT = 51200;
8
- export declare const STAGE_AUTHORITY_BOUND_TEMPLATE_BODY_MINIMUM_HEADROOM = 1024;
8
+ export declare const STAGE_AUTHORITY_BOUND_TEMPLATE_BODY_MINIMUM_HEADROOM = 256;
9
9
  export type StageAuthorityStage = (typeof STAGE_AUTHORITY_STAGES)[number];
10
10
  export type StageAuthorityPartition = (typeof STAGE_AUTHORITY_PARTITIONS)[number];
11
11
  export type StageAuthorityDeploymentPolicyKind = (typeof STAGE_AUTHORITY_DEPLOYMENT_POLICY_KINDS)[number];
@@ -37,6 +37,10 @@ export interface StageAuthorityInput {
37
37
  awsPrincipalArns?: readonly string[];
38
38
  github?: StageAuthorityGithubTrust;
39
39
  partition?: StageAuthorityPartition;
40
+ /** The committed `publicDns.<stage>.hostedZoneId`. Only this one public
41
+ * hosted zone receives direct record writes, and only in the `aws`
42
+ * partition. Omit it for a stage without a custom domain. */
43
+ publicHostedZoneId?: string;
40
44
  region: string;
41
45
  stage: StageAuthorityStage;
42
46
  }
@@ -63,7 +67,9 @@ export interface StageAuthorityDeploymentPolicy {
63
67
  name: string;
64
68
  }
65
69
  export interface StageAuthorityLimitations {
70
+ cloudMapForwardedRoute53Changes: 'cloud-map-forwarded-zone-create-and-soa-upsert-when-record-keys-present-any-cloud-map-managed-zone-service-chain-is-control';
66
71
  protectedDatabaseConfiguration: 'iam-cannot-inspect-rds-modify-request-fields-lifecycle-preflight-required';
72
+ publicDnsRecordScope: 'bound-stage-can-change-any-a-aaaa-or-cname-name-in-its-one-public-hosted-zone-no-name-level-scoping' | 'no-public-hosted-zone-bound-no-direct-route53-record-writes';
67
73
  resourcePolicyAttributes: 'sns-and-sqs-set-attributes-can-write-resource-policies-name-account-region-containment-applies';
68
74
  sameAccountStageDeploymentIsolation: 'deployment-role-is-account-scoped-use-production-isolated-for-hard-production-boundary';
69
75
  wafLoggingResourcePolicy: 'cloudwatch-logs-put-resource-policy-has-no-resource-or-action-condition-keys-reviewed-generated-source-is-control';
@@ -155,7 +161,29 @@ export declare const STAGE_AUTHORITY_WAF_EDGE_MUTATION_ACTIONS: readonly string[
155
161
  * database topologies, integrations, or cross-Region copies. The generated
156
162
  * architecture does not use them. */
157
163
  export declare const STAGE_AUTHORITY_UNSUPPORTED_REPLICATION_AND_TOPOLOGY_ACTIONS: readonly string[];
158
- export declare const STAGE_AUTHORITY_GLOBAL_WRITE_ACTIONS: readonly string[];
164
+ /** Route 53 requests that Cloud Map forwards with the stage deployment role's
165
+ * own identity (forward access sessions) while it creates the generated
166
+ * private DNS namespace. CloudTrail shows the private-zone create and one SOA
167
+ * UPSERT per namespace; the zone ID is unknown in advance, so the
168
+ * resource stays `*` and the Cloud Map service chain is the control. Cloud
169
+ * Map's instance A/SRV records are written by the ECS service-linked role, and
170
+ * Route 53 health checks are unsupported in private DNS namespaces, so no
171
+ * health-check, tag, or other record authority is granted. */
172
+ export declare const STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_ROUTE53_ACTIONS: readonly string[];
173
+ export declare const STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_ACTIONS: readonly string[];
174
+ export declare const STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_TYPES: readonly string[];
175
+ /** Generated stage infrastructure writes only alias records (A and AAAA) and
176
+ * each certificate's ACM validation CNAME in the bound zone, for these names:
177
+ * - the Foundation Router's root and wildcard aliases
178
+ * - `auth.<root>`, the Foundation's Cognito identity domain
179
+ * - `api.<root>`, the Foundation's Regional API Gateway domain for Slice APIs
180
+ *
181
+ * Delegation, zone authority, mail, verification, and certificate-authority
182
+ * records stay ungranted even inside the bound zone. */
183
+ export declare const STAGE_AUTHORITY_PUBLIC_DNS_RECORD_TYPES: readonly string[];
184
+ /** Route 53 hosted-zone IDs are `Z` plus at most 31 upper-case alphanumerics.
185
+ * An ARN or `/hostedzone/` prefix is refused rather than normalized. */
186
+ export declare const STAGE_AUTHORITY_PUBLIC_HOSTED_ZONE_ID: RegExp;
159
187
  export declare const STAGE_AUTHORITY_ACCOUNT_SCOPED_GLOBAL_WRITE_ACTIONS: readonly string[];
160
188
  export declare const STAGE_RUNTIME_REGIONAL_ACTIONS: readonly string[];
161
189
  export declare const STAGE_RUNTIME_GLOBAL_ACTIONS: readonly string[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STAGE_AUTHORITY_CROSS_ACCOUNT_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_CROSS_ACCOUNT_EC2_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_SST_417_EXTERNAL_AMI_OWNERS_BY_PARTITION = exports.STAGE_AUTHORITY_CLOUDCONTROL_EDGE_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_SCOPE_GUARD_MUTATION_FAMILIES = exports.STAGE_AUTHORITY_WORKLOAD_IDENTITY_POLICY_ACTIONS = exports.STAGE_AUTHORITY_APPROVED_AWS_MANAGED_POLICIES = exports.STAGE_RUNTIME_REGIONAL_SERVICE_FAMILIES = exports.STAGE_AUTHORITY_LOGS_MUTATION_FAMILIES = exports.STAGE_AUTHORITY_REGIONAL_MUTATION_FAMILIES = exports.STAGE_RUNTIME_GLOBAL_ACTIONS = exports.STAGE_RUNTIME_REGIONAL_ACTIONS = exports.STAGE_AUTHORITY_ACCOUNT_SCOPED_GLOBAL_WRITE_ACTIONS = exports.STAGE_AUTHORITY_GLOBAL_WRITE_ACTIONS = exports.STAGE_AUTHORITY_UNSUPPORTED_REPLICATION_AND_TOPOLOGY_ACTIONS = exports.STAGE_AUTHORITY_WAF_EDGE_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_S3_REGIONAL_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_UNSCOPED_CLOUDFRONT_CREATE_ACTIONS = exports.STAGE_AUTHORITY_REGIONAL_WRITE_ACTIONS = exports.STAGE_AUTHORITY_LAMBDA_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_KMS_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_EC2_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_BACKUP_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_BROAD_REGIONAL_SERVICE_ACTIONS = exports.STAGE_AUTHORITY_EDGE_OBSERVABILITY_READ_ACTIONS = exports.STAGE_AUTHORITY_GLOBAL_READ_ACTIONS = exports.STAGE_AUTHORITY_REGIONAL_READ_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_WRITE_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_RESOURCE_WRITE_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_CREATE_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_READ_ACTIONS = exports.STAGE_AUTHORITY_KMS_ROTATION_ACTIONS = exports.STAGE_AUTHORITY_RDS_EVENT_SUBSCRIPTION_SOURCE_ACTIONS = exports.STAGE_AUTHORITY_BUDGET_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_EDGE_WAF_LOG_DELIVERY_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_EDGE_WAF_LOG_GROUP_ACTIONS = exports.STAGE_AUTHORITY_WAF_LOGGING_ACTIONS = exports.STAGE_AUTHORITY_CLOUDFRONT_INVALIDATION_ACTIONS = exports.STAGE_AUTHORITY_LAMBDA_DEPLOYMENT_INVOKE_ACTIONS = exports.STAGE_AUTHORITY_EVENT_ARCHIVE_RESOURCE_ACTIONS = exports.STAGE_AUTHORITY_EVENT_ARCHIVE_CREATE_ACTIONS = exports.STAGE_AUTHORITY_CLOUDFORMATION_LIFECYCLE_ACTIONS = exports.STAGE_AUTHORITY_BOUND_TEMPLATE_BODY_MINIMUM_HEADROOM = exports.STAGE_AUTHORITY_TEMPLATE_BODY_BYTE_LIMIT = exports.STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_HEADROOM = exports.STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_LIMIT = exports.STAGE_AUTHORITY_DEPLOYMENT_POLICY_KINDS = exports.STAGE_AUTHORITY_PARTITIONS = exports.STAGE_AUTHORITY_STAGES = exports.STAGE_AUTHORITY_SCHEMA_VERSION = void 0;
4
- exports.STAGE_AUTHORITY_SERVICE_LINKED_ROLES = exports.STAGE_AUTHORITY_UNSUPPORTED_WORKFLOW_EXECUTION_ACTIONS = exports.STAGE_AUTHORITY_NON_DEPLOYMENT_ACCOUNT_AND_DATA_ACTIONS = exports.STAGE_AUTHORITY_UNREVIEWED_PERMISSION_MANAGEMENT_ACTION_PATTERNS = exports.STAGE_AUTHORITY_REVIEWED_PERMISSION_MANAGEMENT_ACTIONS = exports.STAGE_AUTHORITY_S3_BUCKET_POLICY_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_KNOWN_STAGE_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_UNTAGGED_DESTRUCTIVE_ACTIONS = exports.STAGE_AUTHORITY_CROSS_STAGE_DESTRUCTIVE_ACTIONS = void 0;
3
+ exports.STAGE_AUTHORITY_SCOPE_GUARD_MUTATION_FAMILIES = exports.STAGE_AUTHORITY_WORKLOAD_IDENTITY_POLICY_ACTIONS = exports.STAGE_AUTHORITY_APPROVED_AWS_MANAGED_POLICIES = exports.STAGE_RUNTIME_REGIONAL_SERVICE_FAMILIES = exports.STAGE_AUTHORITY_LOGS_MUTATION_FAMILIES = exports.STAGE_AUTHORITY_REGIONAL_MUTATION_FAMILIES = exports.STAGE_RUNTIME_GLOBAL_ACTIONS = exports.STAGE_RUNTIME_REGIONAL_ACTIONS = exports.STAGE_AUTHORITY_ACCOUNT_SCOPED_GLOBAL_WRITE_ACTIONS = exports.STAGE_AUTHORITY_PUBLIC_HOSTED_ZONE_ID = exports.STAGE_AUTHORITY_PUBLIC_DNS_RECORD_TYPES = exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_TYPES = exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_ACTIONS = exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_ROUTE53_ACTIONS = exports.STAGE_AUTHORITY_UNSUPPORTED_REPLICATION_AND_TOPOLOGY_ACTIONS = exports.STAGE_AUTHORITY_WAF_EDGE_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_S3_REGIONAL_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_UNSCOPED_CLOUDFRONT_CREATE_ACTIONS = exports.STAGE_AUTHORITY_REGIONAL_WRITE_ACTIONS = exports.STAGE_AUTHORITY_LAMBDA_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_KMS_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_EC2_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_BACKUP_INFRASTRUCTURE_ACTIONS = exports.STAGE_AUTHORITY_BROAD_REGIONAL_SERVICE_ACTIONS = exports.STAGE_AUTHORITY_EDGE_OBSERVABILITY_READ_ACTIONS = exports.STAGE_AUTHORITY_GLOBAL_READ_ACTIONS = exports.STAGE_AUTHORITY_REGIONAL_READ_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_WRITE_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_RESOURCE_WRITE_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_CREATE_ACTIONS = exports.STAGE_AUTHORITY_COST_ANOMALY_READ_ACTIONS = exports.STAGE_AUTHORITY_KMS_ROTATION_ACTIONS = exports.STAGE_AUTHORITY_RDS_EVENT_SUBSCRIPTION_SOURCE_ACTIONS = exports.STAGE_AUTHORITY_BUDGET_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_EDGE_WAF_LOG_DELIVERY_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_EDGE_WAF_LOG_GROUP_ACTIONS = exports.STAGE_AUTHORITY_WAF_LOGGING_ACTIONS = exports.STAGE_AUTHORITY_CLOUDFRONT_INVALIDATION_ACTIONS = exports.STAGE_AUTHORITY_LAMBDA_DEPLOYMENT_INVOKE_ACTIONS = exports.STAGE_AUTHORITY_EVENT_ARCHIVE_RESOURCE_ACTIONS = exports.STAGE_AUTHORITY_EVENT_ARCHIVE_CREATE_ACTIONS = exports.STAGE_AUTHORITY_CLOUDFORMATION_LIFECYCLE_ACTIONS = exports.STAGE_AUTHORITY_BOUND_TEMPLATE_BODY_MINIMUM_HEADROOM = exports.STAGE_AUTHORITY_TEMPLATE_BODY_BYTE_LIMIT = exports.STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_HEADROOM = exports.STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_LIMIT = exports.STAGE_AUTHORITY_DEPLOYMENT_POLICY_KINDS = exports.STAGE_AUTHORITY_PARTITIONS = exports.STAGE_AUTHORITY_STAGES = exports.STAGE_AUTHORITY_SCHEMA_VERSION = void 0;
4
+ exports.STAGE_AUTHORITY_SERVICE_LINKED_ROLES = exports.STAGE_AUTHORITY_UNSUPPORTED_WORKFLOW_EXECUTION_ACTIONS = exports.STAGE_AUTHORITY_NON_DEPLOYMENT_ACCOUNT_AND_DATA_ACTIONS = exports.STAGE_AUTHORITY_UNREVIEWED_PERMISSION_MANAGEMENT_ACTION_PATTERNS = exports.STAGE_AUTHORITY_REVIEWED_PERMISSION_MANAGEMENT_ACTIONS = exports.STAGE_AUTHORITY_S3_BUCKET_POLICY_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_KNOWN_STAGE_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_UNTAGGED_DESTRUCTIVE_ACTIONS = exports.STAGE_AUTHORITY_CROSS_STAGE_DESTRUCTIVE_ACTIONS = exports.STAGE_AUTHORITY_CROSS_ACCOUNT_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_CROSS_ACCOUNT_EC2_MUTATION_ACTIONS = exports.STAGE_AUTHORITY_SST_417_EXTERNAL_AMI_OWNERS_BY_PARTITION = exports.STAGE_AUTHORITY_CLOUDCONTROL_EDGE_MUTATION_ACTIONS = void 0;
5
5
  exports.createStageAuthorityIdentity = createStageAuthorityIdentity;
6
6
  exports.canonicalStageAuthorityTemplate = canonicalStageAuthorityTemplate;
7
7
  exports.digestStageAuthorityTemplate = digestStageAuthorityTemplate;
@@ -34,7 +34,7 @@ exports.STAGE_AUTHORITY_DEPLOYMENT_POLICY_KINDS = [
34
34
  exports.STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_LIMIT = 6_144;
35
35
  exports.STAGE_AUTHORITY_MANAGED_POLICY_CHARACTER_HEADROOM = 200;
36
36
  exports.STAGE_AUTHORITY_TEMPLATE_BODY_BYTE_LIMIT = 51_200;
37
- exports.STAGE_AUTHORITY_BOUND_TEMPLATE_BODY_MINIMUM_HEADROOM = 1_024;
37
+ exports.STAGE_AUTHORITY_BOUND_TEMPLATE_BODY_MINIMUM_HEADROOM = 256;
38
38
  const STAGE_AUTHORITY_MAX_AWS_PRINCIPALS = 16;
39
39
  const STAGE_AUTHORITY_MAX_AWS_PRINCIPAL_ARN_BYTES = 2_048;
40
40
  // IAM glob syntax cannot validate hexadecimal characters. Framework task
@@ -385,13 +385,31 @@ exports.STAGE_AUTHORITY_UNSUPPORTED_REPLICATION_AND_TOPOLOGY_ACTIONS = Object.fr
385
385
  'secretsmanager:ReplicateSecretToRegions',
386
386
  'secretsmanager:StopReplicationToReplica',
387
387
  ].sort(compareStrings));
388
- exports.STAGE_AUTHORITY_GLOBAL_WRITE_ACTIONS = Object.freeze([
389
- 'route53:ChangeResourceRecordSets',
390
- 'route53:ChangeTagsForResource',
391
- 'route53:CreateHealthCheck',
392
- 'route53:DeleteHealthCheck',
393
- 'route53:UpdateHealthCheck',
394
- ].sort(compareStrings));
388
+ /** Route 53 requests that Cloud Map forwards with the stage deployment role's
389
+ * own identity (forward access sessions) while it creates the generated
390
+ * private DNS namespace. CloudTrail shows the private-zone create and one SOA
391
+ * UPSERT per namespace; the zone ID is unknown in advance, so the
392
+ * resource stays `*` and the Cloud Map service chain is the control. Cloud
393
+ * Map's instance A/SRV records are written by the ECS service-linked role, and
394
+ * Route 53 health checks are unsupported in private DNS namespaces, so no
395
+ * health-check, tag, or other record authority is granted. */
396
+ exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_ROUTE53_ACTIONS = Object.freeze(['route53:ChangeResourceRecordSets', 'route53:CreateHostedZone'].sort(compareStrings));
397
+ exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_ACTIONS = Object.freeze(['UPSERT']);
398
+ exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_TYPES = Object.freeze([
399
+ 'SOA',
400
+ ]);
401
+ /** Generated stage infrastructure writes only alias records (A and AAAA) and
402
+ * each certificate's ACM validation CNAME in the bound zone, for these names:
403
+ * - the Foundation Router's root and wildcard aliases
404
+ * - `auth.<root>`, the Foundation's Cognito identity domain
405
+ * - `api.<root>`, the Foundation's Regional API Gateway domain for Slice APIs
406
+ *
407
+ * Delegation, zone authority, mail, verification, and certificate-authority
408
+ * records stay ungranted even inside the bound zone. */
409
+ exports.STAGE_AUTHORITY_PUBLIC_DNS_RECORD_TYPES = Object.freeze(['A', 'AAAA', 'CNAME'].sort(compareStrings));
410
+ /** Route 53 hosted-zone IDs are `Z` plus at most 31 upper-case alphanumerics.
411
+ * An ARN or `/hostedzone/` prefix is refused rather than normalized. */
412
+ exports.STAGE_AUTHORITY_PUBLIC_HOSTED_ZONE_ID = /^Z[A-Z0-9]{1,31}$/u;
395
413
  exports.STAGE_AUTHORITY_ACCOUNT_SCOPED_GLOBAL_WRITE_ACTIONS = Object.freeze([
396
414
  'cloudfront:DeleteCachePolicy',
397
415
  'cloudfront:DeleteDistribution',
@@ -983,6 +1001,17 @@ exports.STAGE_AUTHORITY_SERVICE_LINKED_ROLES = Object.freeze([
983
1001
  serviceName: 'wafv2.amazonaws.com',
984
1002
  }),
985
1003
  ]);
1004
+ /** A bound stage's Foundation creates a Regional API Gateway custom domain
1005
+ * (`api.<root>`), which needs API Gateway's service-linked role in an account
1006
+ * that does not have it yet. Rendered only with a committed public DNS
1007
+ * binding, so unbound templates are unchanged. Module-private: the exported
1008
+ * array constants are digest-pinned. */
1009
+ const STAGE_AUTHORITY_BOUND_PUBLIC_DNS_SERVICE_LINKED_ROLES = Object.freeze([
1010
+ Object.freeze({
1011
+ path: 'ops.apigateway.amazonaws.com/AWSServiceRoleForAPIGateway',
1012
+ serviceName: 'ops.apigateway.amazonaws.com',
1013
+ }),
1014
+ ]);
986
1015
  const IAM_POLICY_VERSION = '2012-10-17';
987
1016
  function compareStrings(left, right) {
988
1017
  return left < right ? -1 : left > right ? 1 : 0;
@@ -1248,6 +1277,19 @@ function requireIdentity(input) {
1248
1277
  stage: input.stage,
1249
1278
  };
1250
1279
  }
1280
+ function requirePublicHostedZone(input, partition) {
1281
+ const zone = input.publicHostedZoneId;
1282
+ if (zone === undefined)
1283
+ return undefined;
1284
+ if (typeof zone !== 'string' ||
1285
+ !exports.STAGE_AUTHORITY_PUBLIC_HOSTED_ZONE_ID.test(zone)) {
1286
+ throw new Error('Stage authority public DNS requires one exact Route 53 hosted-zone ID (Z followed by at most 31 upper-case letters or digits), without an ARN or path prefix.');
1287
+ }
1288
+ if (partition !== 'aws') {
1289
+ throw new Error('Stage authority binds a public hosted zone only in the aws partition; remove publicDns for this stage.');
1290
+ }
1291
+ return zone;
1292
+ }
1251
1293
  function createStageAuthorityIdentity(input) {
1252
1294
  const identity = requireIdentity(input);
1253
1295
  const boundaryPath = `/ebk/${identity.stage}/`;
@@ -1836,7 +1878,13 @@ function deploymentPolicy(options) {
1836
1878
  const accountExecutionResources = [
1837
1879
  `arn:${options.partition}:states:${options.region}:${options.accountId}:execution:*:*`,
1838
1880
  ];
1839
- const serviceLinkedRoleResources = exports.STAGE_AUTHORITY_SERVICE_LINKED_ROLES.map(({ path }) => `arn:${options.partition}:iam::${options.accountId}:role/aws-service-role/${path}`);
1881
+ const serviceLinkedRoles = [
1882
+ ...exports.STAGE_AUTHORITY_SERVICE_LINKED_ROLES,
1883
+ ...(options.publicHostedZoneId
1884
+ ? STAGE_AUTHORITY_BOUND_PUBLIC_DNS_SERVICE_LINKED_ROLES
1885
+ : []),
1886
+ ].sort((left, right) => compareStrings(left.serviceName, right.serviceName));
1887
+ const serviceLinkedRoleResources = serviceLinkedRoles.map(({ path }) => `arn:${options.partition}:iam::${options.accountId}:role/aws-service-role/${path}`);
1840
1888
  const stageAndSharedMutationResources = [
1841
1889
  `arn:${options.partition}:backup:${options.region}:${options.accountId}:*:*${options.stage}*`,
1842
1890
  `arn:${options.partition}:budgets::${options.accountId}:budget/*`,
@@ -2276,7 +2324,7 @@ function deploymentPolicy(options) {
2276
2324
  Action: ['iam:CreateServiceLinkedRole'],
2277
2325
  Condition: {
2278
2326
  StringEquals: {
2279
- 'iam:AWSServiceName': exports.STAGE_AUTHORITY_SERVICE_LINKED_ROLES.map(({ serviceName }) => serviceName),
2327
+ 'iam:AWSServiceName': serviceLinkedRoles.map(({ serviceName }) => serviceName),
2280
2328
  },
2281
2329
  },
2282
2330
  Effect: 'Allow',
@@ -2292,12 +2340,30 @@ function deploymentPolicy(options) {
2292
2340
  Resource: ['*'],
2293
2341
  Sid: 'CreateOnlyGeneratedCloudFrontResources',
2294
2342
  }),
2295
- statement({
2296
- Action: exports.STAGE_AUTHORITY_GLOBAL_WRITE_ACTIONS,
2297
- Effect: 'Allow',
2298
- Resource: ['*'],
2299
- Sid: 'MutateFixedGlobalServiceFamilies',
2300
- }),
2343
+ // Direct Route 53 record writes exist only for a committed public DNS
2344
+ // binding: one exact hosted zone, Router alias and ACM validation types
2345
+ // only. ForAllValues is true for an absent key, so the Null guard keeps a
2346
+ // request without record-type context denied.
2347
+ ...(options.publicHostedZoneId
2348
+ ? [
2349
+ statement({
2350
+ Action: ['route53:ChangeResourceRecordSets'],
2351
+ Condition: {
2352
+ 'ForAllValues:StringEquals': {
2353
+ 'route53:ChangeResourceRecordSetsRecordTypes': exports.STAGE_AUTHORITY_PUBLIC_DNS_RECORD_TYPES,
2354
+ },
2355
+ Null: {
2356
+ 'route53:ChangeResourceRecordSetsRecordTypes': 'false',
2357
+ },
2358
+ },
2359
+ Effect: 'Allow',
2360
+ Resource: [
2361
+ `arn:${options.partition}:route53:::hostedzone/${options.publicHostedZoneId}`,
2362
+ ],
2363
+ Sid: 'ChangeOnlyBoundPublicZoneAliasRecords',
2364
+ }),
2365
+ ]
2366
+ : []),
2301
2367
  statement({
2302
2368
  Action: exports.STAGE_AUTHORITY_WAF_EDGE_MUTATION_ACTIONS,
2303
2369
  Condition: {
@@ -2307,17 +2373,29 @@ function deploymentPolicy(options) {
2307
2373
  Resource: ['*'],
2308
2374
  Sid: 'MutateCloudFrontScopeWafInEdgeRegion',
2309
2375
  }),
2376
+ // Cloud Map forwards its private-zone create and one SOA UPSERT per
2377
+ // namespace with this role's identity. Neither request can be issued
2378
+ // directly or through another service. CreateHostedZone carries no record
2379
+ // keys, so ForAllValues admits it unchanged; a forwarded record change must
2380
+ // be an SOA UPSERT whenever Route 53 supplies the record keys. A Null guard
2381
+ // would refuse CreateHostedZone in this shared statement, and a separate
2382
+ // guarded statement exceeds the bound-template floor (see the issue #137
2383
+ // ledger), so absent keys fall back to the reviewed Cloud Map-only scope.
2310
2384
  statement({
2311
- Action: ['route53:CreateHostedZone'],
2385
+ Action: exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_ROUTE53_ACTIONS,
2312
2386
  Condition: {
2313
2387
  Bool: { 'aws:ViaAWSService': 'true' },
2388
+ 'ForAllValues:StringEquals': {
2389
+ 'route53:ChangeResourceRecordSetsActions': exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_ACTIONS,
2390
+ 'route53:ChangeResourceRecordSetsRecordTypes': exports.STAGE_AUTHORITY_CLOUD_MAP_FORWARDED_RECORD_TYPES,
2391
+ },
2314
2392
  StringEquals: {
2315
2393
  'aws:CalledViaLast': 'servicediscovery.amazonaws.com',
2316
2394
  },
2317
2395
  },
2318
2396
  Effect: 'Allow',
2319
2397
  Resource: ['*'],
2320
- Sid: 'CreateOnlyCloudMapPrivateHostedZones',
2398
+ Sid: 'ChangeOnlyCloudMapForwardedNamespaceZones',
2321
2399
  }),
2322
2400
  statement({
2323
2401
  Action: exports.STAGE_AUTHORITY_ACCOUNT_SCOPED_GLOBAL_WRITE_ACTIONS,
@@ -2330,6 +2408,29 @@ function deploymentPolicy(options) {
2330
2408
  ],
2331
2409
  Sid: 'MutateAccountCloudFront',
2332
2410
  }),
2411
+ // A bound stage's Cognito custom domain (`auth.<root>`) is served by a
2412
+ // CloudFront distribution that AWS owns. Cognito checks the role twice:
2413
+ // its documented prerequisite, cloudfront:UpdateDistribution on Resource
2414
+ // "*", which only this grant satisfies, and a forwarded UpdateDistribution
2415
+ // on that distribution's concrete ARN, which carries this account, so
2416
+ // the account-scoped grant above also admits it. Bound renders only, this
2417
+ // one action only. CloudFront distributions carry no resource policy, so
2418
+ // the grant reaches no other account's distribution by a direct call. The
2419
+ // edge-Region condition matches the edge-Region deny that already applies
2420
+ // to this action, so it removes nothing.
2421
+ ...(options.publicHostedZoneId
2422
+ ? [
2423
+ statement({
2424
+ Action: ['cloudfront:UpdateDistribution'],
2425
+ Condition: {
2426
+ StringEquals: { 'aws:RequestedRegion': edgeRegion },
2427
+ },
2428
+ Effect: 'Allow',
2429
+ Resource: ['*'],
2430
+ Sid: 'UpdateDistributionForBoundIdentityDomain',
2431
+ }),
2432
+ ]
2433
+ : []),
2333
2434
  statement({
2334
2435
  Action: exports.STAGE_AUTHORITY_CLOUDFRONT_INVALIDATION_ACTIONS,
2335
2436
  Condition: {
@@ -2604,12 +2705,52 @@ function deploymentPolicy(options) {
2604
2705
  Resource: ['*'],
2605
2706
  Sid: 'DenyAccountAndPrivilegeAdministration',
2606
2707
  }),
2607
- statement({
2608
- Action: RESOURCE_POLICY_AND_TRUST_EXPANSION_ACTIONS,
2708
+ // A bound stage's Foundation creates and deletes one Regional API Gateway
2709
+ // custom domain (`api.<root>`). The service reference lists
2710
+ // AddCertificateToDomain as an authorized action of CreateDomainName and
2711
+ // RemoveCertificateFromDomain as one of DeleteDomainName, and marks both
2712
+ // permission management because they also govern mutual TLS. Bound renders
2713
+ // therefore move them out of the unconditional deny and deny them whenever
2714
+ // the request or the domain carries a mutual-TLS truststore, so only the
2715
+ // non-mTLS case is admitted (by the Regional apigateway:* lifecycle grant).
2716
+ // Unbound renders keep the unconditional deny. The domain-name policy
2717
+ // actions (apigateway:Update*Policy) stay denied in every render.
2718
+ statement({
2719
+ Action: options.publicHostedZoneId
2720
+ ? RESOURCE_POLICY_AND_TRUST_EXPANSION_ACTIONS.filter((action) => action !== 'apigateway:*Certificate*Domain')
2721
+ : RESOURCE_POLICY_AND_TRUST_EXPANSION_ACTIONS,
2609
2722
  Effect: 'Deny',
2610
2723
  Resource: ['*'],
2611
2724
  Sid: 'DenyUnreviewableResourcePolicyAndTrustExpansion',
2612
2725
  }),
2726
+ ...(options.publicHostedZoneId
2727
+ ? [
2728
+ statement({
2729
+ Action: [
2730
+ 'apigateway:AddCertificateToDomain',
2731
+ 'apigateway:RemoveCertificateFromDomain',
2732
+ ],
2733
+ Condition: {
2734
+ Null: { 'apigateway:Request/MtlsTrustStoreUri': 'false' },
2735
+ },
2736
+ Effect: 'Deny',
2737
+ Resource: ['*'],
2738
+ Sid: 'DenyMutualTlsDomainCertificateRequest',
2739
+ }),
2740
+ statement({
2741
+ Action: [
2742
+ 'apigateway:AddCertificateToDomain',
2743
+ 'apigateway:RemoveCertificateFromDomain',
2744
+ ],
2745
+ Condition: {
2746
+ Null: { 'apigateway:Resource/MtlsTrustStoreUri': 'false' },
2747
+ },
2748
+ Effect: 'Deny',
2749
+ Resource: ['*'],
2750
+ Sid: 'DenyMutualTlsDomainCertificateResource',
2751
+ }),
2752
+ ]
2753
+ : []),
2613
2754
  statement({
2614
2755
  Action: exports.STAGE_AUTHORITY_UNSUPPORTED_REPLICATION_AND_TOPOLOGY_ACTIONS,
2615
2756
  Effect: 'Deny',
@@ -2823,7 +2964,9 @@ function deploymentPolicy(options) {
2823
2964
  Sid: 'DenyKnownOtherStageResourceMutation',
2824
2965
  }),
2825
2966
  statement({
2826
- Action: exports.STAGE_AUTHORITY_UNTAGGED_DESTRUCTIVE_ACTIONS,
2967
+ Action: options.publicHostedZoneId
2968
+ ? exports.STAGE_AUTHORITY_UNTAGGED_DESTRUCTIVE_ACTIONS.filter((action) => action !== 'cloudfront:UpdateDistribution')
2969
+ : exports.STAGE_AUTHORITY_UNTAGGED_DESTRUCTIVE_ACTIONS,
2827
2970
  Condition: {
2828
2971
  Null: { 'aws:ResourceTag/ebk:stage': 'true' },
2829
2972
  },
@@ -2831,6 +2974,43 @@ function deploymentPolicy(options) {
2831
2974
  NotResource: stageAndSharedMutationResources,
2832
2975
  Sid: 'DenyUntaggedMutationOutsideStageAndSstResources',
2833
2976
  }),
2977
+ // Bound renders only: cloudfront:UpdateDistribution leaves the statement
2978
+ // above, and an update of an untagged distribution ARN is denied here, in
2979
+ // any account, whatever the account key, unless the last service in the
2980
+ // request's chain is Cognito. aws:CalledViaLast is absent for a direct
2981
+ // call; for a forwarded call it names the last forwarding service or is
2982
+ // absent. A negated operator is true when its key is absent, so this deny
2983
+ // applies unless the key names Cognito. Cognito configures the AWS-owned
2984
+ // distribution behind auth.<root> with a forwarded UpdateDistribution under
2985
+ // this role's identity, on an ARN that carries this account (observed live,
2986
+ // 2026-11-08); that call is let through to the other denies. Every other
2987
+ // forwarding chain the role could drive (a CloudFormation stack, Cloud
2988
+ // Control, including the disable that precedes a Cloud Control delete, an
2989
+ // API Gateway edge domain, an AWS MCP server) stays denied by this one
2990
+ // condition. What this admits beyond Cognito's own domains: a forwarded
2991
+ // update from Cognito on any untagged pool of this account and Region or
2992
+ // from a Cognito domain in a stage-tagged stack, and, in theory, another
2993
+ // account's untagged distribution when CloudFront omits the account key.
2994
+ // What it does not bind: tagging an untagged distribution with this stage's
2995
+ // tag and then updating it directly (cloudfront:TagResource is a separate
2996
+ // grant). No NotResource list is needed: no shared stage resource is a
2997
+ // distribution.
2998
+ ...(options.publicHostedZoneId
2999
+ ? [
3000
+ statement({
3001
+ Action: ['cloudfront:UpdateDistribution'],
3002
+ Condition: {
3003
+ Null: { 'aws:ResourceTag/ebk:stage': 'true' },
3004
+ StringNotEquals: {
3005
+ 'aws:CalledViaLast': 'cognito-idp.amazonaws.com',
3006
+ },
3007
+ },
3008
+ Effect: 'Deny',
3009
+ Resource: [`arn:${options.partition}:cloudfront::*:distribution/*`],
3010
+ Sid: 'DenyUntaggedStageAccountDistributionUpdate',
3011
+ }),
3012
+ ]
3013
+ : []),
2834
3014
  statement({
2835
3015
  Action: ['*'],
2836
3016
  Condition: {
@@ -3082,7 +3262,6 @@ function deploymentPolicy(options) {
3082
3262
  kind: 'regional-mutation',
3083
3263
  logicalId: 'StageDeploymentRegionalMutationPolicy',
3084
3264
  sids: [
3085
- 'CreateOnlyCloudMapPrivateHostedZones',
3086
3265
  'CreateBucketOnlyInStageRegion',
3087
3266
  'DenyAcmMutationOutsideStageAndEdgeRegions',
3088
3267
  'DenyEdgeControlMutationOutsideEdgeRegion',
@@ -3139,9 +3318,12 @@ function deploymentPolicy(options) {
3139
3318
  'DenyUnsupportedReplicationAndTopology',
3140
3319
  'LaunchStageInfrastructureFromApprovedReferences',
3141
3320
  'MutateAccountCloudFront',
3321
+ ...(options.publicHostedZoneId
3322
+ ? ['UpdateDistributionForBoundIdentityDomain']
3323
+ : []),
3142
3324
  'MutateCloudFrontScopeWafInEdgeRegion',
3143
3325
  'ManageEdgeWafLogDeliveryControlPlane',
3144
- 'MutateFixedGlobalServiceFamilies',
3326
+ 'ChangeOnlyCloudMapForwardedNamespaceZones',
3145
3327
  'CreateOnlyTaggedStageAccountBudget',
3146
3328
  'DenyStageAccountBudgetStageTagRemoval',
3147
3329
  'MutateOnlyTaggedStageAccountBudget',
@@ -3186,6 +3368,9 @@ function deploymentPolicy(options) {
3186
3368
  kind: 'stage-containment',
3187
3369
  logicalId: 'StageDeploymentStageContainmentPolicy',
3188
3370
  sids: [
3371
+ ...(options.publicHostedZoneId
3372
+ ? ['ChangeOnlyBoundPublicZoneAliasRecords']
3373
+ : []),
3189
3374
  'CreateOnlyGeneratedCloudFrontResources',
3190
3375
  'DenyBucketPolicyMutationOutsideStageAndSstBootstrap',
3191
3376
  'DenyEventArchiveMutationOutsideGeneratedFoundationArchive',
@@ -3201,6 +3386,9 @@ function deploymentPolicy(options) {
3201
3386
  : ['DenyRuntimeTrustPolicyMutation']),
3202
3387
  'DenyUnscopedDatabaseEventSubscriptionSourceMutation',
3203
3388
  'DenyUntaggedMutationOutsideStageAndSstResources',
3389
+ ...(options.publicHostedZoneId
3390
+ ? ['DenyUntaggedStageAccountDistributionUpdate']
3391
+ : []),
3204
3392
  ],
3205
3393
  },
3206
3394
  {
@@ -3258,6 +3446,7 @@ function deploymentPolicy(options) {
3258
3446
  'DenyUnsupportedWorkflowExecutionMutation',
3259
3447
  'DenyUntaggedWorkflowExecutionStart',
3260
3448
  'DenyUntaggedMutationOutsideStageAndSstResources',
3449
+ 'DenyUntaggedStageAccountDistributionUpdate',
3261
3450
  'DenyWorkflowExecutionReadWithoutStageTag',
3262
3451
  'DenyWorkflowExecutionReadOutsideAccount',
3263
3452
  'DenyRunInstancesFromUnapprovedReferenceOwners',
@@ -3351,6 +3540,7 @@ function assertBoundStageAuthorityTemplateFitsBodyLimit(template) {
3351
3540
  }
3352
3541
  function createStageAuthorityPlan(input) {
3353
3542
  const target = requireIdentity(input);
3543
+ const publicHostedZoneId = requirePublicHostedZone(input, target.partition);
3354
3544
  const identity = createStageAuthorityIdentity(target);
3355
3545
  const assumeRolePolicy = requireTrust(input, target);
3356
3546
  const boundary = runtimeBoundaryPolicy({
@@ -3367,6 +3557,7 @@ function createStageAuthorityPlan(input) {
3367
3557
  accountId: target.accountId,
3368
3558
  identity,
3369
3559
  partition: target.partition,
3560
+ publicHostedZoneId,
3370
3561
  region: target.region,
3371
3562
  stage: target.stage,
3372
3563
  });
@@ -3472,7 +3663,11 @@ function createStageAuthorityPlan(input) {
3472
3663
  digest: digestStageAuthorityTemplate(template),
3473
3664
  identity,
3474
3665
  limitations: Object.freeze({
3666
+ cloudMapForwardedRoute53Changes: 'cloud-map-forwarded-zone-create-and-soa-upsert-when-record-keys-present-any-cloud-map-managed-zone-service-chain-is-control',
3475
3667
  protectedDatabaseConfiguration: 'iam-cannot-inspect-rds-modify-request-fields-lifecycle-preflight-required',
3668
+ publicDnsRecordScope: publicHostedZoneId
3669
+ ? 'bound-stage-can-change-any-a-aaaa-or-cname-name-in-its-one-public-hosted-zone-no-name-level-scoping'
3670
+ : 'no-public-hosted-zone-bound-no-direct-route53-record-writes',
3476
3671
  resourcePolicyAttributes: 'sns-and-sqs-set-attributes-can-write-resource-policies-name-account-region-containment-applies',
3477
3672
  sameAccountStageDeploymentIsolation: 'deployment-role-is-account-scoped-use-production-isolated-for-hard-production-boundary',
3478
3673
  wafLoggingResourcePolicy: 'cloudwatch-logs-put-resource-policy-has-no-resource-or-action-condition-keys-reviewed-generated-source-is-control',