Skip to content

Commit 4dcf918

Browse files
authored
Merge branch 'main' into 4130-graphql-error-registry
2 parents dd69bfb + 801333d commit 4dcf918

File tree

119 files changed

+3573
-1853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3573
-1853
lines changed

.github/scripts/update_layer_arn.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# see .github/workflows/publish_layer.yml
99

1010

11-
# Get the new version number from the first command-line argument
11+
# Get the new layer version from the first command-line argument
1212
new_version=$1
1313
if [ -z "$new_version" ]; then
1414
echo "Usage: $0 <new_version>"

.github/workflows/bootstrap_region.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,6 @@ jobs:
9999
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@29979bc5339bf54f76a11ac36ff67701986bb0f0
100100
- id: run-balance
101101
name: Run Balance
102-
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
102+
env:
103+
BALANCE_ROLE_ARN: ${{ secrets.BALANCE_ROLE_ARN }}
104+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role $BALANCE_ROLE_ARN -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: 'Checkout Repository'
2020
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2121
- name: 'Dependency Review'
22-
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
22+
uses: actions/dependency-review-action@bc41886e18ea39df68b1b1245f4184881938e050 # v4.7.2

.github/workflows/dispatch_analytics.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/layer_balance.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
contents: read
4141
id-token: write
4242
environment: layer-${{ inputs.environment }}
43+
env:
44+
BALANCE_ROLE_ARN: ${{ secrets.BALANCE_ROLE_ARN }}
4345
steps:
4446
- id: credentials
4547
name: AWS Credentials
@@ -62,8 +64,8 @@ jobs:
6264
- id: run-balance-new-region
6365
name: Run Balance
6466
if: ${{ inputs.start_at == '' }}
65-
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
67+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role $BALANCE_ROLE_ARN -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
6668
- id: run-balance-existing
6769
name: Run Balance (Existing Region)
6870
if: ${{ inputs.start_at != '' }}
69-
run: balance -read-region us-east-1 -start-at ${{ inputs.start_at }} -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
71+
run: balance -read-region us-east-1 -start-at ${{ inputs.start_at }} -write-region ${{ inputs.region }} -write-role $BALANCE_ROLE_ARN -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false

.github/workflows/layers_partition_verify.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Partition Layer Verification
22
# ---
33
# This workflow queries the Partition layer info in production only
4+
#
5+
# CodeQL Security Note:
6+
# This workflow uses dynamic secret access via secrets[format(...)] which triggers
7+
# an "Excessive Secrets Exposure" alert. However, this is safe because:
8+
# - Secrets are scoped per environment (China/GovCloud Gamma/Prod)
9+
# - Each job only accesses secrets for its specific partition and region
10+
# - No global secrets array containing mixed credentials (API keys, PEM files, etc.)
11+
# - The secrets object is already minimally scoped to the environment being used
412

513
on:
614
workflow_dispatch:
@@ -102,7 +110,7 @@ jobs:
102110
permissions:
103111
id-token: write
104112
contents: read
105-
# Environment should interperlate as "GovCloud Prod" or "China Beta"
113+
# Environment should interpolate as "GovCloud Prod" or "China Beta"
106114
environment: ${{ inputs.partition }} ${{ inputs.environment }}
107115
strategy:
108116
matrix:
@@ -118,6 +126,7 @@ jobs:
118126
- name: Configure AWS Credentials
119127
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
120128
with:
129+
# Dynamic secret access is safe here - secrets are scoped per environment
121130
role-to-assume: ${{ secrets[format('IAM_ROLE_{0}', steps.transform.outputs.CONVERTED_REGION)] }}
122131
aws-region: ${{ matrix.region}}
123132
mask-aws-account-id: true
@@ -129,6 +138,7 @@ jobs:
129138
- name: Verify Layer
130139
run: |
131140
export layer_output='AWSLambdaPowertoolsTypeScriptV2-${{matrix.region}}.json'
141+
# Dynamic secret access is safe here - secrets are scoped per environment
132142
aws --region ${{ matrix.region}} lambda get-layer-version-by-arn --arn "arn:${{ needs.setup.outputs.partition }}:lambda:${{ matrix.region}}:${{ secrets[format('AWS_ACCOUNT_{0}', steps.transform.outputs.CONVERTED_REGION)] }}:layer:AWSLambdaPowertoolsTypeScriptV2:${{ steps.partition_version.outputs.partition_version }}" > $layer_output
133143
REMOTE_SHA=$(jq -r '.Content.CodeSha256' $layer_output)
134144
LOCAL_SHA=$(jq -r '.Content.CodeSha256' AWSLambdaPowertoolsTypeScriptV2.json)

