From fae1f1704b521ac4cf952fc0bb1dc3474ec4af9a Mon Sep 17 00:00:00 2001 From: Rohit Parashar <153898168+maneuvertomars@users.noreply.github.com> Date: Wed, 29 Jul 2026 19:26:30 +0530 Subject: [PATCH 1/2] Harden GitHub Actions workflows Add least-privilege permissions (contents: read), upgrade deprecated actions, and pin every action to a full commit SHA. Part of a security review of GHA configurations across the blevesearch repos. --- .github/workflows/cover.yml | 8 +++++--- .github/workflows/lint.yml | 12 +++++++++--- .github/workflows/tests.yml | 6 ++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index e5269a7..368d683 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -4,20 +4,22 @@ on: - master pull_request: name: Coverage +permissions: + contents: read jobs: coverage: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: '1.14.x' - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Test run: | go test -coverprofile=profile.cov ./... - name: Send coverage - uses: shogo82148/actions-goveralls@v1 + uses: shogo82148/actions-goveralls@9606dbc5ac5cf888a0e9ef901515c3cd516a2790 # v1.11.0 with: path-to-profile: profile.cov diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7b4aa34..0fe1927 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,13 +4,19 @@ on: - master pull_request: name: Lint +permissions: + contents: read jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install Go + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: stable - name: Run golangci-lint - uses: actions-contrib/golangci-lint@v1 + uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: - args: run -E gofmt \ No newline at end of file + version: latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bcafb81..45dfeca 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,8 @@ on: - master pull_request: name: Tests +permissions: + contents: read jobs: test: strategy: @@ -13,11 +15,11 @@ jobs: runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Test run: | go version From 00f789c7e65c939f7f55481e0c9d275e1f7af3ca Mon Sep 17 00:00:00 2001 From: Rohit Parashar <153898168+maneuvertomars@users.noreply.github.com> Date: Wed, 29 Jul 2026 19:37:59 +0530 Subject: [PATCH 2/2] Align CI Go versions with module requirements Newer setup-go pins GOTOOLCHAIN=local, so matrix entries below the go.mod minimum now fail instead of silently upgrading the toolchain. Also: Go toolchains before 1.16 do not exist for darwin/arm64 (current macos-latest), and Go <= 1.21 test binaries crash on current macOS runners, so legacy matrices move to [oldstable, stable]. Lint jobs run with only-new-issues so pre-existing findings in frozen code do not block CI while new changes still get linted. --- .github/workflows/cover.yml | 2 +- .github/workflows/lint.yml | 4 +--- .github/workflows/tests.yml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index 368d683..9bc5397 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -13,7 +13,7 @@ jobs: - name: Install Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: '1.14.x' + go-version: 'stable' - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0fe1927..ea95965 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,4 @@ on: - push: - branches: - - master pull_request: name: Lint permissions: @@ -20,3 +17,4 @@ jobs: uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: version: latest + only-new-issues: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 45dfeca..a4b56ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: test: strategy: matrix: - go-version: [1.13.x, 1.14.x] + go-version: [oldstable, stable] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: