OIDC state cookie name "oidc:${providerId}" is not a valid RFC 6265 cookie name; dropped by Go net/http proxies, breaking SSO login
Describe the bug
The OIDC state cookie name is oidc:${providerId} (e.g. oidc:<uuid>), which contains :. A cookie name must be a token per RFC 6265 §4.1.1, and : is a separator, so the name is not a legal cookie name.
Standards-following intermediaries therefore drop the cookie. Go net/http based reverse proxies (e.g. the NetBird reverse proxy) parse and re-serialise the Cookie header and silently discard any cookie whose name is not a valid token, so on the OIDC callback validate() finds no state cookie and the login fails with:
{"message":"OIDC error. Unable to verify authentication request state.","statusCode":400}The same flow succeeds when the request reaches Docmost without such an intermediary, so the cookie only survives on paths where nothing re-parses the header.
Version
0.96.0 (reproduced against the compiled server in the docmost/docmost:0.96.0 image — apps/server/dist/ee/sso/services/oidc.service.js sets stateCookieKey to oidc:${providerId})
To reproduce
- Put Docmost behind a proxy that re-parses cookies with Go
net/http(e.g. NetBird reverse-proxy 0.74.7). - Configure an OIDC provider and start the login.
- The callback returns 400
Unable to verify authentication request state; theoidc:<providerId>cookie never reaches Docmost.
Suggested fix
Use a token-safe cookie name, e.g. oidc_${providerId}. The Google SSO state cookie has the same problem (google:state). SAML does not set a state cookie in the compiled code (only ssoRedirect / authToken, both token-safe), so OIDC and Google SSO are the affected flows.
Source: docmost/docmost