Skip to content

Commit b3afcf5

Browse files
committed
chore: Add warnings to all fromStream() calls
1 parent 6077709 commit b3afcf5

File tree

6 files changed

+77
-7
lines changed

6 files changed

+77
-7
lines changed

oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ private ExternalAccountAuthorizedUserCredentials(Builder builder) {
127127
/**
128128
* Returns external account authorized user credentials defined by a JSON file stream.
129129
*
130+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
131+
* external source for authentication to Google Cloud Platform, you must validate it before
132+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
133+
* Google APIs can compromise the security of your systems and data. For more information, refer
134+
* to {@link <a
135+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
136+
*
130137
* @param credentialsStream the stream with the credential definition
131138
* @return the credential defined by the credentialsStream
132139
* @throws IOException if the credential cannot be created from the stream
@@ -140,6 +147,13 @@ public static ExternalAccountAuthorizedUserCredentials fromStream(InputStream cr
140147
/**
141148
* Returns external account authorized user credentials defined by a JSON file stream.
142149
*
150+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
151+
* external source for authentication to Google Cloud Platform, you must validate it before
152+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
153+
* Google APIs can compromise the security of your systems and data. For more information, refer
154+
* to {@link <a
155+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
156+
*
143157
* @param credentialsStream the stream with the credential definition
144158
* @param transportFactory the HTTP transport factory used to create the transport to get access
145159
* tokens

oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException
349349
*
350350
* <p>Returns {@link IdentityPoolCredentials} or {@link AwsCredentials}.
351351
*
352+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
353+
* external source for authentication to Google Cloud Platform, you must validate it before
354+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
355+
* Google APIs can compromise the security of your systems and data. For more information, refer
356+
* to {@link <a
357+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
358+
*
352359
* @param credentialsStream the stream with the credential definition
353360
* @return the credential defined by the credentialsStream
354361
* @throws IOException if the credential cannot be created from the stream
@@ -363,6 +370,13 @@ public static ExternalAccountCredentials fromStream(InputStream credentialsStrea
363370
*
364371
* <p>Returns a {@link IdentityPoolCredentials} or {@link AwsCredentials}.
365372
*
373+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
374+
* external source for authentication to Google Cloud Platform, you must validate it before
375+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
376+
* Google APIs can compromise the security of your systems and data. For more information, refer
377+
* to {@link <a
378+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
379+
*
366380
* @param credentialsStream the stream with the credential definition
367381
* @param transportFactory the HTTP transport factory used to create the transport to get access
368382
* tokens

oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ public static GoogleCredentials fromStream(InputStream credentialsStream) throws
179179
* <p>The stream can contain a Service Account key file in JSON format from the Google Developers
180180
* Console or a stored user credential using the format supported by the Cloud SDK.
181181
*
182+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
183+
* external source for authentication to Google Cloud Platform, you must validate it before
184+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
185+
* Google APIs can compromise the security of your systems and data. For more information, refer
186+
* to {@link <a
187+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
188+
*
182189
* @param credentialsStream the stream with the credential definition.
183190
* @param transportFactory HTTP transport factory, creates the transport used to get access
184191
* tokens.

oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ public class ServiceAccountCredentials extends GoogleCredentials
154154
* Returns service account credentials defined by JSON using the format supported by the Google
155155
* Developers Console.
156156
*
157-
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
158-
* external source for authentication to Google Cloud Platform, you must validate it before
159-
* providing it to any Google API or library. Providing an unvalidated credential configuration to
160-
* Google APIs can compromise the security of your systems and data. For more information, refer
161-
* to {@link <a
162-
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
163-
*
164157
* @param json a map from the JSON representing the credentials.
165158
* @param transportFactory HTTP transport factory, creates the transport used to get access
166159
* tokens.
@@ -453,6 +446,13 @@ static ServiceAccountCredentials fromPkcs8(
453446
* Returns credentials defined by a Service Account key file in JSON format from the Google
454447
* Developers Console.
455448
*
449+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
450+
* external source for authentication to Google Cloud Platform, you must validate it before
451+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
452+
* Google APIs can compromise the security of your systems and data. For more information, refer
453+
* to {@link <a
454+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
455+
*
456456
* @param credentialsStream the stream with the credential definition.
457457
* @return the credential defined by the credentialsStream.
458458
* @throws IOException if the credential cannot be created from the stream.
@@ -466,6 +466,13 @@ public static ServiceAccountCredentials fromStream(InputStream credentialsStream
466466
* Returns credentials defined by a Service Account key file in JSON format from the Google
467467
* Developers Console.
468468
*
469+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
470+
* external source for authentication to Google Cloud Platform, you must validate it before
471+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
472+
* Google APIs can compromise the security of your systems and data. For more information, refer
473+
* to {@link <a
474+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
475+
*
469476
* @param credentialsStream the stream with the credential definition.
470477
* @param transportFactory HTTP transport factory, creates the transport used to get access
471478
* tokens.

oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ static ServiceAccountJwtAccessCredentials fromPkcs8(
227227
* Returns credentials defined by a Service Account key file in JSON format from the Google
228228
* Developers Console.
229229
*
230+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
231+
* external source for authentication to Google Cloud Platform, you must validate it before
232+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
233+
* Google APIs can compromise the security of your systems and data. For more information, refer
234+
* to {@link <a
235+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
236+
*
230237
* @param credentialsStream the stream with the credential definition.
231238
* @return the credential defined by the credentialsStream.
232239
* @throws IOException if the credential cannot be created from the stream.
@@ -240,6 +247,13 @@ public static ServiceAccountJwtAccessCredentials fromStream(InputStream credenti
240247
* Returns credentials defined by a Service Account key file in JSON format from the Google
241248
* Developers Console.
242249
*
250+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
251+
* external source for authentication to Google Cloud Platform, you must validate it before
252+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
253+
* Google APIs can compromise the security of your systems and data. For more information, refer
254+
* to {@link <a
255+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
256+
*
243257
* @param credentialsStream the stream with the credential definition.
244258
* @param defaultAudience Audience to use if not provided by transport. May be null.
245259
* @return the credential defined by the credentialsStream.

oauth2_http/java/com/google/auth/oauth2/UserCredentials.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ static UserCredentials fromJson(Map<String, Object> json, HttpTransportFactory t
138138
/**
139139
* Returns credentials defined by a JSON file stream using the format supported by the Cloud SDK.
140140
*
141+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
142+
* external source for authentication to Google Cloud Platform, you must validate it before
143+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
144+
* Google APIs can compromise the security of your systems and data. For more information, refer
145+
* to {@link <a
146+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
147+
*
141148
* @param credentialsStream the stream with the credential definition.
142149
* @return the credential defined by the credentialsStream.
143150
* @throws IOException if the credential cannot be created from the stream.
@@ -149,6 +156,13 @@ public static UserCredentials fromStream(InputStream credentialsStream) throws I
149156
/**
150157
* Returns credentials defined by a JSON file stream using the format supported by the Cloud SDK.
151158
*
159+
* <p>Important: If you accept a credential configuration (credential JSON/File/Stream) from an
160+
* external source for authentication to Google Cloud Platform, you must validate it before
161+
* providing it to any Google API or library. Providing an unvalidated credential configuration to
162+
* Google APIs can compromise the security of your systems and data. For more information, refer
163+
* to {@link <a
164+
* href="https://cloud.google.com/docs/authentication/external/externally-sourced-credentials">documentation</a>}.
165+
*
152166
* @param credentialsStream the stream with the credential definition.
153167
* @param transportFactory HTTP transport factory, creates the transport used to get access
154168
* tokens.

0 commit comments

Comments
 (0)