Skip to content

Conversation

@Q0120S
Copy link

@Q0120S Q0120S commented May 28, 2025

Problem:
The postMessage-tracker Chrome extension currently logs postMessage events originating not only from the web application being inspected but also from other installed Chrome extensions (e.g., Wappalyzer). This leads to the inclusion of irrelevant messages in the tracked data, making it harder to focus on the application-specific communication.
For example, messages with stack traces like at chrome-extension://gppongmhjkpfnbhagpmjfkannfbllamg/js/js.js:48:5 were being captured.
Solution:
To address this, the content_script.js has been modified to filter out postMessage events that originate from any Chrome extension.
The filtering logic was implemented in the l function within content_script.js. This function is responsible for processing and logging the postMessage listeners. The modification involves inspecting the stack trace associated with each listener. If the stack trace string contains chrome-extension://, indicating that the message originated from an extension, the listener is ignored and not processed further.
Specifically, the following check was added:

// ... existing code in function l ...
listener_str = listener.__postmessagetrackername__ || listener.toString();
// Filter out messages from any Chrome extension
if (stack && stack.includes('chrome-extension://')) {
    return;
}
m({window:window.top==window?'top':window.name,hops:h(),domain:document.domain,stack:stack,fullstack:fullstack,listener:listener_str});
// ...

Apply to content_scri...
This change ensures that only postMessage events from the web page itself (and not other extensions) are tracked, providing a cleaner and more focused debugging experience.

Filter out postMessage events from other Chrome extensions

The postMessage tracker was capturing events from all sources,
including other installed Chrome extensions. This commit modifies
the content script to inspect the stack trace of each postMessage
listener. If the stack trace indicates the message originated
from a 'chrome-extension://' URL, it is now ignored.

This provides a cleaner log by excluding irrelevant messages
from other extensions and focusing only on the web application's
postMessage traffic.
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