.github/workflows/layers_partitions.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
# 1. After the `make-release` workflow finishes and the PR for the documentation update gets created, trigger this workflow manually via `workflow_dispatch` with environment, version, and partition inputs for each Gamma and Prod environment in the China and GovCloud partitions
1616
# 2. Monitor deployment progress and verify successful layer publication across all target regions
1717
# 3. Once this workflow is completed, the PR for the documentation update can me merged
18+
#
19+
# CodeQL Security Note:
20+
# This workflow uses dynamic secret access via secrets[format(...)] which triggers
21+
# an "Excessive Secrets Exposure" alert. However, this is safe because:
22+
# - Secrets are scoped per environment (China/GovCloud Gamma/Prod)
23+
# - Each job only accesses secrets for its specific partition and region
24+
# - No global secrets array containing mixed credentials (API keys, PEM files, etc.)
25+
# - The secrets object is already minimally scoped to the environment being used
1826

1927
on:
2028
workflow_dispatch:
@@ -142,6 +150,7 @@ jobs:
142150
- name: Configure AWS Credentials
143151
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
144152
with:
153+
# Dynamic secret access is safe here - secrets are scoped per environment
145154
role-to-assume: ${{ secrets[format('IAM_ROLE_{0}', steps.transform.outputs.CONVERTED_REGION)] }}
146155
aws-region: ${{ matrix.region}}
147156
mask-aws-account-id: true
@@ -175,16 +184,19 @@ jobs:
175184
LAYER_VERSION: ${{ steps.create-layer.outputs.LAYER_VERSION }}
176185
run: |
177186
export layer_output='AWSLambdaPowertoolsTypeScriptV2-${{matrix.region}}.json'
187+
# Dynamic secret access is safe here - secrets are scoped per environment
178188
aws --region ${{ matrix.region}} lambda get-layer-version-by-arn --arn 'arn:${{ needs.setup.outputs.partition }}:lambda:${{ matrix.region}}:${{ secrets[format('AWS_ACCOUNT_{0}', steps.transform.outputs.CONVERTED_REGION)] }}:layer:AWSLambdaPowertoolsTypeScriptV2:${{ env.LAYER_VERSION }}' > $layer_output
179189
REMOTE_SHA=$(jq -r '.Content.CodeSha256' $layer_output)
180190
LOCAL_SHA=$(jq -r '.Content.CodeSha256' AWSLambdaPowertoolsTypeScriptV2.json)
181191
test "$REMOTE_SHA" == "$LOCAL_SHA" && echo "SHA OK: ${LOCAL_SHA}" || exit 1
182192
REMOTE_DESCRIPTION=$(jq -r '.Description' $layer_output)
183193
LOCAL_DESCRIPTION=$(jq -r '.Description' AWSLambdaPowertoolsTypeScriptV2.json)
184194
test "$REMOTE_DESCRIPTION" == "$LOCAL_DESCRIPTION" && echo "Version number OK: ${LOCAL_DESCRIPTION}" || exit 1
185-
REMOTE_LAYER_VERSION=$(jq -r '.LayerVersionArn' $layer_output | sed 's/.*://')
186-
LOCAL_LAYER_VERSION=$(jq -r '.LayerVersionArn' AWSLambdaPowertoolsTypeScriptV2.json | sed 's/.*://')
187-
test "$REMOTE_LAYER_VERSION" == "$LOCAL_LAYER_VERSION" && echo "Layer Version number OK: ${LOCAL_LAYER_VERSION}" || exit 1
195+
if [ "${{ inputs.environment }}" == "Prod" ]; then
196+
REMOTE_LAYER_VERSION=$(jq -r '.LayerVersionArn' $layer_output | sed 's/.*://')
197+
LOCAL_LAYER_VERSION=$(jq -r '.LayerVersionArn' AWSLambdaPowertoolsTypeScriptV2.json | sed 's/.*://')
198+
test "$REMOTE_LAYER_VERSION" == "$LOCAL_LAYER_VERSION" && echo "Layer Version number OK: ${LOCAL_LAYER_VERSION}" || exit 1
199+
fi
188200
jq -s -r '["Layer Arn", "Runtimes", "Version", "Description", "SHA256"], ([.[0], .[1]] | .[] | [.LayerArn, (.CompatibleRuntimes | join("/")), .Version, .Description, .Content.CodeSha256]) |@tsv' AWSLambdaPowertoolsTypeScriptV2.json $layer_output | column -t -s $'\t'
189201
190202
- name: Store Metadata - ${{ matrix.region }}

