Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,13 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
}

if (msg.type === 'getPort') {
sendResponse({ port: serverPort, connected: isConnected, token: authToken });
// Withhold the auth token from content-script callers (content scripts have
// sender.tab set), mirroring the getToken guard below. port/connected stay
// available to any extension context, but the localhost auth token is never
// handed to an injected page context — without this guard getPort leaks the
// exact token getToken is careful to protect.
const token = sender.tab ? null : authToken;
sendResponse({ port: serverPort, connected: isConnected, token });
return true;
}

Expand Down