Repository navigation
Releases
v1.1.1
What's Changed
- ci: drop unused pcregrep install step by @mikehelmick in #69
- chore(deps): Bump actions/setup-go from 7.0.0 to 7.1.0 by @dependabot[bot] in #68
- chore(deps): Bump the go-deps group across 1 directory with 3 updates by @dependabot[bot] in #67
Full Changelog: v1.1.0...v1.1.1
v1.1.0
go-bananas v1.1.0
Summary
v1.1.0 is a security hardening release. It fixes every verified finding from a
2026-11 security review of the framework, changes several defaults to safe
values, and adds a native Go fuzz suite (39 targets, run nightly in CI).
Three issues are exploitable on v1.0.x and have advisories:
- GHSA-g2rq-85pp-c2j9: CSRF bypass through
middleware.MutateMethod. Also fixed in v1.0.2. - GHSA-93pv-fv98-p53j: key-version path traversal in
keys.(*Filesystem).Decrypt. Also fixed in v1.0.2. - GHSA-fqhp-2jm8-w3vm: split session cookies survive logout and expiry in
middleware.RequireSession. Also fixed in v1.0.2.
v1.0.2 is a patch release that carries only these three fixes, for anyone
who can't take the v1.1.0 default changes yet.
No exported signatures change except by gaining trailing variadic options (see
API changes). Ciphertext and cookie formats are unchanged. See
Rollback before relying on a downgrade.
Upgrading: read Migration from v1.0.x before you
bump. Several changes compile cleanly but change runtime behavior.
Go toolchain
Build with Go ≥ 1.27.4. Go 1.27.0–1.27.3 are affected by GO-2026-6859
(net/http), which is reachable from go-bananas servers. The module's go
directive stays at 1.27, so update your CI and build images yourself, and run
govulncheck ./.... go-bananas CI now pins 1.27.4 and runs a pinned
govulncheck.
Security fixes
Found by a security review of the codebase unless noted otherwise.
| Severity | Area | Fix |
|---|---|---|
| High | middleware.MutateMethod |
Only POST can be overridden, only to PUT/PATCH/DELETE, only from a urlencoded body (≤ 64 KB, never multipart, never the query string). Previously a POST with _method=GET reached the POST handler while HandleCSRF saw a GET and skipped validation. (GHSA-g2rq-85pp-c2j9) |
| High | Split session cookies | A captured _gbs-<key> split cookie, replayed without its main session cookie, was joined into a fresh session, so values stored there outlived logout and max age. Split cookies are now bound to their main session by a random ID (stored under the reserved session key "_gbs_binding") and expired with it. Found during this release's build. (GHSA-fqhp-2jm8-w3vm; also fixed in v1.0.2) |
| Low | keys.Filesystem (development provider) |
Decrypt used the ciphertext's version prefix as a path element without validation, so ../otherKey/<ver>:… decrypted with a different key under the same root. Versions must now be decimal digits; reads go through os.OpenRoot. (GHSA-93pv-fv98-p53j) |
| Medium | middleware.SecureHeaders |
No longer trusts X-Forwarded-Host for the HTTPS redirect (open redirect and cache poisoning). New WithSSLHost, WithAllowedHosts, WithTrustedHostHeaders. |
| Medium | Template serverEndpoint |
No longer derived from the client Host header outside dev mode. New TemplateConfig.AllowedHosts. |
| Medium | cookiestore.New |
Cookies are always HttpOnly and Secure; SameSite defaults to Lax; SameSite=None forces Secure; the caller's options are no longer mutated. New WithInsecureCookies() for local HTTP dev. |
| Medium | Sessions | Sessions record a creation time. New opt-in middleware.CheckSessionMaxAge enforces an absolute lifetime. |
| Medium | server.ServeHTTPHandler |
Adds ReadTimeout 5m and IdleTimeout 120s (slow-read and idle-connection exhaustion). |
| Medium | secrets/vault |
References without ?version= read the latest version instead of version 1, so rotation takes effect. |
| Medium | keys/azure |
Encrypt errors on non-empty AAD instead of silently ignoring it. |
| Medium | cache.WriteThruLookup |
The backend lookup no longer holds the cache-wide lock; concurrent callers coalesce per key. |
| Low | middleware.HandleCSRF |
Form bodies are capped at 1 MiB before parsing (was up to 32 MiB plus temp files, before authentication). Multipart temp files are removed. TRACE is no longer a safe method. |
| Low | Azure vault names | Validated against ^[A-Za-z0-9-]{3,24}$ so a crafted name can't send the bearer token to another host. |
| Low | keys/vault |
Sign sends key_version, so signatures match the advertised key after rotation. |
| Low | render.RenderCSV |
Content-Disposition filename is encoded with mime.FormatMediaType (parameter injection). |
| Low | render.RenderJSON |
The error body is always valid JSON. |
| Low | toJSON template func |
Returns template.JS of escaped JSON (was []byte). |
| Low | HSTS | preload is now opt-in (WithHSTSPreload). |
| Low | flash |
No panic when a session flash key holds a non-map value. |
| Low | response.Back |
Follows only same-host http/https referrers; strips userinfo. |
| Low | cache.New |
TTLs above 100 years are rejected (overflow made every Set miss); one purge goroutine per expired key. |
| Low | examples/ssr-oidc |
Logout is POST with CSRF; constant-time state and nonce compare; flow state cleared before the response; admin requires email_verified; OAuth error handled. Outside dev mode, SecureHeaders is pinned with WithAllowedHosts (from ALLOWED_HOSTS) or WithSSLHost (from the host of SERVER_ENDPOINT), so other Host values get 400. |
| Low | CI supply chain | Every workflow (ci.yml, fuzz.yml, pages.yml, codeql-analysis.yml) pins actions by commit SHA with persist-credentials: false; govulncheck is version-pinned; the fuzz workflow uploads no artifacts and has contents: read only. |
Found by fuzzing
renderjoinStrings/toSentencepanicked on a nil value, so
{{joinStrings .missing ", "}}returned a 500. They now render"".response.RealHostFromRequestdropped IPv6 brackets
(https://2001:db8::1:8443); it now usesnet.JoinHostPortand returns
https://[2001:db8::1]:8443.::1(with or without brackets) now counts as
localhost and getshttp:http://[::1]:8080, where v1.0.x gave
https://::1:8080.
Other fixes
keys.Filesystem.Encryptpicks the latest version numerically (it compared as
text, so9beat10), andSigningKeyVersionsskips stray non-numeric files
instead of failing.keys/azure.SigningKeyVersionsworks (it failed on every call), returns
VAULT/KEY/VERSIONIDs, sorts newest first, and omits disabled versions.keys/vault.SigningKeyVersionssorts newest first, andparseKeyIDaccepts
thename/Nform thatKeyID()returns.secretsCacher fetches run on a context detached from every caller's
cancellation and deadline, with a fixed 30s timeout, so one cancelled
request no longer fails coalesced callers.- The 404 and 405 pages in the example now carry the security headers.
New: fuzz suite
Native go test -fuzz targets live next to the code, with seeds in
testdata/fuzz/ that replay in every go test. make fuzz runs every target;
a nightly workflow runs each for 60s.
Migration from v1.0.x
Use the upgrade skill. skills/go-bananas-upgrade
is the authoritative list: it gives a grep, an "affected if" and an exact fix
for every item below, and flags the items that need a human decision. Install it
with /plugin marketplace add mikehelmick/go-bananas and ask Claude Code to
"upgrade go-bananas to v1.1". Scan before you bump: the build alone won't
catch most of these.
Docs: middleware chain,
sessions and CSRF,
server,
secrets and keys,
rendering,
cache.
The numbers below match the skill's entries.
Routing and CSRF
MutateMethodignores_methodin the query string, in multipart
bodies, in urlencoded bodies over 64 KB or that fail strict parsing, on
non-POST requests, and for targets other than PUT/PATCH/DELETE; the request
stays POST. Underr.Useit only changes what later handlers see, not which
route matches. Wrap the router (middleware.MutateMethod()(r)) and keep every
overridable route behindHandleCSRF.- State-changing routes need an explicit
.Methods(...)with POST (or
PUT/PATCH/DELETE).HandleCSRFnever checks GET/HEAD/OPTIONS, so a route
without.Methodsaccepts HEAD and OPTIONS without a token, and GET logout
or delete links are unprotected. TRACE now requires a token. See
Routes must set.Methods. HandleCSRFcaps form-token request bodies at 1 MiB (413), and the limit
carries into the handler (form.Bind,r.FormFile). Header-token and
streaming requests are not capped. For uploads, give the upload routes their
ownHandleCSRF(h, WithCSRFMaxBodyBytes(n))on a subrouter, take
HandleCSRFoff the root router, put the rest on anappsubrouter,
and move the middleware that ran afterHandleCSRFonto both. Every route
left on the root router runs without CSRF protection. See
Request body limit.
Proxies and hosts
SecureHeadersdistrustsX-Forwarded-Host, and HSTSpreloadis
opt-in. Behind a proxy that rewritesHost, add
WithSSLHost("www.example.com"), or `WithTrustedHostHeaders("X-F...
v1.0.2
go-bananas v1.0.2
A security patch release for v1.0.x. It carries only three security fixes,
plus the one-time split-cookie change that the third one requires (see
Compatibility). Most users should move to v1.1.0, which
includes these fixes plus further hardening; v1.0.2 is for apps that need time
before taking v1.1.0's default changes.
Security fixes
- CSRF bypass through
middleware.MutateMethod
(GHSA-g2rq-85pp-c2j9).
MutateMethodrewrote any request method from a_methodvalue in the body
or the query string, including POST → GET. When it was installed withr.Use,
the POST handler ran whileHandleCSRFsaw a GET and skipped token
validation. It now overrides onlyPOST, only toPUT,PATCHorDELETE,
and only from a urlencoded body of at most 64 KB. Query-string and multipart
values are ignored. - Key-version path traversal in
keys.(*Filesystem).Decrypt
(GHSA-93pv-fv98-p53j).
Decryptused the ciphertext's version prefix as a path element without
validation, so a crafted prefix such as../otherKey/<version>decrypted with
a different key under the same key root. The version must now be decimal
digits, and the key is read inside the key's own directory.Encryptand
SigningKeyVersionsalso ignore non-numeric version files and compare
versions numerically. - Split session cookies survive logout and session expiry in
middleware.RequireSession/RequireNamedSession(
GHSA-fqhp-2jm8-w3vm).
A captured_gbs-<key>split cookie, replayed without its main session
cookie, was joined into a fresh session, so values stored there outlived
logout and session expiry. Split cookies are now bound to their main session
by a random ID, joined only when the IDs match and the session isn't new, and
expired when the session is deleted (Options.MaxAge < 0). Only apps that pass
split-value keys toRequireSessionorRequireNamedSessionare affected.
Compatibility
- One-time split-cookie drop. Split cookies (
_gbs-<key>) written by
earlier v1.0.x releases carry no binding, so their values are dropped once
after the upgrade and must be set again (for example a stored ID token, which
may force a re-login). During a rolling deploy this repeats each time a
visitor moves from an older v1.0.x instance back to a v1.0.2 instance.
Apps that passnilassplitValuessee no change. - Reserved session key
"_gbs_binding". The binding ID is stored in the
main session under this string key. Apps must not set or remove it. Earlier
v1.0.x can still decode v1.0.2 sessions, but a downgrade joins split cookies
without the check and is exposed to that issue again. v1.1.0 uses the same binding,
so moving on from v1.0.2 to v1.1.0 drops nothing further. - Ciphertext written by
CreateKeyVersion-managed keys is unaffected. _methodoverrides that are now ignored: query string, multipart bodies,
bodies over 64 KB or with malformed escapes, non-POST requests, and targets
other than PUT/PATCH/DELETE. To change routing, wrap the router with
middleware.MutateMethod()(router).
Go toolchain
Build with Go ≥ 1.27.4. Earlier 1.27.x releases are affected by
GO-2026-6859 (net/http). Run govulncheck ./... after upgrading.
go get github.com/mikehelmick/go-bananas@v1.0.2Note: on routers that use split session values, every session (including anonymous ones) now carries the reserved "_gbs_binding" key. Code that treats an empty session.Values as "logged out" should check for its own keys instead.
v1.0.1
What's Changed
- chore(deps): Bump golang.org/x/oauth2 from 0.37.0 to 0.38.0 in /examples/ssr-oidc in the go-deps group by @dependabot[bot] in #48
- Update all dependencies by @mikehelmick in #49
Full Changelog: v1.0.0...v1.0.1
v1.0.0
What's Changed
Go 1.27 update ; no major updates, but framework is stable.
- chore(deps): Bump the go-deps group across 1 directory with 6 updates by @dependabot[bot] in #33
- chore(deps): Bump the go-deps group across 1 directory with 2 updates by @dependabot[bot] in #36
- Update all dependencies, require Go 1.27, migrate to golangci-lint v2 by @mikehelmick in #42
Full Changelog: v0.3.3...v1.0.0
What's Changed
- chore(deps): Bump the go-deps group across 1 directory with 6 updates by @dependabot[bot] in #33
- chore(deps): Bump the go-deps group across 1 directory with 2 updates by @dependabot[bot] in #36
- Update all dependencies, require Go 1.27, migrate to golangci-lint v2 by @mikehelmick in #42
- Update docs site to Docsy 0.18, Hugo 0.168, Node 24 by @mikehelmick in #43
Full Changelog: v0.3.3...v1.0.0
v0.3.3
What's Changed
- Fix ssr-oidc example build and cover example modules in CI by @mikehelmick in #30
- Demonstrate 401 vs 403 with an authorized /admin route in the example by @mikehelmick in #31
Full Changelog: v0.3.2...v0.3.3
v0.3.2
What's Changed
- Add HTTP 403 Forbidden response helper and documentation by @mikehelmick in #29
Full Changelog: v0.3.1...v0.3.2
v0.3.1
Release capturing recent dependency updates only.
What's Changed
- chore(deps): Bump github.com/coreos/go-oidc/v3 from 3.18.0 to 3.19.0 in /examples/ssr-oidc in the go-deps group by @dependabot[bot] in #15
- chore(deps): Bump actions/checkout from 6 to 7 by @dependabot[bot] in #14
- chore(deps): Bump google.golang.org/api from 0.284.0 to 0.285.0 in the go-deps group by @dependabot[bot] in #13
- chore(deps): Bump google.golang.org/api from 0.285.0 to 0.286.0 in the go-deps group by @dependabot[bot] in #16
- chore(deps): Bump the go-deps group across 1 directory with 8 updates by @dependabot[bot] in #19
- chore(deps): Bump the go-deps group in /examples/ssr-oidc with 2 updates by @dependabot[bot] in #18
- chore(deps): Bump github.com/sethvargo/go-envconfig from 1.3.1 to 1.4.2 in /examples/ssr-oidc in the go-deps group by @dependabot[bot] in #23
- chore(deps): Bump actions/setup-go from 6 to 7 by @dependabot[bot] in #22
- chore(deps): Bump actions/setup-node from 6 to 7 by @dependabot[bot] in #21
- chore(deps): Bump the go-deps group with 8 updates by @dependabot[bot] in #20
- chore(deps): Bump the go-deps group with 8 updates by @dependabot[bot] in #24
- chore(deps): Bump github.com/sethvargo/go-envconfig from 1.4.2 to 1.4.3 in /examples/ssr-oidc in the go-deps group by @dependabot[bot] in #25
- chore(deps): Bump the go-deps group with 5 updates by @dependabot[bot] in #26
- chore(deps): Bump the go-deps group across 1 directory with 7 updates by @dependabot[bot] in #28
Full Changelog: v0.3.0...v0.3.1
v0.3.0 — form handling + config
Two composable, storage-free primitives that close the most central remaining SSR gap, while keeping the core lean (curated-toolkit philosophy — no ORM, no generators, nothing that forces a storage opinion).
✨ Highlights
form package (new)
The server-side parse → validate → re-render loop, previously fully manual.
form.Bind(r, dst) (Errors, error)—gorilla/schemabinding +go-playground/validatortags, with errors keyed by theformfield name so one name spans your HTML, binding, and errors.- Honest two-failure-mode contract: a non-nil
errormeans an unprocessable request (respond400);Errors.Any()means invalid user input (re-render with per-field errors and the user's input preserved). - Optional
Validatorhook for cross-field / bespoke rules thevalidatetags can't express (e.g. a must-accept-terms checkbox). - New dependencies are isolated to this package — the rest of the framework (and your
secrets/keysbuilds) stays free of them, and cloud-isolation is unchanged.
type signup struct {
Email string `form:"email" validate:"required,email"`
Age int `form:"age" validate:"gte=18"`
}
errs, err := form.Bind(r, &in)
if err != nil { response.BadRequest(w, r, renderer); return } // unprocessable
if errs.Any() { // invalid input
renderer.RenderHTMLStatus(w, http.StatusUnprocessableEntity, "signup",
webctx.TemplateMap{"Form": in, "Errors": errs})
return
}Configuration via go-envconfig
- No new package:
logging.Configfollows the existingsecrets.Config/keys.Configenv-tag pattern, and apps compose one config struct processed by a singleenvconfig.Process. - The example drops its hand-rolled
env/envBoolhelpers in favor of a composedappConfig.
render
- 422 Unprocessable Entity is now an allowed response code — the conventional status for a form that failed validation.
📚 Docs & example
- New Forms and Configuration guides.
examples/ssr-oidcwires the full validated/submitloop (422 re-render with preserved input, success flash + redirect) and the composed config.
✅ Quality
- Reviewed by parallel security / correctness / design agents across multiple models;
govulncheckclean on both modules; cloud isolation preserved (form/logging/secrets= 0);go test -race,golangci-lint, and the docs build all green.
Full changelog: v0.2.0...v0.3.0
v0.2.0 — static assets, CSP, i18n, request logging, health endpoints
The second release of go-bananas closes the gaps identified after v0.1.0, with parallel security + code reviews applied on top.
Install
go get github.com/mikehelmick/go-bananas@v0.2.0Requires Go 1.26+.
Highlights
🐛 Static assets actually serve
The renderer's SRI tags pointed at /static/... but nothing served the files. New middleware.ConfigureStaticAssets adds dev/prod cache headers and rejects directory requests (no auto-listings); the example serves its embedded assets behind it.
🔒 Security
middleware.ContentSecurityPolicy— per-request CSP header whose{{nonce}}placeholder shares theProcessNoncenonce with templates.PopulateTraceIDnow validates the client-supplied trace ID before it can reach outbound headers.- The example defaults
DEV_MODE=false(fail-safe) and wires a 30-minute session idle timeout that logs idle users out.
🌍 Internationalization
New i18n package — a gotext-backed LocaleProvider (gettext .po loading with full Accept-Language matching via x/text/language), so ProcessLocale and the t/tDefault template functions work out of the box. The example ships en/es catalogs — try /?lang=es.
📊 Observability & ops
middleware.LogRequests— one structured access-log line per request (method, path, status, bytes, duration), tagged with request/trace IDs.server.HealthzHandler/server.ReadyzHandler— liveness and pluggable readiness probes. Readiness lists failing check names only (details stay in logs) and survives panicking checks.
Reviews
Parallel security and code review of the changes; all findings fixed before release (readyz error-string disclosure, static directory listings, an i18n reload-mode RWMutex hardening, CSP whitespace, idle-timeout logout). go test -race, golangci-lint, and govulncheck all clean.
New core dependency: golang.org/x/text (language matching).
Docs: https://mikehelmick.github.io/go-bananas · Full changelog: v0.1.0...v0.2.0