-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Enforce https in search #11337
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
Enforce https in search #11337
Changes from 1 commit
467da53
e78c0ec
0d6b4ed
0444d6a
83aee6d
f67fa22
06eb9b7
9d034a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -45,6 +45,14 @@ class SearchServiceClient(HeadersMixin): # pylint: disable=too-many-public-meth | |||
| def __init__(self, endpoint, credential, **kwargs): | ||||
| # type: (str, AzureKeyCredential, **Any) -> None | ||||
|
|
||||
| try: | ||||
| if endpoint.lower().startswith('http') and not endpoint.lower().startswith('https'): | ||||
| raise ValueError("Endpoint should be secure. Use https.") | ||||
|
||||
| "Bearer token authentication is not permitted for non-TLS protected (non-https) URLs." |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,14 @@ class SearchServiceClient(HeadersMixin): # pylint: disable=too-many-public-meth | |
| def __init__(self, endpoint, credential, **kwargs): | ||
| # type: (str, AzureKeyCredential, **Any) -> None | ||
|
|
||
| try: | ||
|
||
| if endpoint.lower().startswith('http') and not endpoint.lower().startswith('https'): | ||
| raise ValueError("Endpoint should be secure. Use https.") | ||
| if not endpoint.lower().startswith('http'): | ||
| endpoint = "https://" + endpoint | ||
| except AttributeError: | ||
| raise ValueError("Endpoint must be a string") | ||
|
|
||
| self._endpoint = endpoint # type: str | ||
| self._credential = credential # type: AzureKeyCredential | ||
| self._client = _SearchServiceClient( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there scenario were a valid endpoint would not start by
http?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
service only supports https