Skip to content

fix(webgl): stop the weighted draw from sampling software renderers - #326

Open
shauneccles wants to merge 1 commit into
apify:masterfrom
shauneccles:fix/software-renderer-sampling
Open

fix(webgl): stop the weighted draw from sampling software renderers#326
shauneccles wants to merge 1 commit into
apify:masterfrom
shauneccles:fix/software-renderer-sampling

Conversation

@shauneccles

Copy link
Copy Markdown

Problem

sampleWebGL draws from every webgl_fingerprints row with a positive OS weight. On linux the shipped dataset holds 11 devices, three of which are llvmpipe spellings — 9.0% of draws, roughly one launch in eleven — and the drawn string is what pages read back through WEBGL_debug_renderer_info. A GPU-less software renderer is one of the strongest bot signals a consistency check can test for, which makes ~9% of linux launches self-defeating.

Prior art

Change

One WHERE clause on the weighted-sampling branch: rows whose renderer mentions llvmpipe, SwiftShader, Basic Render (Microsoft Basic Render Driver) or Generic Renderer are excluded from the draw. The rows stay in the dataset and remain selectable through the explicit webgl_config vendor/renderer pair — that path is untouched, so anyone who wants a software-renderer fingerprint can still ask for it.

Tests

New test/webgl-software-renderers.test.ts (against the shipped dataset):

  • 500 draws on linux: no software renderer, and the draw still spans multiple hardware devices (not collapsed to one row)
  • 300 draws each on win/mac/lin: no software renderer
  • an explicit llvmpipe pair still resolves through the two-argument path
  • getPossiblePairs still reports the full unfiltered pair list

Full suite: the only failures in this environment are the pre-existing Xvfb/browser-launch timeouts (WSL, no X11 fork server) — identical set with and without this change, verified stash-baseline vs patched. biome check: same findings before and after (the flagged noNonNullAssertion lines in sample.ts are pre-existing on master, shifted only by the added comment).

Release note suggestion

sampleWebGL no longer returns software-renderer fingerprints from the weighted draw; explicit webgl_config pairs are unaffected.

The weighted sampler draws from every row with a positive OS weight. On
linux that includes three llvmpipe spellings (9% of draws on the shipped
dataset), and pages read the resulting renderer string back through
WEBGL_debug_renderer_info -- a GPU-less software renderer is one of the
strongest bot signals there is.

daijro/camoufox#743 removed the same bias from the python generator
(software rasterizers are excluded from sampling entirely); apify#276
documents the dataset contamination. This applies the same rule to the
Node implementation: the software-renderer rows stay in the db and
remain reachable through an explicit vendor/renderer pair, but the
random draw can no longer hand them out.

Software renderers excluded: llvmpipe, SwiftShader, Microsoft Basic
Render Driver, Generic Renderer.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd2be56ba5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +59 to +62
test("unknown explicit pairs still report the full (unfiltered) pair list", async () => {
const pairs = await getPossiblePairs();
expect(Array.isArray(pairs.lin)).toBe(true);
expect(pairs.lin!.length).toBeGreaterThanOrEqual(11);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise the unknown-pair error path

This test never supplies an unknown explicit pair to sampleWebGL; it only calls the independent getPossiblePairs() API. Consequently, it would remain green if the error path’s SELECT DISTINCT query were filtered or its reported pair list were otherwise broken, so the behavior named by the test is not actually protected. Invoke sampleWebGL with a nonexistent pair and assert that the rejected error contains a known software-renderer pair.

Useful? React with 👍 / 👎.

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.

2 participants