Skip to content

fix: allow numeric DNS names through IPv4 URL guards - #5579

Merged
Xrazik1 merged 1 commit into
mainfrom
fix/numeric-dns-blocking
Sep 9, 2026
Merged

Xrazik1 merged 1 commit into
mainfrom
fix/numeric-dns-blocking

Conversation

@artiom

@artiom artiom commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Allow dotted DNS names with numeric labels to load when IPv4 network ranges are blocked. For example, 127.0.0.1.example.test must not be treated as an IPv4 address.

  • Add ordered hostname-aware CDP rules on the existing page session, without enabling Fetch interception or adding another session.
  • Preserve scheme and hostname blocks, IPv4/IPv6 range checks, and port-specific self-host exemptions.
  • Install the legacy blocklist first. Browsers without ordered-rule support and custom URL-prefix policies retain the existing conservative matching behavior.
  • Keep pattern generation in Node and matching in Chromium; production code does not depend on Node's URLPattern API.

Validation

  • Full build, TypeScript, lint, and formatting checks pass.
  • 58 focused tests pass under Node 24, including site/proxy authentication and a simulated unsupported-protocol fallback.
  • A real Chromium proxy regression fails before the fix and passes afterward: numeric DNS requests reach the fixture while blocked IP requests do not.
  • 20 additional Browserless route and scratch-directory tests pass with Chromium-only routes.
  • The unrestricted local suite encountered startup failures because other browser binaries were not installed. The browser-image matrix is covered by CI.

Devin Review

Summary by CodeRabbit

  • Security Enhancements

    • Improved browser network protection for DNS lookalikes, metadata endpoints, IPv6 addresses, and protocol-based threats.
    • Added more precise URL blocking while preserving access to configured self-host addresses and ports.
    • Maintained conservative blocking behavior when advanced browser rules are unsupported or cannot be safely applied.
  • Bug Fixes

    • Improved handling of numeric DNS labels and complex URL patterns to ensure blocked destinations remain protected.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: d226268f-9d0f-43df-8e42-efcd0b6fc987

📥 Commits

Reviewing files that changed from the base of the PR and between e81e99c and 009d4e6.

📒 Files selected for processing (4)
  • src/browsers/browsers.cdp.spec.ts
  • src/browsers/browsers.cdp.ts
  • src/network-security.spec.ts
  • src/network-security.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The change adds toBlockedUrlRules for ordered Chromium URL rules, integrates those rules into CDP network blocking, and preserves legacy blocking when translation or protocol installation is unsupported. Tests cover IP, hostname, DNS, self-host, explicit pattern, and fallback behavior.

Changes

Network blocking enforcement

Layer / File(s) Summary
URL rule generation and validation
src/network-security.ts, src/network-security.spec.ts
toBlockedUrlRules validates network policies and generates ordered rules for schemes, hosts, IP ranges, self-host exceptions, userinfo, protocols, and ports. Tests cover valid translations and empty-rule fallback cases.
CDP rule installation
src/browsers/browsers.cdp.ts
installBlockedUrlGuard derives ordered rules after installing legacy blocked URLs. It logs a warning and retains legacy patterns when ordered rule installation fails.
Browser enforcement validation
src/browsers/browsers.cdp.spec.ts
Guarded browser tests cover blocked destinations, numeric DNS labels, explicit URL patterns, and unsupported ordered patterns. Launch helpers accept injectable Config instances.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 009d4

The change allows numeric-label DNS hostnames while retaining existing URL blocking behavior and fallback handling. No current merge-blocking risk remains.

Suggested reviewers: adriansillo, joelgriffith

Sequence Diagram(s)

sequenceDiagram
  participant BrowserTest
  participant installBlockedUrlGuard
  participant toBlockedUrlRules
  participant CDP Network
  BrowserTest->>installBlockedUrlGuard: launch guarded browser
  installBlockedUrlGuard->>CDP Network: enable network blocking
  installBlockedUrlGuard->>CDP Network: install legacy blocked URLs
  installBlockedUrlGuard->>toBlockedUrlRules: translate configured policies
  toBlockedUrlRules-->>installBlockedUrlGuard: ordered URL rules or empty list
  installBlockedUrlGuard->>CDP Network: install ordered rules
  CDP Network-->>BrowserTest: block or allow navigation
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: allowing numeric DNS names through IPv4 URL guards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/numeric-dns-blocking

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


A rabbit checks each rule,
The blocked paths hold their line,
Safe hosts pass through,
Tests guard the network gate,
Fallbacks keep the watch,
The patch hops into place.

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

artiom commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Ready for human review: all 14 executed checks passed, including the six browser-image test jobs, lint, formatting, leak checks, and code scanning. Dependabot automerge was skipped; no checks are pending or failing. Devin found no issues and CodeRabbit reported no actionable comments on the current head. CodeRabbit’s auxiliary ESLint installation failed, but repository lint CI passed. No review findings required changes or rejection, and no review threads remain unresolved. The branch has no merge conflicts; human approval is still required.

@Xrazik1
Xrazik1 merged commit 499dba1 into main Sep 9, 2026
17 checks passed
@Xrazik1
Xrazik1 deleted the fix/numeric-dns-blocking branch September 9, 2026 14:01
artiom pushed a commit that referenced this pull request Sep 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.56.6](v2.56.5...v2.56.6)
(2026-09-09)


### Bug Fixes

* allow numeric DNS names through IPv4 URL guards
([#5579](#5579))
([499dba1](499dba1))
* block IPv4 prefixes without a trailing dot
([#5577](#5577))
([e81e99c](e81e99c))
* update Playwright to 1.63 with versioned compatibility
([#5573](#5573))
([5c80510](5c80510))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: browserless-actions-bot[bot] <186328842+browserless-actions-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.

3 participants