fix: normalize bare-IP restrictedAddresses entries against IPv6 embeddings - #1554
Open
tilak-patel-postman wants to merge 3 commits into
Open
fix: normalize bare-IP restrictedAddresses entries against IPv6 embeddings#1554tilak-patel-postman wants to merge 3 commits into
tilak-patel-postman wants to merge 3 commits into
Conversation
…dings isAddressRestricted() applied IPv6-embedding normalization (IPv4-mapped, IPv4-compatible, NAT64, IPv4-translated, 6to4) only to entries written in CIDR notation. A bare exact-match entry (e.g. '169.254.169.254') was checked via string equality alone, so any differently-encoded literal of that same address bypassed it -- even with unrelated CIDR entries present elsewhere in the same list. Promote every entry that parses as a valid IP -- CIDR or bare -- into the same restrictedCidrs list (bare IPv4 as /32, bare IPv6 as /128), so both forms get matched against the normalized address. Hostname entries (e.g. 'internal.corp') are unaffected -- they fail IP parsing and stay on the exact-match branch only. Follow-up to #1548.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1554 +/- ##
===========================================
+ Coverage 77.54% 77.60% +0.06%
===========================================
Files 51 51
Lines 4338 4350 +12
Branches 1223 1228 +5
===========================================
+ Hits 3364 3376 +12
Misses 731 731
Partials 243 243
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
isAddressRestricted()(added in #1548) applied IPv6-embedding normalization (IPv4-mapped, IPv4-compatible, NAT64, IPv4-translated, 6to4) only to entries written in CIDR notation. A bare exact-match entry (e.g.'169.254.169.254': true) was checked via string equality alone, so any differently-encoded literal of that same address —::ffff:169.254.169.254,[::ffff:a9fe:a9fe], its NAT64 form, etc. — bypassed it entirely, even when unrelated CIDR entries existed elsewhere in the samerestrictedAddressesmap.Fix
Every entry that parses as a valid IP — whether written as a CIDR (
'10.0.0.0/8') or a bare address ('169.254.169.254') — is now promoted into the samerestrictedCidrslist (bare IPv4 as/32, bare IPv6 as/128), so both forms get matched against the normalized/unwrapped address. Hostname entries (e.g.'internal.corp') are unaffected — they fail IP parsing and stay covered by the exact-match branch only.Scoped to
lib/requester/core.js, no other files touched.Test plan
npx eslintclean on both changed files.Generated with Claude Code