Skip to content

fix: forward step headers to reflection RPC#1485

Merged
k1LoW merged 1 commit into
k1LoW:mainfrom
kimoto:fix/cgrpc-reflection-auth
Jun 24, 2026
Merged

fix: forward step headers to reflection RPC#1485
k1LoW merged 1 commit into
k1LoW:mainfrom
kimoto:fix/cgrpc-reflection-auth

Conversation

@kimoto

@kimoto kimoto commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Step-level headers: were not forwarded to the reflection client context, so runn failed with UNAUTHENTICATED against servers whose auth interceptor covers every RPC including reflection
  • Fixed by passing setHeaders(ctx, r.headers) to connectAndResolve in run(), mirroring the behaviour of grpcurl -H

Fixes #1484

Test plan

  • TestGrpcRunnerReflectionWithAuth/step headers are forwarded to reflection RPC — verifies the fix works against an auth-required server
  • TestGrpcRunnerReflectionWithAuth/reflection RPC fails without step headers — documents that the server correctly rejects unauthenticated calls
Test results

Before fix (FAIL):

=== RUN   TestGrpcRunnerReflectionWithAuth/step_headers_are_forwarded_to_reflection_RPC
    grpc_test.go:668: run() with auth header failed: rpc error: code = Unauthenticated desc = auth required
--- FAIL: TestGrpcRunnerReflectionWithAuth (0.00s)
    --- FAIL: TestGrpcRunnerReflectionWithAuth/step_headers_are_forwarded_to_reflection_RPC (0.00s)
FAIL	github.com/k1LoW/runn	1.020s

After fix (PASS):

=== RUN   TestGrpcRunnerReflectionWithAuth/step_headers_are_forwarded_to_reflection_RPC
--- PASS: TestGrpcRunnerReflectionWithAuth (0.00s)
    --- PASS: TestGrpcRunnerReflectionWithAuth/step_headers_are_forwarded_to_reflection_RPC (0.00s)
PASS	github.com/k1LoW/runn	0.858s

step-level `headers:` are now passed to the reflection client context,
so reflection succeeds against servers that require auth on every RPC
(including the reflection RPC itself).

Previously `connectAndResolve` received a bare `ctx`, causing
UNAUTHENTICATED failures when the server's auth interceptor covered
reflection. The fix threads `setHeaders(ctx, r.headers)` into
`connectAndResolve`, mirroring grpcurl's `-H` behaviour.

Closes k1LoW#1484

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@k1LoW

k1LoW commented Jun 24, 2026

Copy link
Copy Markdown
Owner

@kimoto Good catch!! Thank you for your contribution!!

@k1LoW k1LoW merged commit 820befe into k1LoW:main Jun 24, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 20, 2026
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.

cgrpc: step headers: not applied to reflection RPC, fails on auth-required servers

2 participants