py2docfx 0.1.22.dev2258230__py3-none-any.whl → 0.1.22rc2268964__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. py2docfx/docfx_yaml/process_doctree.py +3 -23
  2. py2docfx/docfx_yaml/translator.py +6 -35
  3. py2docfx/docfx_yaml/type_mapping.py +102 -0
  4. py2docfx/venv/basevenv/Lib/site-packages/certifi/__init__.py +1 -1
  5. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/default.py +8 -9
  6. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/imds.py +7 -3
  7. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/managed_identity.py +7 -1
  8. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/shared_cache.py +2 -2
  9. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/interactive.py +2 -2
  10. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/msal_managed_identity_client.py +1 -1
  11. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_version.py +1 -1
  12. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/default.py +8 -9
  13. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/imds.py +7 -3
  14. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/managed_identity.py +7 -1
  15. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/shared_cache.py +2 -2
  16. py2docfx/venv/venv1/Lib/site-packages/cachetools/__init__.py +96 -122
  17. py2docfx/venv/venv1/Lib/site-packages/cachetools/{_decorators.py → _cached.py} +106 -13
  18. py2docfx/venv/venv1/Lib/site-packages/cachetools/_cachedmethod.py +128 -0
  19. py2docfx/venv/venv1/Lib/site-packages/cachetools/func.py +5 -25
  20. py2docfx/venv/venv1/Lib/site-packages/certifi/__init__.py +1 -1
  21. py2docfx/venv/venv1/Lib/site-packages/cryptography/__about__.py +1 -1
  22. py2docfx/venv/venv1/Lib/site-packages/google/api_core/client_options.py +9 -2
  23. py2docfx/venv/venv1/Lib/site-packages/google/api_core/general_helpers.py +36 -0
  24. py2docfx/venv/venv1/Lib/site-packages/google/api_core/grpc_helpers.py +10 -7
  25. py2docfx/venv/venv1/Lib/site-packages/google/api_core/grpc_helpers_async.py +8 -3
  26. py2docfx/venv/venv1/Lib/site-packages/google/api_core/operations_v1/transports/base.py +13 -7
  27. py2docfx/venv/venv1/Lib/site-packages/google/api_core/operations_v1/transports/rest.py +19 -12
  28. py2docfx/venv/venv1/Lib/site-packages/google/api_core/operations_v1/transports/rest_asyncio.py +21 -0
  29. py2docfx/venv/venv1/Lib/site-packages/google/api_core/version.py +1 -1
  30. py2docfx/venv/venv1/Lib/site-packages/google/auth/_default.py +66 -12
  31. py2docfx/venv/venv1/Lib/site-packages/google/auth/_default_async.py +16 -10
  32. py2docfx/venv/venv1/Lib/site-packages/google/auth/_helpers.py +41 -0
  33. py2docfx/venv/venv1/Lib/site-packages/google/auth/compute_engine/credentials.py +67 -6
  34. py2docfx/venv/venv1/Lib/site-packages/google/auth/credentials.py +161 -18
  35. py2docfx/venv/venv1/Lib/site-packages/google/auth/environment_vars.py +4 -0
  36. py2docfx/venv/venv1/Lib/site-packages/google/auth/external_account.py +33 -10
  37. py2docfx/venv/venv1/Lib/site-packages/google/auth/external_account_authorized_user.py +24 -1
  38. py2docfx/venv/venv1/Lib/site-packages/google/auth/identity_pool.py +25 -1
  39. py2docfx/venv/venv1/Lib/site-packages/google/auth/impersonated_credentials.py +57 -9
  40. py2docfx/venv/venv1/Lib/site-packages/google/auth/pluggable.py +25 -1
  41. py2docfx/venv/venv1/Lib/site-packages/google/auth/version.py +1 -1
  42. py2docfx/venv/venv1/Lib/site-packages/google/oauth2/_client.py +117 -0
  43. py2docfx/venv/venv1/Lib/site-packages/google/oauth2/service_account.py +39 -4
  44. {py2docfx-0.1.22.dev2258230.dist-info → py2docfx-0.1.22rc2268964.dist-info}/METADATA +1 -1
  45. {py2docfx-0.1.22.dev2258230.dist-info → py2docfx-0.1.22rc2268964.dist-info}/RECORD +47 -45
  46. {py2docfx-0.1.22.dev2258230.dist-info → py2docfx-0.1.22rc2268964.dist-info}/WHEEL +0 -0
  47. {py2docfx-0.1.22.dev2258230.dist-info → py2docfx-0.1.22rc2268964.dist-info}/top_level.txt +0 -0
