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/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 ++++++++++++++++++++ 28 files changed, 1396 insertions(+) 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 (limited to 'test-suite/challenges') diff --git a/test-suite/challenges/01-is-trusted-click.html b/test-suite/challenges/01-is-trusted-click.html new file mode 100644 index 0000000..50a8050 --- /dev/null +++ b/test-suite/challenges/01-is-trusted-click.html @@ -0,0 +1,28 @@ + + +01 isTrusted click + + + +
+

Goal: click the green button. Page only accepts event.isTrusted === true.

+ +
+ + diff --git a/test-suite/challenges/02-is-trusted-keyboard.html b/test-suite/challenges/02-is-trusted-keyboard.html new file mode 100644 index 0000000..4fce713 --- /dev/null +++ b/test-suite/challenges/02-is-trusted-keyboard.html @@ -0,0 +1,50 @@ + + +02 isTrusted keyboard + + + +
+

Goal: type hello into the box. Each character must arrive via a trusted keydown/keypress/input.

+ +
+ + diff --git a/test-suite/challenges/03-webdriver-flag.html b/test-suite/challenges/03-webdriver-flag.html new file mode 100644 index 0000000..c5953f1 --- /dev/null +++ b/test-suite/challenges/03-webdriver-flag.html @@ -0,0 +1,51 @@ + + +03 webdriver / runtime fingerprint + + + +
+

Auto-checks runtime properties commonly inspected by bot-detection scripts.

+

+
+ + diff --git a/test-suite/challenges/04-mouse-entropy.html b/test-suite/challenges/04-mouse-entropy.html new file mode 100644 index 0000000..e4f4693 --- /dev/null +++ b/test-suite/challenges/04-mouse-entropy.html @@ -0,0 +1,34 @@ + + +04 mouse entropy + + + +
+

Goal: click the green button after moving the mouse in an organic path. Page requires + ≥15 mousemove events with non-zero movementX/Y variance before the click.

+ +
+ + diff --git a/test-suite/challenges/05-event-timing.html b/test-suite/challenges/05-event-timing.html new file mode 100644 index 0000000..16269ea --- /dev/null +++ b/test-suite/challenges/05-event-timing.html @@ -0,0 +1,34 @@ + + +05 event timing + + + +
+

Goal: click the button 3 times. Page rejects when pointerdown→pointerup is <30ms + or always identical, and when between-click gaps are too uniform.

+ +
+ + diff --git a/test-suite/challenges/06-click-coordinates.html b/test-suite/challenges/06-click-coordinates.html new file mode 100644 index 0000000..e35ae84 --- /dev/null +++ b/test-suite/challenges/06-click-coordinates.html @@ -0,0 +1,29 @@ + + +06 click coordinates + + + +
+

Goal: click the green button 5 times. Page rejects when clicks always land on the exact element center.

+ +
+ + diff --git a/test-suite/challenges/07-pointer-properties.html b/test-suite/challenges/07-pointer-properties.html new file mode 100644 index 0000000..753c523 --- /dev/null +++ b/test-suite/challenges/07-pointer-properties.html @@ -0,0 +1,29 @@ + + +07 pointer properties + + + +
+

Goal: click the button. Page inspects pointerType, pressure, + movementX/Y on the preceding pointermove, and that pointerId is non-zero.

+ +
+ + diff --git a/test-suite/challenges/08-keyboard-cadence.html b/test-suite/challenges/08-keyboard-cadence.html new file mode 100644 index 0000000..1de9bbd --- /dev/null +++ b/test-suite/challenges/08-keyboard-cadence.html @@ -0,0 +1,37 @@ + + +08 keyboard cadence + + + +
+

Goal: type secret. Page demands per-key keydown+keypress+keyup with non-uniform gaps and non-zero hold time.

+ +
+ + diff --git a/test-suite/challenges/09-composition-input.html b/test-suite/challenges/09-composition-input.html new file mode 100644 index 0000000..b4b2002 --- /dev/null +++ b/test-suite/challenges/09-composition-input.html @@ -0,0 +1,45 @@ + + +09 framework input invariants + + + +
+

Goal: type abc. Page asserts React-style invariants: beforeinput + fires before input, both per-character, inputType==="insertText", + value mutates between events, and no compositionstart for plain typing.

+ +
+ + diff --git a/test-suite/challenges/10-user-activation.html b/test-suite/challenges/10-user-activation.html new file mode 100644 index 0000000..d0929d8 --- /dev/null +++ b/test-suite/challenges/10-user-activation.html @@ -0,0 +1,31 @@ + + +10 user activation gates + + + +
+

Goal: click the button. Handler then tries gated APIs (clipboard.writeText, fullscreen). + Success requires navigator.userActivation.isActive and at least one gated API to succeed.

+ +
+ + diff --git a/test-suite/challenges/11-honeypot.html b/test-suite/challenges/11-honeypot.html new file mode 100644 index 0000000..26a6240 --- /dev/null +++ b/test-suite/challenges/11-honeypot.html @@ -0,0 +1,36 @@ + + +11 honeypot fields + + + +
+

Goal: fill only the visible "Name" field with alex and submit. + Three honeypots (a, b, c) are present that a human cannot see/tab to. Filling any honeypot fails.

+
+ + + + + + + + +
+
+ + diff --git a/test-suite/challenges/12-fingerprint.html b/test-suite/challenges/12-fingerprint.html new file mode 100644 index 0000000..dbc8a25 --- /dev/null +++ b/test-suite/challenges/12-fingerprint.html @@ -0,0 +1,57 @@ + + +12 fingerprint consistency + + + +
+

Auto-check. Looks for cross-API consistency mismatches that betray instrumented Chrome.

+

+
+ + diff --git a/test-suite/challenges/13-focus-order.html b/test-suite/challenges/13-focus-order.html new file mode 100644 index 0000000..90cbcaa --- /dev/null +++ b/test-suite/challenges/13-focus-order.html @@ -0,0 +1,31 @@ + + +13 focus order + + + +
+

Goal: focus the input by clicking it (not .focus()), then type x. + Pointerdown must precede focus, and :focus-visible must be false for pointer focus.

+ +
+ + diff --git a/test-suite/challenges/14-wheel-scroll.html b/test-suite/challenges/14-wheel-scroll.html new file mode 100644 index 0000000..4f03f24 --- /dev/null +++ b/test-suite/challenges/14-wheel-scroll.html @@ -0,0 +1,28 @@ + + +14 wheel scroll + + + +
+

Goal: scroll the box to the bottom. Page rejects raw scrollTop assignment without + wheel events.

+
+
scroll me ⬇

...lots of content...
+
+
+ + diff --git a/test-suite/challenges/15-drag-drop-datatransfer.html b/test-suite/challenges/15-drag-drop-datatransfer.html new file mode 100644 index 0000000..e0b6d12 --- /dev/null +++ b/test-suite/challenges/15-drag-drop-datatransfer.html @@ -0,0 +1,73 @@ + + +15 drag-drop DataTransfer + + + +
+

Goal: drag the red box into the drop zone. Page asserts a full HTML5 + drag sequence with a populated DataTransfer — synthetic pointer drags + dispatched without dragstart/drop + DataTransfer payload fail.

+
+
+ DRAG +
+
+ DROP HERE +
+
+
+ + diff --git a/test-suite/challenges/16-contenteditable-selection.html b/test-suite/challenges/16-contenteditable-selection.html new file mode 100644 index 0000000..fea2adc --- /dev/null +++ b/test-suite/challenges/16-contenteditable-selection.html @@ -0,0 +1,54 @@ + + +16 contenteditable selection + + + +
+

Goal: focus the editable region and type hello. Page asserts that + window.getSelection() reflects per-keystroke caret movement + (rangeCount===1, collapsed caret, anchor inside the editor, + offset advances 1 per char) and that selectionchange fires.

+
+
+ + diff --git a/test-suite/challenges/17-paste-clipboard.html b/test-suite/challenges/17-paste-clipboard.html new file mode 100644 index 0000000..c19e291 --- /dev/null +++ b/test-suite/challenges/17-paste-clipboard.html @@ -0,0 +1,48 @@ + + +17 paste clipboard + + + +
+

Goal: paste the string pi-chrome into the input via a real OS paste + (Cmd/Ctrl+V firing a trusted paste event with populated + clipboardData). Programmatic value= or setRangeText + fail. The input event's inputType must be + insertFromPaste.

+ +
+ + diff --git a/test-suite/challenges/18-native-select.html b/test-suite/challenges/18-native-select.html new file mode 100644 index 0000000..7ca7002 --- /dev/null +++ b/test-suite/challenges/18-native-select.html @@ -0,0 +1,56 @@ + + +18 native select option + + + +
+

Goal: select the option banana from the native <select>. + Page asserts a real picker interaction: mousedown/pointerdown + on the <select> (opening the OS picker), then a change event with + isTrusted=true. Programmatically setting .value or clicking the + option element directly fails (clicking <option> does not change selection in + real browsers).

+ +
+ + diff --git a/test-suite/challenges/19-hover-dwell.html b/test-suite/challenges/19-hover-dwell.html new file mode 100644 index 0000000..21ce80a --- /dev/null +++ b/test-suite/challenges/19-hover-dwell.html @@ -0,0 +1,50 @@ + + +19 hover dwell + + + +
+

Goal: hover the trigger and wait until the Confirm button reveals (≥600ms dwell + with continuous pointermove activity inside the trigger), then click Confirm. + Instant hover-then-click without dwell, or hover with no intermediate pointermove, + looks robotic and fails.

+
+ hover me +
+ +
+ + diff --git a/test-suite/challenges/20-react-value-tracker.html b/test-suite/challenges/20-react-value-tracker.html new file mode 100644 index 0000000..fb217d1 --- /dev/null +++ b/test-suite/challenges/20-react-value-tracker.html @@ -0,0 +1,78 @@ + + +20 React _valueTracker + + + +
+

Goal: set the input to react-ok in a way that React would accept. + The page mimics React's _valueTracker: it stamps the input with a + hidden tracker holding the last-seen value. An input event is only + considered "framework-real" if the tracker's recorded value differs from the + current input.value at the moment the event fires + (i.e. somebody used the native HTMLInputElement.value setter and + dispatched input — what React internals require).

+

Setting el.value = ... directly and dispatching a synthetic input + fails because the native setter wasn't used. Calling setRangeText without + dispatching input also fails.

+ +
+ + diff --git a/test-suite/challenges/21-keyboard-modifiers.html b/test-suite/challenges/21-keyboard-modifiers.html new file mode 100644 index 0000000..870bef6 --- /dev/null +++ b/test-suite/challenges/21-keyboard-modifiers.html @@ -0,0 +1,65 @@ + + +21 keyboard modifiers + + + +
+

Goal: focus the input and type a capital A via Shift+a + (not Caps Lock, not pasted, not assigned). Page asserts a real Shift chord: + keydown for Shift arrives before keydown for + A; the A event has shiftKey=true, + key==="A", code==="KeyA", getModifierState("Shift")===true; + and keyup for Shift arrives after keyup for A.

+ +
+ + diff --git a/test-suite/challenges/22-touch-events.html b/test-suite/challenges/22-touch-events.html new file mode 100644 index 0000000..042ddf4 --- /dev/null +++ b/test-suite/challenges/22-touch-events.html @@ -0,0 +1,66 @@ + + +22 touch events + + + +
+

Goal: tap the green pad on a touch-capable device (or via DevTools touch + emulation). Page asserts a real touchstart/touchend sequence: + touches / changedTouches are + TouchList objects containing Touch instances with + identifier, clientX/Y, radiusX/Y, and + force in [0,1]. Synthetic PointerEvent with + pointerType="touch" alone does not satisfy this — touch events must + fire too.

+

Note for caller: requires Chrome touch emulation on (DevTools → Sensors → + "Touch: Force enabled") or a real touchscreen. This is intentional: pi-chrome's + synthetic pointerType:'touch' does NOT also dispatch TouchEvents.

+
+ TAP +
+
+ + diff --git a/test-suite/challenges/23-stack-trace-fingerprint.html b/test-suite/challenges/23-stack-trace-fingerprint.html new file mode 100644 index 0000000..4c1772b --- /dev/null +++ b/test-suite/challenges/23-stack-trace-fingerprint.html @@ -0,0 +1,78 @@ + + +23 stack-trace fingerprint + + + +
+

Goal: click the button. The page samples call stacks from inside several + instrumented globals (Function.prototype.toString, + document.querySelector, Element.prototype.click) and inspects + the stack of this script's own handler. It fails if it sees telltales of + evaluator-injected frames (e.g. at <anonymous> as the only frame, the + bridge's new Function wrapper, callFunctionOn, + executeScript, or extension URLs).

+ +
+ + diff --git a/test-suite/challenges/24-viewport-edge-clicks.html b/test-suite/challenges/24-viewport-edge-clicks.html new file mode 100644 index 0000000..b1ef598 --- /dev/null +++ b/test-suite/challenges/24-viewport-edge-clicks.html @@ -0,0 +1,51 @@ + + +24 viewport edge clicks + + + +
+

Goal: click the button. Page rejects any pointer event whose + clientX/clientY falls outside the viewport + (x < 0, x > innerWidth, etc.) or lands on a coordinate + that's not actually inside the button's getBoundingClientRect(). + Real pointing devices can't dispatch clicks at negative coordinates; + bridges that pass uncoerced selector-center coords (or coordinates from a + stale layout) trip this.

+ +
+ + diff --git a/test-suite/challenges/25-pointer-continuity.html b/test-suite/challenges/25-pointer-continuity.html new file mode 100644 index 0000000..c441045 --- /dev/null +++ b/test-suite/challenges/25-pointer-continuity.html @@ -0,0 +1,62 @@ + + +25 pointer continuity + + + +
+

Goal: click A, then click B. Page requires pointer continuity: + between the two clicks there must be intermediate pointermove events + whose path roughly connects the two click points (no teleport). Two clicks + >100px apart with zero moves between is a synthetic-bridge tell.

+
+ +
+ +
+
+ + diff --git a/test-suite/challenges/26-mousemove-rate.html b/test-suite/challenges/26-mousemove-rate.html new file mode 100644 index 0000000..6b3722f --- /dev/null +++ b/test-suite/challenges/26-mousemove-rate.html @@ -0,0 +1,57 @@ + + +26 mousemove rate + + + +
+

Goal: sweep the mouse across the box for ~1s, then click the green button. + Page measures the inter-event timestamp distribution of mousemove + events. Real pointing devices fire at ~60–250 Hz (median Δt 4–18ms). Bridges + that flood synthetic moves on a tight for-loop or + setTimeout(...,1) produce a degenerate distribution + (most Δt < 2ms, or all Δt identical, or median > 50ms with no jitter).

+
+ sweep me +
+ +
+ + diff --git a/test-suite/challenges/27-scroll-momentum.html b/test-suite/challenges/27-scroll-momentum.html new file mode 100644 index 0000000..981ec7b --- /dev/null +++ b/test-suite/challenges/27-scroll-momentum.html @@ -0,0 +1,66 @@ + + +27 scroll momentum tail + + + +
+

Goal: scroll the box to its bottom using a real wheel/trackpad gesture. + Page records the deltaY sequence and requires a momentum-like tail: + a peak |deltaY|, then a decreasing decay over several events + (≥4 wheel events whose |deltaY| is strictly less than the previous + by >5%). Constant or single-shot wheel events (one big delta then nothing) + fail.

+
+
scroll me ⬇ … continues …
+
+
+ + diff --git a/test-suite/challenges/28-intersection-visibility.html b/test-suite/challenges/28-intersection-visibility.html new file mode 100644 index 0000000..1c90e33 --- /dev/null +++ b/test-suite/challenges/28-intersection-visibility.html @@ -0,0 +1,72 @@ + + +28 IntersectionObserver visibility + + + +
+

Goal: scroll until the hidden TARGET button comes into view, then click it. + Page uses an IntersectionObserver to track when TARGET crosses the + viewport. Real scrolling produces a sequence of intersection updates with + gradually increasing intersectionRatio (0 → 1) across animation + frames. Programmatic teleports (scrollIntoView({behavior:"instant"}), + direct scrollTop=) produce exactly one observer callback with + ratio≈1 and no rAF samples in between — fail.

+
+
keep scrolling …
+ +
+
+ + -- cgit v1.2.3