clean-whale-52844
03/12/2025, 4:55 PM{
"id": "da42871f-ccfb-413d-be59-ba98c0323ff6",
"error": {
"code": 500,
"status": "Internal Server Error",
"message": "securecookie: error - caused by: crypto/aes: invalid key size 35"
},
"created_at": "2025-03-12T16:37:08.920426Z",
"updated_at": "2025-03-12T16:37:08.920426Z"
}
Looking at my kratos.yml the relevant snippet is currently:
secrets:
cookie:
- 7VPgn1v59aVrjlOeOVZy+ZSP/oSsXQ==
- PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
cipher:
- VZ3Oi1l5Tbj9xFXxZoYR7DDA6Vng/Q==
- 32-LONG-SECRET-NOT-SECURE-AT-ALL
ciphers:
algorithm: xchacha20-poly1305
So it should be using xchacha20 rather than AES, and the key is 32 long... so where is the error coming from?
I can see the following lines in the kratos log journal, but I don't know what to do next.
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: time=2025-03-12T16:50:57Z level=error msg=An error occurred and is being forwarded to the error user interface. audience=application error=map[message:securecookie: error - caused by: crypto/aes: invalid key size 35 stack_trace:
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/x.SessionPersistValues|github.com/ory/kratos/x.SessionPersistValues>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/x/cookie.go:22
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/continuity.(*ManagerCookie).Pause|github.com/ory/kratos/continuity.(*ManagerCookie).Pause>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/continuity/manager_cookie.go:64
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/selfservice/strategy/oidc.(*Strategy).initLinkProvider|github.com/ory/kratos/selfservice/strategy/oidc.(*Strategy).initLinkProvider>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/selfservice/strategy/oidc/strategy_settings.go:380
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/selfservice/strategy/oidc.(*Strategy).Settings|github.com/ory/kratos/selfservice/strategy/oidc.(*Strategy).Settings>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/selfservice/strategy/oidc/strategy_settings.go:312
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/selfservice/flow/settings.(*Handler).updateSettingsFlow|github.com/ory/kratos/selfservice/flow/settings.(*Handler).updateSettingsFlow>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/selfservice/flow/settings/handler.go:595
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/selfservice/flow/settings.(*Handler).RegisterPublicRoutes.(*Handler).IsAuthenticated.func7|github.com/ory/kratos/selfservice/flow/settings.(*Handler).RegisterPublicRoutes.(*Handler).IsAuthenticated.func7>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/session/handler.go:853
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/x.(*RouterPublic).POST.NoCacheHandle.func1|github.com/ory/kratos/x.(*RouterPublic).POST.NoCacheHandle.func1>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/x/nocache.go:21
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/ory/kratos/x.(*RouterPublic).Handle.NoCacheHandle.func1|github.com/ory/kratos/x.(*RouterPublic).Handle.NoCacheHandle.func1>
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: /project/x/nocache.go:21
Mar 12 16:50:57 ip-10-0-1-213 kratos[111802]: <http://github.com/julienschmidt/httprouter.(*Router).ServeHTTP|github.com/julienschmidt/httprouter.(*Router).ServeHTTP>
steep-lamp-91158
steep-lamp-91158
// The encryption key, if set, must be either 16, 24, or 32 bytes to select
// AES-128, AES-192, or AES-256 modes.
this is from the library we use to generate the session cookiessteep-lamp-91158
clean-whale-52844
03/13/2025, 10:17 AMsteep-lamp-91158
PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
secret which is 35 characters longsteep-lamp-91158
steep-lamp-91158
steep-lamp-91158
steep-lamp-91158
clean-whale-52844
03/13/2025, 11:12 AMclean-whale-52844
03/13/2025, 12:28 PMsteep-lamp-91158