saaslayer 0.4.3 → 0.5.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.
@@ -77,47 +77,46 @@
77
77
  # support role, rendered trust-statement enforcement, wildcard justification audit).
78
78
  AWSTemplateFormatVersion: '2010-09-09'
79
79
  Description: >-
80
- SaaSLayer foundation stack: grants each managing SaaSLayer control plane listed in TrustEntries scoped,
81
- trust-identifier-gated access to deploy and support SaaSLayer modules in this account. Installed once per account. Details:
82
- https://saaslayer.com/docs/account-access
80
+ SaaSLayer foundation: trust-identifier-gated access for the TrustEntries control planes to deploy and support
81
+ SaaSLayer modules in this account. https://saaslayer.com/docs/account-access
83
82
 
84
83
  Parameters:
85
84
  ControlPlaneAccountId:
86
85
  Type: String
87
86
  AllowedPattern: '^[0-9]{12}$'
88
87
  Description: >-
89
- Initial control-plane AWS account ID (informational). TrustEntries determines each control plane's trust.
88
+ Initial control-plane account ID (informational; TrustEntries sets trust).
90
89
  TrustEntries:
91
90
  Type: String
92
91
  MaxLength: 4096
93
92
  Description: >-
94
- JSON v1 entries: controlPlaneId, principalAccountId, trustIdentifiers, deployCallerArns, supportCallerArns. The CLI renders trust; identifiers are ExternalIds, not secrets.
93
+ JSON v1 trust entries, rendered by the CLI. Trust identifiers are ExternalIds, not secrets.
95
94
  ConnectionAuthorizerArns:
96
95
  Type: CommaDelimitedList
97
96
  Description: >-
98
- Path-less IAM principal ARNs allowed to authorize org connections. Defaults to the installer; changes require an explicit authorizer update.
97
+ Path-less IAM principal ARNs that may authorize org connections (default: the installer).
99
98
  StackNamePrefix:
100
99
  Type: String
101
100
  Default: sl-
102
101
  Description: >-
103
- The deployment role manages only CloudFormation stacks starting with this prefix.
102
+ Prefix of the stacks the deployment role manages.
104
103
  OrgId:
105
104
  Type: String
106
105
  Default: ''
107
106
  Description: >-
108
- Connected SaaSLayer org (informational output only; never used for authorization).
107
+ Connected SaaSLayer org (informational only).
109
108
  EnableEmailInbound:
110
109
  Type: String
111
110
  AllowedValues: ['true', 'false']
112
111
  Default: 'false'
113
112
  Description: >-
114
- Inbound SES permissions for email-inbound-service. Enable only on inbound-mail hosts: cplane accounts enable-capability <host> ses.
113
+ SES inbound permissions for email-inbound hosts (cplane accounts enable-capability <host> ses).
115
114
  EnableTenantEdge:
116
115
  Type: String
117
116
  AllowedValues: ['true', 'false']
118
117
  Default: 'false'
119
118
  Description: >-
120
- Native single-tenant edge CloudFront permissions. Enable: cplane accounts enable-capability <host> tenant-edge. Existing native-edge hosts must enable this before foundation >= 1.1.0 redeploy to preserve permissions.
119
+ Native tenant-edge CloudFront permissions (cplane accounts enable-capability <host> tenant-edge); native-edge hosts enable it before a >= 1.1.0 redeploy.
121
120
 
122
121
  Conditions:
123
122
  # Capability gates. Each maps 1:1 to an entry in @saaslayer/foundation-contract (packages/
@@ -136,7 +135,7 @@ Mappings:
136
135
  # patch = comments/docs/no behavior change
137
136
  Meta:
138
137
  Foundation:
139
- Version: '8.4.0'
138
+ Version: '8.8.0'
140
139
 
141
140
  Resources:
142
141
  # The shared deployment-artifact bucket moved OUT of this account-global stack into the per-region
@@ -178,103 +177,72 @@ Resources:
178
177
  # ARN, verbs AWS defines with no resource type, and services not yet scoped (UNSCOPED_PENDING_ON_STAR
179
178
  # in tests/bootstrap.test.js, which may only shrink).
180
179
  - Effect: Allow
