-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(auth): Ensure new auth SDK versions are backwards compatible with previous SDKs to enable copying to G3 #17407
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
Changes from 1 commit
6cd4f2b
01cd840
a96d509
92ea90e
46d5f2a
97ff318
f2f5074
403d450
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 | ||
|---|---|---|---|---|
|
|
@@ -262,7 +262,11 @@ def __init__( | |||
| ): | ||||
| self._source_credentials._create_self_signed_jwt(None) | ||||
|
|
||||
| self._universe_domain = source_credentials.universe_domain | ||||
| self._universe_domain = ( | ||||
| source_credentials.universe_domain | ||||
| if isinstance(getattr(source_credentials, "universe_domain", None), str) | ||||
| else credentials.DEFAULT_UNIVERSE_DOMAIN | ||||
| ) | ||||
|
macastelaz marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it could be a pretty big behaviour change. Are you sure this is safe?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be safe (I know, famous last words): the base credential class already sets this same default (
Thoughts? |
||||
| self._target_principal = target_principal | ||||
| self._target_scopes = target_scopes | ||||
| self._delegates = delegates | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -453,7 +453,7 @@ def check_use_client_cert(): | |||||
|
|
||||||
| If GOOGLE_API_USE_CLIENT_CERTIFICATE is set to true or false, a corresponding | ||||||
| bool value will be returned. If the value is set to an unexpected string, it | ||||||
| will default to False. | ||||||
| will raise a ValueError. | ||||||
| If GOOGLE_API_USE_CLIENT_CERTIFICATE is unset, the value will be inferred | ||||||
| by reading a file pointed at by GOOGLE_API_CERTIFICATE_CONFIG, and verifying | ||||||
| it contains a "workload" section. If so, the function will return True, | ||||||
|
|
@@ -470,6 +470,11 @@ def check_use_client_cert(): | |||||
|
|
||||||
| # Check if the value of GOOGLE_API_USE_CLIENT_CERTIFICATE is set. | ||||||
| if use_client_cert: | ||||||
| if use_client_cert.lower() not in ("true", "false"): | ||||||
| raise ValueError( | ||||||
| "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be" | ||||||
| " either `true` or `false`" | ||||||
| ) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should be reverting this kind of behaviour. It was an explicit decision to return False instead of raise an exception here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you by chance have any additional context you could share on the original decision to return False here? From my view point, it feels like a security risk to not fail fast here. E.g. if a user sets this to FWIW, there are internal tests for gapic generated clients that are asserting an error is raised so if we do stick with returning false, we'll likely need to update a lot of older APIs, etc. FWIW, we currently have a discrepancy in Line 310 in 384724c
Line 210 in 384724c
|
||||||
| return use_client_cert.lower() == "true" | ||||||
| else: | ||||||
| # Check if the value of GOOGLE_API_CERTIFICATE_CONFIG is set. | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.