Issue: postMessage Tracker Includes Events from Other Extensions
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.