AdguardTeam / AdguardTeam/Scriptlets

Enhance stealth about `Object.prototype.hasOwnProperty.call` of `XMLHttpRequest` related scriptlets

Abierto
#576 0 comentarios 0 reacciones 1 asignado Reclamado por @maximtop Ver en GitHub
Priority: P4
Lenguaje dominante
JavaScript
Estrellas
195
Forks
33
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

```typescript
const Req = new XMLHttpRequest()
Req.open('OPTIONS', 'https://example.com')
Req.send()

const CleanReq = new XMLHttpRequest()

const Properties = ['status', 'statusText', 'readyState', 'response', 'responseURL', 'responseXML', 'setRequestHeader'] as const
Properties.forEach(Key => {
// 'call' indicates Function.prototype.call
console.log(`Object.prototype.hasOwnProperty.call(Req, ${Key})`, Object.prototype.hasOwnProperty.call(Req, Key))
console.log(`Compares XMLHttpReqeust.prototype with clean one ${Key}`, Req[Key] === CleanReq[Key])
})
```

```typescript
const Properties = ['status', 'statusText', 'readyState', 'response', 'responseURL', 'responseXML', 'setRequestHeader'] as const

const Req = new XMLHttpRequest()
Req.timeout = 1000
Req.onerror = () => { Func() }
Req.onabort = () => {}
Req.onload = () => { Func() }
Req.ontimeout = () => {}
Req.open('OPTIONS', 'https://example.com/', true)
Req.send()

const CleanReq = new XMLHttpRequest()

function Func() {
Properties.forEach(Key => {
// 'call' indicates Function.prototype.call
console.log(`Object.prototype.hasOwnProperty.call(Req, ${Key})`, Object.prototype.hasOwnProperty.call(Req, Key))
console.log(`Compares XMLHttpReqeust.prototype with clean one ${Key}`, Req[Key] === CleanReq[Key])
})
}
```

Compares execution result in DevTool of the above Typescript code snippet with and without `example.com#%#//scriptlet('prevent-xhr', 'example.com method:OPTIONS')`.

Related to https://github.com/uBlockOrigin/uAssets/issues/34177

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.