Skip to content

Commit 927e00a

Browse files
committed
Documented the justification for the CodeQL alert
1 parent 8028978 commit 927e00a

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

.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: 10 additions & 0 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,6 +184,7 @@ 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)

.github/workflows/update_ssm.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
# /aws/service/powertools/python/arm64/python3.8/3.1.0
1212
# And will have a value of:
1313
# arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsPythonV3-python38-arm64:4
14+
#
15+
# CodeQL Security Note:
16+
# This workflow uses dynamic secret access via secrets[format(...)] which triggers
17+
# an "Excessive Secrets Exposure" alert. However, this is safe because:
18+
# - Secrets are scoped per environment (SSM)
19+
# - Each job only accesses secrets for SSM
20+
# - No global secrets array containing mixed credentials (API keys, PEM files, etc.)
21+
# - The secrets object is already minimally scoped to the environment being used
1422

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

0 commit comments

Comments
 (0)