Skip to content

Commit

Permalink
[CI][OSSF] Add default permissions to work flows (intel#13173)
Browse files Browse the repository at this point in the history
per OSSF
(https://securityscorecards.dev/viewer/?uri=github.com/intel/llvm) all
workflows should have default top level permission set. Which we set to
below as per recommendation

permissions:
  contents: read

then within actual jobs, when needed, we added additional privileges. 

These changes were generated by the recommended OSSF tool 

This PR changes those workflows created/owned by intel/llvm repo. Will
do seperate PR for issues found in llvm/llvm-project inherited
workflows.
  • Loading branch information
stdale-intel authored Mar 28, 2024
1 parent db6a05d commit 1e894d1
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/sycl-aws.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Start/Stop AWS instance

permissions: read-all

on:
workflow_call:
inputs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sycl-containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:
- 'devops/scripts/install_build_tools.sh'
- '.github/workflows/sycl-containers.yaml'

permissions: read-all

jobs:
base_image_ubuntu2204:
if: github.repository == 'intel/llvm'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sycl-detect-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
description: Matched filters
value: ${{ jobs.need_check.outputs.filters }}

permissions: read-all

jobs:
need_check:
name: Decide which tests could be affected by the changes
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/sycl-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ on:
- 'clang/docs/**'
- 'sycl/doc/**'

permissions:
contents: read

jobs:
build:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
if: github.repository == 'intel/llvm'
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ on:
options:
- 3

permissions:
contents: read

jobs:
build:
name: Build + LIT
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-linux-matrix-e2e-on-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
Format: '{"VAR1":"VAL1","VAR2":"VAL2",...}'
default: '{"LIT_FILTER":""}'

permissions:
contents: read

jobs:
linux_e2e_on_nightly:
name: E2E on Nightly
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-linux-precommit-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
types:
- completed

permissions:
contents: read

jobs:
create-check:
runs-on: [Linux, build]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-linux-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
detect_changes:
uses: ./.github/workflows/sycl-detect-changes.yml
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-linux-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ on:
- false
- true

permissions:
contents: read

jobs:
run:
name: ${{ inputs.name }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-macos-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
required: false
default: ""

permissions:
contents: read

jobs:
build:
name: Build
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
schedule:
- cron: '0 3 * * *'

permissions:
contents: read

jobs:
ubuntu2204_build:
if: github.repository == 'intel/llvm'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sycl-post-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
- ./devops/actions/cleanup
- ./devops/actions/cached_checkout

permissions:
contents: read

jobs:
build-lin:
name: Linux (Self build + shared libraries + no-assertions)
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/sycl-stale-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ on:
schedule:
- cron: '30 1 * * *'

permissions:
contents: read

jobs:
close-issues:
permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-20.04
steps:
- uses: actions/stale@v9
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/sycl-sync-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ name: main branch sync
on:
workflow_dispatch:

permissions:
contents: read

jobs:
sync:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-20.04
if: github.repository == 'intel/llvm'
steps:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/sycl-update-gpu-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ on:
- cron: '0 3 * * 2'
workflow_dispatch:

permissions:
contents: read

jobs:
update_driver_linux:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-20.04
if: github.repository == 'intel/llvm'
steps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sycl-windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ on:
type: choice
options:
- 3
permissions:
contents: read

jobs:
build:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sycl-windows-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ on:
type: string
default: '{}'
required: False

permissions:
contents: read

jobs:
run:
name: ${{ inputs.name }}
Expand Down

0 comments on commit 1e894d1

Please sign in to comment.