Repository navigation
Reject an invalid host in auth login and auth token #7195
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
Merged
+326
−47
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
57f8b47
Reject an empty host at the login host prompt
maksim-zuev-db 81bdb8f
Add a changelog fragment for the empty host prompt fix
maksim-zuev-db 9df79c6
Trim spaces around the host entered at the login host prompt
maksim-zuev-db 5a1041f
Reject a host that is empty after normalization
maksim-zuev-db 00f08ce
Check the screen in the empty host prompt test
maksim-zuev-db 63017a4
Show a blank prompt glyph until invalid input is edited
maksim-zuev-db f6d384f
Update the changelog fragment for the review fixes
maksim-zuev-db 954e9ac
Check for an empty host in one place, including --skip-workspace
maksim-zuev-db 5604deb
Rename normalizeHost to normalizeLoginHost
maksim-zuev-db fe365cb
Revert the blank prompt glyph
maksim-zuev-db ab595b8
List all query params in the normalizeLoginHost comment
maksim-zuev-db 6317d0a
Name the empty host test cases and keep paired tests together
maksim-zuev-db f206240
Trim spaces around the host in normalizeLoginHost
maksim-zuev-db d091842
Validate the normalized host at the login host prompt
maksim-zuev-db 1f1a485
Add acceptance tests for an invalid host in auth login and auth token
maksim-zuev-db 4e0b261
Drop the prompt baseline tests added for the reverted glyph change
maksim-zuev-db da27a3a
Reject a login host without a hostname
maksim-zuev-db 7d6471d
Reject an invalid login host before the profile name prompt
maksim-zuev-db 02ec972
Reject a login host that is not a URL
maksim-zuev-db df05549
Reject a login host with a scheme that is not a URL
maksim-zuev-db 7d24efd
Rename the skip workspace invalid host test
maksim-zuev-db 35c5fa9
Simplify the login host hostname check
maksim-zuev-db de8d027
Require an http or https scheme in the login host
maksim-zuev-db 0810d37
Normalize the login host before the profile name prompt
maksim-zuev-db b4fe7ae
Keep the login host unchanged when it is rejected
maksim-zuev-db 46a6421
Show an example host in the invalid login host error
maksim-zuev-db e040201
Use the picker label in the changelog fragment
maksim-zuev-db b501336
Only trim the login host before the profile name prompt
maksim-zuev-db 27671c6
refactor
maksim-zuev-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * `databricks auth login` and `databricks auth token` now reject a host that is not a URL with a hostname, such as `/`, `?o=123` or `https://`, instead of falling back to `DATABRICKS_HOST` or failing later. An empty host after "Enter a host URL manually" in the login profile picker no longer starts discovery login. ([#7195](https://github.com/databricks/cli/pull/7195)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| >>> musterr [CLI] auth login --host ?o=123 --profile test | ||
| Error: invalid host "?o=123". Expected a URL like https://<databricks-instance>.cloud.databricks.com | ||
|
|
||
| >>> musterr [CLI] auth login --host https:// --profile test | ||
| Error: invalid host "https://". Expected a URL like https://<databricks-instance>.cloud.databricks.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| sethome "./home" | ||
|
|
||
| # A host that is empty without its query params is rejected before login | ||
| # can fall back to discovery or DATABRICKS_HOST. | ||
| trace musterr $CLI auth login --host '?o=123' --profile test | ||
|
|
||
| # A host without a hostname is rejected instead of being read as a host | ||
| # named "https". | ||
| trace musterr $CLI auth login --host 'https://' --profile test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Ignore = [ | ||
| "home" | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| >>> musterr [CLI] auth token --host ?o=123 | ||
| Error: invalid host "?o=123". Expected a URL like https://<databricks-instance>.cloud.databricks.com | ||
|
|
||
| >>> musterr [CLI] auth token --host https:// | ||
| Error: invalid host "https://". Expected a URL like https://<databricks-instance>.cloud.databricks.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| sethome "./home" | ||
|
|
||
| unset DATABRICKS_HOST | ||
| unset DATABRICKS_TOKEN | ||
| unset DATABRICKS_CONFIG_PROFILE | ||
|
|
||
| # A host that is empty without its query params is rejected instead of | ||
| # falling back to DATABRICKS_HOST. | ||
| trace musterr $CLI auth token --host '?o=123' | ||
|
|
||
| # A host without a hostname is rejected instead of being read as a host | ||
| # named "https". | ||
| trace musterr $CLI auth token --host 'https://' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Ignore = [ | ||
| "home" | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.