saaslayer 0.4.0 → 0.4.2
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/README.md +94 -2
- package/bin/saaslayer.js +110 -13
- package/package.json +2 -2
- package/src/api-client.js +3 -2
- package/src/commands/deploy.js +16 -1
- package/src/commands/foundation.js +5 -3
- package/src/commands/hooks.js +4 -9
- package/src/commands/release-manifest.js +3 -1
- package/src/commands/settings.js +2 -0
- package/src/commands/sms.js +35 -4
- package/src/commands/sso.js +913 -0
- package/src/commands/users.js +7 -3
- package/src/commands/verifier-keys.js +105 -0
- package/src/deployments.js +13 -1
- package/src/login-domain.js +1 -1
- package/src/release-manifest.js +30 -7
- package/src/secret-sink.js +77 -0
- package/src/sms/registration-fields.js +1 -1
- package/src/sso-plan.js +21 -0
- package/src/user-service-instance.js +30 -1
- package/src/users-api.js +3 -2
- package/templates/bootstrap/saaslayer-bootstrap-permission-set-inline-policy.json +148 -0
- package/templates/bootstrap/saaslayer-bootstrap-policy-email-sender.json +22 -0
- package/templates/bootstrap/saaslayer-bootstrap-policy-sms-number.json +22 -0
- package/templates/bootstrap/saaslayer-bootstrap-policy.json +114 -0
- package/templates/bootstrap/saaslayer-bootstrap-trust-policy.json +18 -0
- package/templates/saaslayer-foundation-region.yml +10 -2
- package/templates/saaslayer-foundation.yml +53 -26
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Version": "2012-10-17",
|
|
3
|
+
"Statement": [
|
|
4
|
+
{
|
|
5
|
+
"Sid": "FoundationStacks",
|
|
6
|
+
"Effect": "Allow",
|
|
7
|
+
"Action": [
|
|
8
|
+
"cloudformation:CreateStack",
|
|
9
|
+
"cloudformation:DeleteStack",
|
|
10
|
+
"cloudformation:DescribeStacks",
|
|
11
|
+
"cloudformation:DescribeStackEvents",
|
|
12
|
+
"cloudformation:GetTemplate",
|
|
13
|
+
"cloudformation:CreateChangeSet",
|
|
14
|
+
"cloudformation:DescribeChangeSet",
|
|
15
|
+
"cloudformation:ExecuteChangeSet",
|
|
16
|
+
"cloudformation:DeleteChangeSet",
|
|
17
|
+
"cloudformation:ContinueUpdateRollback"
|
|
18
|
+
],
|
|
19
|
+
"Resource": [
|
|
20
|
+
"arn:aws:cloudformation:*:*:stack/saaslayer-foundation*/*",
|
|
21
|
+
"arn:aws:cloudformation:*:*:changeSet/saaslayer-*/*"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"Sid": "FindStacks",
|
|
26
|
+
"Effect": "Allow",
|
|
27
|
+
"Action": [
|
|
28
|
+
"cloudformation:ListStacks",
|
|
29
|
+
"cloudformation:DescribeStackResources"
|
|
30
|
+
],
|
|
31
|
+
"Resource": "*"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"Sid": "FoundationRoles",
|
|
35
|
+
"Effect": "Allow",
|
|
36
|
+
"Action": [
|
|
37
|
+
"iam:CreateRole",
|
|
38
|
+
"iam:DeleteRole",
|
|
39
|
+
"iam:GetRole",
|
|
40
|
+
"iam:UpdateRole",
|
|
41
|
+
"iam:UpdateRoleDescription",
|
|
42
|
+
"iam:UpdateAssumeRolePolicy",
|
|
43
|
+
"iam:PutRolePolicy",
|
|
44
|
+
"iam:GetRolePolicy",
|
|
45
|
+
"iam:DeleteRolePolicy",
|
|
46
|
+
"iam:ListRolePolicies",
|
|
47
|
+
"iam:AttachRolePolicy",
|
|
48
|
+
"iam:DetachRolePolicy",
|
|
49
|
+
"iam:ListAttachedRolePolicies",
|
|
50
|
+
"iam:PutRolePermissionsBoundary",
|
|
51
|
+
"iam:DeleteRolePermissionsBoundary",
|
|
52
|
+
"iam:TagRole",
|
|
53
|
+
"iam:UntagRole",
|
|
54
|
+
"iam:ListRoleTags"
|
|
55
|
+
],
|
|
56
|
+
"Resource": "arn:aws:iam::*:role/sl-foundation-*"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"Sid": "FoundationManagedPolicies",
|
|
60
|
+
"Effect": "Allow",
|
|
61
|
+
"Action": [
|
|
62
|
+
"iam:CreatePolicy",
|
|
63
|
+
"iam:DeletePolicy",
|
|
64
|
+
"iam:GetPolicy",
|
|
65
|
+
"iam:GetPolicyVersion",
|
|
66
|
+
"iam:ListPolicyVersions",
|
|
67
|
+
"iam:CreatePolicyVersion",
|
|
68
|
+
"iam:DeletePolicyVersion",
|
|
69
|
+
"iam:ListEntitiesForPolicy"
|
|
70
|
+
],
|
|
71
|
+
"Resource": "arn:aws:iam::*:policy/sl-foundation-*"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"Sid": "FoundationParameter",
|
|
75
|
+
"Effect": "Allow",
|
|
76
|
+
"Action": [
|
|
77
|
+
"ssm:GetParameter",
|
|
78
|
+
"ssm:GetParameters",
|
|
79
|
+
"ssm:PutParameter",
|
|
80
|
+
"ssm:DeleteParameter",
|
|
81
|
+
"ssm:AddTagsToResource",
|
|
82
|
+
"ssm:RemoveTagsFromResource",
|
|
83
|
+
"ssm:ListTagsForResource"
|
|
84
|
+
],
|
|
85
|
+
"Resource": "arn:aws:ssm:*:*:parameter/saaslayer/foundation/*"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"Sid": "ArtifactBuckets",
|
|
89
|
+
"Effect": "Allow",
|
|
90
|
+
"Action": [
|
|
91
|
+
"s3:CreateBucket",
|
|
92
|
+
"s3:DeleteBucket*",
|
|
93
|
+
"s3:Get*",
|
|
94
|
+
"s3:List*",
|
|
95
|
+
"s3:Put*",
|
|
96
|
+
"s3:TagResource",
|
|
97
|
+
"s3:UntagResource"
|
|
98
|
+
],
|
|
99
|
+
"Resource": "arn:aws:s3:::sl-artifacts-*"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"Sid": "ArtifactBucketObjects",
|
|
103
|
+
"Effect": "Allow",
|
|
104
|
+
"Action": [
|
|
105
|
+
"s3:DeleteObject",
|
|
106
|
+
"s3:PutObjectAcl"
|
|
107
|
+
],
|
|
108
|
+
"Resource": [
|
|
109
|
+
"arn:aws:s3:::sl-artifacts-*",
|
|
110
|
+
"arn:aws:s3:::sl-artifacts-*/*"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Version": "2012-10-17",
|
|
3
|
+
"Statement": [
|
|
4
|
+
{
|
|
5
|
+
"Sid": "AdministratorsOfThisAccountWithMfa",
|
|
6
|
+
"Effect": "Allow",
|
|
7
|
+
"Principal": {
|
|
8
|
+
"AWS": "arn:aws:iam::YOUR_AWS_ACCOUNT_ID:root"
|
|
9
|
+
},
|
|
10
|
+
"Action": "sts:AssumeRole",
|
|
11
|
+
"Condition": {
|
|
12
|
+
"Bool": {
|
|
13
|
+
"aws:MultiFactorAuthPresent": "true"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -61,6 +61,14 @@ Parameters:
|
|
|
61
61
|
The account's SMS sending number in this region: none, a toll-free number (sends once its registration is
|
|
62
62
|
approved), or a simulator number (dev only; delivers to AWS simulator destinations). Set by saaslayer sms setup and
|
|
63
63
|
moved back to none only by saaslayer sms release.
|
|
64
|
+
SmsHelpMessage:
|
|
65
|
+
Type: String
|
|
66
|
+
MinLength: 1
|
|
67
|
+
MaxLength: 160
|
|
68
|
+
Default: 'Account verification and sign-in codes. Msg and data rates may apply. Reply STOP to opt out.'
|
|
69
|
+
Description: >-
|
|
70
|
+
The number's automatic reply when someone texts HELP (carriers expect the sender's name, a contact and how to opt
|
|
71
|
+
out, in one SMS). Set by saaslayer sms setup --help-message; the default is the generic reply.
|
|
64
72
|
|
|
65
73
|
Conditions:
|
|
66
74
|
HasEmailSenderDomain: !Not [!Equals [!Ref EmailSenderDomain, '']]
|
|
@@ -73,7 +81,7 @@ Mappings:
|
|
|
73
81
|
# saaslayer-foundation: major = breaking change (resource replaced/removed), minor = additive, patch = docs.
|
|
74
82
|
Meta:
|
|
75
83
|
FoundationRegion:
|
|
76
|
-
Version: '1.
|
|
84
|
+
Version: '1.3.0'
|
|
77
85
|
|
|
78
86
|
Resources:
|
|
79
87
|
# Shared deployment-artifact bucket. Serverless namespaces every deploy under
|
|
@@ -156,7 +164,7 @@ Resources:
|
|
|
156
164
|
NumberCapabilities: [SMS]
|
|
157
165
|
MandatoryKeywords:
|
|
158
166
|
HELP:
|
|
159
|
-
Message:
|
|
167
|
+
Message: !Ref SmsHelpMessage
|
|
160
168
|
STOP:
|
|
161
169
|
Message: 'You are unsubscribed and will receive no further messages from this number.'
|
|
162
170
|
# The account's default sender; named senders, if any are added, carry their own saaslayer:sender value.
|
|
@@ -86,52 +86,38 @@ Parameters:
|
|
|
86
86
|
Type: String
|
|
87
87
|
AllowedPattern: '^[0-9]{12}$'
|
|
88
88
|
Description: >-
|
|
89
|
-
AWS account ID
|
|
90
|
-
is rendered from TrustEntries, which names each managing control plane's own account.
|
|
89
|
+
Initial control-plane AWS account ID (informational). TrustEntries determines each control plane's trust.
|
|
91
90
|
TrustEntries:
|
|
92
91
|
Type: String
|
|
93
92
|
MaxLength: 4096
|
|
94
93
|
Description: >-
|
|
95
|
-
JSON
|
|
96
|
-
principalAccountId, trustIdentifiers, deployCallerArns, supportCallerArns. The SaaSLayer CLI renders
|
|
97
|
-
the entry roles' trust statements from it. Trust identifiers are AWS ExternalIds, not secrets.
|
|
94
|
+
JSON v1 entries: controlPlaneId, principalAccountId, trustIdentifiers, deployCallerArns, supportCallerArns. The CLI renders trust; identifiers are ExternalIds, not secrets.
|
|
98
95
|
ConnectionAuthorizerArns:
|
|
99
96
|
Type: CommaDelimitedList
|
|
100
97
|
Description: >-
|
|
101
|
-
IAM principal ARNs
|
|
102
|
-
account. Defaults to the principal that first deploys this stack; changed only by an explicit
|
|
103
|
-
authorizer update.
|
|
98
|
+
Path-less IAM principal ARNs allowed to authorize org connections. Defaults to the installer; changes require an explicit authorizer update.
|
|
104
99
|
StackNamePrefix:
|
|
105
100
|
Type: String
|
|
106
101
|
Default: sl-
|
|
107
102
|
Description: >-
|
|
108
|
-
|
|
109
|
-
stacks whose names start with this prefix.
|
|
103
|
+
The deployment role manages only CloudFormation stacks starting with this prefix.
|
|
110
104
|
OrgId:
|
|
111
105
|
Type: String
|
|
112
106
|
Default: ''
|
|
113
107
|
Description: >-
|
|
114
|
-
SaaSLayer org
|
|
115
|
-
trust decision. Surfaced in Outputs so support can identify the account from the stack alone.
|
|
108
|
+
Connected SaaSLayer org (informational output only; never used for authorization).
|
|
116
109
|
EnableEmailInbound:
|
|
117
110
|
Type: String
|
|
118
111
|
AllowedValues: ['true', 'false']
|
|
119
112
|
Default: 'false'
|
|
120
113
|
Description: >-
|
|
121
|
-
|
|
122
|
-
email-inbound-service needs. Default 'false' so host accounts that do NOT run email-inbound are
|
|
123
|
-
not over-permissioned for SES. Set per host via `cplane accounts enable-capability <host> ses`.
|
|
114
|
+
Inbound SES permissions for email-inbound-service. Enable only on inbound-mail hosts: cplane accounts enable-capability <host> ses.
|
|
124
115
|
EnableTenantEdge:
|
|
125
116
|
Type: String
|
|
126
117
|
AllowedValues: ['true', 'false']
|
|
127
118
|
Default: 'false'
|
|
128
119
|
Description: >-
|
|
129
|
-
|
|
130
|
-
single-tenant edge (epic f55t, Model B) provisions in this account. Default 'false' so host
|
|
131
|
-
accounts that route through the shared edge are not granted CloudFront write. Set per host via
|
|
132
|
-
`cplane accounts enable-capability <host> tenant-edge`.
|
|
133
|
-
WARNING (rollout order): a host ALREADY running the native edge must have this enabled BEFORE
|
|
134
|
-
its foundation is redeployed at >= 1.1.0, or the redeploy strips the perms its live edge needs.
|
|
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.
|
|
135
121
|
|
|
136
122
|
Conditions:
|
|
137
123
|
# Capability gates. Each maps 1:1 to an entry in @saaslayer/foundation-contract (packages/
|
|
@@ -150,7 +136,7 @@ Mappings:
|
|
|
150
136
|
# patch = comments/docs/no behavior change
|
|
151
137
|
Meta:
|
|
152
138
|
Foundation:
|
|
153
|
-
Version: '8.
|
|
139
|
+
Version: '8.4.0'
|
|
154
140
|
|
|
155
141
|
Resources:
|
|
156
142
|
# The shared deployment-artifact bucket moved OUT of this account-global stack into the per-region
|
|
@@ -354,6 +340,17 @@ Resources:
|
|
|
354
340
|
Condition:
|
|
355
341
|
StringEquals:
|
|
356
342
|
aws:ResourceTag/managed-by: saaslayer-deployer
|
|
343
|
+
# Custom login domain (user-service UserPoolCustomDomain): Cognito serves it from a CloudFront distribution
|
|
344
|
+
# AWS owns and does not tag, and refuses CreateUserPoolDomain unless the caller may UpdateDistribution on '*'.
|
|
345
|
+
# CalledVia keeps the grant to requests Cognito makes for this role.
|
|
346
|
+
- Effect: Allow
|
|
347
|
+
Action:
|
|
348
|
+
- cloudfront:UpdateDistribution
|
|
349
|
+
Resource: '*'
|
|
350
|
+
Condition:
|
|
351
|
+
ForAnyValue:StringEquals:
|
|
352
|
+
aws:CalledVia:
|
|
353
|
+
- cognito-idp.amazonaws.com
|
|
357
354
|
# managed-by unlocks the deploy role's tag-scoped pool actions, so it can never be added to a pool
|
|
358
355
|
# that does not already carry it (e.g. a customer pool brought in by an import).
|
|
359
356
|
- Effect: Deny
|
|
@@ -402,6 +399,16 @@ Resources:
|
|
|
402
399
|
Condition:
|
|
403
400
|
StringEquals:
|
|
404
401
|
aws:RequestTag/managed-by: saaslayer-deployer
|
|
402
|
+
# GlobalTable's provider reads the AWS-managed DynamoDB key when SSEEnabled is true without a CMK.
|
|
403
|
+
# AWS-managed keys cannot carry our resource tag; allow metadata only, for this service alias only.
|
|
404
|
+
- Effect: Allow
|
|
405
|
+
Action:
|
|
406
|
+
- kms:DescribeKey
|
|
407
|
+
Resource: !Sub arn:${AWS::Partition}:kms:*:${AWS::AccountId}:key/*
|
|
408
|
+
Condition:
|
|
409
|
+
ForAnyValue:StringEquals:
|
|
410
|
+
kms:ResourceAliases:
|
|
411
|
+
- alias/aws/dynamodb
|
|
405
412
|
# Grant + data-plane actions: a resource encrypted with a customer CMK (email-inbound's
|
|
406
413
|
# InboundTable via DynamoDB SSE-KMS) makes the service create a grant AND
|
|
407
414
|
# decrypt/generate data keys against the CMK during provisioning — without these the
|
|
@@ -781,12 +788,19 @@ Resources:
|
|
|
781
788
|
# Lambda manages the federated IdPs; the PreSignUp/stitching + account Lambdas link/disable
|
|
782
789
|
# providers, set passwords, and delete users. The boundary is the ceiling, so it must allow
|
|
783
790
|
# every action the managed roles use (their inline policies scope the resources).
|
|
784
|
-
|
|
785
|
-
-
|
|
786
|
-
|
|
791
|
+
# Create/Delete/Describe/UpdateIdentityProvider, as one pattern (the template is at CloudFormation's
|
|
792
|
+
# inline size limit). Enterprise SSO (user-service EnableSso, foundation 8.4.0) also manages each
|
|
793
|
+
# connection's dedicated app client (Create/Delete/Describe/UpdateUserPoolClient) and lists both for
|
|
794
|
+
# reconciliation, on the instance's own pool (its role names that pool). Also each SSO client's
|
|
795
|
+
# 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
|
|
787
802
|
- cognito-idp:GetUserPoolMfaConfig
|
|
788
803
|
- cognito-idp:ListUsers
|
|
789
|
-
- cognito-idp:UpdateIdentityProvider
|
|
790
804
|
- dynamodb:BatchGetItem
|
|
791
805
|
- dynamodb:BatchWriteItem
|
|
792
806
|
# TransactWriteItems ConditionCheck items (permissions-service audit writes check erasure markers).
|
|
@@ -921,6 +935,9 @@ Resources:
|
|
|
921
935
|
- cloudformation:UpdateTerminationProtection
|
|
922
936
|
- cloudformation:DeleteChangeSet
|
|
923
937
|
- cloudformation:DeleteStack
|
|
938
|
+
# A module stack left in UPDATE_ROLLBACK_FAILED: the deployer continues its rollback (never skipping
|
|
939
|
+
# a resource), so the stack accepts updates again (8.4.0).
|
|
940
|
+
- cloudformation:ContinueUpdateRollback
|
|
924
941
|
- cloudformation:Describe*
|
|
925
942
|
- cloudformation:Get*
|
|
926
943
|
# Drift gate (update runs refuse to apply over out-of-band edits):
|
|
@@ -951,6 +968,7 @@ Resources:
|
|
|
951
968
|
ForAnyValue:StringNotEquals:
|
|
952
969
|
cloudformation:ImportResourceTypes:
|
|
953
970
|
- AWS::DynamoDB::Table
|
|
971
|
+
- AWS::DynamoDB::GlobalTable
|
|
954
972
|
- AWS::Cognito::UserPool
|
|
955
973
|
- AWS::Cognito::UserPoolClient
|
|
956
974
|
- AWS::Cognito::UserPoolGroup
|
|
@@ -1075,6 +1093,13 @@ Resources:
|
|
|
1075
1093
|
Action:
|
|
1076
1094
|
- lambda:UpdateFunctionConfiguration
|
|
1077
1095
|
Resource: !Sub arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackNamePrefix}*
|
|
1096
|
+
# Seed re-apply: with SSO on, the user-service seed asks its deployed restApi to re-apply each SSO
|
|
1097
|
+
# connection's Cognito runtime (a direct invocation). Managed-prefix restApi functions only.
|
|
1098
|
+
- Sid: SeedInvokeRestApi
|
|
1099
|
+
Effect: Allow
|
|
1100
|
+
Action:
|
|
1101
|
+
- lambda:InvokeFunction
|
|
1102
|
+
Resource: !Sub arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackNamePrefix}*-restApi
|
|
1078
1103
|
# Post-deploy SEED data-plane: after a module deploys, the deployer runs its seed
|
|
1079
1104
|
# script under this role to make the deployment usable — bootstrap the tenant, the
|
|
1080
1105
|
# designated first admin's deployment-administrator binding (and an explicit recovery's
|
|
@@ -1106,6 +1131,8 @@ Resources:
|
|
|
1106
1131
|
- dynamodb:DeleteItem
|
|
1107
1132
|
- dynamodb:Query
|
|
1108
1133
|
- dynamodb:BatchWriteItem
|
|
1134
|
+
# Audit transactions (permissions seed) carry ConditionCheck items on erasure markers.
|
|
1135
|
+
- dynamodb:ConditionCheckItem
|
|
1109
1136
|
# Teardown cleanup: a table with DeletionPolicy:Retain survives `serverless remove`, so the
|
|
1110
1137
|
# deployer's module-runner deletes those retained sl-* tables directly after the stack is gone
|
|
1111
1138
|
# (deleteStackOwnedTables) — else a same-named recreate collides. Scoped to sl-* tables only.
|