Skip to content

Fix : [ISSUE] databricks auth login - Invalid Databricks Account configuration when host does not specify scheme #1403#1196

Closed
lakshiya wants to merge 2 commits intodatabricks:mainfrom
lakshiya:Issue_1403_Priya
Closed

Fix : [ISSUE] databricks auth login - Invalid Databricks Account configuration when host does not specify scheme #1403#1196
lakshiya wants to merge 2 commits intodatabricks:mainfrom
lakshiya:Issue_1403_Priya

Conversation

@lakshiya
Copy link
Copy Markdown

What changes are proposed in this pull request?

This PR addresses an issue where the Databricks authentication process fails when the host URL does not explicitly include the https:// scheme.

  • WHAT

    The following changes were made:

    1. Updated the logic in the IsAccountClient function in [./config/config.go](config/config.go) to account for host URLs without the https:// scheme (e.g., accounts.cloud.databricks.com).
    2. Added more prefixes to the check to allow authentication with valid hosts that omit the https:// scheme.
    3. Created test cases to validate the fix by checking for authentication with both aws and aws-dod host URLs without the https:// scheme.
  • WHY

    Previously, the authentication failed for users who did not specify https:// in their host URL, even though this should have been allowed. The change ensures that authentication works seamlessly even when the URL is missing the scheme, avoiding unnecessary errors.

How is this tested?

Added unit tests functions in [./config/config_test.go](config/config_test.go) to validate the changes:

  • TestIsAccountClient_WithoutHTTPSInHost_AWSAccount: Validates that the IsAccountClient function works for AWS accounts without the https:// scheme.
  • TestIsAccountClient_WithoutHTTPSInHost_AwsDodAccount: Tests the same functionality for AWS DOD accounts.
  • Both tests were successful, confirming the issue has been resolved. A screenshot showing the test results before and after the fix has been included for reference.

After:

Screenshot 2025-03-30 at 7 57 36 PM

Before:

Screenshot 2025-03-30 at 7 57 53 PM

@github-actions
Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1196
  • Commit SHA: 2c1896a3f2afa5ea0e49d1ffaf11da0190e0487a

Checks will be approved automatically on success.

@github-actions
Copy link
Copy Markdown

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 15 days if no further activity occurs. If this PR is still relevant, please leave a comment or push new changes to keep it open. Thank you for your contributions.

@github-actions github-actions Bot added the stale The PR has been marked as "stale" and will automatically be closed if no further activity. label Mar 27, 2026
@renaudhartert-db
Copy link
Copy Markdown
Contributor

Hi @lakshiya, sorry for the very late response on this.

Thanks for taking the time to investigate this and put together a fix. The issue you identified was real -- IsAccountClient() did not handle hosts without the https:// scheme.

That said, this has since been addressed differently. IsAccountClient() is now deprecated, and the replacement method HostType() normalizes the host before checking prefixes, which handles the schemeless case correctly. Additionally, fixHostIfNeeded() ensures the scheme is always added during config resolution, so by the time any production code checks the host type, it already has the scheme.

Closing this as superseded. Thanks again for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The PR has been marked as "stale" and will automatically be closed if no further activity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants