@continuous-excellence/ze-great-dashboard-aws 0.1.30 → 0.1.32

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.
@@ -10,6 +10,8 @@
10
10
  "stackName": "team-dashboard-github-bootstrap",
11
11
  "providerArn": "arn:aws:iam::123456789012:oidc-provider/token.actions.githubusercontent.com",
12
12
  "repository": "example/team-dashboard",
13
+ "ownerId": "12345678",
14
+ "repositoryId": "123456789",
13
15
  "environment": "production"
14
16
  }
15
17
  }
@@ -1,5 +1,5 @@
1
1
  AWSTemplateFormatVersion: '2010-09-09'
2
- Description: Ze Great Dashboard GitHub OIDC adapter v1. Administrator-managed; requires a central OIDC provider.
2
+ Description: Ze Great Dashboard GitHub OIDC adapter v1. Superseded by github-oidc-v2.yml; retained for explicit migration review.
3
3
 
4
4
  Parameters:
5
5
  GitHubOidcProviderArn: { Type: String }
@@ -0,0 +1,60 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Description: Ze Great Dashboard GitHub OIDC adapter v2. Administrator-managed; requires a central OIDC provider.
3
+
4
+ Parameters:
5
+ GitHubOidcProviderArn: { Type: String }
6
+ GitHubRepository: { Type: String, Description: owner/repository }
7
+ GitHubOwnerId: { Type: String, Description: Immutable numeric GitHub owner id }
8
+ GitHubRepositoryId: { Type: String, Description: Immutable numeric GitHub repository id }
9
+ GitHubEnvironment: { Type: String, Description: Protected GitHub Environment name }
10
+ ApplicationStackName: { Type: String }
11
+ ArtifactBucketName: { Type: String }
12
+ CloudFormationExecutionRoleArn: { Type: String }
13
+
14
+ Resources:
15
+ GitHubDeployRole:
16
+ Type: AWS::IAM::Role
17
+ DeletionPolicy: Retain
18
+ UpdateReplacePolicy: Retain
19
+ Properties:
20
+ RoleName: !Sub '${ApplicationStackName}-github-deploy'
21
+ MaxSessionDuration: 3600
22
+ AssumeRolePolicyDocument:
23
+ Version: '2012-10-17'
24
+ Statement:
25
+ - Effect: Allow
26
+ Principal: { Federated: !Ref GitHubOidcProviderArn }
27
+ Action: sts:AssumeRoleWithWebIdentity
28
+ Condition:
29
+ StringEquals:
30
+ 'token.actions.githubusercontent.com:aud': sts.amazonaws.com
31
+ 'token.actions.githubusercontent.com:sub': !Sub
32
+ - 'repo:${Owner}@${GitHubOwnerId}/${Repository}@${GitHubRepositoryId}:environment:${GitHubEnvironment}'
33
+ - Owner: !Select [0, !Split ['/', !Ref GitHubRepository]]
34
+ Repository: !Select [1, !Split ['/', !Ref GitHubRepository]]
35
+ Policies:
36
+ - PolicyName: DeployOneDashboard
37
+ PolicyDocument:
38
+ Version: '2012-10-17'
39
+ Statement:
40
+ - Sid: UploadLambdaArtifacts
41
+ Effect: Allow
42
+ Action: [s3:PutObject, s3:GetObject]
43
+ Resource: !Sub 'arn:${AWS::Partition}:s3:::${ArtifactBucketName}/lambda/*'
44
+ - Sid: InspectArtifactBucket
45
+ Effect: Allow
46
+ Action: [s3:GetBucketLocation, s3:ListBucket]
47
+ Resource: !Sub 'arn:${AWS::Partition}:s3:::${ArtifactBucketName}'
48
+ - Sid: OperateOneApplicationStack
49
+ Effect: Allow
50
+ Action: [cloudformation:CreateChangeSet, cloudformation:DescribeChangeSet, cloudformation:ExecuteChangeSet, cloudformation:DeleteChangeSet, cloudformation:DescribeStacks, cloudformation:DescribeStackEvents, cloudformation:GetTemplate, cloudformation:GetTemplateSummary]
51
+ Resource: !Sub 'arn:${AWS::Partition}:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${ApplicationStackName}/*'
52
+ - Sid: PassCoreExecutionRole
53
+ Effect: Allow
54
+ Action: iam:PassRole
55
+ Resource: !Ref CloudFormationExecutionRoleArn
56
+ Condition: { StringEquals: { 'iam:PassedToService': cloudformation.amazonaws.com } }
57
+
58
+ Outputs:
59
+ BootstrapContractVersion: { Value: '2' }
60
+ GitHubDeployRoleArn: { Value: !GetAtt GitHubDeployRole.Arn }
@@ -25,6 +25,8 @@ export type BootstrapConfig = {
25
25
  stackName?: string;
26
26
  providerArn?: string;
27
27
  repository?: string;
28
+ ownerId?: string;
29
+ repositoryId?: string;
28
30
  environment?: string;
29
31
  };
30
32
  };
package/dist/cli.js CHANGED
@@ -843,7 +843,7 @@ import { readFile as readFile2 } from "node:fs/promises";
843
843
  import { fileURLToPath } from "node:url";
844
844
  var templates = {
845
845
  core: "../bootstrap/core-v1.yml",
846
- "github-oidc": "../bootstrap/github-oidc-v1.yml"
846
+ "github-oidc": "../bootstrap/github-oidc-v2.yml"
847
847
  };
848
848
  async function bootstrapTemplatePath(kind) {
849
849
  if (!Object.hasOwn(templates, kind)) throw new Error(`Unknown bootstrap template: ${kind}`);
@@ -901,6 +901,8 @@ function requiredBootstrapParameters(kind, values) {
901
901
  const keys = kind === "core" ? ["ArtifactBucketName", "ApplicationStackName", "DashboardFunctionName"] : [
902
902
  "GitHubOidcProviderArn",
903
903
  "GitHubRepository",
904
+ "GitHubOwnerId",
905
+ "GitHubRepositoryId",
904
906
  "GitHubEnvironment",
905
907
  "ApplicationStackName",
906
908
  "ArtifactBucketName",
@@ -1254,6 +1256,8 @@ function bootstrapValues(config, coreOutputs = {}) {
1254
1256
  ArtifactKmsKeyArn: option("--artifact-kms-key-arn", config.core?.artifactKmsKeyArn),
1255
1257
  GitHubOidcProviderArn: option("--github-oidc-provider-arn", config.githubOidc?.providerArn),
1256
1258
  GitHubRepository: option("--github-repository", config.githubOidc?.repository),
1259
+ GitHubOwnerId: option("--github-owner-id", config.githubOidc?.ownerId),
1260
+ GitHubRepositoryId: option("--github-repository-id", config.githubOidc?.repositoryId),
1257
1261
  GitHubEnvironment: option("--github-environment", config.githubOidc?.environment),
1258
1262
  CloudFormationExecutionRoleArn: option(
1259
1263
  "--execution-role-arn",
package/dist/index.js CHANGED
@@ -830,7 +830,7 @@ import { readFile as readFile2 } from "node:fs/promises";
830
830
  import { fileURLToPath } from "node:url";
831
831
  var templates = {
832
832
  core: "../bootstrap/core-v1.yml",
833
- "github-oidc": "../bootstrap/github-oidc-v1.yml"
833
+ "github-oidc": "../bootstrap/github-oidc-v2.yml"
834
834
  };
835
835
  async function bootstrapTemplatePath(kind) {
836
836
  if (!Object.hasOwn(templates, kind)) throw new Error(`Unknown bootstrap template: ${kind}`);
@@ -888,6 +888,8 @@ function requiredBootstrapParameters(kind, values) {
888
888
  const keys = kind === "core" ? ["ArtifactBucketName", "ApplicationStackName", "DashboardFunctionName"] : [
889
889
  "GitHubOidcProviderArn",
890
890
  "GitHubRepository",
891
+ "GitHubOwnerId",
892
+ "GitHubRepositoryId",
891
893
  "GitHubEnvironment",
892
894
  "ApplicationStackName",
893
895
  "ArtifactBucketName",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@continuous-excellence/ze-great-dashboard-aws",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "type": "module",
5
5
  "description": "AWS Lambda and CloudFormation adapter for Ze Great Dashboard.",
6
6
  "keywords": [