Skip to content

Commit

Permalink
ci: add minimum GitHub token permissions for workflows (#5072)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
  • Loading branch information
ashishkurmi authored Oct 3, 2022
1 parent f4e08ae commit b821e43
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ on:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC

permissions:
contents: read

jobs:
security-audit:
permissions:
checks: write # for actions-rs/audit-check to create check
contents: read # for actions/checkout to fetch code
issues: write # for actions-rs/audit-check to create issues
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ defaults:
run:
shell: bash

permissions:
contents: read

jobs:
# Depends on all action sthat are required for a "successful" CI run.
tests-pass:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ on:

# See .github/labeler.yml file

permissions:
contents: read

jobs:
triage:
permissions:
contents: read # for actions/labeler to determine modified files
pull-requests: write # for actions/labeler to add labels to PRs
runs-on: ubuntu-latest
if: github.repository_owner == 'tokio-rs'
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/loom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ env:
# Change to specific Rust release to pin
rust_stable: stable

permissions:
contents: read

jobs:
loom:
name: loom
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
paths:
- '**/Cargo.toml'

permissions:
contents: read

jobs:
security-audit:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/stress-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
# Change to specific Rust release to pin
rust_stable: stable

permissions:
contents: read

jobs:
stress-test:
name: Stress Test
Expand Down

0 comments on commit b821e43

Please sign in to comment.