Skip to content

Commit

Permalink
ci: github actions hardening (#190)
Browse files Browse the repository at this point in the history
Restrict permissions of github token. Pin action versions.

Following advice in briansmith/untrusted#50.
  • Loading branch information
mmcloughlin authored Apr 28, 2021
1 parent ec9535c commit 3a219c8
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
name: ci

permissions:
contents: read

on:
push:
branches:
Expand All @@ -6,7 +11,6 @@ on:
schedule:
- cron: '17 12 * * 6'

name: ci
jobs:
test:
strategy:
Expand All @@ -16,7 +20,7 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8 # v2.1.3
with:
go-version: ${{ matrix.go-version }}
- name: Configure Go Environment
Expand All @@ -26,7 +30,9 @@ jobs:
- name: Go Environment
run: go env
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
persist-credentials: false
- name: Bootstrap
run: ./script/bootstrap

Expand All @@ -38,13 +44,13 @@ jobs:
run: ./script/coverage

- name: Upload Unit Test Coverage
uses: codecov/codecov-action@v1.0.5
uses: codecov/codecov-action@967e2b38a85a62bd61be5529ada27ebc109948c2 #v1.4.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: unittests.coverprofile
flags: unittests
- name: Upload Integration Test Coverage
uses: codecov/codecov-action@v1.0.5
uses: codecov/codecov-action@967e2b38a85a62bd61be5529ada27ebc109948c2 #v1.4.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: integration.coverprofile
Expand All @@ -58,7 +64,7 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8 # v2.1.3
with:
go-version: ${{ matrix.go-version }}
- name: Configure Go Environment
Expand All @@ -68,7 +74,9 @@ jobs:
- name: Go Environment
run: go env
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
persist-credentials: false
- name: Bootstrap
run: ./script/bootstrap
- name: Lint
Expand All @@ -82,11 +90,13 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8 # v2.1.3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
persist-credentials: false
- name: Run Third-Party Tests
working-directory: ./tests/thirdparty
run: go test -pkgs packages.json

0 comments on commit 3a219c8

Please sign in to comment.