How can I prevent "tampermonkey" Hacks

Just for those unfamiliar with this Tampermonkey script:

Tampermonkey is used to run so-called userscripts (sometimes also called Greasemonkey scripts) on websites.
Userscripts are small computer programs that change the layout of a page, add or remove new functionality and content, or automate actions.

The short answer is: you can’t completely. In the end, the server sends data to the visitor’s browser, which is then rendered in the browser of the visitor on the device of the visitor. You can’t control the runtime environment, which means you can’t control how your code is executed.

Maybe there are ways to mitigate them. Maybe you can use Javascript to detect Tampermonkey hooks and disable, block or sabotage them. But entirely blocking them is impossible because you don’t control the browser.

You can’t control software running on client devices. If you need to store or transfer data from a central system, always make sure that you’re implementing security checks like authentication and validation on the server side because you can never be sure that the data sent by clients is safe and clean.

7 Likes