From 33110e803fcacc31dc2859dbc0d470b008556798 Mon Sep 17 00:00:00 2001 From: Tianren Dong Date: Wed, 13 May 2026 01:05:46 -0400 Subject: pi-chrome: humanize synthetic input + anti-automation test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump 0.8.0 → 0.9.1. Companion extension (service_worker.js): - humanise pointer paths: easing Bezier-ish interpolation w/ wobble, 12–42 steps, 4–18 ms gaps; pointer position persisted across calls - click point picked inside element rect, not dead center - pointer events fill movementX/Y, screenX/Y, pressure (0.5 on down), pointerId, width/height, tilt, composed - click sequence: humanMoveTo → pointerdown → focus → 45–140 ms hold → pointerup → mouseup → click - per-character typing: keydown → keypress → beforeinput → value mutate (or execCommand for contenteditable) → input → keyup, with 25–95 ms hold + 35–140 ms inter-key; auto Shift chord for uppercase/symbols - pressKeyInPage emits same cadence + handles printable insert / Backspace - hoverPage: humanised path + 80–220 ms dwell - dragPage: full HTML5 sequence (dragstart/drag/dragenter/dragover/ dragleave/drop/dragend) with shared DataTransfer + pointer continuity - new scrollPage: wheel events with front-loaded momentum-shaped deltas - self-reload on version drift: SW reads x-pi-chrome-version header, reloads when older than pi-chrome Pi side (index.ts): - new chrome_scroll tool - PI_CHROME_VERSION read from package.json (and re-read on every /next so future bumps take effect without pi restart) - /chrome-doctor escalates version mismatch to top-line ✗ error and skips downstream capability probes when stale - /next response carries x-pi-chrome-version header for SW self-heal Test suite (test-suite/): - 28 challenge pages each catching a different synthetic-event tell: isTrusted, webdriver/fingerprint, mouse entropy/timing/coords, pointer pressure/continuity, per-char cadence + framework invariants, user activation, honeypots, focus order, wheel scroll, drag+ DataTransfer, contenteditable+Selection, paste/clipboard, native select, hover dwell, React valueTracker, keyboard modifiers, touch events, stack-trace fingerprint, viewport-edge clicks, mousemove rate, scroll momentum, IntersectionObserver visibility - shared _lib.js exposes window.__verdict + writes localStorage so index.html dashboard aggregates results - notes/bypass-ideas.md documents fixes still needed per challenge --- test-suite/README.md | 74 +++++++++++++++++ test-suite/_lib.js | 81 +++++++++++++++++++ test-suite/_style.css | 4 + test-suite/baseline-dashboard.png | Bin 0 -> 439285 bytes test-suite/challenges/01-is-trusted-click.html | 28 +++++++ test-suite/challenges/02-is-trusted-keyboard.html | 50 ++++++++++++ test-suite/challenges/03-webdriver-flag.html | 51 ++++++++++++ test-suite/challenges/04-mouse-entropy.html | 34 ++++++++ test-suite/challenges/05-event-timing.html | 34 ++++++++ test-suite/challenges/06-click-coordinates.html | 29 +++++++ test-suite/challenges/07-pointer-properties.html | 29 +++++++ test-suite/challenges/08-keyboard-cadence.html | 37 +++++++++ test-suite/challenges/09-composition-input.html | 45 +++++++++++ test-suite/challenges/10-user-activation.html | 31 +++++++ test-suite/challenges/11-honeypot.html | 36 +++++++++ test-suite/challenges/12-fingerprint.html | 57 +++++++++++++ test-suite/challenges/13-focus-order.html | 31 +++++++ test-suite/challenges/14-wheel-scroll.html | 28 +++++++ .../challenges/15-drag-drop-datatransfer.html | 73 +++++++++++++++++ .../challenges/16-contenteditable-selection.html | 54 +++++++++++++ test-suite/challenges/17-paste-clipboard.html | 48 +++++++++++ test-suite/challenges/18-native-select.html | 56 +++++++++++++ test-suite/challenges/19-hover-dwell.html | 50 ++++++++++++ test-suite/challenges/20-react-value-tracker.html | 78 ++++++++++++++++++ test-suite/challenges/21-keyboard-modifiers.html | 65 +++++++++++++++ test-suite/challenges/22-touch-events.html | 66 +++++++++++++++ .../challenges/23-stack-trace-fingerprint.html | 78 ++++++++++++++++++ test-suite/challenges/24-viewport-edge-clicks.html | 51 ++++++++++++ test-suite/challenges/25-pointer-continuity.html | 62 ++++++++++++++ test-suite/challenges/26-mousemove-rate.html | 57 +++++++++++++ test-suite/challenges/27-scroll-momentum.html | 66 +++++++++++++++ .../challenges/28-intersection-visibility.html | 72 +++++++++++++++++ test-suite/index.html | 90 +++++++++++++++++++++ test-suite/notes/bypass-ideas.md | 76 +++++++++++++++++ test-suite/serve.sh | 6 ++ 35 files changed, 1727 insertions(+) create mode 100644 test-suite/README.md create mode 100644 test-suite/_lib.js create mode 100644 test-suite/_style.css create mode 100644 test-suite/baseline-dashboard.png create mode 100644 test-suite/challenges/01-is-trusted-click.html create mode 100644 test-suite/challenges/02-is-trusted-keyboard.html create mode 100644 test-suite/challenges/03-webdriver-flag.html create mode 100644 test-suite/challenges/04-mouse-entropy.html create mode 100644 test-suite/challenges/05-event-timing.html create mode 100644 test-suite/challenges/06-click-coordinates.html create mode 100644 test-suite/challenges/07-pointer-properties.html create mode 100644 test-suite/challenges/08-keyboard-cadence.html create mode 100644 test-suite/challenges/09-composition-input.html create mode 100644 test-suite/challenges/10-user-activation.html create mode 100644 test-suite/challenges/11-honeypot.html create mode 100644 test-suite/challenges/12-fingerprint.html create mode 100644 test-suite/challenges/13-focus-order.html create mode 100644 test-suite/challenges/14-wheel-scroll.html create mode 100644 test-suite/challenges/15-drag-drop-datatransfer.html create mode 100644 test-suite/challenges/16-contenteditable-selection.html create mode 100644 test-suite/challenges/17-paste-clipboard.html create mode 100644 test-suite/challenges/18-native-select.html create mode 100644 test-suite/challenges/19-hover-dwell.html create mode 100644 test-suite/challenges/20-react-value-tracker.html create mode 100644 test-suite/challenges/21-keyboard-modifiers.html create mode 100644 test-suite/challenges/22-touch-events.html create mode 100644 test-suite/challenges/23-stack-trace-fingerprint.html create mode 100644 test-suite/challenges/24-viewport-edge-clicks.html create mode 100644 test-suite/challenges/25-pointer-continuity.html create mode 100644 test-suite/challenges/26-mousemove-rate.html create mode 100644 test-suite/challenges/27-scroll-momentum.html create mode 100644 test-suite/challenges/28-intersection-visibility.html create mode 100644 test-suite/index.html create mode 100644 test-suite/notes/bypass-ideas.md create mode 100755 test-suite/serve.sh (limited to 'test-suite') diff --git a/test-suite/README.md b/test-suite/README.md new file mode 100644 index 0000000..241976c --- /dev/null +++ b/test-suite/README.md @@ -0,0 +1,74 @@ +# pi-chrome anti-automation test suite + +Static pages that each block a different automated-interaction signal. Drive them +with the `chrome_*` tools to discover where the companion-extension's synthetic +events still look like a bot, and to verify any humanization fixes. + +## Run + +```bash +cd test-suite +python3 -m http.server 8765 +# open http://127.0.0.1:8765/ in the Chrome window pi-chrome controls +``` + +Each challenge page exposes: + +- `window.__challenge` — short id +- `window.__verdict` — `"PENDING" | "PASS" | "FAIL"` +- `window.__reason` — array of strings, why it failed (or how it passed) +- `window.__events` — raw event log for forensics + +`PASS` means the page believes a real human did the thing. +`FAIL` means the page caught the automation. + +## Aggregate runner + +`index.html` lists every challenge, loads each one in an iframe, lets you (or +the agent) drive the interaction, and tallies verdicts. + +Recommended agent flow: + +1. `chrome_navigate` to `http://127.0.0.1:8765/`. +2. For each challenge link, open it, run the listed interaction with the + `chrome_*` tools, then read `window.__verdict` / `window.__reason` via + `chrome_evaluate`. +3. Compare against the manual baseline (do the same interaction by hand and + confirm `PASS`). + +## Challenges + +| id | file | what it blocks | +|----|------|----------------| +| `is-trusted-click` | `challenges/01-is-trusted-click.html` | click handler ignores `event.isTrusted === false` | +| `is-trusted-keyboard` | `challenges/02-is-trusted-keyboard.html` | input rejects if `keydown.isTrusted` false | +| `webdriver-flag` | `challenges/03-webdriver-flag.html` | `navigator.webdriver` truthy / Chrome runtime quirks | +| `mouse-entropy` | `challenges/04-mouse-entropy.html` | requires organic mousemove path before click | +| `event-timing` | `challenges/05-event-timing.html` | rejects when pointerdown→pointerup gap < N ms or always-equal | +| `click-coordinates` | `challenges/06-click-coordinates.html` | rejects clicks that land on exact element center | +| `pointer-properties` | `challenges/07-pointer-properties.html` | demands pressure / non-zero movementX/Y / pointerId variety | +| `keyboard-cadence` | `challenges/08-keyboard-cadence.html` | rejects same-tick `keydown`/`keyup` and missing per-char events | +| `composition-input` | `challenges/09-composition-input.html` | listens for native `keydown` + `keypress` + `input` sequence | +| `user-activation` | `challenges/10-user-activation.html` | feature gates: clipboard.writeText, fullscreen | +| `honeypot` | `challenges/11-honeypot.html` | hidden field must stay empty | +| `fingerprint` | `challenges/12-fingerprint.html` | UA-CH, languages, plugins, permissions consistency | +| `focus-order` | `challenges/13-focus-order.html` | requires `pointerdown`-driven focus, not direct `.focus()` | +| `wheel-scroll` | `challenges/14-wheel-scroll.html` | rejects scrollTop jumps without `wheel`/`scroll` events | +| `drag-drop-datatransfer` | `challenges/15-drag-drop-datatransfer.html` | requires full HTML5 drag cycle with populated `DataTransfer` | +| `contenteditable-selection` | `challenges/16-contenteditable-selection.html` | requires `selectionchange` + monotonic caret advance per keystroke | +| `paste-clipboard` | `challenges/17-paste-clipboard.html` | demands real OS paste with `clipboardData` + `inputType=insertFromPaste` | +| `native-select` | `challenges/18-native-select.html` | rejects `