fix(image): keep spoofed OS fonts behind a build arg - #108
Merged
Conversation
The pool assigns each browser a fingerprint and maps it to Camoufox's os token
(pool.ts: Win32 -> windows, MacIntel -> macos), and Camoufox spoofs that OS's
font list along with it. The image then deleted /opt/camoufox/fonts/{macos,windows},
so any browser that is not spoofing Linux advertises fonts whose files are gone and
renders every glyph as a tofu box. FINGERPRINT_POOL is indexed by browser number, so
browser 0 is always Win32 and browser 1 MacIntel: with a small pool, every screenshot
is affected.
It is invisible from inside the container — the system Liberation fonts are present
and fc-match resolves — so only a rendered pixel shows it. Verified by re-rendering
the same URL with the windows bundle restored: tofu becomes readable text.
Deleting them also leaves the fingerprint self-inconsistent (a Windows UA with no
Windows fonts), which anti-bot vendors grade on.
Default is unchanged, so the published image keeps its current size; build with
--build-arg KEEP_SPOOFED_OS_FONTS=1 (+891MB) when rendered output matters.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replacement for #101 because the maintainer adaptation could not be pushed to the contributor fork.
KEEP_SPOOFED_OS_FONTSbehavior toapps/api/Dockerfile.baseline--build-arg KEEP_SPOOFED_OS_FONTS=1Closes #97.
Verification
docker buildx build --check --file apps/api/Dockerfile .docker buildx build --check --file apps/api/Dockerfile.baseline .bun run verify(271 tests)