.github/workflows/make-release.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ name: Make Release
1717
# 4. Merge the PR created by the `publish_layer` workflow to update the documentation
1818
# 5. Update draft release notes with the latest changes and publish the release on GitHub
1919

20-
on:
21-
workflow_dispatch:
22-
inputs:
23-
layer_documentation_version:
24-
description: "Lambda layer version to be updated in our documentation. e.g. if the current layer number is 3, this value must be 4."
25-
type: string
26-
required: true
20+
on: workflow_dispatch
2721

2822
permissions:
2923
contents: read
@@ -59,8 +53,10 @@ jobs:
5953
node-version: "22"
6054
cache: "npm"
6155
- name: Setup auth tokens
56+
env:
57+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6258
run: |
63-
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
59+
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
6460
- name: Setup dependencies
6561
uses: aws-powertools/actions/.github/actions/cached-node-modules@29979bc5339bf54f76a11ac36ff67701986bb0f0
6662
- name: Publish to npm
@@ -97,13 +93,14 @@ jobs:
9793
# publish_layer -> reusable_deploy_layer_stack -> reusable_update_layer_arn_docs
9894
publish_layer:
9995
needs: publish-npm
100-
secrets: inherit
96+
secrets:
97+
# We use "inherit" because need to propagate the secrets to the reusable workflow, secrets are already scoped by using GitHub's deployment environments to mitigate the risk of secret exposure.
98+
inherit
10199
permissions:
102100
id-token: write
103101
contents: write
104102
pages: write
105103
pull-requests: write
106104
uses: ./.github/workflows/publish_layer.yml
107105
with:
108-
latest_published_version: ${{ needs.publish-npm.outputs.RELEASE_VERSION }}
109-
layer_documentation_version: ${{ inputs.layer_documentation_version }}
106+
latest_published_version: ${{ needs.publish-npm.outputs.RELEASE_VERSION }}

.github/workflows/make-version.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ on:
44
workflow_dispatch:
55
inputs:
66
release-type:
7-
description: 'Release type (major, minor, patch)'
7+
description: 'Release type, if auto it will be determined by the changes since the last tag'
88
required: false
99
type: choice
1010
options:
11+
- auto
1112
- major
1213
- minor
1314
- patch
@@ -39,13 +40,13 @@ jobs:
3940
node-version: ${{ env.NODE_VERSION }}
4041
cache: "npm"
4142
- name: Setup dependencies
42-
uses: aws-powertools/actions/.github/actions/cached-node-modules@743fa57a003787b157991ea5c6e3cf0d40468676 # v1.4.0
43+
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
4344
with:
4445
node-version: ${{ env.NODE_VERSION }}
4546
build: "false"
4647
- name: Version and changelog
4748
id: version-n-changelog
48-
uses: aws-powertools/actions/.github/actions/version-n-changelog@743fa57a003787b157991ea5c6e3cf0d40468676 # v1.4.0
49+
uses: aws-powertools/actions/.github/actions/version-n-changelog@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
4950
with:
5051
release-type: ${{ github.event.inputs.release-type }}
5152
- name: Update user agent version
@@ -55,7 +56,7 @@ jobs:
5556
run: git add .
5657
- name: Create PR
5758
id: create-pr
58-
uses: aws-powertools/actions/.github/actions/create-pr@743fa57a003787b157991ea5c6e3cf0d40468676 # v1.4.0
59+
uses: aws-powertools/actions/.github/actions/create-pr@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
5960
with:
6061
temp_branch_prefix: "ci-bump"
6162
pull_request_title: "chore(ci): bump version to ${{ steps.version-n-changelog.outputs.new-version }}"

.github/workflows/on_doc_merge.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ jobs:
1616
permissions:
1717
id-token: write # trade JWT token for AWS credentials in AWS Docs account
1818
contents: read # read from this repo to publish docs
19-
secrets: inherit
19+
secrets:
20+
AWS_DOCS_ROLE_ARN: ${{ secrets.AWS_DOCS_ROLE_ARN }}
21+
AWS_DOCS_BUCKET: ${{ secrets.AWS_DOCS_BUCKET }}
2022
uses: ./.github/workflows/reusable_publish_docs.yml
2123
with:
2224
version: main

0 commit comments

Comments
 (0)