181
- Action:
180
+ Action: [
181
+ # Scaling reads of the AWS::DynamoDB::GlobalTable handler (read, update, delete).
182
+ application-autoscaling:Describe*,
182
183
  # Stack introspection while executing changesets (read-only verbs).
183
- - cloudformation:Describe*
184
- - cloudformation:Get*
185
- - cloudformation:List*
184
+ cloudformation:Describe*, cloudformation:Get*, cloudformation:List*,
186
185
  # CloudWatch alarm + dashboard reads for module observability resources. Lifecycle:
187
186
  # sl-foundation-cfn-exec-policy (managed prefix).
188
- - cloudwatch:DescribeAlarms
189
- - cloudwatch:GetDashboard
190
- - cloudwatch:ListDashboards
187
+ cloudwatch:DescribeAlarms, cloudwatch:GetDashboard, cloudwatch:ListDashboards,
191
188
  # DetectStackDrift reads alarm tags; without this, drift checks on the ops alarms
192
189
  # 403 and block every UPDATE (fail-closed drift gate).
193
- - cloudwatch:ListTagsForResource
190
+ cloudwatch:ListTagsForResource,
194
191
  # Origin access control lifecycle for static-site modules (frontend-hosting, permissions-admin-ui:
195
192
  # private S3 origin + OAC): *OriginAccessControl is its Create/Get/Update/Delete (template size). An OAC
196
193
  # ARN carries an id and AWS defines no condition key for it, so neither a name nor a tag can scope it.
197
194
  # CreateInvalidation busts the edge cache when a redeploy uploads a new SPA build. Distribution
198
195
  # lifecycle: tag-scoped statements below.
199
- - cloudfront:*OriginAccessControl
200
- - cloudfront:CreateInvalidation
201
- - cloudfront:GetDistribution*
202
- - cloudfront:ListTagsForResource
196
+ cloudfront:*OriginAccessControl, cloudfront:CreateInvalidation, cloudfront:GetDistribution*,
197
+ cloudfront:ListTagsForResource,
203
198
  # Identity pool calls that take no pool ARN: the pool list and the role attachment (user-service
204
199
  # IdentityPoolRoleAttachment). Pool lifecycle: tag-scoped statements below.
205
- - cognito-identity:ListIdentityPools
206
- - cognito-identity:SetIdentityPoolRoles
200
+ cognito-identity:ListIdentityPools, cognito-identity:SetIdentityPoolRoles,
207
201
  # User-pool reads that take no resource ARN.
208
- - cognito-idp:DescribeUserPoolDomain
209
- - cognito-idp:ListUserPools
202
+ cognito-idp:DescribeUserPoolDomain, cognito-idp:ListUserPools,
210
203
  # EventBridge custom event bus lifecycle (module event buses) + rule lifecycle for
211
204
  # scheduled Lambdas (serverless `schedule` events generate AWS::Events::Rule — e.g.
212
205
  # rbac-service's event-delivery poller). DescribeRule/PutRule/*Targets are required
213
206
  # or the rule CREATE fails with AccessDenied. Reads here; lifecycle: sl-foundation-cfn-exec-policy.
214
- - events:DescribeEventBus
215
- - events:DescribeRule
216
- - events:ListTagsForResource
217
- - events:ListTargetsByRule
207
+ events:DescribeEventBus, events:DescribeRule, events:ListTagsForResource,
208
+ events:ListTargetsByRule,
218
209
  # EarlyValidation runs a KMS::Alias name-conflict check on change-set creation; without
219
210
  # ListAliases it reports a (non-fatal) "not allowed to check if resource already exists"
220
211
  # FAIL in the console Hooks view and can't detect a real alias collision. Enumeration API,
221
212
  # no resource-level scoping (monorepo-pcren). Key and alias lifecycle: tag/prefix-scoped statements below.
222
- - kms:ListAliases
213
+ kms:ListAliases,
223
214
  # IAM read-only introspection during changeset execution. Mutating IAM verbs
224
215
  # (Create/Delete/Update/Attach/Pass/Tag) are prefix-scoped in dedicated
225
216
  # statements below — never Resource '*' — and CreateRole additionally requires
226
217
  # SaaSLayerManagedResourceBoundary so no created role can exceed the boundary.
227
- - iam:GetPolicy
228
- - iam:GetPolicyVersion
229
- - iam:GetRole
230
- - iam:GetRolePolicy
231
- - iam:ListAttachedRolePolicies
232
- - iam:ListEntitiesForPolicy
233
- - iam:ListPolicyVersions
234
- - iam:ListRolePolicies
218
+ iam:GetPolicy, iam:GetPolicyVersion, iam:GetRole,
219
+ iam:GetRolePolicy, iam:ListAttachedRolePolicies, iam:ListEntitiesForPolicy,
220
+ iam:ListPolicyVersions, iam:ListRolePolicies,
235
221
  # Lambda calls that take no function ARN (event-source-mapping create, account and list reads).
236
222
  # Function lifecycle: the managed-prefix statement below.
237
- - lambda:CreateEventSourceMapping
238
- - lambda:GetAccountSettings
239
- - lambda:GetEventSourceMapping
240
- - lambda:ListEventSourceMappings
241
- - lambda:ListFunctions
242
- - lambda:ListLayerVersions
223
+ lambda:CreateEventSourceMapping, lambda:GetAccountSettings, lambda:GetEventSourceMapping,
224
+ lambda:ListEventSourceMappings, lambda:ListFunctions, lambda:ListLayerVersions,
243
225
  # Log group reads for module functions/services. The LogDelivery and
244
226
  # resource-policy verbs support AWS::Cognito::LogDeliveryConfiguration
245
227
  # (user-service auth event logging) and take no resource ARN. Log group and metric filter
246
228
  # (billing-service ops alarms on its log events) lifecycle: sl-foundation-cfn-exec-policy.
247
- - logs:CreateLogDelivery
248
- - logs:DeleteLogDelivery
249
- - logs:DescribeIndexPolicies
250
- - logs:DescribeLogGroups
251
- - logs:DescribeLogStreams
252
- - logs:DescribeMetricFilters
253
- - logs:DescribeResourcePolicies
254
- - logs:GetLogDelivery
255
- - logs:ListLogDeliveries
256
- - logs:ListTagsForResource
257
- - logs:PutResourcePolicy
258
- - logs:UpdateLogDelivery
229
+ logs:CreateLogDelivery, logs:DeleteLogDelivery, logs:DescribeIndexPolicies,
230
+ logs:DescribeLogGroups, logs:DescribeLogStreams, logs:DescribeMetricFilters,
231
+ logs:DescribeResourcePolicies, logs:GetLogDelivery, logs:ListLogDeliveries,
232
+ logs:ListTagsForResource, logs:PutResourcePolicy, logs:UpdateLogDelivery,
259
233
  # EventBridge Scheduler reads for module-declared schedules (rbac-core
260
234
  # delegation expiry uses schedules; runtime CRUD is granted via the boundary). Lifecycle:
261
235
  # sl-foundation-cfn-exec-policy.
262
- - scheduler:GetSchedule
263
- - scheduler:GetScheduleGroup
264
- - scheduler:ListTagsForResource
236
+ scheduler:GetSchedule, scheduler:GetScheduleGroup, scheduler:ListTagsForResource,
265
237
  # Secret metadata reads. Lifecycle: tag-scoped statements below.
266
- - secretsmanager:DescribeSecret
267
- - secretsmanager:GetResourcePolicy
238
+ secretsmanager:DescribeSecret, secretsmanager:GetResourcePolicy,
268
239
  # SSM parameter reads for module configuration exports (AWS::SSM::Parameter). Lifecycle:
269
240
  # sl-foundation-cfn-exec-policy.
270
- - ssm:DescribeParameters
271
- - ssm:GetParameter
272
- - ssm:GetParameters
273
- - ssm:GetParametersByPath
274
- - ssm:ListTagsForResource
241
+ ssm:DescribeParameters, ssm:GetParameter, ssm:GetParameters,
242
+ ssm:GetParametersByPath, ssm:ListTagsForResource,
275
243
  # SQS queue reads. Lifecycle: sl-foundation-cfn-exec-policy.
276
- - sqs:GetQueueAttributes
277
- - sqs:ListQueueTags
244
+ sqs:GetQueueAttributes, sqs:ListQueueTags,
245
+ ]
278
246
  Resource: '*'
