Skip to content

Commit

Permalink
[StepSecurity] ci: Restrict token permissions to harden GitHub Actions (
Browse files Browse the repository at this point in the history
#2483)

* Restrict token permissions as identified by https://app.stepsecurity.io/.

Signed-off-by: StepSecurity Bot <[email protected]>
  • Loading branch information
step-security-bot authored May 25, 2024
1 parent e6e6647 commit cdd404a
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ on:
description: 'Perform a dry run to check'
default: true

permissions:
contents: read

jobs:
bump-version:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
if: github.repository == 'scikit-hep/pyhf'

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:

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

permissions:
contents: read

jobs:
test:

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
analyze:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
name: Analyze
runs-on: ubuntu-latest

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dependencies-head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
release-candidates:

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

permissions:
contents: read

jobs:
docker:
name: Build, test, and publish Docker images to Docker Hub
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lower-bound-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- cron: '1 0 * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
test:

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/merged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
types: [closed]
workflow_dispatch:

permissions:
contents: read

jobs:
binder:
name: Trigger Binder build
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build Python distribution
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:

pypi_release:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/semantic-pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
cancel-in-progress: true

permissions:
contents: read

jobs:
main:

permissions:
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
name: Validate PR title
runs-on: ubuntu-latest

Expand Down

0 comments on commit cdd404a

Please sign in to comment.