Skip to content

Throw if response from IMDS is not valid json #44073

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

Closed

Conversation

billwert
Copy link
Contributor

@billwert billwert commented Feb 7, 2025

Fixes #41291

throw new RuntimeException(e);
}
HttpClient client = HttpClient.createDefault(new HttpClientOptions().setConnectTimeout(Duration.ofSeconds(1)));
HttpRequest request = new HttpRequest(HttpMethod.GET, url);
Copy link
Member

@chlowell chlowell Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a probe request or a fully formed token request? Edit: looks like it's the probe, in which case this would break ACI support (Azure/azure-sdk-for-go#23894). We want to interpret any response to the probe to mean managed identity is worth trying, and throw CredentialUnavailable if the endpoint then responds with a non-JSON body to a token request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a probe. I'll rename the method and add a doc too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test ACI with this change.

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@billwert billwert closed this Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

IMDS probe requests should throw CredentialUnavailableException for any response that is not valid json
5 participants