Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-extra-plugin-stealth

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-extra-plugin-stealth - npm Package Compare versions

Comparing version 2.7.9 to 2.7.10

4

evasions/iframe.contentWindow/index.js

@@ -46,2 +46,6 @@ 'use strict'

}
// Intercept iframe.contentWindow[0] to hide the property 0 added by the proxy.
if (key === '0') {
return undefined
}
return Reflect.get(target, key)

@@ -48,0 +52,0 @@ }

150

evasions/iframe.contentWindow/index.test.js

@@ -54,2 +54,38 @@ const test = require('ava')

test('vanilla: will not have contentWindow[0]', async t => {
const browser = await vanillaPuppeteer.launch({ headless: true })
const page = await browser.newPage()
const zero = await page.evaluate(returnValue => {
const { document } = window // eslint-disable-line
const body = document.querySelector('body')
const iframe = document.createElement('iframe')
iframe.srcdoc = 'foobar'
body.appendChild(iframe)
return typeof iframe.contentWindow[0]
})
await browser.close()
t.is(zero, 'undefined')
})
test('stealth: will not have contentWindow[0]', async t => {
const browser = await addExtra(vanillaPuppeteer)
.use(Plugin())
.launch({ headless: true })
const page = await browser.newPage()
const zero = await page.evaluate(returnValue => {
const { document } = window // eslint-disable-line
const body = document.querySelector('body')
const iframe = document.createElement('iframe')
iframe.srcdoc = 'foobar'
body.appendChild(iframe)
return typeof iframe.contentWindow[0]
})
await browser.close()
t.is(zero, 'undefined')
})
test('vanilla: will not have chrome runtine in any frame', async t => {

@@ -260,71 +296,71 @@ const browser = await vanillaPuppeteer.launch({ headless: true })

test('regression: new method will not break recaptcha popup', async t => {
// const browser = await vanillaPuppeteer.launch({ headless: false })
const browser = await addExtra(vanillaPuppeteer)
.use(Plugin())
.launch({ headless: true })
const page = await browser.newPage()
// NOTE: This test is flaky in CI and temporarily disabled
// test('regression: new method will not break recaptcha popup', async t => {
// // const browser = await vanillaPuppeteer.launch({ headless: false })
// const browser = await addExtra(vanillaPuppeteer)
// .use(Plugin())
// .launch({ headless: true })
// const page = await browser.newPage()
page.waitForTimeout = page.waitForTimeout || page.waitFor
// page.waitForTimeout = page.waitForTimeout || page.waitFor
await page.goto('https://www.fbdemo.com/invisible-captcha/index.html')
// await page.goto('https://www.fbdemo.com/invisible-captcha/index.html')
await page.type('#tswname', 'foo')
await page.type('#tswemail', 'foo@foo.foo')
await page.type(
'#tswcomments',
'In the depth of winter, I finally learned that within me there lay an invincible summer.'
)
await page.click('#tswsubmit')
await page.waitForTimeout(1000)
// await page.type('#tswname', 'foo')
// await page.type('#tswemail', 'foo@foo.foo')
// await page.type(
// '#tswcomments',
// 'In the depth of winter, I finally learned that within me there lay an invincible summer.'
// )
// await page.click('#tswsubmit')
// await page.waitForTimeout(1000)
// const { hasRecaptchaPopup } = await page.evaluate(() => {
// const hasRecaptchaPopup = !!document.querySelectorAll(
// `iframe[title="recaptcha challenge"]`
// ).length
// return { hasRecaptchaPopup }
// })
const { hasRecaptchaPopup } = await page.evaluate(() => {
const hasRecaptchaPopup = !!document.querySelectorAll(
`iframe[title="recaptcha challenge"]`
).length
return { hasRecaptchaPopup }
})
// await browser.close()
await browser.close()
// t.true(hasRecaptchaPopup)
// })
t.true(hasRecaptchaPopup)
})
// test('regression: old method indeed did break recaptcha popup', async t => {
// const browser = await vanillaPuppeteer.launch({ headless: true })
// const page = await browser.newPage()
test('regression: old method indeed did break recaptcha popup', async t => {
const browser = await vanillaPuppeteer.launch({ headless: true })
const page = await browser.newPage()
// page.waitForTimeout = page.waitForTimeout || page.waitFor
// // Old method
// await page.evaluateOnNewDocument(() => {
// // eslint-disable-next-line
// Object.defineProperty(HTMLIFrameElement.prototype, 'contentWindow', {
// get: function() {
// return window
// }
// })
// })
page.waitForTimeout = page.waitForTimeout || page.waitFor
// Old method
await page.evaluateOnNewDocument(() => {
// eslint-disable-next-line
Object.defineProperty(HTMLIFrameElement.prototype, 'contentWindow', {
get: function () {
return window
}
})
})
// await page.goto('https://www.fbdemo.com/invisible-captcha/index.html')
await page.goto('https://www.fbdemo.com/invisible-captcha/index.html')
// await page.type('#tswname', 'foo')
// await page.type('#tswemail', 'foo@foo.foo')
// await page.type(
// '#tswcomments',
// 'In the depth of winter, I finally learned that within me there lay an invincible summer.'
// )
// await page.click('#tswsubmit')
// await page.waitForTimeout(1000)
await page.type('#tswname', 'foo')
await page.type('#tswemail', 'foo@foo.foo')
await page.type(
'#tswcomments',
'In the depth of winter, I finally learned that within me there lay an invincible summer.'
)
await page.click('#tswsubmit')
await page.waitForTimeout(1000)
// const { hasRecaptchaPopup } = await page.evaluate(() => {
// const hasRecaptchaPopup = !!document.querySelectorAll(
// `iframe[title="recaptcha challenge"]`
// ).length
// return { hasRecaptchaPopup }
// })
const { hasRecaptchaPopup } = await page.evaluate(() => {
const hasRecaptchaPopup = !!document.querySelectorAll(
`iframe[title="recaptcha challenge"]`
).length
return { hasRecaptchaPopup }
})
// await browser.close()
await browser.close()
t.false(hasRecaptchaPopup)
})
// t.false(hasRecaptchaPopup)
// })
{
"name": "puppeteer-extra-plugin-stealth",
"version": "2.7.9",
"version": "2.7.10",
"description": "Stealth mode: Applies various techniques to make detection of headless puppeteer harder.",

@@ -58,3 +58,3 @@ "main": "index.js",

},
"gitHead": "cbfacf8dd53e8d3f5a0447d8395451abe143107f"
"gitHead": "45e5cd6740aafc177b518867144cc09fb520b0e3"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc