Execute any JavaScript from any browser tab on any browser tabs
github.com
github.com
- want to run custom JS from one tab in another often
- Wouldn't write their own extension to do it
But credit for OSSing your own tools :)
It's not like "include a script in a page, then execute arbitrary js on any tabs of anyone who visits that page".
That would've been a CVSS 10.
if (typeof window.tabgod === 'function') {
tabgod(
(tab) => tab.url === 'https://bankofamerica.com',
() => { /* absolutely nothing good */ },
}
}
Keep in mind any network requests running from the script directly in the page will happily send your cookies, so this makes it trivial to gain unauthorized access to people's accounts. Any site you visit while running this extension can basically access your private data from every other site you happen to have a tab open for, and send requests impersonating you. It could also install a keyboard logger, etc.https://github.com/devidw/tabgod/issues/1#issuecomment-19336...
But from reading the description it says in all devtools consoles - so I had assumed it was only in devtools context that the function was available?
I was thinking more along the lines of breaking out of process/site isolation or sandboxing - but yeah, you're making a good point.
Isn't this what a Browser does ?
Then end the script with wait command and run the script.
Though I guess this might just trigger all the requests on all that tabs anyway. I suppose you'd have to add architecture to start one instance of that app as the 'controller' and then a way to pass off controller responsibilities to other tabs... which sounds like basically "step 2: draw the rest of the owl"
Since I just noticed this is an extension rather than a library, I think it's probably more useful for automating interactions with a number of tabs of the same page (but puppeteer or something similar would probably be a better fit for this also)
For user-driven automations, something like Tampermonkey would be way better (and safer, since they can be domain-limited).
I can think of no reason why a regular user would want to allow tabs to execute each other's code... that just seems like a setup for self-XSS attacks by people who don't know any better :(
---------
edit: Sorry, re: the second part of your comment, I misunderstood what you meant. Like if you wanted to purposely script multiple identical tabs at the same time.
however since Firefox supports Broadcast channel API it should probably be theoretically possible in there.
Junior Developers: what’s this do? Probably nothing… yeet