Skip to content

Commit ab7c05f

Browse files
committed
Fix GHA Permissions
Why these changes are being introduced: The workflows do not need to permission to make any changes to the code itself, so we restrict to just `read-only`. How this addresses that need: * Add a line to each of the GHA workflows to restrict the workflow to just read-only permissions to the code in the repository. * Update the permissions for the job to allow GitHub Actions to interact with the OIDC endpoint Additionally, * Add a `temp/` directory to the .gitignore file so that it's possible to do some local work moving files around without worrying about content getting accidentally pushed to GitHub * Minor formatting changes to a few files Side effects of this change: None.
1 parent 54b8f7f commit ab7c05f

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

.github/workflows/dev-build.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
### This is the Terraform-generated dev-build.yml workflow for the docker-matomo-dev app repository ###
2-
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the document ###
3-
### If the container requires any additional pre-build commands, uncomment and edit ###
4-
### the PREBUILD line at the end of the document. ###
1+
### This is the Terraform-generated dev-build.yml workflow for the ###
2+
### docker-matomo-dev app repository. ###
3+
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the ###
4+
### document. If the container requires any additional pre-build commands, ###
5+
### uncomment and edit the PREBUILD line at the end of the document. ###
56
name: Dev Container Build and Deploy
67
on:
78
workflow_dispatch:
@@ -11,8 +12,15 @@ on:
1112
paths-ignore:
1213
- '.github/**'
1314

15+
permissions: read-all
16+
1417
jobs:
1518
deploy:
19+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
20+
permissions:
21+
id-token: write
22+
contents: read
23+
1624
name: Dev Container Deploy
1725
uses: mitlibraries/.github/.github/workflows/ecr-shared-deploy-dev.yml@main
1826
secrets: inherit

.github/workflows/prod-promote.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
### This is the Terraform-generated prod-promote.yml workflow for the docker-matomo-prod repository. ###
2-
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the document. ###
1+
### This is the Terraform-generated prod-promote.yml workflow for the ###
2+
### docker-matomo-prod repository. ###
3+
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the ###
4+
### document. ###
35
name: Prod Container Promote
46
on:
57
workflow_dispatch:
68
release:
79
types: [published]
810

11+
permissions: read-all
12+
913
jobs:
1014
deploy:
15+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
16+
permissions:
17+
id-token: write
18+
contents: read
19+
1120
name: Prod Container Promote
1221
uses: mitlibraries/.github/.github/workflows/ecr-shared-promote-prod.yml@main
1322
secrets: inherit

.github/workflows/stage-build.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
### This is the Terraform-generated dev-build.yml workflow for the docker-matomo-stage app repository ###
2-
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the document ###
3-
### If the container requires any additional pre-build commands, uncomment and edit ###
4-
### the PREBUILD line at the end of the document. ###
1+
### This is the Terraform-generated dev-build.yml workflow for the ###
2+
### docker-matomo-stage app repository. ###
3+
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the ###
4+
### document. If the container requires any additional pre-build commands, ###
5+
### uncomment and edit the PREBUILD line at the end of the document. ###
56
name: Stage Container Build and Deploy
67
on:
78
workflow_dispatch:
@@ -11,8 +12,15 @@ on:
1112
paths-ignore:
1213
- '.github/**'
1314

15+
permissions: read-all
16+
1417
jobs:
1518
deploy:
19+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
20+
permissions:
21+
id-token: write
22+
contents: read
23+
1624
name: Stage Container Deploy
1725
uses: mitlibraries/.github/.github/workflows/ecr-shared-deploy-stage.yml@main
1826
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.env
22
**/.DS_Store
3+
temp/

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.PHONY: help dist-dev publish-dev dist-stage publish-stage
22
SHELL=/bin/bash
33
### This is the Terraform-generated header for docker-matomo-dev. If ###
4-
### this is a Lambda repo, uncomment the FUNCTION line below ###
5-
### and review the other commented lines in the document. ###
4+
### this is a Lambda repo, uncomment the FUNCTION line below ###
5+
### and review the other commented lines in the document. ###
66
ECR_NAME_DEV:=docker-matomo-dev
77
ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/docker-matomo-dev
88
# FUNCTION_DEV:=
9-
### End of Terraform-generated header ###
9+
### End of Terraform-generated header ###
1010

1111
help: ## Print this message
1212
@awk 'BEGIN { FS = ":.*##"; print "Usage: make <target>\n\nTargets:" } \

0 commit comments

Comments
 (0)