-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reclient issues requests with duplicate Authorization headers #27
Comments
When PerRPCCreds is used, we are already setting it as part of DialParams, so we don't have to once again include it as part of clientopts when creating the connection. When included again as part of clientopts, it results in gRPC adding duplicate Authorization header to the requests. Issue: bazelbuild/reclient#27 (thanks to @MarshallOfSound for debugging this) Tested: I build with this, ran a sample command and confirmed with mitmproxy that authorization header wasn't repeated.
Just a heads up: the experimental_credentials_helper flag might change in the next few months (and hence the experimental_ prefix). The way we envision credentials helper to actually work is that it will directly return the headers to be included and reproxy will include only those headers with the request (#16). However, it will still use That aside, thanks for tracking the issue down - that was some great debugging 😄 The gRPC comment indicates that these will be included twice if both |
@MarshallOfSound
Is there a specific extension I should be using to make it work with gRPC? |
Yup I've been following that issue and any progress on the credential helper work, our current helper returns both the current format and the proposed
I actually swapped out the
Ah no, unfortunately burpsuite doesn't successfully proxy GRPC requests 🙃 It just proxies enough of the initial HTTP/2 request to diagnose this issue, I couldn't find a very nice GRPC-capable proxy and burpsuite worked just barely to figure this out so I didn't really look harder 😆 |
When PerRPCCreds is used, we are already setting it as part of DialParams, so we don't have to once again include it as part of clientopts when creating the connection. When included again as part of clientopts, it results in gRPC adding duplicate Authorization header to the requests. Issue: bazelbuild/reclient#27 (thanks to @MarshallOfSound for debugging this) Tested: I build with this, ran a sample command and confirmed with mitmproxy that authorization header wasn't repeated.
Confirmed this appears to fix it 👍 |
Got it. I was able to setup and make mitmproxy CLI to work (didn't try intercepting requests, but it atleast logs them which gave me sufficient info to confirm the fix).
thanks for confirming! I'll close this out now, you should see the SDK version bumped in reclient soon. |
As in the title, outgoing requests from
reclient
include theAuthorization
header twice (with the exact same value)On paper this doesn't sound too bad but nginx enforces there is only a single authorization header. This means that folks using nginx as tls termination in front of their RBE cluster (hi, that's me) can't use reclient with authentication.
My configuration was mostly reverse engineered as the docs are a bit all over the place but I think I pieced it all together correctly.
I'm then also configuring two options via environment variables:
The credential helper I'm using at the moment is just a binary that echos hardcoded json so nothing funky going on there.
Included below is a screenshot from a mitm proxy (burpsuite) showing the 400 response and the duplicate auth header

I tracked down the "duplicate header injection" part to this core code in grpc-go 😅 And I "fixed" the issue locally by building a version of
reproxy
with these lines removed. The comment in that file indicates this behavior is intentional so I'm not sure what the path forward is here.Maybe fixing it so that
use_rpc_credentials
actually works for credential helper backed requests 🤔 At the moment that only impacts a subset of authentication strategies based on their impl inremote-apis-sdk
. Either that or patchinggrpc-go
to never set duplicateAuthorization
headers specifically to avoid this issue. I'm not familiar enough with go or this ecosystem at large to actually offer a change in the right place but if someone has an answer I'm happy to write the code in the place I'm pointed to 😄The text was updated successfully, but these errors were encountered: