From b6fc60f137b26bff62af7cdc0f59d793e3789ee4 Mon Sep 17 00:00:00 2001 From: StepSecurity Bot Date: Fri, 7 Oct 2022 21:02:33 +0000 Subject: [PATCH] [StepSecurity] ci: Harden GitHub Actions Signed-off-by: StepSecurity Bot --- .github/workflows/codeql-analysis.yml | 7 +++++++ .github/workflows/fossa.yml | 3 +++ .github/workflows/labeler.yml | 3 +++ .github/workflows/lint.yml | 6 ++++++ .github/workflows/release-drafter.yml | 3 +++ .github/workflows/stale.yml | 6 ++++++ 6 files changed, 28 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1dde14d8..03c01fbf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,8 +20,15 @@ on: schedule: - cron: '24 0 * * 0' +permissions: # added using https://github.com/step-security/secure-workflows + 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/autobuild to send a status report name: Analyze runs-on: ubuntu-latest diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 60f638dd..09806239 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -8,6 +8,9 @@ on: - '**.md' - 'LICENSE' +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + jobs: scan: diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 053fddb0..44136051 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,6 +2,9 @@ name: "Pull Request Labeler" on: - pull_request_target +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + jobs: triage: permissions: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 342e9b58..b9a1dd30 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,9 +16,15 @@ defaults: run: shell: bash +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + jobs: lint: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests name: Lint runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index e4f04cd9..47400885 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -5,6 +5,9 @@ on: branches: - main +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + jobs: update_release_draft: runs-on: ubuntu-20.04 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fdfeb9b0..5ca0e002 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -3,8 +3,14 @@ on: schedule: - cron: '30 1 * * *' +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + jobs: stale: + 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@v6