You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "MonkeyCanCode (via GitHub)" <gi...@apache.org> on 2026/07/11 18:29:12 UTC
[PR] CLI add supports for non-http scheme [polaris]
MonkeyCanCode opened a new pull request, #5043:
URL: https://github.com/apache/polaris/pull/5043
<!--
๐ Describe what changes you're proposing, especially breaking or user-facing changes.
๐ See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
-->
_**Please don't merge this one as I am not able to update `CHANGELOG.md` due to https://github.com/apache/polaris/pull/5042**_
This PR fixes https://github.com/apache/polaris/issues/4993 where we default to `http` for scheme when creating profile. Also, the CLI itself lacks scheme support unless using `base_url` (so this was not possible earlier when using `--host` and `--port` option.
Here is sample output for this change:
Add profiles with http and https scheme:
```
# https scheme
โ polaris git:(main) โ ./polaris profiles create dev_https
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Polaris Client ID: abc
Polaris Client Secret: abc
Polaris Host [localhost]:
Polaris Port [8181]:
Polaris URL Scheme [http]: https
Polaris Context Realm:
Polaris Context Header Name [Polaris-Realm]:
Polaris profile dev_https created successfully.
# http scheme
โ polaris git:(main) โ ./polaris profiles create dev_http
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Polaris Client ID: abc
Polaris Client Secret: abc
Polaris Host [localhost]:
Polaris Port [8181]:
Polaris URL Scheme [http]:
Polaris Context Realm:
Polaris Context Header Name [Polaris-Realm]:
Polaris profile dev_http created successfully.
```
Ensure scheme got persisted:
```
# display for https scheme
โ polaris git:(main) โ ./polaris profiles get dev_https
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Polaris profile dev_https: {'client_id': 'abc', 'client_secret': '********', 'host': 'localhost', 'port': 8181, 'scheme': 'https', 'realm': '', 'header': 'Polaris-Realm'}
# display for http scheme
โ polaris git:(main) โ ./polaris profiles get dev_http
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Polaris profile dev_http: {'client_id': 'abc', 'client_secret': '********', 'host': 'localhost', 'port': 8181, 'scheme': 'http', 'realm': '', 'header': 'Polaris-Realm'}
```
Validation to ensure scheme got honored during api requests:
```
# https scheme
โ polaris git:(main) โ ./polaris --profile dev_https catalogs list --debug
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Request: POST https://localhost:8181/api/catalog/v1/oauth/tokens
Headers: {'Content-Type': 'application/x-www-form-urlencoded'}
Body: <redacted sensitive authentication payload>
...
# http scheme
โ polaris git:(main) โ ./polaris --profile dev_http catalogs list --debug
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Request: POST http://localhost:8181/api/catalog/v1/oauth/tokens
Headers: {'Content-Type': 'application/x-www-form-urlencoded'}
Body: <redacted sensitive authentication payload>
...
```
Ensure change is backward compatible:
```
# older profile without those extra files in the schema (fall-back to default)
โ polaris git:(cli_add_scheme_support) ./polaris profiles get dev
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Polaris profile dev: {'client_id': 'root', 'client_secret': '********', 'host': 'localhost', 'port': 8181}
# Sample request to ensure it still works
โ polaris git:(cli_add_scheme_support) ./polaris --profile dev catalogs list --debug
โโ[DEPRECATED]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ This script is deprecated. Use pip instead: โ
โ โ
โ pip install apache-polaris โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Request: POST http://localhost:8181/api/catalog/v1/oauth/tokens
Headers: {'Content-Type': 'application/x-www-form-urlencoded'}
Body: <redacted sensitive authentication payload>
Response: 200
Response Headers: {'Content-Type': 'application/json;charset=UTF-8', 'content-length': '757', 'X-Request-ID': 'c74784fa-9391-4178-b959-4bbee98d68eb_0000000000000000007'}
Response Body: <redacted sensitive authentication payload>
Request: GET http://localhost:8181/api/management/v1/catalogs
Headers: {'Accept': 'application/json', 'User-Agent': 'OpenAPI-Generator/1.0.0/python', 'Authorization': '***REDACTED***'}
Response: 200
Response Headers: {'Content-Type': 'application/json;charset=UTF-8', 'content-length': '15', 'X-Request-ID': 'c74784fa-9391-4178-b959-4bbee98d68eb_0000000000000000008'}
Response Body: {"catalogs": []}
```
## Checklist
- [x] ๐ก๏ธ Don't disclose security issues! (contact security@apache.org)
- [x] ๐ Clearly explained why the changes are needed, or linked related issues: Fixes #
- [x] ๐งช Added/updated tests with good coverage, or manually tested (and explained how)
- [x] ๐ก Added comments for complex logic
- [ ] ๐งพ Updated `CHANGELOG.md` (if needed)
- [x] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #5043:
URL: https://github.com/apache/polaris/pull/5043#issuecomment-4964464080
> LGTM. Thanks @MonkeyCanCode for the fix. I think we will need to update the doc to reflect the new option. I'm OK with a followup.
Good point. Yes, let me update the PR for fixing changlog then I will sync and update this one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode merged PR #5043:
URL: https://github.com/apache/polaris/pull/5043
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #5043:
URL: https://github.com/apache/polaris/pull/5043#issuecomment-4975294554
> One gap worth closing: --scheme on the CLI flag is validated against choices=["http","https"], but profiles create/update take it through a raw input() prompt with no validation, so a typo there gets baked straight into base_url unchecked.
>
> 2 cents: run the prompt value through the same allowlist.
Thanks for the feedback. This had been handled now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3583244171
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -112,6 +116,7 @@ def _update_profile(self, name: str) -> None:
)
host = input(f"Polaris Host [{current_host}]: ") or current_host
port = input(f"Polaris Port [{current_port}]: ") or current_port
+ scheme = input(f"Polaris URL Scheme [{current_scheme}]: ") or current_scheme
Review Comment:
That is a good catch. Let me add that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "flyingImer (via GitHub)" <gi...@apache.org>.
flyingImer commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3581825476
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -112,6 +116,7 @@ def _update_profile(self, name: str) -> None:
)
host = input(f"Polaris Host [{current_host}]: ") or current_host
port = input(f"Polaris Port [{current_port}]: ") or current_port
+ scheme = input(f"Polaris URL Scheme [{current_scheme}]: ") or current_scheme
Review Comment:
similar here: do we perform validation like choices=["http","https"] on this path?
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -62,6 +63,7 @@ def _create_profile(self, name: str) -> None:
client_secret = input("Polaris Client Secret: ")
host = input(f"Polaris Host [{DEFAULT_HOSTNAME}]: ") or DEFAULT_HOSTNAME
port = input(f"Polaris Port [{DEFAULT_PORT}]: ") or DEFAULT_PORT
+ scheme = input(f"Polaris URL Scheme [{DEFAULT_SCHEME}]: ") or DEFAULT_SCHEME
Review Comment:
do we perform validation like choices=["http","https"] on this path?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3583242525
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -62,6 +63,7 @@ def _create_profile(self, name: str) -> None:
client_secret = input("Polaris Client Secret: ")
host = input(f"Polaris Host [{DEFAULT_HOSTNAME}]: ") or DEFAULT_HOSTNAME
port = input(f"Polaris Port [{DEFAULT_PORT}]: ") or DEFAULT_PORT
+ scheme = input(f"Polaris URL Scheme [{DEFAULT_SCHEME}]: ") or DEFAULT_SCHEME
Review Comment:
That is a good catch. Let me add that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3592413435
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -36,6 +37,19 @@
)
from apache_polaris.sdk.management import PolarisDefaultApi
+ALLOWED_SCHEMES = ("http", "https")
+
+
+def _prompt_scheme(default: str) -> str:
+ while True:
+ scheme = (input(f"Polaris URL Scheme [{default}]: ") or default).lower()
+ if scheme in ALLOWED_SCHEMES:
+ return scheme
+ else:
+ print(
+ f"Invalid scheme '{scheme}'. Excepeted one of {list(ALLOWED_SCHEMES)}."
Review Comment:
Yes. Let me fixed that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #5043:
URL: https://github.com/apache/polaris/pull/5043#issuecomment-4965996296
> > LGTM. Thanks @MonkeyCanCode for the fix. I think we will need to update the doc to reflect the new option. I'm OK with a followup.
>
> Good point. Yes, let me update the PR for fixing changlog then I will sync and update this one.
This is now completed along with updated CHANGEME.md.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3583490483
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -62,6 +63,7 @@ def _create_profile(self, name: str) -> None:
client_secret = input("Polaris Client Secret: ")
host = input(f"Polaris Host [{DEFAULT_HOSTNAME}]: ") or DEFAULT_HOSTNAME
port = input(f"Polaris Port [{DEFAULT_PORT}]: ") or DEFAULT_PORT
+ scheme = input(f"Polaris URL Scheme [{DEFAULT_SCHEME}]: ") or DEFAULT_SCHEME
Review Comment:
This is added now.
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -112,6 +116,7 @@ def _update_profile(self, name: str) -> None:
)
host = input(f"Polaris Host [{current_host}]: ") or current_host
port = input(f"Polaris Port [{current_port}]: ") or current_port
+ scheme = input(f"Polaris URL Scheme [{current_scheme}]: ") or current_scheme
Review Comment:
This is added now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3574191351
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -100,6 +103,7 @@ def _update_profile(self, name: str) -> None:
current_client_secret = profiles[name].get("client_secret")
current_host = profiles[name].get("host")
current_port = profiles[name].get("port")
+ current_scheme = profiles[name].get(Arguments.SCHEME) or DEFAULT_SCHEME
Review Comment:
Good backward-compat handling here! `.get(SCHEME) or DEFAULT_SCHEME` means profiles created before this change update cleanly to http. Same pattern in `base_url`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CLI add supports for non-http scheme [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #5043:
URL: https://github.com/apache/polaris/pull/5043#discussion_r3592315602
##########
client/python/apache_polaris/cli/command/profiles.py:
##########
@@ -36,6 +37,19 @@
)
from apache_polaris.sdk.management import PolarisDefaultApi
+ALLOWED_SCHEMES = ("http", "https")
+
+
+def _prompt_scheme(default: str) -> str:
+ while True:
+ scheme = (input(f"Polaris URL Scheme [{default}]: ") or default).lower()
+ if scheme in ALLOWED_SCHEMES:
+ return scheme
+ else:
+ print(
+ f"Invalid scheme '{scheme}'. Excepeted one of {list(ALLOWED_SCHEMES)}."
Review Comment:
typo? `Excepeted` -> `Supported`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org