Skip to content

Support proxy_auth_domain on gRPC auxiliary transport - #6469

Merged
finnegancarroll merged 2 commits into
opensearch-project:mainfrom
abhinavp105:feature/grpc-proxy-auth-domain
Sep 17, 2026
Merged

finnegancarroll merged 2 commits into
opensearch-project:mainfrom
abhinavp105:feature/grpc-proxy-auth-domain

Conversation

@abhinavp105

Copy link
Copy Markdown
Contributor

Closes #6439

BackendRegistry.GRPC_SUPPORTED_AUTH gated the gRPC auth path on {jwt, basic}, silently dropping any configured proxy_auth_domain. This adds "proxy" to that set so HTTPProxyAuthenticator is included in the gRPC auth chain — enabling Envoy ext_authz-style header-based identity (x-proxy-user / x-proxy-roles) to be trusted on gRPC the same way it is on REST today.

No other wiring changes were needed:

  • BackendRegistry.authenticate() already calls XFFResolver.resolve() unconditionally for both REST and gRPC, so RemoteIpDetector sets OPENDISTRO_SECURITY_XFF_DONE on the thread context when the caller IP matches the configured internal-proxies allowlist.
  • GrpcRequestChannel.getRemoteAddress() returns the client InetSocketAddress from Grpc.TRANSPORT_ATTR_REMOTE_ADDR.
  • GrpcRequestChannel.getHeaders() exposes ASCII headers case-insensitively so user_header / roles_header lookups work.

Tests

  • BackendRegistryGrpcAuthTest — added a success case (testGrpcAuthenticateWithValidProxyAuthAndConfiguredDomain) and a regression guard (testGrpcProxyAuthDomainIsNotSkipped) that fails if "proxy" is dropped from GRPC_SUPPORTED_AUTH.
  • ProxyAuthGrpcTest (new) — full integration test on SINGLENODE + SecureNetty4GrpcServerTransport + TLS, exercising SecurityGrpcFilterBackendRegistryHTTPProxyAuthenticatorroles_mapping with a real DocumentService.Bulk call. Positive case, plus negatives for missing x-forwarded-for and missing user header.

Also updates the stale "JWT only" comment inside authenticate().

Check List

  • New functionality includes testing
  • New functionality has been documented in the code (Javadoc / comments where relevant)
  • Commits are signed per the DCO using --signoff

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit 931657d)

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 5fb409c

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.89%. Comparing base (b6c53ba) to head (931657d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6469      +/-   ##
==========================================
- Coverage   75.92%   75.89%   -0.04%     
==========================================
  Files         461      461              
  Lines       30968    30968              
  Branches     4674     4674              
==========================================
- Hits        23513    23502      -11     
- Misses       5290     5302      +12     
+ Partials     2165     2164       -1     
Files with missing lines Coverage Δ
.../org/opensearch/security/auth/BackendRegistry.java 79.88% <100.00%> (ø)

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@finnegancarroll

Copy link
Copy Markdown
Collaborator

Thanks for adding this support @abhinavp105 !
Added a minor comment on testing the negative case but otherwise LGTM.

BackendRegistry gated the gRPC auth path on GRPC_SUPPORTED_AUTH =
Set.of("jwt", "basic"), which silently dropped any configured
proxy_auth_domain. This adds "proxy" to that set so HTTPProxyAuthenticator
is included in the gRPC auth chain.

No other changes were needed:
 - BackendRegistry.authenticate() already calls XFFResolver.resolve()
   unconditionally for both REST and gRPC, so RemoteIpDetector sets
   OPENDISTRO_SECURITY_XFF_DONE on the thread context when the caller
   IP matches the configured internal-proxies allowlist.
 - GrpcRequestChannel.getRemoteAddress() returns the client
   InetSocketAddress from Grpc.TRANSPORT_ATTR_REMOTE_ADDR.
 - GrpcRequestChannel.getHeaders() exposes ASCII headers
   case-insensitively so user_header / roles_header lookups work.

Tests
 - BackendRegistryGrpcAuthTest: added a success case and a regression
   guard that fails if "proxy" is dropped from GRPC_SUPPORTED_AUTH.
 - ProxyAuthGrpcTest (new): full integration test on
   SINGLENODE + SecureNetty4GrpcServerTransport + TLS, exercising
   SecurityGrpcFilter -> BackendRegistry -> HTTPProxyAuthenticator ->
   roles_mapping with a real DocumentService.Bulk call. Covers a
   positive case plus negative cases for missing x-forwarded-for and
   missing user header.
 - ProxyAuthGrpcUntrustedProxyTest (new): security-critical negative
   suite that pins internalProxies to a non-loopback address. Asserts
   that a well-formed x-proxy-user request from an untrusted source IP
   (127.0.0.1) is rejected as UNAUTHENTICATED, matching REST behavior
   and guarding against caller-forged identity headers.

Also updates the stale "JWT only" comment inside authenticate().

Signed-off-by: Abhinav Pandey <avinodkumarpandey@atlassian.com>
@abhinavp105
abhinavp105 force-pushed the feature/grpc-proxy-auth-domain branch from 5fb409c to 87734ef Compare September 17, 2026 04:26
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 87734ef

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 931657d

@finnegancarroll
finnegancarroll merged commit d6e21e3 into opensearch-project:main Sep 17, 2026
67 of 68 checks passed
@abhinavp105
abhinavp105 deleted the feature/grpc-proxy-auth-domain branch September 18, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] proxy_auth_domain support on gRPC auxiliary transport

3 participants