Get the latest tech news
Checking if a JavaScript native function is monkey patched (2022)
Delving deep into how to determine whether a JavaScript native function has been monkey patched, and why it's not possible to determine it reliably.
For example, monitoring tools such as Bugsnag override the Fetch and XMLHttpRequest APIs to gain visibility into network connections triggered by JavaScript code. It requires storing the original function reference before running any other code in your app (to ensure it's still untouched), which sometimes you won't be able to do (e.g., if you're building a library). If you're in control of the entire web page, you can set up your code in advance by storing references of the functions you want to check when they're still "clean" and compare them later.
Or read this on Hacker News