Skip to content

fix(companion-wallet): reject path-like session IDs - #58

Open
SashaMIT wants to merge 1 commit into
WalletConnect:mainfrom
SashaMIT:fix/companion-wallet-session-id-jail
Open

fix(companion-wallet): reject path-like session IDs#58
SashaMIT wants to merge 1 commit into
WalletConnect:mainfrom
SashaMIT:fix/companion-wallet-session-id-jail

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 18, 2026

Copy link
Copy Markdown

Summary

grantSession emits a 32-char hex id. loadSession / get-session joined any sessionId onto ~/.config/wallet/sessions. filepath-style .. (for example ../keys/<address>) opened a sibling keystore JSON, including the mnemonic.

sessionFilePath now requires ^[0-9a-f]{32}$ before join, matching the ids grantSession already issues. Granted sessions still load.

Why

An agent or CWP caller already chooses sessionId. They do not already have read of ~/.config/wallet/keys. The remaining guard is that session files stay under the sessions directory.

Test plan

  • npm test --workspace=@walletconnect/companion-wallet (108/108 after workspace build)
  • npm run lint --workspace=@walletconnect/companion-wallet
  • Revert-tested: without the hex check, loadSession("../keys/0xdead") returns the sibling keystore instead of throwing

grantSession emits 32 hex chars. loadSession joined any sessionId onto
the sessions dir, so get-session ../keys/<address> read a keystore JSON
(including the mnemonic). Keep session files under the sessions directory.
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