Skip to content

fix: sync session lifespan watches directly to hardware key constraints - #24

Merged
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
Husten150:fix/session-wallet-sync
Jun 16, 2026
Merged

fix: sync session lifespan watches directly to hardware key constraints#24
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
Husten150:fix/session-wallet-sync

Conversation

@Husten150

Copy link
Copy Markdown
Contributor

Problem

When a user locks or disconnects their browser-based wallet, the backend API session remains active. \monitorWalletLock\ was polling the session storage (\utility-session) rather than the actual wallet connection state. A malicious actor with access to the unattended machine could continue performing authenticated actions until the session timer expired.

Solution

Added \isWalletConnected(address)\ helper that reads the actual wallet connection state from \utility-wallet-session\ (the key used by \WalletProvider). Updated \monitorWalletLock\ to poll wallet existence via this helper and call \destroySession()\ immediately when the wallet is gone.

Changes

  • \src/services/session.ts: Added \WALLET_SESSION_KEY\ constant and \isWalletConnected()\ helper
  • \monitorWalletLock()\ now checks actual wallet state instead of session state
  • Session is destroyed synchronously with \onLocked()\ callback when wallet disconnects

Closes #22

The monitorWalletLock function previously polled the session storage
(utility-session) to detect wallet disconnection, which meant the backend
API session remained active even after wallet disconnect until the TTL
expired.

Now monitorWalletLock checks the actual wallet connection state
(utility-wallet-session) directly. When the wallet is disconnected,
the session is destroyed immediately, preventing unauthorized access
from unattended machines.

Closes Utility-Protocol#22
@elizabetheonoja-art
elizabetheonoja-art merged commit c8c9abb into Utility-Protocol:main Jun 16, 2026
3 checks passed
elizabetheonoja-art pushed a commit that referenced this pull request Jul 22, 2026
Add webhook delivery service with signed retries
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.

Issue 15: Session Lifespan Watches Synced Directly to Hardware Key Constraints

2 participants