Skip to content

Commit

Permalink
Add restrictive default permissions to workflows (#733)
Browse files Browse the repository at this point in the history
The default workflow permissions configured on the repository are
already restrictive but explicitly setting permissions in each workflow
makes the OSSF Scorecard checks happier.

Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday authored Jul 25, 2024
1 parent 02ffaab commit b66aa4e
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Build documentation
on:
workflow_call:

permissions:
contents: read

jobs:
node:
runs-on: ubuntu-22.04
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: "15 23 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
analyze:
name: Analyze
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
uses: ./.github/workflows/test.yml
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
build:
uses: ./.github/workflows/test.yml
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- "v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: read

jobs:
verify-versions:
Expand All @@ -18,7 +21,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"
- name: Build
run: make build-node
- name: Publish
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: "32 23 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
main:
uses: ./.github/workflows/test.yml
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with:
results_file: results.sarif
results_format: sarif
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Test
on:
workflow_call:

permissions:
contents: read

jobs:
verify-versions:
uses: ./.github/workflows/verify-versions.yml
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/verify-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Verify versions
on:
workflow_call:

permissions:
contents: read

env:
GATEWAY_VERSION: 1.5.2

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/vulnerability-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: "20 23 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
go:
runs-on: ubuntu-latest
Expand Down

0 comments on commit b66aa4e

Please sign in to comment.