Repository navigation
ci: restrict workflow permissions and align golangci-lint version - #95
Merged
Merged
Conversation
raeperd
marked this pull request as ready for review
November 5, 2026 13:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3/3 of the repo review. This PR only touches
.github/workflows/build.yamlandMakefile. Go sources and the Dockerfile are handled in PR 1 and PR 2.Net diff: 2 files, +5 / -2.
Changes
1. Least-privilege
GITHUB_TOKENforbuild.yamlbuild.yamlhad nopermissionsblock, so both jobs ran with the repository's default token scope. Neither job needs more than read access:buildjob:actions/checkout,go build/go test, andcoverallsapp/github-action. The Coveralls uploader only uses the token to identify the repo; it does not write to GitHub through it.lintjob:actions/checkout,golangci-lint-action(annotations are emitted via workflow commands, which need no extra scope), anddeadcode.So the workflow now declares
permissions: contents: readat the top level, matching the style already used indeploy.yaml.deploy.yamlalready hadcontents: read+packages: write, which is exactly what its single job needs to push to GHCR, so it is left as is.2. Same golangci-lint version locally and in CI
Before: CI pinned
v2.11viagolangci-lint-action, whilemake lintran whatevergolangci-linthappened to be onPATH. Local and CI could lint with different versions and report different findings.Now both use
v2.15.0:Makefile:go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.15.0 run, the same pattern as the existingdeadcodeline. No local install needed.build.yaml:golangci-lint-actionwithversion: v2.15.0.The version string lives in two places, one line each. An earlier revision of this PR had CI run
make lintso the version lived only in the Makefile, but that compiled golangci-lint on every run (lint steps 31s → 62s) and dropped the action's prebuilt binary, analysis cache, inline PR annotations, and config schema verification. Keeping the action was judged worth one duplicated line.Why
v2.15.0rather than keepingv2.11:v2.11.xcannot typecheck the Go 1.27 standard library (export data version mismatch), so anyone on a current Go toolchain gets 8 spurioustypecheckerrors locally.v2.15.0is the current release, works with both Go 1.26 (what CI gets fromgo.mod) and Go 1.27, and reports0 issueson the current code.golangci-lint config verifypasses against.golangci.ymlwith this version.Verification
actionlintpasses on both workflows.make lintpasses locally on Go 1.27.3 and withGOTOOLCHAIN=go1.26.10(what CI resolves fromgo.mod).Review order
This PR is safest to finalize after PR 2 (Dockerfile) is merged, since
build.yaml's path filter includesDockerfileand a rebase onto that change should get one more CI run here before marking this ready.Suggestions not included in this PR (low risk, separate follow-ups)
actions/checkout@<sha> # v7). Dependabot already handlesgithub-actions, so SHA pins would be kept up to date automatically..golangci.ymlis not in the workflow path filters, so lint config changes alone do not trigger CI.deadcode@latestis unpinned in both the Makefile and CI. It could be pinned the same way if reproducibility matters.