This commit is contained in:
Mike Ilog 2026-08-15 18:29:05 -04:00 committed by GitHub
commit 50553dfb21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -328,7 +328,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;
}