-
Notifications
You must be signed in to change notification settings - Fork 848
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
azcore 1.8.0 prevents the usage of the sdk against non-https test endpoint #21821
Comments
azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go Lines 32 to 38 in 5d4f342
I wonder whether something like wrapping the above with +1 that the gymnastics we're having to pull to workaround this are really awful. |
That would work. However, I think what we should settle on is the overall pattern on how unit tests should work WRT credentials across all SDKs.
When you write unit tests, which is easier for you? Passing |
I will add that passing |
Note: it's more of an integration test scenario; it's not a unit test scenario. It seems logical to me to pass a nil cred if no Authorization header is wanted, but our integration scenario is a rare use case, and if that flow is enabled, it might become a common error case for new SDK users to pass a nil cred and then be confused when they get a 401 back from production ARM? It's not clear to me that Reducing this to enabling a nil cred effectively solves two problems for us - we no longer need the |
CC @chlowell for awareness At present, the You are correct that if |
Would you mind expanding on how these tests work? What I'm wondering is if our fakes (which GA in November) will be a better way to solve this issue. |
I see, we could manually implement New*ClientWithNoCredential() functions in our SDKs, but if we were to do this it would probably convenient for azcore to have arm.NewClientWithNoCredential() and armruntime.NewPipelineWithNoCredential() analogs. I think that something like that could potentially work. |
This was introduced by #21673 |
The fix (accepting a |
Thank you @jhendrixMSFT ! Appreciate the quick turn around |
Bug Report
in azcore 1.8.0, a new Policy was added in azcore to ensure BearerToken are not sent to an http endpoint.
That's a great addition to ensure we don't leak tokens.
However, we are also unable to configure the clients to not set a bearer token on the outgoing request.
that makes us unable to use the SDK in internal integration testing where we use HTTP enpoints to avoid the overhead of certificate setup.
Would you consider adding an option to make this possible?
I don't think we should allow sending a BearerToken to an httpendpoint, but if we could configure the sdk with a
NoAuthIdentity
type or remove the BearerTokenPolicy from the clients, that would allow us to do this, without the risk of sending a token over insecure channel.Our current workaround is to wrap the transport, and strip the fake bearer token from the header, but that is really hacky, and has some complexity caused by Poller, and Paging on List calls.
The text was updated successfully, but these errors were encountered: