Skip to content

Update isLocalURL to include LAN addresses, .local domains, and hostn…#5973

Open
cathaysia wants to merge 4 commits intofirefox-devtools:mainfrom
cathaysia:main
Open

Update isLocalURL to include LAN addresses, .local domains, and hostn…#5973
cathaysia wants to merge 4 commits intofirefox-devtools:mainfrom
cathaysia:main

Conversation

@cathaysia
Copy link
Copy Markdown

@cathaysia cathaysia commented Apr 28, 2026

Treat non-public addresses—such as loopback addresses, LAN addresses, and CGNAT addresses—as local addresses; this allows for direct access to computers within the local network, Tailscale and etc..

@cathaysia cathaysia force-pushed the main branch 2 times, most recently from 38f05a1 to c5cad4d Compare April 28, 2026 07:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.35%. Comparing base (b868d0e) to head (7b3c2f1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/url.ts 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5973      +/-   ##
==========================================
+ Coverage   85.34%   85.35%   +0.01%     
==========================================
  Files         318      318              
  Lines       31922    31947      +25     
  Branches     8834     8851      +17     
==========================================
+ Hits        27244    27269      +25     
  Misses       4246     4246              
  Partials      432      432              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@canova canova left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, adding some comments below.

Comment thread src/test/unit/url.test.ts
Comment thread src/utils/url.ts Outdated
Comment thread src/utils/url.ts Outdated
Comment thread src/utils/url.ts Outdated
return true;
}
// .local domains or hostnames without dots
if (hostname.endsWith('.local') || !hostname.includes('.')) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm !hostname.includes('.') will now catch all ipv6 addresses. I think we can remove this check.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I add a new function isLocalHostName, which will check is the hostname is a local hostname. :)

Comment thread src/test/unit/url.test.ts
@cathaysia cathaysia force-pushed the main branch 2 times, most recently from 7dcfd1c to ee13e17 Compare April 30, 2026 10:37
@cathaysia
Copy link
Copy Markdown
Author

before:

image

after:

image

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