Repository navigation
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.