279
247
  # API Gateway IAM actions are bare HTTP verbs against untyped resource paths; REST, HTTP and
280
248
  # WebSocket API provisioning (methods, resources, deployments, stages, authorizers, routes,
@@ -379,6 +347,24 @@ Resources:
379
347
  - dynamodb:UpdateTimeToLive
380
348
  # The wildcard also covers the tables' indexes (table/<name>/index/<index>).
381
349
  Resource: !Sub arn:${AWS::Partition}:dynamodb:*:${AWS::AccountId}:table/${StackNamePrefix}*
350
+ # AWS::DynamoDB::GlobalTable scaling cleanup (8.5.0): the handler's delete and update call these on the table's
351
+ # scalable targets, DeregisterScalableTarget even for PAY_PER_REQUEST tables with none, so the first delete of
352
+ # a GlobalTable stack failed AccessDenied without them. A target ARN carries a generated id and a table with no
353
+ # target has no ARN, so the request's service namespace (DynamoDB only) scopes them instead. Describe* is
354
+ # in the read statement above. No iam:CreateServiceLinkedRole: only RegisterScalableTarget on a provisioned
355
+ # table creates the scaling service-linked role, and every module table is PAY_PER_REQUEST.
356
+ - Effect: Allow
357
+ Action:
358
+ # Delete* is DeleteScalingPolicy and DeleteScheduledAction; Put* is PutScalingPolicy and
359
+ # PutScheduledAction (template size).
360
+ - application-autoscaling:Delete*
361
+ - application-autoscaling:DeregisterScalableTarget
362
+ - application-autoscaling:Put*
363
+ - application-autoscaling:RegisterScalableTarget
364
+ Resource: '*'
365
+ Condition:
366
+ StringEquals:
367
+ application-autoscaling:service-namespace: dynamodb
382
368
  # KMS customer-managed key + alias lifecycle. rbac-service provisions an
383
369
  # EventDeliveryKey (AWS::KMS::Key, rotation on) + alias for webhook payload
384
370
  # encryption; CreateKey mandates Resource '*', and TagResource on the new key
@@ -415,23 +401,12 @@ Resources:
415
401
  # table create fails AccessDenied (kms:CreateGrant, then kms:Decrypt/GenerateDataKey).
416
402
  # Alias verbs authorize against both the alias (next statement) and its key (here).
417
403
  - Effect: Allow
