@@ -130,12 +130,50 @@ class DatastoreClient
130130 * fetcher instance.
131131 * @type callable $httpHandler A handler used to deliver Psr7 requests.
132132 * Only valid for requests sent over REST.
133- * @type array $keyFile The contents of the service account credentials
134- * .json file retrieved from the Google Developer's Console.
135- * Ex: `json_decode(file_get_contents($path), true)`.
136- * @type string $keyFilePath The full path to your service account
137- * credentials .json file retrieved from the Google Developers
138- * Console.
133+ * @type array $keyFile [DEPRECATED]
134+ * @deprecated This option is being deprecated because of a potential security risk.
135+ * This option does not validate the credential configuration. The security
136+ * risk occurs when a credential configuration is accepted from a source
137+ * that is not under your control and used without validation on your side.
138+ * If you know that you will be loading credential configurations of a
139+ * specific type, it is recommended to create the credentials directly and
140+ * configure them using the `credentialsFetcher` option instead.
141+ * ```
142+ * use Google\Auth\Credentials\ServiceAccountCredentials;
143+ * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
144+ * $creds = new DatastoreClient(['credentialsFetcher' => $creds]);
145+ * ```
146+ * This will ensure that an unexpected credential type with potential for
147+ * malicious intent is not loaded unintentionally. You might still have to do
148+ * validation for certain credential types.
149+ * If you are loading your credential configuration from an untrusted source and have
150+ * not mitigated the risks (e.g. by validating the configuration yourself), make
151+ * these changes as soon as possible to prevent security risks to your environment.
152+ * Regardless of the method used, it is always your responsibility to validate
153+ * configurations received from external sources.
154+ * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
155+ * @type string $keyFilePath [DEPRECATED]
156+ * @deprecated This option is being deprecated because of a potential security risk.
157+ * This option does not validate the credential configuration. The security
158+ * risk occurs when a credential configuration is accepted from a source
159+ * that is not under your control and used without validation on your side.
160+ * If you know that you will be loading credential configurations of a
161+ * specific type, it is recommended to create the credentials directly and
162+ * configure them using the `credentialsFetcher` option instead.
163+ * ```
164+ * use Google\Auth\Credentials\ServiceAccountCredentials;
165+ * $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
166+ * $creds = new DatastoreClient(['credentialsFetcher' => $creds]);
167+ * ```
168+ * This will ensure that an unexpected credential type with potential for
169+ * malicious intent is not loaded unintentionally. You might still have to do
170+ * validation for certain credential types.
171+ * If you are loading your credential configuration from an untrusted source and have
172+ * not mitigated the risks (e.g. by validating the configuration yourself), make
173+ * these changes as soon as possible to prevent security risks to your environment.
174+ * Regardless of the method used, it is always your responsibility to validate
175+ * configurations received from external sources.
176+ * @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
139177 * @type float $requestTimeout Seconds to wait before timing out the
140178 * request. **Defaults to** `0` with REST and `60` with gRPC.
141179 * @type int $retries Number of retries for a failed request. **Defaults
0 commit comments