Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/layers_partition_verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Partition Layer Verification
# ---
# This workflow queries the Partition layer info in production only
#
# CodeQL Security Note:
# This workflow uses dynamic secret access via secrets[format(...)] which triggers
# an "Excessive Secrets Exposure" alert. However, this is safe because:
# - Secrets are scoped per environment (China/GovCloud Gamma/Prod)
# - Each job only accesses secrets for its specific partition and region
# - No global secrets array containing mixed credentials (API keys, PEM files, etc.)
# - The secrets object is already minimally scoped to the environment being used

on:
workflow_dispatch:
Expand Down Expand Up @@ -102,7 +110,7 @@ jobs:
permissions:
id-token: write
contents: read
# Environment should interperlate as "GovCloud Prod" or "China Beta"
# Environment should interpolate as "GovCloud Prod" or "China Beta"
environment: ${{ inputs.partition }} ${{ inputs.environment }}
strategy:
matrix:
Expand All @@ -118,6 +126,7 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
# Dynamic secret access is safe here - secrets are scoped per environment
role-to-assume: ${{ secrets[format('IAM_ROLE_{0}', steps.transform.outputs.CONVERTED_REGION)] }}
aws-region: ${{ matrix.region}}
mask-aws-account-id: true
Expand All @@ -129,6 +138,7 @@ jobs:
- name: Verify Layer
run: |
export layer_output='AWSLambdaPowertoolsTypeScriptV2-${{matrix.region}}.json'
# Dynamic secret access is safe here - secrets are scoped per environment
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
REMOTE_SHA=$(jq -r '.Content.CodeSha256' $layer_output)
LOCAL_SHA=$(jq -r '.Content.CodeSha256' AWSLambdaPowertoolsTypeScriptV2.json)
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/layers_partitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
# 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
# 2. Monitor deployment progress and verify successful layer publication across all target regions
# 3. Once this workflow is completed, the PR for the documentation update can me merged
#
# CodeQL Security Note:
# This workflow uses dynamic secret access via secrets[format(...)] which triggers
# an "Excessive Secrets Exposure" alert. However, this is safe because:
# - Secrets are scoped per environment (China/GovCloud Gamma/Prod)
# - Each job only accesses secrets for its specific partition and region
# - No global secrets array containing mixed credentials (API keys, PEM files, etc.)
# - The secrets object is already minimally scoped to the environment being used

on:
workflow_dispatch:
Expand Down Expand Up @@ -142,6 +150,7 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
# Dynamic secret access is safe here - secrets are scoped per environment
role-to-assume: ${{ secrets[format('IAM_ROLE_{0}', steps.transform.outputs.CONVERTED_REGION)] }}
aws-region: ${{ matrix.region}}
mask-aws-account-id: true
Expand Down Expand Up @@ -175,6 +184,7 @@ jobs:
LAYER_VERSION: ${{ steps.create-layer.outputs.LAYER_VERSION }}
run: |
export layer_output='AWSLambdaPowertoolsTypeScriptV2-${{matrix.region}}.json'
# Dynamic secret access is safe here - secrets are scoped per environment
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
REMOTE_SHA=$(jq -r '.Content.CodeSha256' $layer_output)
LOCAL_SHA=$(jq -r '.Content.CodeSha256' AWSLambdaPowertoolsTypeScriptV2.json)
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/update_ssm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
# /aws/service/powertools/python/arm64/python3.8/3.1.0
# And will have a value of:
# arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsPythonV3-python38-arm64:4
#
# CodeQL Security Note:
# This workflow uses dynamic secret access via secrets[format(...)] which triggers
# an "Excessive Secrets Exposure" alert. However, this is safe because:
# - Secrets are scoped per environment (SSM)
# - Each job only accesses secrets for SSM
# - No global secrets array containing mixed credentials (API keys, PEM files, etc.)
# - The secrets object is already minimally scoped to the environment being used

on:
workflow_dispatch:
Expand Down Expand Up @@ -96,6 +104,7 @@ jobs:
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a
with:
aws-region: ${{ matrix.region }}
# Dynamic secret access is safe here - secrets are scoped per environment
role-to-assume: ${{ secrets[format('{0}', steps.transform.outputs.CONVERTED_REGION)] }}
mask-aws-account-id: true
- id: write-version
Expand Down