Shortcut for easier XSS filter testing.
This commit is contained in:
parent
5f343ad16a
commit
17f3bfd14b
|
@ -1,5 +1,5 @@
|
|||
if (UA.isMozilla) {
|
||||
let y = async (url, originUrl = '') => await XSS.maybe(XSS.parseRequest({originUrl, url, method: "GET"}));
|
||||
let y = async (url, originUrl = '') => await XSS.test({originUrl, url, method: "GET"});
|
||||
let n = async (...args) => !await y(...args);
|
||||
Promise.all([
|
||||
() => y("https://noscript.net/<script"),
|
||||
|
|
|
@ -7,6 +7,8 @@ var XSS = (() => {
|
|||
let workersMap = new Map();
|
||||
let promptsMap = new Map();
|
||||
|
||||
let requestIdCount = 0;
|
||||
|
||||
async function getUserResponse(xssReq) {
|
||||
let {originKey} = xssReq;
|
||||
await promptsMap.get(originKey);
|
||||
|
@ -309,6 +311,20 @@ var XSS = (() => {
|
|||
return false;
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
async test(urlOrRequest) {
|
||||
let r = {
|
||||
requestId: `fake${requestIdCount++}`,
|
||||
originUrl: '',
|
||||
method: "GET",
|
||||
};
|
||||
if (typeof urlOrRequest === "string") {
|
||||
r.url = urlOrRequest;
|
||||
} else if (typeof urlOrRequest === "object") {
|
||||
Object.assign(r, urlOrRequest);
|
||||
}
|
||||
return await XSS.maybe(XSS.parseRequest(r));
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue