Skip to content

Commit

Permalink
docs: add warning against accepting untrusted credentials (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Jan 22, 2025
1 parent cfcb931 commit 86e9d93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ Application Default Credentials provides a simple way to get authorization
credentials for use in calling Google APIs, and is
the recommended approach to authorize calls to Cloud APIs.

**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 library. Providing an unvalidated credential configuration to Google APIs
can compromise the security of your systems and data. For more information, refer to
[Validate credential configurations from external sources][externally-sourced-credentials].

[externally-sourced-credentials]: https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

### Set up ADC

To use ADC, you must set it up by providing credentials.
Expand Down Expand Up @@ -302,7 +310,7 @@ $middleware = ApplicationDefaultCredentials::getCredentials($scope, cache: $memo

### FileSystemCacheItemPool Cache
The `FileSystemCacheItemPool` class is a `PSR-6` compliant cache that stores its
serialized objects on disk, caching data between processes and making it possible
serialized objects on disk, caching data between processes and making it possible
to use data between different requests.

```php
Expand Down
6 changes: 6 additions & 0 deletions src/CredentialsLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public static function fromWellKnownFile()
* user-defined scopes exist, expressed either as an Array or as a
* space-delimited string.
*
* **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 library. Providing an unvalidated credential configuration to
* Google APIs can compromise the security of your systems and data. For more information
* {@see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
*
* @return ServiceAccountCredentials|UserRefreshCredentials|ImpersonatedServiceAccountCredentials|ExternalAccountCredentials
*/
public static function makeCredentials(
Expand Down

0 comments on commit 86e9d93

Please sign in to comment.