fix(login): omit client_id from password_login body when empty #13

Merged
YousifShkara merged 1 commit from fix/login-skip-empty-client-id into main 2026-05-29 06:51:00 +02:00
Owner

bunyip-web's password_login unconditionally put cfg.client_id into the JSON body it POSTed to mokosh-server's /v1/auth/login. mokosh-server types LoginRequest.client_id as Option<uuid::Uuid>; serde's behaviour for that shape accepts a missing field or null as None, accepts a valid UUID string as Some, and 422s on anything else (including the empty string).

bunyip-web's OidcConfig::from_env() falls back to "" whenever the image was built without BUNYIP_OIDC_CLIENT_ID set - the common shape for staging deploys where the SaaS shell only needs an OP-session cookie (no per-RP token bundle). On those deploys every /login submit returned 422 Unprocessable Content; the SPA mapped that to the generic "Email or password didn't match" toast even when the credentials were correct, and the audit log contained zero matching attempts because the request never made it past the deserialiser.

Switch to a json!() builder that includes client_id only when the configured value is non-empty. mokosh-server then deserialises the body as client_id: None and falls back to the legacy session-cookie-only flow, which is what staging actually wants.

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

bunyip-web's password_login unconditionally put `cfg.client_id` into the JSON body it POSTed to mokosh-server's /v1/auth/login. mokosh-server types LoginRequest.client_id as `Option<uuid::Uuid>`; serde's behaviour for that shape accepts a missing field or null as None, accepts a valid UUID string as Some, and 422s on anything else (including the empty string). bunyip-web's OidcConfig::from_env() falls back to `""` whenever the image was built without BUNYIP_OIDC_CLIENT_ID set - the common shape for staging deploys where the SaaS shell only needs an OP-session cookie (no per-RP token bundle). On those deploys every /login submit returned 422 Unprocessable Content; the SPA mapped that to the generic "Email or password didn't match" toast even when the credentials were correct, and the audit log contained zero matching attempts because the request never made it past the deserialiser. Switch to a json!() builder that includes `client_id` only when the configured value is non-empty. mokosh-server then deserialises the body as `client_id: None` and falls back to the legacy session-cookie-only flow, which is what staging actually wants. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fix(login): omit client_id from password_login body when empty
All checks were successful
build / Build and push OCI images (pull_request) Has been skipped
build / Lint and type-check (pull_request) Successful in 14s
ae197fb2fe
bunyip-web's password_login unconditionally put `cfg.client_id` into the JSON body it POSTed to mokosh-server's /v1/auth/login. mokosh-server types LoginRequest.client_id as `Option<uuid::Uuid>`; serde's behaviour for that shape accepts a missing field or null as None, accepts a valid UUID string as Some, and 422s on anything else (including the empty string).

bunyip-web's OidcConfig::from_env() falls back to `""` whenever the image was built without BUNYIP_OIDC_CLIENT_ID set - the common shape for staging deploys where the SaaS shell only needs an OP-session cookie (no per-RP token bundle). On those deploys every /login submit returned 422 Unprocessable Content; the SPA mapped that to the generic "Email or password didn't match" toast even when the credentials were correct, and the audit log contained zero matching attempts because the request never made it past the deserialiser.

Switch to a json!() builder that includes `client_id` only when the configured value is non-empty. mokosh-server then deserialises the body as `client_id: None` and falls back to the legacy session-cookie-only flow, which is what staging actually wants.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
YousifShkara deleted branch fix/login-skip-empty-client-id 2026-05-29 06:51:00 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/bunyip!13
No description provided.