Skip to content

ci(golangci-lint): enable strict lint gate#782

Merged
cssbruno merged 1 commit into
mainfrom
ci/strict-golangci-lint
Jun 27, 2026
Merged

ci(golangci-lint): enable strict lint gate#782
cssbruno merged 1 commit into
mainfrom
ci/strict-golangci-lint

Conversation

@cssbruno

Copy link
Copy Markdown
Owner

Summary

  • Adds a strict golangci-lint v2.12.2 configuration, pinned local runner, and GitHub Actions lint workflow.
  • Fixes the findings surfaced by the enabled linters without adding a baseline or exclude list.
  • Removes unused internal helpers where lint proved they were dead code.
  • Updates CI documentation for the new lint gate.

Issue Closure

Related: lint gate hardening; no issue auto-close.

Verification

  • I ran the relevant tests, lint, and build commands.
  • I ran scripts/test-go-modules.sh when Go code or compiler behavior changed.
  • I ran go build ./cmd/gowdk when CLI, compiler, runtime, addon, or release behavior changed.
  • I ran node --check editors/vscode/extension.js when editor files changed.
  • I updated docs for behavior, setup, or architecture changes.
  • I added or updated tests for changed behavior.
  • I considered security-sensitive surfaces such as auth, CSRF, redirects, request-time handlers, logs, diagnostics, embedded assets, editor commands, WASM, contracts, and realtime behavior.

Commands run:

  • scripts/check-golangci-lint.sh -> 0 issues.
  • go test ./internal/publicapi -count=1
  • go test ./internal/gowdkcmd -run 'TestBuildCommandProductionScansFinalArtifactsForSecrets|TestBuildCommandProductionBlocksInsecureAuditFindings|TestComputeAuditDiffClassifiesIntroducedResolvedUnchanged' -count=1
  • go build ./cmd/gowdk
  • git diff --check

Known gap: full go test ./... was attempted earlier, but the existing nested internal/gowdkcmd integration tests ran excessively long. This PR is validated with the lint gate and focused tests for the touched late fixes.

LLM Assistance

  • LLM session summary: Codex added the strict lint config and runner, fixed lint findings across the repository, rebased the work onto current main, resolved conflicts, and opened this draft PR.
  • Human-reviewed assumptions: no golangci baseline or exclude list should be used; dead unused helpers can be deleted when no call sites remain.
  • Follow-up work: run the full repository/module test suite in CI or an environment where the long internal/gowdkcmd integration tests can complete.

@github-actions github-actions Bot added compiler Compiler internals, pipeline, and generated metadata parser .gwdk parser and syntax handling IR Internal compiler IR and phase handoffs generated Go Generated Go source and adapter output runtime GOWDK Runtime packages and server behavior SSR Request-time page rendering client Generated browser enhancement runtime WASM Go js/wasm artifacts and islands security Security hardening and security-sensitive behavior ops Operations, release, deployment, and CI hardening docs Documentation work examples Examples and sample applications LSP Language server and editor tooling labels Jun 27, 2026
@cssbruno cssbruno marked this pull request as ready for review June 27, 2026 13:17
@cssbruno cssbruno merged commit 5bec0c3 into main Jun 27, 2026
96 of 98 checks passed
@cssbruno cssbruno deleted the ci/strict-golangci-lint branch June 27, 2026 13:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bddd2aec3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// path rather than a PATH lookup inside the sandbox.
func resolveGoRoot() (string, error) {
goRoot := strings.TrimSpace(runtime.GOROOT())
output, err := exec.Command("go", "env", "GOROOT").Output()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid PATH lookup before sandbox confinement

In hosted playground runs, resolveGoRoot executes before LaunchSandbox/ConfineToSandbox and now resolves go through the host PATH. If that environment contains an attacker-writable directory, submitted code can supply a fake go that runs outside the sandbox or returns an arbitrary GOROOT to mount, undermining the fail-closed sandbox boundary. Use the baked-in runtime.GOROOT() or another trusted absolute toolchain path instead.

Useful? React with 👍 / 👎.

request.Header.Del("Accept-Encoding")
proxy := &httputil.ReverseProxy{
Rewrite: func(proxyRequest *httputil.ProxyRequest) {
proxyRequest.SetURL(target)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the inbound Host in the dev proxy

For requests proxied by gowdk dev, ProxyRequest.SetURL rewrites the outbound Host to the runtime target port, unlike the previous NewSingleHostReverseProxy behavior. The runtime's safeRedirectPath accepts an absolute same-origin Referer only when it matches request.Host, so browser redirects from the dev host (for example cookie acknowledgement back to 127.0.0.1:8080/foo) now see request.Host as the hidden runtime port and fall back to /. Set proxyRequest.Out.Host = proxyRequest.In.Host after SetURL.

Useful? React with 👍 / 👎.

case buildValueString:
encoded, _ := json.Marshal(v.text)
return string(encoded)
return strconv.Quote(v.text)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve JSON encoding for build data strings

When a build {} object/list contains a string with a control byte (for example "\x00"), buildFieldValueFromString unquotes it into a NUL byte and this line serializes it with strconv.Quote, producing Go-only escapes such as "\x00" instead of valid JSON (json.Valid rejects that form). The comment and downstream build-data map expect canonical JSON text, so generated data can no longer be parsed by JSON clients; keep using encoding/json for strings and object keys.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Generated browser enhancement runtime compiler Compiler internals, pipeline, and generated metadata docs Documentation work examples Examples and sample applications generated Go Generated Go source and adapter output IR Internal compiler IR and phase handoffs LSP Language server and editor tooling ops Operations, release, deployment, and CI hardening parser .gwdk parser and syntax handling runtime GOWDK Runtime packages and server behavior security Security hardening and security-sensitive behavior SSR Request-time page rendering WASM Go js/wasm artifacts and islands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant