Skip to content

feat(stealth): WebGL in headed mode and a timezone request field - #92

Merged
gildesmarais merged 2 commits into
mainfrom
stealth/webgl-timezone
Nov 30, 2026
Merged

gildesmarais merged 2 commits into
mainfrom
stealth/webgl-timezone

Conversation

@gildesmarais

Copy link
Copy Markdown
Member

What changed

  • WebGL in headed mode: Chromium now starts with --use-angle=swiftshader --enable-unsafe-swiftshader (RENDER_ARGUMENTS in app/engine/warm_pool.py). Headed mode runs on Xvfb, the default virtual display, which has no GL, so pages got no WebGL context at all. Now both modes report the same software renderer headless already used: ANGLE (Google, Vulkan … SwiftShader driver).
  • Timezone:
    • New optional timezone field on POST /scrape. It takes an IANA id such as Europe/Berlin, validated against the tz database; unknown ids return 422.
    • New SCRAPE_DEFAULT_TIMEZONE env fills it when a request sends none. An invalid value fails at startup.
    • configure_driver applies it per tab with Emulation.setTimezoneOverride, so it also covers adopted warm spares.
    • Browser tier only; the request tier has no JavaScript.
  • openapi.yaml is regenerated. The change is additive and info.version stays at 2.0.0. The README documents the field, the env and the WebGL behavior.

Why

These come from a stealth audit of the browser tier:

  • WebGL: a desktop Chrome UA with no WebGL context is a strong "not a real browser" signal.
  • Timezone:
    • Pages always saw UTC, which matches almost no real user.
    • With a residential upstream proxy, UTC also contradicts the exit IP's location.
    • The operator picks the proxy country, so they can pass the matching zone.

Risk

  • WebGL:
    • SwiftShader is software rendering, so WebGL-heavy pages cost CPU. Feed pages rarely use WebGL.
    • The renderer string still names SwiftShader. That is common on VMs, and it is what headless already reported.
    • The renderer is not spoofed, because a JavaScript shim is easier to detect than the plain value.
  • Timezone:
    • It is a per-tab CDP override, verified for the page and for workers.
    • Cross-origin iframes are unverified. They should share it, since Botasaurus disables site isolation.
    • Pages that open a new tab would not inherit it.
  • Stacked on feat(security): enforce SSRF policy inside Chromium with pinned-DNS egress guard #91: both PRs change create_driver_from_fingerprint. Merge feat(security): enforce SSRF policy inside Chromium with pinned-DNS egress guard #91 first, then retarget this PR to main.
  • Gem follow-up: html2rss needs timezone in BotasaurusContract::REQUEST_OPTION_KEYS and its validator, plus the vendored openapi.yaml, before feeds can set it.

Review map: small. Start at tests/engine/test_driver_profile.py (WebGL flags, timezone default and override), then tests/api/test_request_schema.py, app/engine/strategies.py, app/config.py.

Validation

  • make check: 263 tests, pyright 0 errors, openapi-verify ok.
  • make smoke: both profiles pass.
  • In-container probe through create_driver_from_fingerprint and configure_driver, in headed mode:
    • WebGL went from null to the SwiftShader renderer.
    • With timezone=Asia/Tokyo, the page and a worker both report Asia/Tokyo (offset -540). Without it, they report UTC.

🤖 Generated with Claude Code

@gildesmarais
gildesmarais marked this pull request as ready for review November 30, 2026 17:12
@gildesmarais
gildesmarais added this pull request to stack #93 November 30, 2026 17:14
Base automatically changed from brain/t2-chrome-egress to main November 30, 2026 17:15
gildesmarais and others added 2 commits November 30, 2026 18:15
Xvfb has no GL, so headed Chromium exposed no WebGL context at all; a
hard tell on a desktop Chrome UA. --use-angle=swiftshader with
--enable-unsafe-swiftshader gives headed mode the same software renderer
headless already reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Browser scrapes always reported UTC, which matches no ordinary user and
contradicts any non-UTC exit IP. An optional IANA timezone (validated
against the tz database; 422 otherwise) falls back to
SCRAPE_DEFAULT_TIMEZONE and is applied per tab via
Emulation.setTimezoneOverride in configure_driver, after warm adoption.
Pages and workers both see it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gildesmarais
gildesmarais force-pushed the stealth/webgl-timezone branch from 4714793 to 439704d Compare November 30, 2026 17:15
@gildesmarais
gildesmarais enabled stacked auto-merge (squash) November 30, 2026 17:16
@gildesmarais
gildesmarais merged commit 1e9f480 into main Nov 30, 2026
13 checks passed
@gildesmarais
gildesmarais deleted the stealth/webgl-timezone branch November 30, 2026 17:17
gildesmarais added a commit to html2rss/html2rss that referenced this pull request Nov 30, 2026
## What changed

- `request.botasaurus.timezone`, an IANA id such as `Europe/Berlin`, is
a new accepted option. It is forwarded on `POST /scrape` through
`BotasaurusContract::REQUEST_OPTION_KEYS`. `Config::Validator` accepts
it as a non-empty string.
- `spec/fixtures/botasaurus/openapi.yaml` is vendored from
html2rss/botasaurus-scrape-api#92. `schema/html2rss-config.schema.json`
is regenerated.
- The six boolean Botasaurus options are declared in one loop, so the
schema block stays within `Metrics/BlockLength`. The exported schema is
unchanged by this.

## Why

The scrape API now lets the caller set the timezone the browser reports
to pages, for example to match a residential proxy's exit country (#92).
Without the key here, feed configs could not set it.

## Risk

- Low. The scrape API owns the IANA check and answers unknown ids with
`422`, so the gem does not duplicate the tz database.
- Merge order:
  1. html2rss/botasaurus-scrape-api#91, then #92
  2. #723
  3. this PR, retargeted to `master`

Review map: small. Start at
`spec/lib/html2rss/request_service/botasaurus_contract_spec.rb`.

## Validation

- `make ready`: 8717 examples and 0 failures, RuboCop clean, the schema
check passes. The sibling-OpenAPI sync spec ran against #92's
`openapi.yaml`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant