Skip to content

Commit 8344ba7

Browse files
committed
npm release (1.0.7), readme changes, little fix in the patcher
1 parent e7e0304 commit 8344ba7

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ This repo contains patches to enhance popular web automation libraries. Specific
44

55
Some aspects of automation libraries or browser behavior cannot be adjusted through settings or command-line switches. Therefore, we fix these issues by patching the library's source code. While this approach is fragile and may break as the libraries' source code changes over time, the goal is to maintain this repo with community help to keep the patches up to date.
66

7+
## Do I really need any patches?
8+
Out of the box Puppeteer and Playwright come with some significant leaks that are easy to detect. It doesn't matter how good your proxies, fingeprints, and behaviour scripts, if you don't have it patched, you're just a big red flag for any major website.
9+
10+
🕵️ You can easily test your automation setup for major modern detections with [rebrowser-bot-detector](https://rebrowser.github.io/rebrowser-bot-detector/) ([sources and details](https://github.com/rebrowser/rebrowser-bot-detector))
11+
12+
| Before the patches 👎 | After the patches 👍 |
13+
|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
14+
| ![before](https://github.com/user-attachments/assets/6fc29650-4ea9-4d27-a152-0b7b40cd2b92) | ![after](https://github.com/user-attachments/assets/2ba0db25-c0db-4015-9c83-731a355cd2e9) |
15+
716
## Available patches
817
### Fix `Runtime.Enable` leak
918
Popular automation libraries rely on the CDP command `Runtime.Enable`, which allows receiving events from the `Runtime.` domain. This is crucial for managing execution contexts used to evaluate JavaScript on pages, a key feature for any automation process.
@@ -47,12 +56,6 @@ or in command line:
4756
REBROWSER_PATCHES_RUNTIME_FIX_MODE=alwaysIsolated node app.js
4857
```
4958

50-
> To test this leak, you can use this page: [https://kaliiiiiiiiii.github.io/brotector/](https://kaliiiiiiiiii.github.io/brotector/) ([sources](https://github.com/kaliiiiiiiiii/brotector/blob/master/brotector.js))
51-
52-
| Before patch 👎 | After patch 👍 |
53-
|--------| --- |
54-
| ![before](https://github.com/user-attachments/assets/daf4fee7-538c-49aa-946a-f9e939fe8fe5) | ![after](https://github.com/user-attachments/assets/0680a6f1-2fd9-4a49-ad7f-ae32758715ec) |
55-
5659
### Change sourceURL to generic script name
5760
By default, Puppeteer adds `//# sourceURL=pptr:...` to every script in `page.evaluate()`. A remote website can detect this behavior and raise red flags.
5861
This patch changes it to `//# sourceURL=app.js`. You can also adjust it via environment variable:
@@ -80,6 +83,11 @@ REBROWSER_PATCHES_UTILITY_WORLD_NAME=0
8083
```
8184
This env variable cannot be changed on the fly, you have to set it before running your script because it's used at the moment when the module is getting imported.
8285

86+
| Before patch 👎 | After patch 👍 |
87+
|--------| --- |
88+
| ![before](https://github.com/user-attachments/assets/3f6719e8-37ab-4451-be19-f854d66184d0) | ![after](https://github.com/user-attachments/assets/5425ab0e-50bc-4c40-b94f-443011fdb210) |
89+
90+
8391
*Note: it's not detectable by external website scripts, but Google might use this information in their proprietary Chrome; we never know.*
8492

8593
## Usage
@@ -112,6 +120,7 @@ If you already have your package patched and want to update to the latest versio
112120

113121
| Pptr Ver | Release Date | Chrome Ver | Patch Support |
114122
|--------------------------------------|--------------|------------|---------------|
123+
| 23.3.x | 2024-09-04 | 128 ||
115124
| 23.2.x | 2024-08-29 | 128 ||
116125
| 23.1.x | 2024-08-14 | 127 ||
117126
| 23.0.x | 2024-08-07 | 127 ||
@@ -155,6 +164,16 @@ You can check that patch.exe is installed correctly by using next command:
155164
patch -v
156165
```
157166

167+
### Special thanks
168+
[zfcsoftware/puppeteer-real-browser](https://github.com/zfcsoftware/puppeteer-real-browser) - general ideas and contribution to the automation community
169+
170+
[kaliiiiiiiiii/brotector](https://github.com/kaliiiiiiiiii/brotector) - some modern tests, algorithm to distinguish CDP vs devtools
171+
172+
[prescience-data/harden-puppeteer](https://github.com/prescience-data/harden-puppeteer) - one of the pioneers of the execution in an isolated world
173+
174+
[puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) - where it all started, big props to all the contributors and the community 🙏 berstend and co are the goats
175+
176+
158177
### Disclaimer
159178
<small>
160179
No responsibility is accepted for the use of this software. This software is intended for educational and informational purposes only. Users should use this software at their own risk. The developers of the software cannot be held liable for any damages that may result from the use of this software. This software is not intended to bypass any security measures, including but not limited to CAPTCHAs, anti-bot systems, or other protective mechanisms employed by websites. The software must not be used for malicious purposes. By using this software, you agree to this disclaimer and acknowledge that you are using the software responsibly and in compliance with all applicable laws and regulations.</small>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rebrowser-patches",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Collection of patches for puppeteer and playwright to avoid automation detection and leaks. Helps to avoid Cloudflare and DataDome CAPTCHA pages. Easy to patch/unpatch, can be enabled/disabled on demand.",
55
"keywords": [
66
"automation",

scripts/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const fatalError = (...args) => {
3131
}
3232

3333
export const getPatchBaseCmd = (patchFilePath) => {
34-
return `patch --batch -p1 --input=${patchFilePath} --verbose --reject-file=- --forward --silent`
34+
return `patch --batch -p1 --input=${patchFilePath} --verbose --no-backup-if-mismatch --reject-file=- --forward --silent`
3535
}
3636

3737
export const isDebug = () => {

0 commit comments

Comments
 (0)