diff --git a/Dockerfile b/Dockerfile index b35cd35..c67596b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ## toolchain, module cache, or source tree — is present in the final ## image; only the compiled binary is copied out of it below. ## --------------------------------------------------------------------- -FROM golang:1.26.9-alpine AS builder +FROM golang:1.27.2-alpine AS builder WORKDIR /src diff --git a/Makefile b/Makefile index 04740ae..ef2c969 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,12 @@ # Atualizar é deliberado: suba o número aqui, rode `make check`, e o # commit registra a troca. O CI chama estes mesmos alvos, então não há um # segundo lugar para desalinhar. -STATICCHECK_VERSION ?= v0.8.1 +STATICCHECK_VERSION ?= v0.8.2 GOVULNCHECK_VERSION ?= v1.7.0 -GOSEC_VERSION ?= v2.28.0 +# O gosec está fixado num commit do master, não numa tag: a v2.29.0, última +# release, não lê o export data do Go 1.27 (#316). É o mesmo pin do usher e +# do sapper; volta para uma tag quando uma ler (usher#146, sapper#56). +GOSEC_VERSION ?= d2b649ec01825c20bd101ec584e559adb287e578 # Connection string used by the local PostgreSQL instance started via # `make db-up` / `make docker-up` (see docker-compose.yml). Override on diff --git a/README.md b/README.md index 923cd44..6519af8 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ make build && ./bin/task-api # build a standalone binary ## Running with Docker -`Dockerfile` is a two-stage build: `golang:1.26.9-alpine` compiles a static (`CGO_ENABLED=0`) binary, copied into an empty `scratch` image — no shell, no libc, just the binary and a nonroot user. +`Dockerfile` is a two-stage build: `golang:1.27.2-alpine` compiles a static (`CGO_ENABLED=0`) binary, copied into an empty `scratch` image — no shell, no libc, just the binary and a nonroot user. ```bash make docker-build # build the image diff --git a/cmd/web/main.go b/cmd/web/main.go index bf5785a..00828ae 100644 --- a/cmd/web/main.go +++ b/cmd/web/main.go @@ -337,6 +337,12 @@ func spaHandler(distDir string, indexHTML []byte) http.Handler { return } + // #nosec G703 -- fsPath is path.Clean of a rooted request path + // joined under cleanDistDir, then checked by pathEscapesDir above + // (see this handler's opening comment and + // TestSPAHandler_PathTraversal_AttemptStillResolvesInsideDist). + // gosec's taint analysis sees the request path reach os.Stat and + // nothing of the containment in between. if info, err := os.Stat(fsPath); err == nil && !info.IsDir() { // Vite hashes every filename under assets/ (index-BusBMSGH.js), // so a given URL's content never changes — safe to cache diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 0d3abd5..8dca875 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -3206,3 +3206,33 @@ por padrão. da função e `TestSPAHandler_PathTraversal_AttemptStillResolvesInsideDist` já documentam. Vai precisar de um `#nosec G703` com essa justificativa quando a versão do gosec for atualizada. + +## Piso Go 1.27.2: o resíduo da GO-2026-6617 encerrado (issue #316) + +A entrada acima aceitou o piso 1.26.9 com um resíduo: um build local com Go +1.27.0 ou 1.27.1 satisfaz o piso e gera um binário vulnerável. O gatilho para +reabrir chegou com o `staticcheck` 2026.2.2 (v0.8.2, 2026-10-12), que "now +supports the updated export data format used by Go 1.27.2". `go.mod` e as duas +imagens passam para **1.27.2**, a única versão que exclui as duas linhas +vulneráveis, que é o mesmo piso do `usher` (usher#139). + +**Ferramentas:** `STATICCHECK_VERSION` vai para v0.8.2. O `gosec` não tem +release que leia o export data do Go 1.27: a v2.29.0, a última, também não +lê. Então `GOSEC_VERSION` fica fixado no commit `d2b649e` do master, o mesmo +pin do `usher` e do `sapper`, e volta para uma tag quando uma ler (usher#146, +sapper#56). + +**O G703 previsto acima apareceu, e foi anotado.** O gosec novo aponta o +`os.Stat(fsPath)` do `spaHandler` (`cmd/web/main.go`). É um falso positivo +pelo motivo já registrado, e o `#nosec G703` fica ao lado da chamada com essa +justificativa. + +Todos os gates foram conferidos **pelo código de saída**, em Go 1.27.2: +- `go build` e `go vet`, com e sem `-tags=integration`; +- `make lint`, que roda o staticcheck nas duas variantes; +- `make gosec` e `make vulncheck`; +- `make tidy-check`; +- `go test -race ./...`. + +Sem resíduo: os artefatos e qualquer build local que respeite o `go.mod` +estão em 1.27.2. diff --git a/go.mod b/go.mod index 9ec3098..b7c558c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/JonasBorgesLM/task-api -go 1.26.9 +go 1.27.2 require ( github.com/JonasBorgesLM/bastion v0.2.1 diff --git a/web/Dockerfile b/web/Dockerfile index 616665f..bb4efb2 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -47,7 +47,7 @@ RUN npm run build ## server either serves the files in /dist or it does not, and that is ## already visible from what index.html itself renders. ## --------------------------------------------------------------------- -FROM golang:1.26.9-alpine AS go-builder +FROM golang:1.27.2-alpine AS go-builder WORKDIR /src