Skip to content

Commit 08bd040

Browse files
authored
ci(permissions): add explicit permissions to build_containers workflow (#33)
Set global permissions to read-all and grant packages write permission to the docker job to follow the principle of least privilege for GITHUB_TOKEN. This restricts the default token permissions to read-only access globally, with the docker job explicitly granted write access only for packages (needed to push containers to ghcr.io). This improves the security posture of the workflow by limiting the scope of what the GITHUB_TOKEN can do. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent e18e5e4 commit 08bd040

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/build_containers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ env:
1111
REGISTRY_USER: ${{ github.actor }}
1212
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
1313

14+
permissions: read-all
15+
1416
jobs:
1517
docker:
1618
runs-on: ubuntu-latest
19+
permissions:
20+
packages: write
1721
steps:
1822
- name: Login to Docker Hub
1923
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3

0 commit comments

Comments
 (0)