Skip to content

Commit

Permalink
chore: Add warnings regarding consuming externally sourced credentials (
Browse files Browse the repository at this point in the history
#1655)

* chore: Add warnings regarding consuming externally sourced credential configurations

* update syntax

* remove in ADC

* period

* make it warning

* update warning syntax

* update secret after rebase
  • Loading branch information
sai-sunder-s authored Jan 22, 2025
1 parent 34ee3fe commit d049370
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ that supports OpenID Connect (OIDC).
Obtaining credentials
---------------------

.. warning::
Important: If you accept a credential configuration (credential JSON/File/Stream)
from an external source for authentication to Google Cloud Platform, you must
validate it before providing it to any Google API or client library. Providing an
unvalidated credential configuration to Google APIs or libraries can compromise
the security of your systems and data. For more information, refer to
`Validate credential configurations from external sources`_.

.. _Validate credential configurations from external sources:
https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

.. _application-default:

Application default credentials
Expand Down
22 changes: 22 additions & 0 deletions google/auth/_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ def load_credentials_from_file(
user credentials, external account credentials, or impersonated service
account credentials.
.. warning::
Important: If you accept a credential configuration (credential JSON/File/Stream)
from an external source for authentication to Google Cloud Platform, you must
validate it before providing it to any Google API or client library. Providing an
unvalidated credential configuration to Google APIs or libraries can compromise
the security of your systems and data. For more information, refer to
`Validate credential configurations from external sources`_.
.. _Validate credential configurations from external sources:
https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
Args:
filename (str): The full path to the credentials file.
scopes (Optional[Sequence[str]]): The list of scopes for the credentials. If
Expand Down Expand Up @@ -137,6 +148,17 @@ def load_credentials_from_dict(
user credentials, external account credentials, or impersonated service
account credentials.
.. warning::
Important: If you accept a credential configuration (credential JSON/File/Stream)
from an external source for authentication to Google Cloud Platform, you must
validate it before providing it to any Google API or client library. Providing an
unvalidated credential configuration to Google APIs or libraries can compromise
the security of your systems and data. For more information, refer to
`Validate credential configurations from external sources`_.
.. _Validate credential configurations from external sources:
https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
Args:
info (Dict[str, Any]): A dict object containing the credentials
scopes (Optional[Sequence[str]]): The list of scopes for the credentials. If
Expand Down
Binary file modified system_tests/secrets.tar.enc
Binary file not shown.

0 comments on commit d049370

Please sign in to comment.