fix(web): match IPv6 loopback hostname with brackets in isPrivateOrLo… - #40152
Open
zl86790 wants to merge 5 commits into
Open
fix(web): match IPv6 loopback hostname with brackets in isPrivateOrLo…#40152zl86790 wants to merge 5 commits into
zl86790 wants to merge 5 commits into
Conversation
…calAddress URL.hostname serializes IPv6 addresses with brackets (e.g. "[::1]"), but the localhost check compared against the unbracketed "::1", so it never matched and IPv6 loopback URLs weren't flagged as private/local.
anujbolewar
reviewed
Aug 7, 2026
anujbolewar
left a comment
There was a problem hiding this comment.
The IPv6 loopback recognition is right, and the test for the bracket form is welcome given the parser here returns the hostname without braces for ::1. A cleaner approach is to strip and normalize brackets once at the top of this function, then compare against the bare values, which avoids two subtly different comparisons. Also note this only covers IPv6 loopback, not other private v6 ranges such as fe80; worth deciding whether that is in scope or a follow-up.
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
isPrivateOrLocalAddress()inweb/utils/urlValidation.tsis supposed to flag localhost, private IP ranges, and.localaddresses so the UI can warn users. The IPv6 loopback check never actually works though:URL.hostnameserializes IPv6 addresses with brackets, so forhttp://[::1]/the hostname is the string"[::1]", not"::1". The comparison never matches, soisPrivateOrLocalAddress('http://[::1]/')silently returnsfalse— it falls through every other check and ends up treated as a public address.Ran it before/after the fix:
Two places use this to warn users about private/local endpoints, and both silently skip the warning for IPv6 loopback:
web/app/components/workflow/nodes/trigger-webhook/panel.tsx:199(webhook debug URL)web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.helpers.ts:171(plugin subscription callback URL)Fix is just matching the bracketed form instead:
Kept this scoped to just the loopback comparison.
isPrivateOrLocalAddressalso doesn't coverfe80::/10(link-local) orfd00::/8(ULA) IPv6 ranges, but that's a separate gap, not something this bug touches — didn't want to bundle it in here.isPrivateOrLocalAddresshad zero test coverage before this, so added a small one covering the loopback case this PR fixes.Screenshots
N/A — logic fix, no UI change.
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods