@@ -193,17 +193,37 @@ public static GoogleCredentials getApplicationDefault(HttpTransportFactory trans
193193 }
194194
195195 /**
196- * Returns credentials defined by a JSON file stream.
196+ * This method is obsolete because of a potential security risk. Use the credential specific load
197+ * method instead
198+ *
199+ * <p>Returns credentials defined by a JSON file stream.
197200 *
198201 * <p>The stream can contain a Service Account key file in JSON format from the Google Developers
199202 * Console or a stored user credential using the format supported by the Cloud SDK.
200203 *
201- * <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
202- * external source for authentication to Google Cloud Platform, you must validate it before
203- * providing it to any Google API or library. Providing an unvalidated credential configuration to
204- * Google APIs can compromise the security of your systems and data. For more information, refer
205- * to {@link <a
206- * href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
204+ * <p>Important: This method does not validate the credential configuration. A security risk holds
205+ * when a credential configuration is accepted from a source that is not under your control and
206+ * used without validation on your side.
207+ *
208+ * <p>If you know that you will be loading credential configurations of a specific type, it is
209+ * recommended to use a credential-type-specific `load()` method. This will ensure that an
210+ * unexpected credential type with potential for malicious intent is not loaded unintentionally.
211+ * You might still have to do validation for certain credential types. Please follow the
212+ * recommendation for that method. For example, if you want to load only service accounts, you can
213+ * use: <code>
214+ * GoogleCredentials credentials = ServiceAccountCredentials.fromStream(json);
215+ * </code>. See {@link ServiceAccountCredentials#fromStream(InputStream, HttpTransportFactory)}.
216+ *
217+ * <p>If you are loading your credential configuration from an untrusted source and have not
218+ * mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon
219+ * as possible to prevent security risks to your environment.
220+ *
221+ * <p>Regardless of the method used, it is always your responsibility to validate configurations
222+ * received from external sources.
223+ *
224+ * <p>See the {@link <a
225+ * href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}
226+ * for more details.
207227 *
208228 * @param credentialsStream the stream with the credential definition.
209229 * @return the credential defined by the credentialsStream.
@@ -216,17 +236,37 @@ public static GoogleCredentials fromStream(InputStream credentialsStream) throws
216236 }
217237
218238 /**
219- * Returns credentials defined by a JSON file stream.
239+ * This method is obsolete because of a potential security risk. Use the credential specific load
240+ * method instead
241+ *
242+ * <p>Returns credentials defined by a JSON file stream.
220243 *
221244 * <p>The stream can contain a Service Account key file in JSON format from the Google Developers
222245 * Console or a stored user credential using the format supported by the Cloud SDK.
223246 *
224- * <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
225- * external source for authentication to Google Cloud Platform, you must validate it before
226- * providing it to any Google API or library. Providing an unvalidated credential configuration to
227- * Google APIs can compromise the security of your systems and data. For more information, refer
228- * to {@link <a
229- * href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
247+ * <p>Important: This method does not validate the credential configuration. A security risk holds
248+ * when a credential configuration is accepted from a source that is not under your control and
249+ * used without validation on your side.
250+ *
251+ * <p>If you know that you will be loading credential configurations of a specific type, it is
252+ * recommended to use a credential-type-specific `load()` method. This will ensure that an
253+ * unexpected credential type with potential for malicious intent is not loaded unintentionally.
254+ * You might still have to do validation for certain credential types. Please follow the
255+ * recommendation for that method. For example, if you want to load only service accounts, you can
256+ * use: <code>
257+ * GoogleCredentials credentials = ServiceAccountCredentials.fromStream(json);
258+ * </code>. See {@link ServiceAccountCredentials#fromStream(InputStream, HttpTransportFactory)}.
259+ *
260+ * <p>If you are loading your credential configuration from an untrusted source and have not
261+ * mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon
262+ * as possible to prevent security risks to your environment.
263+ *
264+ * <p>Regardless of the method used, it is always your responsibility to validate configurations
265+ * received from external sources.
266+ *
267+ * <p>See the {@link <a
268+ * href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}
269+ * for more details.
230270 *
231271 * @param credentialsStream the stream with the credential definition.
232272 * @param transportFactory HTTP transport factory, creates the transport used to get access
0 commit comments