Repository navigation
[ISSUE #11673] fix(common): match equivalent IPv6 literals in ACL source IP check - #11674
Open
amalsaidov wants to merge 1 commit into
Open
amalsaidov wants to merge 1 commit into
amalsaidov wants to merge 1 commit into
Conversation
…ange A single-IP ACL entry was compared to the client address as a plain string, so '::1' never matched a client reported as '0:0:0:0:0:0:0:1' or '[0:0:0:0:0:0:0:1]' (the form InetSocketAddress#toString uses on JDK 14+). Fall back to comparing the parsed addresses when both sides are IP literals.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #11674 +/- ##
=============================================
- Coverage 51.41% 51.38% -0.04%
+ Complexity 15065 15060 -5
=============================================
Files 1391 1391
Lines 103941 103947 +6
Branches 13645 13648 +3
=============================================
- Hits 53444 53408 -36
- Misses 44254 44284 +30
- Partials 6243 6255 +12 ☔ 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.
Which Issue(s) This PR Fixes
Fixes #11673
Brief Description
IPAddressUtils#isIPInRangecompared a single-IP ACL entry with the client IP as plain strings, so::1never matched a client reported as0:0:0:0:0:0:0:1or[0:0:0:0:0:0:0:1](theInetSocketAddress#toString()form on JDK 14+).When the strings differ, the method now compares the parsed addresses, provided both sides are valid IP literals (one pair of
[]around the client IP is stripped first). Non-IP values are never resolved and still returnfalse, so behaviour for IPv4 and invalid input is unchanged.How Did You Test This Change?
Added
IPAddressUtilsTest#isIPInRangeShouldMatchEquivalentIPv6Literalscovering compressed, full, bracketed and upper-case forms, plus negative cases (different address, non-IP string, different IPv4). It fails before the change and passes after;mvn -pl common -Dtest=IPAddressUtilsTest testis green.