Skip to content
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

fix: Use url.JoinPath() to more flexibly handle extraneous slashes #1148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bmoylan
Copy link

@bmoylan bmoylan commented Jan 24, 2025

In a custom cloud environment, we configure terraform-provider-azurerm with a metadata_host whose response to GET /metadata/endpoints?api-version=2022-09-01 includes a trailing slash in the loginEndpoint field. The current Sprintf approach assumes well formed (no slashes) endpoints. The provider fails to get OIDC credentials in this environment due to the double slash at the beginning of the path returned by tokenEndpoint().

In order to be more robust to this subtly unepected input, the provider can use url.JoinPath to clean missing and double slashes.

Fixes #1152

@bmoylan bmoylan requested a review from a team as a code owner January 24, 2025 23:01
Copy link

hashicorp-cla-app bot commented Jan 24, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the release-once-merged The SDK should be released once this PR is merged label Jan 24, 2025
@bmoylan
Copy link
Author

bmoylan commented Jan 28, 2025

Hi @manicminer it looks like you've worked on a lot of the surrounding code here. Would you be able to review this change? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-once-merged The SDK should be released once this PR is merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sdk/auth: loginEndpoint in secure cloud contains unhandled trailing slash
1 participant