418
- Action:
419
- - kms:*Alias
420
- - kms:CreateGrant
421
- - kms:Decrypt
422
- - kms:DescribeKey
423
- - kms:DisableKeyRotation
424
- - kms:EnableKeyRotation
425
- - kms:Encrypt
426
- - kms:GenerateDataKey*
427
- - kms:Get*
428
- - kms:List*
429
- - kms:PutKeyPolicy
430
- - kms:ReEncrypt*
431
- - kms:RevokeGrant
432
- - kms:ScheduleKeyDeletion
433
- - kms:TagResource
434
- - kms:UntagResource
404
+ Action: [
405
+ kms:*Alias, kms:CreateGrant, kms:Decrypt, kms:DescribeKey,
406
+ kms:DisableKeyRotation, kms:EnableKeyRotation, kms:Encrypt, kms:GenerateDataKey*,
407
+ kms:Get*, kms:List*, kms:PutKeyPolicy, kms:ReEncrypt*,
408
+ kms:RevokeGrant, kms:ScheduleKeyDeletion, kms:TagResource, kms:UntagResource
409
+ ]
435
410
  Resource: !Sub arn:${AWS::Partition}:kms:*:${AWS::AccountId}:key/*
436
411
  Condition:
437
412
  StringEquals:
@@ -446,22 +421,14 @@ Resources:
446
421
  # function is ${stackName}-<fn> or (email-inbound's pinned custom-resource functions)
447
422
  # sl-email-inbound-<stage>-<fn>, under the managed prefix.
448
423
  - Effect: Allow
449
- Action:
424
+ Action: [
450
425
  # Get/List/Delete/Put/Update as globs (inline policy size, as for buckets); the resources below
451
426
  # keep them on managed-prefix functions and layers.
452
- - lambda:AddPermission
453
- - lambda:CreateFunction
454
- - lambda:Delete*
455
- - lambda:Get*
456
- - lambda:InvokeFunction
457
- - lambda:List*
458
- - lambda:PublishLayerVersion
459
- - lambda:PublishVersion
460
- - lambda:Put*
461
- - lambda:RemovePermission
462
- - lambda:TagResource
463
- - lambda:UntagResource
464
- - lambda:Update*
427
+ lambda:AddPermission, lambda:CreateFunction, lambda:Delete*, lambda:Get*,
428
+ lambda:InvokeFunction, lambda:List*, lambda:PublishLayerVersion, lambda:PublishVersion,
429
+ lambda:Put*, lambda:RemovePermission, lambda:TagResource, lambda:UntagResource,
430
+ lambda:Update*
431
+ ]
465
432
  Resource:
466
433
  - !Sub arn:${AWS::Partition}:lambda:*:${AWS::AccountId}:function:${StackNamePrefix}*
467
434
  - !Sub arn:${AWS::Partition}:lambda:*:${AWS::AccountId}:layer:${StackNamePrefix}*
@@ -486,24 +453,14 @@ Resources:
486
453
  # read/write used while CloudFormation stages template artifacts. Every module bucket, the shared
487
454
  # artifacts bucket and the framework's auto-named deployment bucket start with the managed prefix.
488
455
  - Effect: Allow
489
- Action:
456
+ Action: [
490
457
  # Bucket configuration verbs as globs (the role's inline policy is near IAM's 10,240-character
491
458
  # limit); the resources below keep them on managed-prefix buckets.
492
- - s3:CreateBucket
493
- - s3:DeleteBucket*
494
- - s3:DeleteObject
495
- - s3:GetAccelerateConfiguration
496
- - s3:GetBucket*
497
- - s3:GetEncryptionConfiguration
498
- - s3:GetLifecycleConfiguration
499
- - s3:GetObject
500
- - s3:ListBucket
501
- - s3:PutAccelerateConfiguration
502
- - s3:PutBucket*
503
- - s3:PutEncryptionConfiguration
504
- - s3:PutLifecycleConfiguration
505
- - s3:PutObject
506
- - s3:PutObjectAcl
459
+ s3:CreateBucket, s3:DeleteBucket*, s3:DeleteObject, s3:GetAccelerateConfiguration,
460
+ s3:GetBucket*, s3:GetEncryptionConfiguration, s3:GetLifecycleConfiguration, s3:GetObject,
461
+ s3:ListBucket, s3:PutAccelerateConfiguration, s3:PutBucket*, s3:PutEncryptionConfiguration,
462
+ s3:PutLifecycleConfiguration, s3:PutObject, s3:PutObjectAcl
463
+ ]
507
464
  # The wildcard also covers the buckets' objects (<bucket>/<key>).
508
465
  Resource: !Sub arn:${AWS::Partition}:s3:::${StackNamePrefix}*
509
466
  # SNS topic lifecycle: module stacks create an ops-alarms topic that
@@ -639,19 +596,11 @@ Resources:
639
596
  # (country rule set; AWS-generated id, so not name-scopable). Lifecycle + tag verbs only: no
640
597
  # sending, no account-default protect, spend limit, origination identity or registration changes.
641
598
  - Effect: Allow
642
- Action:
643
- - sms-voice:AssociateProtectConfiguration
644
- - sms-voice:CreateConfigurationSet
645
- - sms-voice:CreateProtectConfiguration
646
- - sms-voice:DeleteConfigurationSet
647
- - sms-voice:DeleteProtectConfiguration
648
- - sms-voice:DisassociateProtectConfiguration
649
- - sms-voice:GetProtectConfigurationCountryRuleSet
650
- - sms-voice:ListTagsForResource
651
- - sms-voice:TagResource
652
- - sms-voice:UntagResource
653
- - sms-voice:UpdateProtectConfiguration
654
- - sms-voice:UpdateProtectConfigurationCountryRuleSet
599
+ Action: [
600
+ sms-voice:AssociateProtectConfiguration, sms-voice:CreateConfigurationSet, sms-voice:CreateProtectConfiguration, sms-voice:DeleteConfigurationSet,
601
+ sms-voice:DeleteProtectConfiguration, sms-voice:DisassociateProtectConfiguration, sms-voice:GetProtectConfigurationCountryRuleSet, sms-voice:ListTagsForResource,
602
+ sms-voice:TagResource, sms-voice:UntagResource, sms-voice:UpdateProtectConfiguration, sms-voice:UpdateProtectConfigurationCountryRuleSet
603
+ ]
655
604
  Resource:
656
605
  - !Sub arn:${AWS::Partition}:sms-voice:*:${AWS::AccountId}:configuration-set/${StackNamePrefix}*
657
606
  - !Sub arn:${AWS::Partition}:sms-voice:*:${AWS::AccountId}:protect-configuration/*
@@ -679,63 +628,63 @@ Resources:
679
628
  PolicyDocument:
680
629
  Version: '2012-10-17'
681
630
  Statement:
631
+ # CDN policies have generated ids and cannot be tagged. AWS requires '*' for create;
632
+ # every subsequent lifecycle call is constrained to this account's policy ARNs.
633
+ - Effect: Allow
634
+ Action:
635
+ - cloudfront:CreateCachePolicy
636
+ - cloudfront:CreateResponseHeadersPolicy
637
+ Resource: '*'
638
+ - Sid: CdnPolicyLifecycle
639
+ Effect: Allow
640
+ Action:
641
+ - cloudfront:GetCachePolicy
642
+ - cloudfront:GetCachePolicyConfig
643
+ - cloudfront:UpdateCachePolicy
644
+ - cloudfront:DeleteCachePolicy
645
+ - cloudfront:GetResponseHeadersPolicy
646
+ - cloudfront:GetResponseHeadersPolicyConfig
647
+ - cloudfront:UpdateResponseHeadersPolicy
648
+ - cloudfront:DeleteResponseHeadersPolicy
649
+ Resource:
650
+ - !Sub arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:cache-policy/*
651
+ - !Sub arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:response-headers-policy/*
652
+ # Primary REST API protection only. No WAF access is added to runtime roles.
653
+ # REST disassociation uses the existing apigateway:SetWebACL grant, not WAF DisassociateWebACL.
654
+ - Effect: Allow
655
+ Action: [
656
+ wafv2:CreateWebACL, wafv2:DeleteWebACL, wafv2:UpdateWebACL,
657
+ wafv2:GetWebACL, wafv2:GetWebACLForResource, wafv2:ListTagsForResource,
658
+ wafv2:TagResource, wafv2:UntagResource, wafv2:AssociateWebACL,
659
+ wafv2:PutLoggingConfiguration, wafv2:GetLoggingConfiguration, wafv2:DeleteLoggingConfiguration,
660
+ ]
661
+ Resource:
662
+ - !Sub arn:${AWS::Partition}:wafv2:*:${AWS::AccountId}:regional/webacl/${StackNamePrefix}*-waf/*
682
663
  # Alarm, dashboard, EventBridge bus and rule, log group, schedule, SSM parameter and queue lifecycle. Every
683
664
  # module names these from its stack name: alarms ${stackName}-<alarm>, buses ${stackName}-<purpose>, rules
684
665
  # ${stackName}-<fn> (unnamed schedule rules get CloudFormation's <stackName>-<LogicalId>-<random>), the schedule
685
666
  # group ${stackName}, parameters /${stackName}/..., queues ${stackName}-<purpose>. Log groups are
686
667
  # /aws/lambda/<function> (every function is under the managed prefix) and /aws/cognito/${stackName}-logs.
687
668
  - Effect: Allow
688
- Action:
689
- - cloudwatch:DeleteAlarms
690
- - cloudwatch:DeleteDashboards
691
- - cloudwatch:DisableAlarmActions
692
- - cloudwatch:EnableAlarmActions
693
- - cloudwatch:PutDashboard
694
- - cloudwatch:PutMetricAlarm
695
- - cloudwatch:TagResource
696
- - cloudwatch:UntagResource
697
- - events:CreateEventBus
698
- - events:DeleteEventBus
699
- - events:DeleteRule
700
- - events:DisableRule
701
- - events:EnableRule
702
- - events:PutRule
703
- - events:PutTargets
704
- - events:RemoveTargets
705
- - events:TagResource
706
- - events:UntagResource
707
- - logs:CreateLogGroup
708
- - logs:CreateLogStream
709
- - logs:DeleteLogGroup
710
- - logs:DeleteLogStream
711
- - logs:DeleteMetricFilter
712
- - logs:DeleteRetentionPolicy
713
- - logs:PutDestination
714
- - logs:PutDestinationPolicy
715
- - logs:PutLogEvents
716
- - logs:PutMetricFilter
717
- - logs:PutRetentionPolicy
718
- - logs:TagLogGroup
719
- - logs:TagResource
720
- - logs:UntagLogGroup
721
- - logs:UntagResource
722
- - scheduler:CreateSchedule
723
- - scheduler:CreateScheduleGroup
724
- - scheduler:DeleteSchedule
725
- - scheduler:DeleteScheduleGroup
726
- - scheduler:TagResource
727
- - scheduler:UntagResource
728
- - scheduler:UpdateSchedule
729
- - ssm:AddTagsToResource
730
- - ssm:DeleteParameter
731
- - ssm:DeleteParameters
732
- - ssm:PutParameter
733
- - ssm:RemoveTagsFromResource
734
- - sqs:CreateQueue
735
- - sqs:DeleteQueue
736
- - sqs:SetQueueAttributes
737
- - sqs:TagQueue
738
- - sqs:UntagQueue
669
+ Action: [
670
+ cloudwatch:DeleteAlarms, cloudwatch:DeleteDashboards, cloudwatch:DisableAlarmActions,
671
+ cloudwatch:EnableAlarmActions, cloudwatch:PutDashboard, cloudwatch:PutMetricAlarm,
672
+ cloudwatch:TagResource, cloudwatch:UntagResource, events:CreateEventBus,
673
+ events:DeleteEventBus, events:DeleteRule, events:DisableRule,
674
+ events:EnableRule, events:PutRule, events:PutTargets,
675
+ events:RemoveTargets, events:TagResource, events:UntagResource,
676
+ logs:CreateLogGroup, logs:CreateLogStream, logs:DeleteLogGroup,
677
+ logs:DeleteLogStream, logs:DeleteMetricFilter, logs:DeleteRetentionPolicy,
678
+ logs:PutDestination, logs:PutDestinationPolicy, logs:PutLogEvents,
679
+ logs:PutMetricFilter, logs:PutRetentionPolicy, logs:TagLogGroup,
680
+ logs:TagResource, logs:UntagLogGroup, logs:UntagResource,
681
+ scheduler:CreateSchedule, scheduler:CreateScheduleGroup, scheduler:DeleteSchedule,
682
+ scheduler:DeleteScheduleGroup, scheduler:TagResource, scheduler:UntagResource,
683
+ scheduler:UpdateSchedule, ssm:AddTagsToResource, ssm:DeleteParameter,
684
+ ssm:DeleteParameters, ssm:PutParameter, ssm:RemoveTagsFromResource,
685
+ sqs:CreateQueue, sqs:DeleteQueue, sqs:SetQueueAttributes,
686
+ sqs:TagQueue, sqs:UntagQueue,
687
+ ]
739
688
  # Each action matches only its own service's ARNs, so one statement carries every service.
740
689
  Resource:
741
690
  - !Sub arn:${AWS::Partition}:cloudwatch:*:${AWS::AccountId}:alarm:${StackNamePrefix}*
@@ -745,6 +694,7 @@ Resources:
745
694
  - !Sub arn:${AWS::Partition}:events:*:${AWS::AccountId}:rule/${StackNamePrefix}*
746
695
  - !Sub arn:${AWS::Partition}:logs:*:${AWS::AccountId}:log-group:/aws/lambda/${StackNamePrefix}*
747
696
  - !Sub arn:${AWS::Partition}:logs:*:${AWS::AccountId}:log-group:/aws/cognito/${StackNamePrefix}*
697
+ - !Sub arn:${AWS::Partition}:logs:*:${AWS::AccountId}:log-group:aws-waf-logs-${StackNamePrefix}*
748
698
  - !Sub arn:${AWS::Partition}:logs:*:${AWS::AccountId}:destination:${StackNamePrefix}*
749
699
  - !Sub arn:${AWS::Partition}:scheduler:*:${AWS::AccountId}:schedule-group/${StackNamePrefix}*
750
700
  - !Sub arn:${AWS::Partition}:scheduler:*:${AWS::AccountId}:schedule/${StackNamePrefix}*
@@ -767,23 +717,15 @@ Resources:
767
717
  Version: '2012-10-17'
768
718
  Statement:
769
719
  - Effect: Allow
770
- Action:
720
+ Action: [
771
721
  # Invitation registration creates the invited account after mailbox proof (user-service).
772
- - cognito-idp:AdminCreateUser
773
- - cognito-idp:AdminDeleteUser
774
- - cognito-idp:AdminDeleteUserAttributes
775
- - cognito-idp:AdminDisableProviderForUser
722
+ cognito-idp:AdminCreateUser, cognito-idp:AdminDeleteUser, cognito-idp:AdminDeleteUserAttributes,
723
+ cognito-idp:AdminDisableProviderForUser,
776
724
  # User lifecycle operations by suid (user-service API: disable/enable after global sign-out, reset-password).
777
- - cognito-idp:AdminDisableUser
778
- - cognito-idp:AdminEnableUser
779
- - cognito-idp:AdminGetUser
780
- - cognito-idp:AdminLinkProviderForUser
781
- - cognito-idp:AdminListGroupsForUser
782
- - cognito-idp:AdminResetUserPassword
783
- - cognito-idp:AdminSetUserMFAPreference
784
- - cognito-idp:AdminSetUserPassword
785
- - cognito-idp:AdminUpdateUserAttributes
786
- - cognito-idp:AdminUserGlobalSignOut
725
+ cognito-idp:AdminDisableUser, cognito-idp:AdminEnableUser, cognito-idp:AdminGetUser,
726
+ cognito-idp:AdminLinkProviderForUser, cognito-idp:AdminListGroupsForUser, cognito-idp:AdminResetUserPassword,
727
+ cognito-idp:AdminSetUserMFAPreference, cognito-idp:AdminSetUserPassword, cognito-idp:AdminUpdateUserAttributes,
728
+ cognito-idp:AdminUserGlobalSignOut,
787
729
  # Social login + identity stitching (epic monorepo-24667): the idpResource custom-resource
788
730
  # Lambda manages the federated IdPs; the PreSignUp/stitching + account Lambdas link/disable
789
731
  # providers, set passwords, and delete users. The boundary is the ceiling, so it must allow
@@ -793,71 +735,39 @@ Resources:
793
735
  # connection's dedicated app client (Create/Delete/Describe/UpdateUserPoolClient) and lists both for
794
736
  # reconciliation, on the instance's own pool (its role names that pool). Also each SSO client's
795
737
  # managed-login branding (Create/Delete/Describe/DescribeByClient/Update) and the login domains' version.
796
- - cognito-idp:*IdentityProvider
797
- - cognito-idp:*ManagedLoginBranding*
798
- - cognito-idp:*UserPoolClient
799
- - cognito-idp:UpdateUserPoolDomain
800
- - cognito-idp:ListIdentityProviders
801
- - cognito-idp:ListUserPoolClients
802
- - cognito-idp:GetUserPoolMfaConfig
803
- - cognito-idp:ListUsers
804
- - dynamodb:BatchGetItem
805
- - dynamodb:BatchWriteItem
738
+ cognito-idp:*IdentityProvider, cognito-idp:*ManagedLoginBranding*, cognito-idp:*UserPoolClient,
739
+ cognito-idp:UpdateUserPoolDomain, cognito-idp:ListIdentityProviders, cognito-idp:ListUserPoolClients,
740
+ cognito-idp:GetUserPoolMfaConfig, cognito-idp:ListUsers, dynamodb:BatchGetItem,
741
+ dynamodb:BatchWriteItem,
806
742
  # TransactWriteItems ConditionCheck items (permissions-service audit writes check erasure markers).
807
- - dynamodb:ConditionCheckItem
808
- - dynamodb:DeleteItem
809
- - dynamodb:DescribeStream
810
- - dynamodb:DescribeTable
811
- - dynamodb:GetItem
812
- - dynamodb:GetRecords
813
- - dynamodb:GetShardIterator
814
- - dynamodb:ListStreams
815
- - dynamodb:PutItem
816
- - dynamodb:Query
817
- - dynamodb:Scan
818
- - dynamodb:UpdateItem
819
- - events:PutEvents
820
- - execute-api:Invoke
821
- - iam:PassRole
822
- - kms:Decrypt
823
- - kms:DescribeKey
824
- - kms:Encrypt
825
- - kms:GenerateDataKey
826
- - lambda:InvokeFunction
827
- - logs:CreateLogGroup
828
- - logs:CreateLogStream
743
+ dynamodb:ConditionCheckItem, dynamodb:DeleteItem, dynamodb:DescribeStream,
744
+ dynamodb:DescribeTable, dynamodb:GetItem, dynamodb:GetRecords,
745
+ dynamodb:GetShardIterator, dynamodb:ListStreams, dynamodb:PutItem,
746
+ dynamodb:Query, dynamodb:Scan, dynamodb:UpdateItem,
747
+ events:PutEvents, execute-api:Invoke, iam:PassRole,
748
+ kms:Decrypt, kms:DescribeKey, kms:Encrypt,
749
+ kms:GenerateDataKey, lambda:InvokeFunction, logs:CreateLogGroup,
750
+ logs:CreateLogStream,
829
751
  # Cognito validates a user-import job's logs role for DescribeLogStreams before it starts the job
830
752
  # (user-service UserImportLogsRole; `saaslayer users import`).
831
- - logs:DescribeLogStreams
832
- - logs:PutLogEvents
833
- - mobiletargeting:PutEvents
834
- - s3:AbortMultipartUpload
835
- - s3:DeleteObject
836
- - s3:GetBucketLocation
837
- - s3:GetObject
838
- - s3:ListBucket
839
- - s3:PutObject
840
- - scheduler:CreateSchedule
841
- - scheduler:DeleteSchedule
842
- - scheduler:GetSchedule
843
- - scheduler:UpdateSchedule
844
- - sns:Publish
845
- - sqs:DeleteMessage
846
- - sqs:GetQueueAttributes
847
- - sqs:GetQueueUrl
848
- - sqs:ReceiveMessage
849
- - sqs:SendMessage
850
- - sqs:SendMessageBatch
753
+ logs:DescribeLogStreams, logs:PutLogEvents, mobiletargeting:PutEvents,
754
+ s3:AbortMultipartUpload, s3:DeleteObject, s3:GetBucketLocation,
755
+ s3:GetObject, s3:ListBucket, s3:PutObject,
756
+ scheduler:CreateSchedule, scheduler:DeleteSchedule, scheduler:GetSchedule,
757
+ scheduler:UpdateSchedule, sns:Publish, sqs:DeleteMessage,
758
+ sqs:GetQueueAttributes, sqs:GetQueueUrl, sqs:ReceiveMessage,
759
+ sqs:SendMessage, sqs:SendMessageBatch,
851
760
  # Social login (epic monorepo-24667): the idpResource custom resource reads the BYO client
852
761
  # secret from an SSM SecureString (/saaslayer/deployment/*); kms:Decrypt above covers the
853
762
  # SecureString's aws/ssm key.
854
- - ssm:GetParameter
763
+ ssm:GetParameter,
855
764
  # ssm SecretDelivery: user-service reads its create-only integration-credential generations by path
856
765
  # (/saaslayer/deployment/<dep>/<inst>/users/integration-credentials); its role scopes the path.
857
- - ssm:GetParametersByPath
766
+ ssm:GetParametersByPath,
858
767
  # ssm SecretDelivery: user-service reads its permissions handoff parameters in one batch call; its role
859
768
  # names the exact parameters.
860
- - ssm:GetParameters
769
+ ssm:GetParameters,
770
+ ]
861
771
  Resource: '*'
862
772
  # PITR check + opt-in on-demand backup for per-service migrate roles (@saaslayer/migrations).
863
773
  # Managed-prefix tables only. The boundary is account-global and the role policies do the
@@ -921,6 +831,20 @@ Resources:
921
831
  PolicyDocument:
922
832
  Version: '2012-10-17'
923
833
  Statement:
834
+ # Read-only WAF preflight/read-back; foreign ACL access fails closed rather than taking ownership.
835
+ - Effect: Allow
836
+ Action:
837
+ - wafv2:GetWebACL
838
+ - wafv2:GetWebACLForResource
839
+ - wafv2:GetLoggingConfiguration
840
+ Resource:
841
+ - !Sub arn:${AWS::Partition}:wafv2:*:${AWS::AccountId}:regional/webacl/${StackNamePrefix}*-waf/*
842
+ # These two APIs do not support resource-level permissions.
843
+ - Effect: Allow
844
+ Action:
845
+ - wafv2:DescribeManagedRuleGroup
846
+ - wafv2:CheckCapacity
847
+ Resource: '*'
924
848
  # Full stack lifecycle (create/update/delete via changesets), restricted to stacks
925
849
  # in the SaaSLayer namespace. Stacks outside ${StackNamePrefix}* are untouchable.
926
850
  - Effect: Allow
@@ -974,6 +898,7 @@ Resources:
974
898
  - AWS::Cognito::UserPoolGroup
975
899
  - AWS::Cognito::IdentityPool
976
900
  - AWS::S3::Bucket
901
+ - AWS::S3::BucketPolicy
977
902
  - AWS::KMS::Key
978
903
  - AWS::SecretsManager::Secret
979
904
  # Actions the API cannot scope to a stack ARN: ValidateTemplate, and the
@@ -1021,6 +946,23 @@ Resources:
1021
946
  # managed prefix — never a bare literal (D8: StackNamePrefix is customer-configurable).
1022
947
  - !Sub arn:aws:s3:::${StackNamePrefix}*
1023
948
  - !Sub arn:aws:s3:::${StackNamePrefix}*/*
