From 87af31847cea16c3a04ce045c89e49d94e2bdc14 Mon Sep 17 00:00:00 2001 From: mandlil <138015259+mandlil@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:15:01 +0530 Subject: [PATCH 1/2] Remediate Scorecard Token-Permissions findings This attempts to remediate the problems reported by Scorecard about Token-Permissions --- .github/workflows/osv-scanner-unified.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/osv-scanner-unified.yml b/.github/workflows/osv-scanner-unified.yml index 1c6ba2c2c..6da65105a 100644 --- a/.github/workflows/osv-scanner-unified.yml +++ b/.github/workflows/osv-scanner-unified.yml @@ -26,13 +26,14 @@ on: permissions: # Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117 actions: read - # Require writing security events to upload SARIF file to security tab - security-events: write # Read commit contents contents: read jobs: scan-scheduled: + permissions: + # Required for writing security events to upload SARIF file to security tab + security-events: write if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} # If you want to copy this config, highly suggest pinning this version to a release rather than tracking the main branch uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@8bd1ce1c4be9d98053ffd9e6e14585276a36762c" # v1.9.1 @@ -43,6 +44,9 @@ jobs: --skip-git ./ scan-pr: + permissions: + # Required for writing security events to upload SARIF file to security tab + security-events: write if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} # If you want to copy this config, highly suggest pinning this version to a release rather than tracking the main branch uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@8bd1ce1c4be9d98053ffd9e6e14585276a36762c" # v1.9.1 From 3be7ca2acb1cc8ef741ec2a53719386a66997544 Mon Sep 17 00:00:00 2001 From: mandlil <138015259+mandlil@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:44:09 +0530 Subject: [PATCH 2/2] Update osv-scanner-unified.yml --- .github/workflows/osv-scanner-unified.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/osv-scanner-unified.yml b/.github/workflows/osv-scanner-unified.yml index 6da65105a..1c3c60e1c 100644 --- a/.github/workflows/osv-scanner-unified.yml +++ b/.github/workflows/osv-scanner-unified.yml @@ -23,17 +23,17 @@ on: push: branches: ["master"] -permissions: - # Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117 - actions: read - # Read commit contents - contents: read +# Declare default permissions as read only. +permissions: read-all + jobs: scan-scheduled: permissions: # Required for writing security events to upload SARIF file to security tab security-events: write + actions: read + contents: read if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} # If you want to copy this config, highly suggest pinning this version to a release rather than tracking the main branch uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@8bd1ce1c4be9d98053ffd9e6e14585276a36762c" # v1.9.1 @@ -47,6 +47,8 @@ jobs: permissions: # Required for writing security events to upload SARIF file to security tab security-events: write + actions: read + contents: read if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} # If you want to copy this config, highly suggest pinning this version to a release rather than tracking the main branch uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@8bd1ce1c4be9d98053ffd9e6e14585276a36762c" # v1.9.1