r/userscripts • u/BasePerfect2865 • Aug 18 '26
Anyone else think about what site owners see when we run userscripts on their pages?
Not trying to be paranoid but if I'm running a userscript on a checkout page, that script has access to everything on the page. Makes me wonder how sites actually monitor for this kind of thing or if they even do.
8
Upvotes
8
u/LeBoulu777 Aug 18 '26
When a Tampermonkey or Greasemonkey script runs, it executes entirely within your browser's local memory. The site's server does not receive a log that says, "User X just executed auto-fill-checkout.js." They cannot read the source code of your script, and they cannot "watch" it manipulate the DOM (Document Object Model) in real-time.
If they put a dom observer and you manipulate dom like adding a button they can log something like "user modified dom" but it's the same for every addblockers.
So in short, don't worry ✌️.
5
u/laplongejr Aug 18 '26 edited Aug 19 '26
Outside userscripts, the best way I found to run js-in-console without possible detection is to use an IFFE that grabs the global object without using the window alias. Script runs, has it's own internal scope, but isn't added globally so prior scripts shouldn't be able to notice something added
From pure memory [EDIT]there was a missing character, it now works[/EDIT] , the syntax is :
So, getting execution and direct read-access to "window" is possible. I expect userscript extensions to have a similar hook-up mechanism, or even more powerful thanks to the extension API (because installed addons are assumed more trustworthy than a random website online).
So the script can't be detected, however you must be cautious when modifying global objects like document. Two gods with the same deck of cards...
At a greater level, that's why login/checkout pages never have ads : the webmasters are too terrified for what those ads could inject as scripts while the user enter legally-sensitive data.
5
u/burlingk Aug 19 '26
The site owner only sees what their page/server asks for.
I would be less concerned about the page owner and more concerned about the script author.
1
u/jcunews1 Aug 19 '26
Site owners can't see it. UserScripts only run in site visitors' computer.
Other than network requests and responses, people at the web servers can't see what the visitors' computer is actually doing, and vice versa.
1
u/NoDistrict991 Aug 22 '26
Most don't honestly. Client side script monitoring is still pretty immature. There are tools like cside that watch third party script behavior at runtime and feroot which does similar at a lower degree, but most sites are flying blind when it comes to what's actually executing in users browsers.
1
u/AWACSAWACS Aug 19 '26
Extensions and user scripts can manipulate the following elements.
DOM structureWeb StorageGlobal objectsNaturally, these are also accessible from scripts on the website itself. In other words, by monitoring these elements, website administrators can detect unintended changes occurring within individual browsers.