Skip to content

Clear pending map entries after 35s timeout#11

Merged
bazfer merged 1 commit into
masterfrom
pending-timeout
May 21, 2026
Merged

Clear pending map entries after 35s timeout#11
bazfer merged 1 commit into
masterfrom
pending-timeout

Conversation

@DeetBot

@DeetBot DeetBot commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes DA finding #8 — pending map leak.

requestFromRelay adds entries to the pending Map but only clears them when the relay replies. If the relay times out (30s) and stops caring, the extension entry leaks forever. On a long session this accumulates; and while command ID wraparound takes ~4B commands, it's still unclean.

Fix: 35s client-side timeout (5s after relay gives up). If no response by then, the entry is deleted and the promise rejected. Timer is cleared on normal resolve/reject paths.

Test plan

  • Ohm gates

Relay-side timeout is 30s — if relay never replies, extension pending
entry leaked forever. 35s timer ensures cleanup slightly after relay
gives up, preventing unbounded map growth on long sessions.

@DeetGates DeetGates left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Reviewed the pending-map timeout change:

  • requestFromRelay now installs a 35s timer per pending command.
  • On timeout, the pending entry is deleted before rejecting, preventing unbounded pending growth when the relay never replies.
  • Normal relay response paths clear the timer through the wrapped resolve/reject handlers.
  • Immediate sendToRelay failures clear the timer and remove the pending entry before rejecting.

Validation:

  • GitHub check: lint passing.
  • Local gate: node --check background.js passing.
  • Checked PR inline review comments from chatgpt-codex-connector[bot]: none present.

No blocking findings.

@bazfer bazfer merged commit b8e45a8 into master May 21, 2026
1 check passed
DeetBot pushed a commit that referenced this pull request May 22, 2026
… allowlist

- getRelayUrl(): validate wss:// scheme before use — invalid storage value
  falls back to DEFAULT_RELAY_URL with a console.warn instead of
  connecting to an arbitrary URL and potentially exfilling the token
- options.js save(): reject non-wss:// URLs before writing to storage
- Remove requestFromRelay, pending map, and all usage sites — function
  was never called; dead code since PR #11 added timeout to it
- Target.createTarget: validate URL scheme (http/https/about only)
  before passing to chrome.tabs.create — blocks javascript:, data:,
  chrome-extension:, and other dangerous schemes
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.

3 participants