Skip to content

Add race, gofmt, smoke-test, staticcheck, govulncheck, CodeQL to CI#4

Merged
JeremiahM37 merged 2 commits into
mainfrom
ci/harden-tests
May 13, 2026
Merged

Add race, gofmt, smoke-test, staticcheck, govulncheck, CodeQL to CI#4
JeremiahM37 merged 2 commits into
mainfrom
ci/harden-tests

Conversation

@JeremiahM37
Copy link
Copy Markdown
Owner

Summary

Match librarr's CI hardening. Every PR is now gated on the same suite that protects librarr (see librarr commit 755c4a8).

What changed

.github/workflows/test.yml — replaces the bare go build + go test

  • gofmt — fails the build if any file isn't gofmt'd (also runs gofmt -w . would fix locally)
  • go build — binary compiles
  • go test -race -count=1 -v — race detector + no cache
  • go vet
  • staticcheck (latest)
  • govulncheck (latest) — scans against Go 1.25 stdlib so the 1.24.x stdlib CVEs that affect local runs disappear
  • smoke test — boots the binary on port 15001 with DATA_DIR=/tmp/smoke-data, waits up to 15s for /api/health, then confirms the new /api/openapi.json and /torznab/api?t=caps endpoints respond. Greps boot log for panic/fatal.
  • docker build job verifies the Dockerfile still produces an image.
  • Bumped CI Go version to 1.25.x to match the Dockerfile. go.mod's 1.24.0 floor unchanged.

.github/workflows/codeql.yml — new

Security-and-quality queries, runs on push + PR + weekly cron (Mon 04:23 UTC). Surfaces post-merge dependency CVEs without manual intervention.

What had to be fixed for these gates to pass

  • 26 files reformatted via gofmt -w . (no behavioral changes — just whitespace and import-block ordering).
  • 3 staticcheck findings fixed:
    • internal/api/api.go:775for ... append(all, c)append(all, custom...) (S1011)
    • internal/api/handlers_extra.go:248 — numeric 403http.StatusForbidden (ST1013)
    • internal/search/filter_test.go:238 — redundant nil check before len() (S1009)

Test plan

  • Full gate sweep locally: gofmt clean, go vet clean, staticcheck clean, go test -race -count=1 ./... clean, govulncheck clean against the binary's actual build target (1.25), smoke test bound + /api/health, /api/openapi.json, /torznab/api?t=caps all return 200, no panic/fatal in boot log.
  • 457 existing tests still pass.
  • Docker build verified locally during the recent isolated-container deploy.

Match librarr's CI hardening (see librarr commit 755c4a8). The existing
'go build + go test' workflow now gates every PR on:

  - gofmt -l (formatter enforcement)
  - go build (binary compiles)
  - go test -race -count=1 -v (race detector + no cache)
  - go vet
  - staticcheck (latest)
  - govulncheck (latest, scans against Go 1.25 stdlib so the 1.24.x stdlib
    CVEs that affect local runs disappear)
  - smoke test — boots the binary on port 15001 with DATA_DIR=/tmp/smoke-data,
    waits up to 15s for /api/health, then confirms /api/openapi.json and
    /torznab/api?t=caps respond. Greps boot log for panic/fatal.
  - docker build job verifies the Dockerfile still produces an image.

Plus a new CodeQL workflow (security-and-quality queries) that runs on
push, PR, and weekly cron so post-merge dependency CVEs surface without
manual intervention.

Bumped CI Go to 1.25.x (matches the Dockerfile). go.mod's 1.24.0 floor
unchanged.

Pre-push verification ran the full gate suite locally — all clean,
including the new smoke test.
@JeremiahM37 JeremiahM37 self-assigned this May 13, 2026
@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

CI's govulncheck caught GO-2025-3770: Host header injection leading to
open redirect in chi's RedirectSlashes (chi v5.2.1 -> fixed in v5.2.2).
Bumping to v5.2.5 to clear the finding and pick up subsequent patches.

No code changes — chi's API is stable across this range.
@JeremiahM37 JeremiahM37 merged commit 383eae1 into main May 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants