diff --git a/.github/workflows/check-change-note.yml b/.github/workflows/check-change-note.yml index e701090420dc..026408a028d5 100644 --- a/.github/workflows/check-change-note.yml +++ b/.github/workflows/check-change-note.yml @@ -1,5 +1,8 @@ name: Check change note +permissions: + pull-requests: read + on: pull_request_target: types: [labeled, unlabeled, opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/check-implicit-this.yml b/.github/workflows/check-implicit-this.yml index 14100ed33252..f58db399ccb9 100644 --- a/.github/workflows/check-implicit-this.yml +++ b/.github/workflows/check-implicit-this.yml @@ -9,6 +9,9 @@ on: - main - "rc/*" +permissions: + contents: read + jobs: check: runs-on: ubuntu-latest diff --git a/.github/workflows/check-qldoc.yml b/.github/workflows/check-qldoc.yml index 7996123e9bf3..e64d661c7911 100644 --- a/.github/workflows/check-qldoc.yml +++ b/.github/workflows/check-qldoc.yml @@ -10,6 +10,9 @@ on: - main - "rc/*" +permissions: + contents: read + jobs: qldoc: runs-on: ubuntu-latest diff --git a/.github/workflows/check-query-ids.yml b/.github/workflows/check-query-ids.yml index 9e84fe0b0e35..8ae19cc3e5f8 100644 --- a/.github/workflows/check-query-ids.yml +++ b/.github/workflows/check-query-ids.yml @@ -11,6 +11,9 @@ on: - "rc/*" workflow_dispatch: +permissions: + contents: read + jobs: check: name: Check query IDs diff --git a/.github/workflows/close-stale.yml b/.github/workflows/close-stale.yml index a9e0d2763089..1c74ede8bf6f 100644 --- a/.github/workflows/close-stale.yml +++ b/.github/workflows/close-stale.yml @@ -5,6 +5,9 @@ on: schedule: - cron: "30 1 * * *" +permissions: + issues: write + jobs: stale: if: github.repository == 'github/codeql' diff --git a/.github/workflows/compile-queries.yml b/.github/workflows/compile-queries.yml index bc8a9f8666d6..7176c6c1a50c 100644 --- a/.github/workflows/compile-queries.yml +++ b/.github/workflows/compile-queries.yml @@ -8,6 +8,9 @@ on: - "codeql-cli-*" pull_request: +permissions: + contents: read + jobs: compile-queries: if: github.repository_owner == 'github' diff --git a/.github/workflows/csharp-qltest.yml b/.github/workflows/csharp-qltest.yml index cc9520de0e25..557354e96ded 100644 --- a/.github/workflows/csharp-qltest.yml +++ b/.github/workflows/csharp-qltest.yml @@ -25,6 +25,9 @@ defaults: run: working-directory: csharp +permissions: + contents: read + jobs: qlupgrade: runs-on: ubuntu-latest diff --git a/.github/workflows/csv-coverage-metrics.yml b/.github/workflows/csv-coverage-metrics.yml index e24c6bc74a4c..6f1170047bfd 100644 --- a/.github/workflows/csv-coverage-metrics.yml +++ b/.github/workflows/csv-coverage-metrics.yml @@ -14,6 +14,10 @@ on: - ".github/workflows/csv-coverage-metrics.yml" - ".github/actions/fetch-codeql/action.yml" +permissions: + contents: read + security-events: write + jobs: publish-java: runs-on: ubuntu-latest diff --git a/.github/workflows/csv-coverage-pr-artifacts.yml b/.github/workflows/csv-coverage-pr-artifacts.yml index 8e2df456260f..b5baa70321d5 100644 --- a/.github/workflows/csv-coverage-pr-artifacts.yml +++ b/.github/workflows/csv-coverage-pr-artifacts.yml @@ -19,6 +19,10 @@ on: - main - "rc/*" +permissions: + contents: read + pull-requests: read + jobs: generate: name: Generate framework coverage artifacts diff --git a/.github/workflows/csv-coverage-pr-comment.yml b/.github/workflows/csv-coverage-pr-comment.yml index 86fe74d3419a..cf01ef063acf 100644 --- a/.github/workflows/csv-coverage-pr-comment.yml +++ b/.github/workflows/csv-coverage-pr-comment.yml @@ -6,6 +6,10 @@ on: types: - completed +permissions: + contents: read + pull-requests: write + jobs: check: name: Check framework coverage differences and comment diff --git a/.github/workflows/csv-coverage-timeseries.yml b/.github/workflows/csv-coverage-timeseries.yml index cf2758dd9d34..f2e1ed47a3d1 100644 --- a/.github/workflows/csv-coverage-timeseries.yml +++ b/.github/workflows/csv-coverage-timeseries.yml @@ -3,6 +3,9 @@ name: Build framework coverage timeseries reports on: workflow_dispatch: +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/csv-coverage-update.yml b/.github/workflows/csv-coverage-update.yml index ccf1ffd47053..4902bee7a4f5 100644 --- a/.github/workflows/csv-coverage-update.yml +++ b/.github/workflows/csv-coverage-update.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 * * *" +permissions: + contents: read + pull-requests: write + jobs: update: name: Update framework coverage report diff --git a/.github/workflows/csv-coverage.yml b/.github/workflows/csv-coverage.yml index 4fb1d143fc39..9461ba887f5e 100644 --- a/.github/workflows/csv-coverage.yml +++ b/.github/workflows/csv-coverage.yml @@ -7,6 +7,9 @@ on: description: "github/codeql repo SHA used for looking up the CSV models" required: false +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/fast-forward.yml b/.github/workflows/fast-forward.yml index c89675efc4ed..dd8fefbc529f 100644 --- a/.github/workflows/fast-forward.yml +++ b/.github/workflows/fast-forward.yml @@ -7,13 +7,14 @@ name: Fast-forward tracking branch for selected CodeQL version on: workflow_dispatch: +permissions: + contents: write + jobs: fast-forward: name: Fast-forward tracking branch for selected CodeQL version runs-on: ubuntu-latest if: github.repository == 'github/codeql' - permissions: - contents: write env: BRANCH_NAME: 'lgtm.com' steps: diff --git a/.github/workflows/go-tests-other-os.yml b/.github/workflows/go-tests-other-os.yml index 9c489d38600a..10ee9e8d13ce 100644 --- a/.github/workflows/go-tests-other-os.yml +++ b/.github/workflows/go-tests-other-os.yml @@ -9,6 +9,10 @@ on: - codeql-workspace.yml env: GO_VERSION: '~1.21.0' + +permissions: + contents: read + jobs: test-mac: name: Test MacOS diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 9a6b2bde7d70..5c67fae3a5cd 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -15,8 +15,13 @@ on: - .github/workflows/go-tests.yml - .github/actions/** - codeql-workspace.yml + env: GO_VERSION: '~1.21.0' + +permissions: + contents: read + jobs: test-linux: if: github.repository_owner == 'github' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 057208eda328..512fa40d2e3a 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,11 +2,12 @@ name: "Pull Request Labeler" on: - pull_request_target +permissions: + contents: read + pull-requests: write + jobs: triage: - permissions: - contents: read - pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/labeler@v4 diff --git a/.github/workflows/mad_regenerate-models.yml b/.github/workflows/mad_regenerate-models.yml index 3268a17dfbb4..1c7d14238f33 100644 --- a/.github/workflows/mad_regenerate-models.yml +++ b/.github/workflows/mad_regenerate-models.yml @@ -11,6 +11,9 @@ on: - ".github/workflows/mad_regenerate-models.yml" - ".github/actions/fetch-codeql/action.yml" +permissions: + contents: read + jobs: regenerate-models: runs-on: ubuntu-latest diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index c5d237fc0d3d..8a4b882f30a9 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -9,6 +9,10 @@ on: env: CARGO_TERM_COLOR: always +permissions: + contents: read + security-events: read + jobs: analyze: if: github.repository_owner == 'github' @@ -20,7 +24,7 @@ jobs: fetch-depth: 0 - name: Find codeql id: find-codeql - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@main with: languages: javascript # does not matter - uses: ./.github/actions/os-version @@ -66,7 +70,7 @@ jobs: exclude:*/ql/lib/upgrades/ exclude:java/ql/integration-tests - name: Upload sarif to code-scanning - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@main with: sarif_file: ql-for-ql.sarif category: ql-for-ql diff --git a/.github/workflows/ql-for-ql-dataset_measure.yml b/.github/workflows/ql-for-ql-dataset_measure.yml index d317d467c9aa..4f9887c4edc4 100644 --- a/.github/workflows/ql-for-ql-dataset_measure.yml +++ b/.github/workflows/ql-for-ql-dataset_measure.yml @@ -11,6 +11,10 @@ on: - ql/ql/src/ql.dbscheme workflow_dispatch: +permissions: + contents: read + security-events: read + jobs: measure: env: @@ -25,7 +29,7 @@ jobs: - name: Find codeql id: find-codeql - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@main with: languages: javascript # does not matter - uses: ./.github/actions/os-version diff --git a/.github/workflows/ql-for-ql-tests.yml b/.github/workflows/ql-for-ql-tests.yml index 4385e3f76bb1..578c26c29775 100644 --- a/.github/workflows/ql-for-ql-tests.yml +++ b/.github/workflows/ql-for-ql-tests.yml @@ -17,6 +17,9 @@ on: env: CARGO_TERM_COLOR: always +permissions: + contents: read + jobs: qltest: runs-on: ubuntu-latest @@ -24,7 +27,7 @@ jobs: - uses: actions/checkout@v4 - name: Find codeql id: find-codeql - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@main with: languages: javascript # does not matter - uses: ./.github/actions/os-version @@ -69,7 +72,7 @@ jobs: echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH - name: Find codeql id: find-codeql - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@main with: languages: javascript # does not matter - uses: ./.github/actions/os-version diff --git a/.github/workflows/query-list.yml b/.github/workflows/query-list.yml index 07fb3b682da3..233cc8120f51 100644 --- a/.github/workflows/query-list.yml +++ b/.github/workflows/query-list.yml @@ -13,6 +13,9 @@ on: - '.github/actions/fetch-codeql/action.yml' - 'misc/scripts/generate-code-scanning-query-list.py' +permissions: + contents: read + jobs: build: diff --git a/.github/workflows/ruby-build.yml b/.github/workflows/ruby-build.yml index 617346470699..fda4045cd447 100644 --- a/.github/workflows/ruby-build.yml +++ b/.github/workflows/ruby-build.yml @@ -32,6 +32,9 @@ defaults: run: working-directory: ruby +permissions: + contents: read + jobs: build: strategy: diff --git a/.github/workflows/ruby-dataset-measure.yml b/.github/workflows/ruby-dataset-measure.yml index c064d8d2bfb4..dd15a0aa63e2 100644 --- a/.github/workflows/ruby-dataset-measure.yml +++ b/.github/workflows/ruby-dataset-measure.yml @@ -17,6 +17,9 @@ on: - .github/workflows/ruby-dataset-measure.yml workflow_dispatch: +permissions: + contents: read + jobs: measure: env: diff --git a/.github/workflows/ruby-qltest.yml b/.github/workflows/ruby-qltest.yml index fbac0488b51f..9dc86bbce203 100644 --- a/.github/workflows/ruby-qltest.yml +++ b/.github/workflows/ruby-qltest.yml @@ -29,6 +29,9 @@ defaults: run: working-directory: ruby +permissions: + contents: read + jobs: qlupgrade: runs-on: ubuntu-latest diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index a461fbfdf8ce..6956d31a3988 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -33,6 +33,9 @@ on: - rc/* - codeql-cli-* +permissions: + contents: read + jobs: # not using a matrix as you cannot depend on a specific job in a matrix, and we want to start linux checks # without waiting for the macOS build diff --git a/.github/workflows/sync-files.yml b/.github/workflows/sync-files.yml index 7894eae7f55a..1ed49ac3ecf6 100644 --- a/.github/workflows/sync-files.yml +++ b/.github/workflows/sync-files.yml @@ -10,6 +10,9 @@ on: - main - 'rc/*' +permissions: + contents: read + jobs: sync: runs-on: ubuntu-latest diff --git a/.github/workflows/tree-sitter-extractor-test.yml b/.github/workflows/tree-sitter-extractor-test.yml index 5d13b25466d3..acc68e7ec2c7 100644 --- a/.github/workflows/tree-sitter-extractor-test.yml +++ b/.github/workflows/tree-sitter-extractor-test.yml @@ -23,6 +23,9 @@ defaults: run: working-directory: shared/tree-sitter-extractor +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/validate-change-notes.yml b/.github/workflows/validate-change-notes.yml index f8c1d9f65042..3c83ffa709a5 100644 --- a/.github/workflows/validate-change-notes.yml +++ b/.github/workflows/validate-change-notes.yml @@ -15,6 +15,9 @@ on: - ".github/workflows/validate-change-notes.yml" - ".github/actions/fetch-codeql/action.yml" +permissions: + contents: read + jobs: check-change-note: runs-on: ubuntu-latest