Repository navigation
Check template installer hosts as parsed IP addresses - #196
Merged
Merged
Conversation
The remote template installer's host guard compared IP literals as strings. Parse IPv4 and IPv6 literals into numbers and check the address ranges numerically instead (new utils/ipRanges.ts), so every spelling of an address is handled the same way. Resolved DNS addresses go through the same check. The range list now also covers translated and embedded IPv4 forms, deprecated site-local and multicast IPv6, and the IPv4 multicast, reserved, benchmarking and IETF protocol ranges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
The remote template installer's host guard (
assertSafeRemoteUrlinbackend/src/controllers/templates.ts) checked IP literals with string comparisons and regexes. This replaces them with a small module that parses IPv4 and IPv6 literals into numbers and checks the address ranges numerically, so every spelling of an address is handled the same way.Changes
backend/src/utils/ipRanges.ts:parseIPv4,parseIPv6(compressed::and trailing dotted quads),isInternalIPv4,isInternalIPv6,isInternalAddress.templates.tsusesisInternalAddressfor host literals and for addresses returned by DNS resolution. The previous string-based helpers are removed; redirect handling and DNS resolution are unchanged.Verification
backend/src/utils/ipRanges_test.ts: IPv6 parsing, internal addresses in various spellings (as normalized byURL), and public addresses that must still pass.installTemplateFromManifestwith internal hosts is rejected by the guard; a public URL (raw.githubusercontent.com) still passes the guard.deno checkand the existing backend tests pass.🤖 Generated with Claude Code