Skip to content

Commit

Permalink
chore(ci): change token permissions (#5862)
Browse files Browse the repository at this point in the history
* Improving security

* Improving security
  • Loading branch information
leandrodamascena authored Jan 13, 2025
1 parent 09001b2 commit 27737cf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/dispatch_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ jobs:
statuses: read
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: eu-central-1
role-to-assume: ${{ secrets.AWS_ANALYTICS_ROLE_ARN }}
role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }}
mask-aws-account-id: true

- name: Invoke Lambda function
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/layer_govcloud_python313.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Layer Deployment (GovCloud) - Temporary for Python 3.13

# GovCloud Layer Publish
# ---
# This workflow publishes a specific layer version in an AWS account based on the environment input.
Expand Down Expand Up @@ -32,9 +34,11 @@ on:
type: string
required: true

name: Layer Deployment (GovCloud) - Temporary for Python 3.13
run-name: Layer Deployment (GovCloud) - ${{ inputs.environment }}

permissions:
contents: read

jobs:
download:
runs-on: ubuntu-latest
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/reusable_deploy_v2_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ jobs:

- name: Install poetry
run: pipx install git+https://github.com/python-poetry/poetry@68b88e5390720a3dd84f02940ec5200bfce39ac6 # v1.5.0
- name: aws credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ matrix.region }}
role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }}
mask-aws-account-id: true
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/reusable_deploy_v2_sar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ jobs:
integrity_hash: ${{ inputs.source_code_integrity_hash }}
artifact_name: ${{ inputs.source_code_artifact_name }}


- name: AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }}
mask-aws-account-id: true

# NOTE
# We connect to Layers account to log our intent to publish a SAR Layer
# we then jump to our specific SAR Account with the correctly scoped IAM Role
# this allows us to have a single trail when a release occurs for a given layer (beta+prod+SAR beta+SAR prod)
# NOTE
# We connect to Layers account to log our intent to publish a SAR Layer
# we then jump to our specific SAR Account with the correctly scoped IAM Role
# this allows us to have a single trail when a release occurs for a given layer (beta+prod+SAR beta+SAR prod)
- name: AWS credentials SAR role
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
id: aws-credentials-sar-role
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
Expand All @@ -110,6 +110,8 @@ jobs:
role-duration-seconds: 1200
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_SAR_V2_ROLE_ARN }}
mask-aws-account-id: true

- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/reusable_deploy_v3_sar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
# we then jump to our specific SAR Account with the correctly scoped IAM Role
# this allows us to have a single trail when a release occurs for a given layer (beta+prod+SAR beta+SAR prod)
- name: AWS credentials SAR role
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
id: aws-credentials-sar-role
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
Expand All @@ -107,6 +107,7 @@ jobs:
role-duration-seconds: 1200
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_SAR_V2_ROLE_ARN }}
mask-aws-account-id: true
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
Expand Down

0 comments on commit 27737cf

Please sign in to comment.