Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Restrict default permissions on GitHub Actions workflows #4942

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/additional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

permissions: {}

jobs:
additional-checks:
name: Additional checks
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
language:
- c-cpp
- python
- actions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from the commit of #4940. We should either merge #4940 (and see the new security issues), then update this PR, or, remove it from this PR (thus losing the way to verify that the issue isn't there anymore).


concurrency:
group: ${{ github.workflow }}-${{
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ on:
release:
types: [published]

jobs:
permissions: {}

jobs:
# Run for push to configured branches and all published releases.
# Take care of different os.
# For main branch, created tags are:
Expand All @@ -47,6 +48,10 @@ jobs:
- ubuntu_wxgui
fail-fast: false

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- releasebranch_*
pull_request:

permissions: {}

jobs:
build:
name: ${{ matrix.c }} & ${{ matrix.cpp }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ env:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

permissions: {}

jobs:
macos_build:
name: macOS build
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/milestones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ on:
pull_request_target:
types: [closed]

permissions: {}

jobs:
assign-milestone:
runs-on: ubuntu-latest
if: github.event.pull_request.merged
permissions:
contents: read
pull-requests: write
steps:
# Retreiving the current milestoone from API instead of github context,
# Retrieving the current milestone from API instead of github context,
# so up-to-date information is used when running after being queued or for reruns
# Otherwise, the information should be available using
# ${{ github.event.pull_request.milestone.title }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- releasebranch_*
pull_request:

permissions: {}

jobs:
build:
name: ${{ matrix.os }} build and tests
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/periodic_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ on:
# See https://crontab.guru/#32_10_*/100,1-7_*_WED
- cron: "32 10 */100,1-7 * WED"

permissions: {}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
update-configure:
# The type of runner that the job will run on
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Create URL to the run output
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- releasebranch_*
pull_request:

permissions: {}

jobs:
pytest:
concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- releasebranch_*
pull_request:

permissions: {}

jobs:
python-checks:
name: Python Code Quality Checks
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

permissions: {}

jobs:
super-linter:
name: GitHub Super Linter
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
- releasebranch_*
pull_request:

permissions: {}

jobs:
ubuntu:
concurrency:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/verify-success.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,36 @@ on:
type: string
required: true
# Can't escape the handlebars in the description
description:
description: >-
In the calling job that defines all the needed jobs,
send `toJson(needs)` inside `$` followed by `{{ }}`
fail_if_failure:
type: boolean
default: true
description:
description: >-
If true, this workflow will fail if any job from 'needs_context was
failed
fail_if_cancelled:
type: boolean
default: true
description:
description: >-
If true, this workflow will fail if any job from 'needs_context' was
cancelled
fail_if_skipped:
type: boolean
default: false
description:
description: >-
If true, this workflow will fail if any job from 'needs_context' was
skipped
require_success:
type: boolean
default: true
description:
description: >-
If true, this workflow will fail if no job from 'needs_context' was
successful

permissions: {}

jobs:
verify-success:
name: Success
Expand Down
Loading