@@ -30,11 +30,16 @@ from google.auth import metrics
30
30
  from google.auth.compute_engine import _metadata
31
31
  from google.oauth2 import _client
32
32
 
33
+ _TRUST_BOUNDARY_LOOKUP_ENDPOINT = (
34
+ "https://iamcredentials.{}/v1/projects/-/serviceAccounts/{}/allowedLocations"
35
+ )
36
+
33
37
 
34
38
  class Credentials(
35
39
  credentials.Scoped,
36
40
  credentials.CredentialsWithQuotaProject,
37
41
  credentials.CredentialsWithUniverseDomain,
42
+ credentials.CredentialsWithTrustBoundary,
38
43
  ):
39
44
  """Compute Engine Credentials.
40
45
 
@@ -61,6 +66,7 @@ class Credentials(
61
66
  scopes=None,
62
67
  default_scopes=None,
63
68
  universe_domain=None,
69
+ trust_boundary=None,
64
70
  ):
65
71
  """
66
72
  Args:
@@ -76,6 +82,7 @@ class Credentials(
76
82
  provided or None, credential will attempt to fetch the value
77
83
  from metadata server. If metadata server doesn't have universe
78
84
  domain endpoint, then the default googleapis.com will be used.
85
+ trust_boundary (Mapping[str,str]): A credential trust boundary.
79
86
  """
80
87
  super(Credentials, self).__init__()
81
88
  self._service_account_email = service_account_email
@@ -86,6 +93,7 @@ class Credentials(
86
93
  if universe_domain:
87
94
  self._universe_domain = universe_domain
88
95
  self._universe_domain_cached = True
96
+ self._trust_boundary = trust_boundary
89
97
 
90
98
  def _retrieve_info(self, request):
91
99
  """Retrieve information about the service account.
@@ -100,16 +108,22 @@ class Credentials(
100
108
  request, service_account=self._service_account_email
101
109
  )
102
110
 
111
+ if not info or "email" not in info:
112
+ raise exceptions.RefreshError(
113
+ "Unexpected response from metadata server: "
114
+ "service account info is missing 'email' field."
115
+ )
116
+
103
117
  self._service_account_email = info["email"]
104
118
 
105
119
  # Don't override scopes requested by the user.
106
120
  if self._scopes is None:
107
- self._scopes = info["scopes"]
121
+ self._scopes = info.get("scopes")
108
122
 
109
123
  def _metric_header_for_usage(self):
110
124
  return metrics.CRED_TYPE_SA_MDS
111
125
 
112
- def refresh(self, request):
126
+ def _refresh_token(self, request):
113
127
  """Refresh the access token and scopes.
114
128
 
115
129
  Args:
@@ -132,6 +146,37 @@ class Credentials(
132
146
  new_exc = exceptions.RefreshError(caught_exc)
133
147
  raise new_exc from caught_exc
134
148
 
149
+ def _build_trust_boundary_lookup_url(self):
150
+ """Builds and returns the URL for the trust boundary lookup API for GCE."""
151
+ # If the service account email is 'default', we need to get the
152
+ # actual email address from the metadata server.
153
+ if self._service_account_email == "default":
154
+ from google.auth.transport import requests as google_auth_requests
155
+
156
+ request = google_auth_requests.Request()
157
+ try:
158
+ info = _metadata.get_service_account_info(request, "default")
159
+ if not info or "email" not in info:
160
+ raise exceptions.RefreshError(
161
+ "Unexpected response from metadata server: "
162
+ "service account info is missing 'email' field."
163
+ )
164
+ self._service_account_email = info["email"]
165
+
166
+ except exceptions.TransportError as e:
167
+ # If fetching the service account email fails due to a transport error,
168
+ # it means we cannot build the trust boundary lookup URL.
169
+ # Wrap this in a RefreshError so it's caught by _refresh_trust_boundary.
170
+ raise exceptions.RefreshError(
171
+ "Failed to get service account email for trust boundary lookup: {}".format(
172
+ e
173
+ )
174
+ ) from e
175
+
176
+ return _TRUST_BOUNDARY_LOOKUP_ENDPOINT.format(
177
+ self.universe_domain, self.service_account_email
178
+ )
179
+
135
180
  @property
136
181
  def service_account_email(self):
137
182
  """The service account email.
@@ -173,8 +218,9 @@ class Credentials(
173
218
  quota_project_id=quota_project_id,
174
219
  scopes=self._scopes,
175
220
  default_scopes=self._default_scopes,
221
+ universe_domain=self._universe_domain,
222
+ trust_boundary=self._trust_boundary,
176
223
  )
177
- creds._universe_domain = self._universe_domain
178
224
  creds._universe_domain_cached = self._universe_domain_cached
179
225
  return creds
180
226
 
@@ -188,8 +234,9 @@ class Credentials(
188
234
  default_scopes=default_scopes,
189
235
  service_account_email=self._service_account_email,
190
236
  quota_project_id=self._quota_project_id,
237
+ universe_domain=self._universe_domain,
238
+ trust_boundary=self._trust_boundary,
191
239
  )
192
- creds._universe_domain = self._universe_domain
193
240
  creds._universe_domain_cached = self._universe_domain_cached
194
241
  return creds
195
242
 
@@ -200,9 +247,23 @@ class Credentials(
200
247
  default_scopes=self._default_scopes,
201
248
  service_account_email=self._service_account_email,
202
249
  quota_project_id=self._quota_project_id,
250
+ trust_boundary=self._trust_boundary,
203
251
  universe_domain=universe_domain,
204
252
  )
205
253
 
254
+ @_helpers.copy_docstring(credentials.CredentialsWithTrustBoundary)
255
+ def with_trust_boundary(self, trust_boundary):
256
+ creds = self.__class__(
257
+ service_account_email=self._service_account_email,
258
+ quota_project_id=self._quota_project_id,
259
+ scopes=self._scopes,
260
+ default_scopes=self._default_scopes,
261
+ universe_domain=self._universe_domain,
262
+ trust_boundary=trust_boundary,
263
+ )
264
+ creds._universe_domain_cached = self._universe_domain_cached
265
+ return creds
266
+
206
267
 
207
268
  _DEFAULT_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds
208
269
  _DEFAULT_TOKEN_URI = "https://www.googleapis.com/oauth2/v4/token"
@@ -275,7 +336,7 @@ class IDTokenCredentials(
275
336
 
276
337
  if use_metadata_identity_endpoint:
277
338
  if token_uri or additional_claims or service_account_email or signer:
278
- raise exceptions.MalformedError(
339
+ raise ValueError(
279
340
  "If use_metadata_identity_endpoint is set, token_uri, "
280
341
  "additional_claims, service_account_email, signer arguments"
281
342
  " must not be set"
@@ -366,7 +427,7 @@ class IDTokenCredentials(
366
427
  # since the signer is already instantiated,
367
428
  # the request is not needed
368
429
  if self._use_metadata_identity_endpoint:
369
- raise exceptions.MalformedError(
430
+ raise ValueError(
370
431
  "If use_metadata_identity_endpoint is set, token_uri" " must not be set"
371
432
  )
372
433
  else:
@@ -18,14 +18,18 @@
18
18
  import abc
19
19
  from enum import Enum
20
20
  import os
21
+ from typing import List
21
22
 
22
23
  from google.auth import _helpers, environment_vars
23
24
  from google.auth import exceptions
24
25
  from google.auth import metrics
25
26
  from google.auth._credentials_base import _BaseCredentials
27
+ from google.auth._default import _LOGGER
26
28
  from google.auth._refresh_worker import RefreshThreadManager
27
29
 
28
30
  DEFAULT_UNIVERSE_DOMAIN = "googleapis.com"
31
+ NO_OP_TRUST_BOUNDARY_LOCATIONS: List[str] = []
32
+ NO_OP_TRUST_BOUNDARY_ENCODED_LOCATIONS = "0x0"
29
33
 
30
34
 
31
35
  class Credentials(_BaseCredentials):
@@ -178,22 +182,7 @@ class Credentials(_BaseCredentials):
178
182
  token (Optional[str]): If specified, overrides the current access
179
183
  token.
180
184
  """
181
- self._apply(headers, token=token)
182
- """Trust boundary value will be a cached value from global lookup.
183
-
184
- The response of trust boundary will be a list of regions and a hex
185
- encoded representation.
186
-
187
- An example of global lookup response:
188
- {
189
- "locations": [
190
- "us-central1", "us-east1", "europe-west1", "asia-east1"
191
- ]
192
- "encoded_locations": "0xA30"
193
- }
194
- """
195
- if self._trust_boundary is not None:
196
- headers["x-allowed-locations"] = self._trust_boundary["encoded_locations"]
185
+ self._apply(headers, token)
197
186
  if self.quota_project_id:
198
187
  headers["x-goog-user-project"] = self.quota_project_id
199
188
 
@@ -299,6 +288,161 @@ class CredentialsWithUniverseDomain(Credentials):
299
288
  )
300
289
 
301
290
 
291
+ class CredentialsWithTrustBoundary(Credentials):
292
+ """Abstract base for credentials supporting ``with_trust_boundary`` factory"""
293
+
294
+ @abc.abstractmethod
295
+ def _refresh_token(self, request):
296
+ """Refreshes the access token.
297
+
298
+ Args:
299
+ request (google.auth.transport.Request): The object used to make
300
+ HTTP requests.
301
+
302
+ Raises:
303
+ google.auth.exceptions.RefreshError: If the credentials could
304
+ not be refreshed.
305
+ """
306
+ raise NotImplementedError("_refresh_token must be implemented")
307
+
308
+ def with_trust_boundary(self, trust_boundary):
309
+ """Returns a copy of these credentials with a modified trust boundary.
310
+
311
+ Args:
312
+ trust_boundary Mapping[str, str]: The trust boundary to use for the
313
+ credential. This should be a map with a "locations" key that maps to
314
+ a list of GCP regions, and a "encodedLocations" key that maps to a
315
+ hex string.
316
+
317
+ Returns:
318
+ google.auth.credentials.Credentials: A new credentials instance.
319
+ """
320
+ raise NotImplementedError("This credential does not support trust boundaries.")
321
+
322
+ def _is_trust_boundary_lookup_required(self):
323
+ """Checks if a trust boundary lookup is required.
324
+
325
+ A lookup is required if the feature is enabled via an environment
326
+ variable, the universe domain is supported, and a no-op boundary
327
+ is not already cached.
328
+
329
+ Returns:
330
+ bool: True if a trust boundary lookup is required, False otherwise.
331
+ """
332
+ # 1. Check if the feature is enabled via environment variable.
333
+ if not _helpers.get_bool_from_env(
334
+ environment_vars.GOOGLE_AUTH_TRUST_BOUNDARY_ENABLED, default=False
335
+ ):
336
+ return False
337
+
338
+ # 2. Skip trust boundary flow for non-default universe domains.
339
+ if self.universe_domain != DEFAULT_UNIVERSE_DOMAIN:
340
+ return False
341
+
342
+ # 3. Do not trigger refresh if credential has a cached no-op trust boundary.
343
+ return not self._has_no_op_trust_boundary()
344
+
345
+ def _get_trust_boundary_header(self):
346
+ if self._trust_boundary is not None:
347
+ if self._has_no_op_trust_boundary():
348
+ # STS expects an empty string if the trust boundary value is no-op.
349
+ return {"x-allowed-locations": ""}
350
+ else:
351
+ return {"x-allowed-locations": self._trust_boundary["encodedLocations"]}
352
+ return {}
353
+
354
+ def apply(self, headers, token=None):
355
+ """Apply the token to the authentication header."""
356
+ super().apply(headers, token)
357
+ headers.update(self._get_trust_boundary_header())
358
+
359
+ def refresh(self, request):
360
+ """Refreshes the access token and the trust boundary.
361
+
362
+ This method calls the subclass's token refresh logic and then
363
+ refreshes the trust boundary if applicable.
364
+ """
365
+ self._refresh_token(request)
366
+ self._refresh_trust_boundary(request)
367
+
368
+ def _refresh_trust_boundary(self, request):
369
+ """Triggers a refresh of the trust boundary and updates the cache if necessary.
370
+
371
+ Args:
372
+ request (google.auth.transport.Request): The object used to make
373
+ HTTP requests.
374
+
375
+ Raises:
376
+ google.auth.exceptions.RefreshError: If the trust boundary could
377
+ not be refreshed and no cached value is available.
378
+ """
379
+ if not self._is_trust_boundary_lookup_required():
380
+ return
381
+ try:
382
+ self._trust_boundary = self._lookup_trust_boundary(request)
383
+ except exceptions.RefreshError as error:
384
+ # If the call to the lookup API failed, check if there is a trust boundary
385
+ # already cached. If there is, do nothing. If not, then throw the error.
386
+ if self._trust_boundary is None:
387
+ raise error
388
+ if _helpers.is_logging_enabled(_LOGGER):
389
+ _LOGGER.debug(
390
+ "Using cached trust boundary due to refresh error: %s", error
391
+ )
392
+ return
393
+
394
+ def _lookup_trust_boundary(self, request):
395
+ """Calls the trust boundary lookup API to refresh the trust boundary cache.
396
+
397
+ Args:
398
+ request (google.auth.transport.Request): The object used to make
399
+ HTTP requests.
400
+
401
+ Returns:
402
+ trust_boundary (dict): The trust boundary object returned by the lookup API.
403
+
404
+ Raises:
405
+ google.auth.exceptions.RefreshError: If the trust boundary could not be
406
+ retrieved.
407
+ """
408
+ from google.oauth2 import _client
409
+
410
+ url = self._build_trust_boundary_lookup_url()
411
+ if not url:
412
+ raise exceptions.InvalidValue("Failed to build trust boundary lookup URL.")
413
+
414
+ headers = {}
415
+ self._apply(headers)
416
+ headers.update(self._get_trust_boundary_header())
417
+ return _client._lookup_trust_boundary(request, url, headers=headers)
418
+
419
+ @abc.abstractmethod
420
+ def _build_trust_boundary_lookup_url(self):
421
+ """
422
+ Builds and returns the URL for the trust boundary lookup API.
423
+
424
+ This method should be implemented by subclasses to provide the
425
+ specific URL based on the credential type and its properties.
426
+
427
+ Returns:
428
+ str: The URL for the trust boundary lookup endpoint, or None
429
+ if lookup should be skipped (e.g., for non-applicable universe domains).
430
+ """
431
+ raise NotImplementedError(
432
+ "_build_trust_boundary_lookup_url must be implemented"
433
+ )
434
+
435
+ def _has_no_op_trust_boundary(self):
436
+ # A no-op trust boundary is indicated by encodedLocations being "0x0".
437
+ # The "locations" list may or may not be present as an empty list.
438
+ if self._trust_boundary is None:
439
+ return False
440
+ return (
441
+ self._trust_boundary.get("encodedLocations")
442
+ == NO_OP_TRUST_BOUNDARY_ENCODED_LOCATIONS
443
+ )
444
+
445
+
302
446
  class AnonymousCredentials(Credentials):
303
447
  """Credentials that do not provide any authentication information.
304
448
 
@@ -382,8 +526,7 @@ class ReadOnlyScoped(metaclass=abc.ABCMeta):
382
526
 
383
527
  @abc.abstractproperty
384
528
  def requires_scopes(self):
385
- """True if these credentials require scopes to obtain an access token.
386
- """
529
+ """True if these credentials require scopes to obtain an access token."""
387
530
  return False
388
531
 
389
532
  def has_scopes(self, scopes):
@@ -82,3 +82,7 @@ AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"
82
82
  AWS_SESSION_TOKEN = "AWS_SESSION_TOKEN"
83
83
  AWS_REGION = "AWS_REGION"
84
84
  AWS_DEFAULT_REGION = "AWS_DEFAULT_REGION"
85
+
86
+ GOOGLE_AUTH_TRUST_BOUNDARY_ENABLED = "GOOGLE_AUTH_TRUST_BOUNDARY_ENABLED"
87
+ """Environment variable controlling whether to enable trust boundary feature.
88
+ The default value is false. Users have to explicitly set this value to true."""
@@ -59,18 +59,18 @@ _DEFAULT_TOKEN_URL = "https://sts.{universe_domain}/v1/token"
59
59
  @dataclass
60
60
  class SupplierContext:
61
61
  """A context class that contains information about the requested third party credential that is passed
62
- to AWS security credential and subject token suppliers.
62
+ to AWS security credential and subject token suppliers.
63
63
 
64
- Attributes:
65
- subject_token_type (str): The requested subject token type based on the Oauth2.0 token exchange spec.
66
- Expected values include::
64
+ Attributes:
65
+ subject_token_type (str): The requested subject token type based on the Oauth2.0 token exchange spec.
66
+ Expected values include::
67
67
 
68
- “urn:ietf:params:oauth:token-type:jwt”
69
- “urn:ietf:params:oauth:token-type:id-token”
70
- “urn:ietf:params:oauth:token-type:saml2”
71
- “urn:ietf:params:aws:token-type:aws4_request”
68
+ “urn:ietf:params:oauth:token-type:jwt”
69
+ “urn:ietf:params:oauth:token-type:id-token”
70
+ “urn:ietf:params:oauth:token-type:saml2”
71
+ “urn:ietf:params:aws:token-type:aws4_request”
72
72
 
73
- audience (str): The requested audience for the subject token.
73
+ audience (str): The requested audience for the subject token.
74
74
  """
75
75
 
76
76
  subject_token_type: str
@@ -89,7 +89,14 @@ class Credentials(
89
89
  credentials for Google access token and authorizing requests to Google APIs.
90
90
  The base class implements the common logic for exchanging external account
91
91
  credentials for Google access tokens.
92
- """
92
+
93
+ **IMPORTANT**:
94
+ This class does not validate the credential configuration. A security
95
+ risk occurs when a credential configuration configured with malicious urls
96
+ is used.
97
+ When the credential configuration is accepted from an
98
+ untrusted source, you should validate it before using.
99
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details."""
93
100
 
94
101
  def __init__(
95
102
  self,
@@ -576,6 +583,14 @@ class Credentials(
576
583
  def from_info(cls, info, **kwargs):
577
584
  """Creates a Credentials instance from parsed external account info.
578
585
 
586
+ **IMPORTANT**:
587
+ This method does not validate the credential configuration. A security
588
+ risk occurs when a credential configuration configured with malicious urls
589
+ is used.
590
+ When the credential configuration is accepted from an
591
+ untrusted source, you should validate it before using with this method.
592
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
593
+
579
594
  Args:
580
595
  info (Mapping[str, str]): The external account info in Google
581
596
  format.
@@ -615,6 +630,14 @@ class Credentials(
615
630
  def from_file(cls, filename, **kwargs):
616
631
  """Creates a Credentials instance from an external account json file.
617
632
 
633
+ **IMPORTANT**:
634
+ This method does not validate the credential configuration. A security
635
+ risk occurs when a credential configuration configured with malicious urls
636
+ is used.
637
+ When the credential configuration is accepted from an
638
+ untrusted source, you should validate it before using with this method.
639
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
640
+
618
641
  Args:
619
642
  filename (str): The path to the external account json file.
620
643
  kwargs: Additional arguments to pass to the constructor.
@@ -60,7 +60,14 @@ class Credentials(
60
60
  The credentials are considered immutable. If you want to modify the
61
61
  quota project, use `with_quota_project` and if you want to modify the token
62
62
  uri, use `with_token_uri`.
63
- """
63
+
64
+ **IMPORTANT**:
65
+ This class does not validate the credential configuration. A security
66
+ risk occurs when a credential configuration configured with malicious urls
67
+ is used.
68
+ When the credential configuration is accepted from an
69
+ untrusted source, you should validate it before using.
70
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details."""
64
71
 
65
72
  def __init__(
66
73
  self,
@@ -328,6 +335,14 @@ class Credentials(
328
335
  def from_info(cls, info, **kwargs):
329
336
  """Creates a Credentials instance from parsed external account info.
330
337
 
338
+ **IMPORTANT**:
339
+ This method does not validate the credential configuration. A security
340
+ risk occurs when a credential configuration configured with malicious urls
341
+ is used.
342
+ When the credential configuration is accepted from an
343
+ untrusted source, you should validate it before using with this method.
344
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
345
+
331
346
  Args:
332
347
  info (Mapping[str, str]): The external account info in Google
333
348
  format.
@@ -367,6 +382,14 @@ class Credentials(
367
382
  def from_file(cls, filename, **kwargs):
368
383
  """Creates a Credentials instance from an external account json file.
369
384
 
385
+ **IMPORTANT**:
386
+ This method does not validate the credential configuration. A security
387
+ risk occurs when a credential configuration configured with malicious urls
388
+ is used.
389
+ When the credential configuration is accepted from an
390
+ untrusted source, you should validate it before using with this method.
391
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
392
+
370
393
  Args:
371
394
  filename (str): The path to the external account json file.
372
395
  kwargs: Additional arguments to pass to the constructor.
@@ -253,7 +253,15 @@ def _parse_token_data(token_content, format_type="text", subject_token_field_nam
253
253
 
254
254
 
255
255
  class Credentials(external_account.Credentials):
256
- """External account credentials sourced from files and URLs."""
256
+ """External account credentials sourced from files and URLs.
257
+
258
+ **IMPORTANT**:
259
+ This class does not validate the credential configuration. A security
260
+ risk occurs when a credential configuration configured with malicious urls
261
+ is used.
262
+ When the credential configuration is accepted from an
263
+ untrusted source, you should validate it before using.
264
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details."""
257
265
 
258
266
  def __init__(
259
267
  self,
@@ -497,6 +505,14 @@ class Credentials(external_account.Credentials):
497
505
  def from_info(cls, info, **kwargs):
498
506
  """Creates an Identity Pool Credentials instance from parsed external account info.
499
507
 
508
+ **IMPORTANT**:
509
+ This method does not validate the credential configuration. A security
510
+ risk occurs when a credential configuration configured with malicious urls
511
+ is used.
512
+ When the credential configuration is accepted from an
513
+ untrusted source, you should validate it before using with this method.
514
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
515
+
500
516
  Args:
501
517
  info (Mapping[str, str]): The Identity Pool external account info in Google
502
518
  format.
@@ -517,6 +533,14 @@ class Credentials(external_account.Credentials):
517
533
  def from_file(cls, filename, **kwargs):
518
534
  """Creates an IdentityPool Credentials instance from an external account json file.
519
535
 
536
+ **IMPORTANT**:
537
+ This method does not validate the credential configuration. A security
538
+ risk occurs when a credential configuration configured with malicious urls
539
+ is used.
540
+ When the credential configuration is accepted from an
541
+ untrusted source, you should validate it before using with this method.
542
+ Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
543
+
520
544
  Args:
521
545
  filename (str): The path to the IdentityPool external account json file.
522
546
  kwargs: Additional arguments to pass to the constructor.