Repository navigation
🔧 config(security): resolve open code-scanning alerts - #18
Merged
Merged
Conversation
- 🐛 fix(auth): handle the authorized_keys close error (CodeQL #19, go/unhandled-writable-file-close). appendKeyLine now uses a named return and checks the deferred Close, so a flush failure on write surfaces instead of being reported as success. - 🎨 style(banner): switch two gosec suppressions from //nolint:gosec to gosec-native #nosec — G306 on the generated banner asset (gen/main.go, world-readable is intended) and G103 on the ioctl unsafe.Pointer (tty_unix.go, required by SYS_IOCTL). Both were already justified; the standalone SARIF gosec job only honors #nosec, so it kept reporting them. gosec now reports 0 issues across the repo. - 🔧 config(docker): pin base images by digest in all Dockerfiles (golang:1.26.4-alpine, cgr.dev/chainguard/wolfi-base:latest, alpine:3.24) to clear Scorecard Pinned-Dependencies. Multi-arch index digests, so buildx stays per-arch correct; tags kept for readability and the existing Dependabot docker ecosystem tracks digest bumps. Verified: go build/vet clean, golangci-lint 0 issues, gosec 0 issues, and docker build of the main Dockerfile succeeds on the pinned bases.
scttbnsn
requested review from
ALARGECOMPANY and
biggest-littlest
as code owners
June 16, 2026 15:20
biggest-littlest
approved these changes
Jun 16, 2026
biggest-littlest
left a comment
Member
There was a problem hiding this comment.
Good fixes. The #nosec-vs-//nolint distinction is the real root cause on the gosec ones — switching to native #nosec is correct, and gosec ./... confirms 0. enroll.go close handling is the proper fix. Digest pins use multi-arch index digests so buildx stays correct, and docker build is verified. LGTM.
ALARGECOMPANY
approved these changes
Jun 16, 2026
ALARGECOMPANY
left a comment
Member
There was a problem hiding this comment.
Verified the reasoning: keygen alert is the public authorized_keys line (genuine FP), Scorecard pins are index digests, Dependabot docker ecosystem already tracks them. Approving.
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.
Clears the remaining code-scanning alerts (the rename-era stale ones already auto-closed on a re-scan; this handles the genuinely-current ones).
CodeQL
go/unhandled-writable-file-close(internal/auth/enroll.go) —appendKeyLinenow uses a named return and checks the deferredClose(), so a flush failure on the write surfaces instead of being swallowed. Real fix.gosec
Both findings were already justified inline, but with
//nolint:gosec— which golangci-lint honors but the standalone SARIF gosec job does not, so they kept reporting. Switched to gosec-native#nosec:internal/banner/gen/main.go— generated banner asset,0644is intended.internal/banner/tty_unix.go—unsafe.Pointerrequired bySYS_IOCTL.gosec ./...now reports 0 issues (was 2).Scorecard — Pinned-Dependencies (×9)
Pinned all Docker base images by digest across
Dockerfile,Dockerfile.release,Dockerfile.armv7,Dockerfile.dev:golang:1.26.4-alpine@sha256:f1ddd9…cgr.dev/chainguard/wolfi-base:latest@sha256:34977a…alpine:3.24@sha256:28bd5f…These are multi-arch index digests, so buildx still resolves the correct per-arch layer. Tags are kept for readability and the existing Dependabot
dockerecosystem will track digest bumps. This is roadmap item #37.Verification
go build+go vetclean ·golangci-lint0 issues ·gosec0 issues ·docker buildof the main Dockerfile succeeds on the pinned bases (golang + wolfi-base digests pull and build).Scorecard re-runs on push to main, so the pinned-deps alerts auto-close on merge. The 3 non-code alerts (keygen clear-text-logging false-positive — it prints the public authorized_keys line — plus Scorecard Maintained/CII-Best-Practices, which aren't code issues) are dismissed separately.