949
+ # Readiness and withdrawal inspect only managed distributions. Bucket-policy writes
950
+ # remain CloudFormation-owned; the runner reads the retained policy for verification.
951
+ - Sid: CdnInvalidation
952
+ Effect: Allow
953
+ Action:
954
+ - cloudfront:GetDistribution
955
+ - cloudfront:CreateInvalidation
956
+ - cloudfront:GetInvalidation
957
+ Resource: !Sub arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:distribution/*
958
+ Condition:
959
+ StringEquals:
960
+ aws:ResourceTag/managed-by: saaslayer-deployer
961
+ - Sid: CdnRecoveryPolicyRead
962
+ Effect: Allow
963
+ Action:
964
+ - s3:GetBucketPolicy
965
+ Resource: !Sub arn:${AWS::Partition}:s3:::${StackNamePrefix}*
1024
966
  # Deploy tooling introspection after stack operations complete: stack enumeration
1025
967
  # (ListStacks has no resource scoping) and lambda version/alias inspection. The API Gateway
1026
968
  # calls the Serverless tooling and the domain-service make outside CloudFormation are below.
@@ -1030,6 +972,7 @@ Resources:
1030
972
  - cloudformation:ListStackResources
1031
973
  - lambda:GetAlias
1032
974
  - lambda:GetFunction
975
+ - lambda:GetFunctionCodeSigningConfig
1033
976
  - lambda:GetFunctionConfiguration
1034
977
  - lambda:ListAliases
1035
978
  - lambda:ListTags
@@ -1085,12 +1028,15 @@ Resources:
1085
1028
  - apigateway:DELETE
1086
1029
  - apigateway:PUT
1087
1030
  Resource: !Sub arn:${AWS::Partition}:apigateway:*::/tags/*
1088
- # Env-mode credential hot-swap: revoke/rotate updates a managed function's environment directly
1089
- # (UpdateFunctionConfiguration with RevisionId, read back with GetFunctionConfiguration above) instead
1090
- # of a stack deploy. Managed-prefix functions only.
1091
- - Sid: HotSwapFunctionConfiguration
1031
+ # Direct function updates outside a stack deploy, each with a RevisionId precondition and read back with
1032
+ # GetFunctionConfiguration above: the env-mode credential hot-swap (revoke/rotate rewrites a managed
1033
+ # function's environment) and the code-only update (foundation 8.7.0: a planned function-code change
1034
+ # uploads the sealed artifact; GetFunctionCodeSigningConfig above refuses a signed function before any
1035
+ # write). Managed-prefix functions only.
1036
+ - Sid: DirectFunctionUpdate
1092
1037
  Effect: Allow
1093
1038
  Action:
1039
+ - lambda:UpdateFunctionCode
1094
1040
  - lambda:UpdateFunctionConfiguration
1095
1041
  Resource: !Sub arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackNamePrefix}*
1096
1042
  # Seed re-apply: with SSO on, the user-service seed asks its deployed restApi to re-apply each SSO
@@ -1435,27 +1381,15 @@ Resources:
1435
1381
  # managed-by=saaslayer-deployer via stack tags. Untagged (customer) resources
1436
1382
  # fail the condition and are not readable.
1437
1383
  - Effect: Allow
1438
- Action:
1439
- - apigateway:GET
1440
- - cognito-idp:DescribeUserPool
1441
- - cognito-idp:DescribeUserPoolClient
1442
- - cognito-idp:GetUserPoolMfaConfig
1443
- - dynamodb:DescribeContinuousBackups
1444
- - dynamodb:DescribeTable
1445
- - dynamodb:DescribeTimeToLive
1446
- - dynamodb:ListTagsOfResource
1447
- - events:DescribeEventBus
1448
- - events:ListTagsForResource
1384
+ Action: [
1385
+ apigateway:GET, cognito-idp:DescribeUserPool, cognito-idp:DescribeUserPoolClient, cognito-idp:GetUserPoolMfaConfig,
1386
+ dynamodb:DescribeContinuousBackups, dynamodb:DescribeTable, dynamodb:DescribeTimeToLive, dynamodb:ListTagsOfResource,
1387
+ events:DescribeEventBus, events:ListTagsForResource,
1449
1388
  # No lambda:GetFunction: it returns a presigned code download URL. Configuration reads stay.
1450
- - lambda:GetAlias
1451
- - lambda:GetFunctionConfiguration
1452
- - lambda:GetFunctionEventInvokeConfig
1453
- - lambda:GetPolicy
1454
- - lambda:ListAliases
1455
- - lambda:ListTags
1456
- - lambda:ListVersionsByFunction
1457
- - sqs:GetQueueAttributes
1458
- - sqs:ListQueueTags
1389
+ lambda:GetAlias, lambda:GetFunctionConfiguration, lambda:GetFunctionEventInvokeConfig, lambda:GetPolicy,
1390
+ lambda:ListAliases, lambda:ListTags, lambda:ListVersionsByFunction, sqs:GetQueueAttributes,
1391
+ sqs:ListQueueTags
1392
+ ]
1459
1393
  Resource: '*'
1460
1394
  Condition:
1461
1395
  StringEquals:
@@ -1548,22 +1482,22 @@ Resources:
1548
1482
 
1549
1483
  Outputs:
1550
1484
  DeploymentRoleArn:
1551
- Description: Cross-account deployment role the managing SaaSLayer control planes assume (trust identifier required).
1485
+ Description: Deployment role the managing control planes assume (trust identifier required).
1552
1486
  Value: !GetAtt SaaSLayerDeploymentRole.Arn
1553
1487
  SupportReadOnlyRoleArn:
1554
- Description: Cross-account read-only role SaaSLayer support staff assume for diagnostics (trust identifier required).
1488
+ Description: Read-only role SaaSLayer support assumes (trust identifier required).
1555
1489
  Value: !GetAtt SaaSLayerSupportReadOnlyRole.Arn
1556
1490
  CloudFormationExecutionRoleArn:
1557
- Description: Service role CloudFormation uses to provision approved SaaSLayer module stacks; not assumable cross-account.
1491
+ Description: Service role CloudFormation uses for SaaSLayer module stacks.
1558
1492
  Value: !GetAtt SaaSLayerCloudFormationExecutionRole.Arn
1559
1493
  ManagedResourceBoundaryArn:
1560
- Description: Permissions boundary capping the runtime permissions of every IAM role created by SaaSLayer module stacks.
1494
+ Description: Boundary of every IAM role SaaSLayer module stacks create.
1561
1495
  Value: !Ref SaaSLayerManagedResourceBoundary
1562
1496
  FoundationVersion:
1563
- Description: Version of this foundation template installed in the account.
1497
+ Description: Installed foundation version.
1564
1498
  Value: !FindInMap [Meta, Foundation, Version]
1565
1499
  SaaSLayerAccountRef:
1566
- Description: Share this with SaaSLayer support to identify your account and foundation version.
1500
+ Description: Share with SaaSLayer support to identify this account.
1567
1501
  Value: !Sub
1568
1502
  - 'org=${OrgId} account=${AWS::AccountId} region=${AWS::Region} prefix=${StackNamePrefix} v=${Ver}'
1569
1503
  - Ver: !FindInMap [Meta, Foundation, Version]