fix(renderer): strip Mozilla UA prefix for lightpanda#186
Merged
Conversation
v0.18.2's Network.setUserAgentOverride was a silent no-op on lightpanda: its validateUserAgent rejects ANY UA containing "Mozilla" (error.Reserved) and keeps its own default UA, so JS-rendered scrapes via lightpanda (the default engine) still tripped "browser outdated" gates. Strip the "Mozilla/5.0 " prefix when the tier is lightpanda — the "...Chrome/<ver>..." token UA gates check survives, and lightpanda accepts it. Chrome keeps the full UA. (lightpanda routes Network.* to the same Emulation handler, so no method change needed.)
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.
v0.18.2's UA override was a silent no-op on lightpanda (default engine): its validateUserAgent rejects ANY UA containing "Mozilla" (error.Reserved, verified in lightpanda source) → kept its own default UA → JS scrapes still tripped "browser outdated". Strip "Mozilla/5.0 " prefix for lightpanda; the "...Chrome/..." token survives. Chrome keeps full UA. Plan→3x review (caught the Network==Emulation + Mozilla-reject premise)→implement→2x code-review→revise. clippy+209 tests green. Ships in v0.18.3.
Known follow-up (separate, stealth-only): with stealth UA rotation, a Firefox/Safari pool entry sent to lightpanda has no Chrome token — Chrome-only gates may still reject. Not this bug (Mozilla-reject affected everyone); tracked separately.