Skip to content

Fix incorrect hostname suffix matching in no_proxy handling (prevents proxy bypass)#41915

Open
manan2212 wants to merge 2 commits intogrpc:masterfrom
manan2212:manan2212-patch-1
Open

Fix incorrect hostname suffix matching in no_proxy handling (prevents proxy bypass)#41915
manan2212 wants to merge 2 commits intogrpc:masterfrom
manan2212:manan2212-patch-1

Conversation

@manan2212
Copy link
Copy Markdown

The current implementation of hostname matching in no_proxy logic uses a naive suffix check:

absl::EndsWithIgnoreCase(host_name, host_name_or_domain)

This can incorrectly match unrelated domains:

  • evilcorp.example.com matches corp.example.com
  • notexample.com matches example.com

This behavior deviates from standard no_proxy implementations and can lead to proxy bypass or policy evasion.

Fix

This patch replaces suffix matching with boundary-aware domain validation:

  • Exact match for normal entries
  • Proper subdomain matching only for dot-prefixed entries

Security Impact

Prevents:

  • Proxy bypass
  • Security control evasion

… proxy bypass / SSRF)

The current implementation of hostname matching in no_proxy logic uses a naive suffix check:

    absl::EndsWithIgnoreCase(host_name, host_name_or_domain)

This can incorrectly match unrelated domains:
- evilcorp.example.com matches corp.example.com
- notexample.com matches example.com

This behavior deviates from standard no_proxy implementations and can lead to proxy bypass and potential SSRF or policy evasion.

## Fix
This patch replaces suffix matching with boundary-aware domain validation:
- Exact match for normal entries
- Proper subdomain matching only for dot-prefixed entries

## Security Impact
Prevents:
- Proxy bypass
- SSRF amplification
- Security control evasion
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 21, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: manan2212 / name: Manan Sanghvi (0da92ba)
  • ✅ login: manan2212 / name: manan2212 (46f98b4)

@murgatroid99 murgatroid99 added release notes: yes Indicates if PR needs to be in release notes kokoro:run labels Apr 3, 2026
@murgatroid99
Copy link
Copy Markdown
Member

Can you also update the documentation here to match the modified behavior?

Copy link
Copy Markdown
Member

@murgatroid99 murgatroid99 left a comment

Choose a reason for hiding this comment

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

Please run the formatter (tools/distrib/clang_format_code.sh) or directly apply the changes from this test result

@manan2212
Copy link
Copy Markdown
Author

I did required changes. Please let me know if i missed anything else.

Copy link
Copy Markdown
Author

@manan2212 manan2212 left a comment

Choose a reason for hiding this comment

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

Fixed!

@manan2212 manan2212 closed this Apr 4, 2026
@manan2212 manan2212 reopened this Apr 4, 2026
@manan2212
Copy link
Copy Markdown
Author

Sorry, I closed the PR by mistake!!

@manan2212 manan2212 requested a review from murgatroid99 April 4, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bloat/none lang/core release notes: yes Indicates if PR needs to be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants