Clear pending map entries after 35s timeout#11
Merged
Merged
Conversation
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
approved these changes
May 21, 2026
DeetGates
left a comment
Collaborator
There was a problem hiding this comment.
Approved.
Reviewed the pending-map timeout change:
requestFromRelaynow installs a 35s timer per pending command.- On timeout, the pending entry is deleted before rejecting, preventing unbounded
pendinggrowth when the relay never replies. - Normal relay response paths clear the timer through the wrapped
resolve/rejecthandlers. - Immediate
sendToRelayfailures clear the timer and remove the pending entry before rejecting.
Validation:
- GitHub check:
lintpassing. - Local gate:
node --check background.jspassing. - Checked PR inline review comments from
chatgpt-codex-connector[bot]: none present.
No blocking findings.
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
5 tasks
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
Fixes DA finding #8 — pending map leak.
requestFromRelayadds entries to thependingMap 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