Description
This test scenario is a security control mechanism that detects proxy manipulation of event handlers. The aim is to distinguish real user interactions from artificial/bot interactions. EventTarget.prototype.addEventListener detects unauthorized modification of events.
Test Code
document.addEventListener('click', (event) => {
try {
const proxyEvent = new Proxy(event, {});
Object.getOwnPropertyDescriptor(Event.prototype, "type").get.call(event);
if (proxyEvent.isTrusted === false) {
console.log("Potential bot/proxy attempt detected");
}
} catch (error) {
// Error handling and anti-bot control mechanism
if (error instanceof TypeError && error.message.includes("Illegal invocation")) {
console.log("[E]Potential bot/proxy attempt detected");
// Anti-bot action
}
}
});
document.dispatchEvent(new Event("click"));
Description
This test scenario is a security control mechanism that detects proxy manipulation of event handlers. The aim is to distinguish real user interactions from artificial/bot interactions.
EventTarget.prototype.addEventListenerdetects unauthorized modification of events.Test Code