Skip to content

[config/configgrpc] Return PerRPCCredentials error instead of swallowing it#15657

Open
lazureykis wants to merge 1 commit into
open-telemetry:mainfrom
lazureykis:fix/configgrpc-perrpc-auth-swallow
Open

[config/configgrpc] Return PerRPCCredentials error instead of swallowing it#15657
lazureykis wants to merge 1 commit into
open-telemetry:mainfrom
lazureykis:fix/configgrpc-perrpc-auth-swallow

Conversation

@lazureykis

@lazureykis lazureykis commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

ClientConfig.getGrpcDialOptions swallowed the error from a gRPC client auth extension's PerRPCCredentials(). On failure it ran return nil, err, but err at that point is the (nil) result of the earlier successful cc.TLS.LoadTLSConfig(ctx) — so the function returned (nil, nil). The gRPC client was then built without the intended per-RPC credentials instead of failing, silently dropping client auth.

The fix returns perr (the actual PerRPCCredentials() error) so the failure propagates through ToClientConn.

Link to tracking issue

Fixes #15658

Testing

Added TestGetGRPCDialOptionsPerRPCCredentialsError, which configures a client auth extension via extensionauthtest.NewErr (whose PerRPCCredentials() returns an error) and asserts getGrpcDialOptions propagates it. This path was previously untested: every existing configgrpc auth test uses extensionauthtest.NewNopClient, whose PerRPCCredentials() returns a nil error, so the bug was never exercised. The test fails against the old code (An error is expected but got nil) and passes with the fix. It mirrors the existing HTTP-side analog in confighttp/client_test.go.

Documentation

Changelog entry added under .chloggen/.

Authorship

  • I, a human, wrote this pull request description myself.

…ing it

getGrpcDialOptions returned the outer (nil) err rather than perr when a
client auth extension's PerRPCCredentials() failed, so the error was
silently swallowed and the gRPC client was built without the intended
per-RPC credentials instead of failing.

Return perr, and add a test exercising the failure path via
extensionauthtest.NewErr, which was previously untested (every auth
test used NewNopClient, whose PerRPCCredentials returns a nil error).

Assisted-by: Claude Opus 4.8
Signed-off-by: Pavel Lazureykis <pavel@lazureykis.dev>
@lazureykis
lazureykis force-pushed the fix/configgrpc-perrpc-auth-swallow branch from 41640f9 to 1da8b15 Compare July 24, 2026 18:12
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.03%. Comparing base (00f6354) to head (1da8b15).
⚠️ Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15657      +/-   ##
==========================================
- Coverage   91.10%   91.03%   -0.07%     
==========================================
  Files         726      729       +3     
  Lines       48079    48491     +412     
==========================================
+ Hits        43803    44146     +343     
- Misses       2978     3019      +41     
- Partials     1298     1326      +28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@songy23 songy23 added the ready-to-merge Code review completed; ready to merge by maintainers label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Code review completed; ready to merge by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[config/configgrpc] gRPC client auth extension error is swallowed, silently dropping per-RPC credentials

2 participants