Is there a way to prevent the intercepting of XHR requests from the global scope (like here)?
First, that comes to mind, pass XMLHttpRequest as a parameter to the application entry function (or IIFE) and make requests based on that copy (e.g. JQuery has an option for a custom XHR object). Is it reliable? Or there are other ways to intercept requests without altering XMLHttpRequest?
The concern is to handle a case when after a successful XSS attack, an attacker can intercept requests and steal the JWT from a header.