invalidate http sessions on mqtt password change and reset#70
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handle_password_change_mqttandhandle_password_reset_submit_mqttnow destroy every HTTP session for the affected user and revoke their JTIs, matching the HTTP-path behavior added in invalidate other sessions on password change #68.HttpServerConfignow owns theArc<SessionStore>andArc<JtiRevocationStore>, so the same instances back both the HTTP server and the MQTT handler task.MqdbAgentsnapshots the Arcs inwith_http_configand threads Option references throughMessageContext→AdminContext(Option because cluster-agent mode has no HTTP server).Session/NewSession/SessionRefcarry thejtidirectly (captured when the JWT is minted), sodestroy_others_by_canonical_idreturns JTIs instead of JWTs andhandle_logoutno longer decodes its own session's JWT.mint_callback_jwtreturns(jwt, jti)— all three callers updated.JtiRevocationStore::revokenowwarn!s when theMAX_REVOKED_JTIScap is hit (invalidate other sessions on password change #68 review nit).Test plan
cargo make dev(format + clippy + tests) — clean; the one pre-existing failure ismqdb-cluster::mqtt_transport_heartbeat_roundtripbecause port 11883 is held by a local frontend POC agent, unrelated to this branchsession_store.rs(destroy_others_skips_empty_jti_sessions,revoke_many_revokes_all_jtis); existing 3 destroy-others tests rewritten around JTIs