Skip to content

Fix InetAddressMatchers#matchExternal to exclude null and any local addresses#19073

Open
therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic:gh-19072
Open

Fix InetAddressMatchers#matchExternal to exclude null and any local addresses#19073
therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic:gh-19072

Conversation

@therepanic
Copy link
Copy Markdown
Contributor

This commit fixes the incorrect behavior of
InetAddressMatchers#matchExternal, where matchExternal returns an incorrect answer when passing a null / local address argument, which is not reliable.

Closes: gh-19072

…ddresses

This commit fixes the incorrect behavior of
`InetAddressMatchers#matchExternal`, where `matchExternal` returns an
incorrect answer when passing a null / local address argument, which is
not reliable.

Closes: spring-projectsgh-19072

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 14, 2026
Comment on lines 259 to 263
}
if (address.isAnyLocalAddress()) {
return true;
}
if (address.isLoopbackAddress() || address.isLinkLocalAddress() || address.isSiteLocalAddress()) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This would probably be more elegant than adding the same check but on matchExternal, since the logic of matchExternal is to return the response back from matchInternal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InetAddressMatchers.matchExternal() matches null and 0.0.0.0

2 participants