fix(startup): fail loud when configured SSO bootstrap fails #223
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pms-289-sso-fail-loud-when-configured"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Makes a configured-but-broken SSO bootstrap fatal instead of a silent degrade to legacy auth. Closes PMS-289. Sibling to PMS-286 (fatal PSA migrations).
try_bootstrap_ssocollapsed two outcomes into oneErr, andmaintreated them identically (WARN + run legacy-only):from_env(partial/invalid config) orbootstrap(auth migrations, key load) failed - a real error.So a configured deployment whose SSO bootstrap broke silently lost its OIDC / at+jwt verification path with only a WARN.
Change
SsoSetupenum +sso_is_configured(): SSO is "configured" when any requiredMOKOSH_AUTH_*env var is set (MOKOSH_AUTH_ISSUER,_JWT_PRIVATE_KEY_PATH,_JWT_ACTIVE_KID,_JWT_PUBLIC_KEYS_DIR,_DATA_ENCRYPTION_KEY).try_bootstrap_sso: returnsOk(NotConfigured)when none set;Ok(Mounted)on success;Err(fatal) when configured but bootstrap fails.main:NotConfigured-> WARN + legacy-only (unchanged);Err-> ERROR + return frommain-> exit non-zero.No new env var. The legacy-only path (no
MOKOSH_AUTH_*) is unchanged.Tests
sso_is_configured_tracks_env_presence: none set => not configured; any set => configured.main()isn't unit-testable), same approach as PMS-286: withMOKOSH_AUTH_*set but e.g. an unreadable key dir, the server logsERROR ... SSO is configured but failed to bootstrapand exits non-zero instead of coming up legacy-only.Verification
cargo test --bin mokosh-server sso_is_configured_tracks_env_presence: 1 passed.cargo fmt --all --checkclean;cargo clippy --bin mokosh-serverclean.