Skip to content

fix(auth): publish fingerprinted hosted session expiry - #664

Merged
senamakel merged 4 commits into
epic/8369-security-migrationfrom
issue/hosted-session-401-provenance
Oct 24, 2026
Merged

senamakel merged 4 commits into
epic/8369-security-migrationfrom
issue/hosted-session-401-provenance

Conversation

@senamakel

Copy link
Copy Markdown
Owner

HostedClient converts hosted session 401s into SESSION_EXPIRED errors, but the core dispatcher no longer infers which credential a request used. Without a request-owned expiry event, hosted 401s leave the current session active.

The hosted client now fingerprints the exact trimmed session bearer used to build its SDK client and publishes SessionExpired with that fingerprint on a session 401. API-key 401 handling remains unchanged.

The wiremock regression sends a hosted request with a known bearer and checks that the expiry event carries the matching fingerprint. It failed before the publisher because the event timed out, and passes with the fix. The full hosted client unit group passes (12 tests).

Follow-up to senamakel/openhuman#636 / PR #663. Part of tinyhumansai/openhuman#8369.

senamakel and others added 4 commits October 24, 2026 12:33
Add a test asserting that a hosted session 401 publishes a SessionExpired
event carrying the fingerprint of the request credential, so the expiry
signal can be matched back to the credential that was rejected.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test now matches on the event stream's Option-based receive results instead of the previous Result with TryRecvError, so it compiles against the updated tinybus channel interface.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Hosted clients now record a fingerprint of the session credential at
construction and, when a request fails with a 401 while using a session
credential, publish a SessionExpired domain event naming the operation and
fingerprint. This lets the rest of the system react to a rejected session
instead of only surfacing the error to the caller.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reordered the import list in the hosted client and reformatted the 401
session-expiry check so the matches! guard and the credential-kind
condition sit on separate lines. No behaviour change.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit 66a4242 into epic/8369-security-migration Oct 24, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant