You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* deprecate unsafe methods, add warnings to risky credential types, and update README instructions
* remove message added in prev commit; it is not strictly required here.
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* fix(docs): update README with secure credential loading example
Updates .readme-partials.yaml with the secure JWT constructor
example for loading credentials from environment variables. This
resolves a Windy Eagle vulnerability mitigation concern and adheres
to the synthtool workflow for documentation.
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* deprecate unsafe client options
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .readme-partials.yaml
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -253,7 +253,7 @@ body: |-
253
253
The parameters for the JWT auth client including how to use it with a `.pem` file are explained in [samples/jwt.js](https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/jwt.js).
254
254
255
255
#### Loading credentials from environment variables
256
-
Instead of loading credentials from a key file, you can also provide them using an environment variable and the `GoogleAuth.fromJSON()` method. This is particularly convenient for systems that deploy directly from source control (Heroku, App Engine, etc).
256
+
Instead of loading credentials from a key file, you can also provide them using an environment variable. This is particularly convenient for systems that deploy directly from source control (Heroku, App Engine, etc).
257
257
258
258
Start by exporting your credentials:
259
259
@@ -274,7 +274,7 @@ body: |-
274
274
Now you can create a new client from the credentials:
275
275
276
276
```js
277
-
const {auth} = require('google-auth-library');
277
+
const {JWT} = require('google-auth-library');
278
278
279
279
// load the environment variable with our keys
280
280
const keysEnvVar = process.env['CREDS'];
@@ -283,9 +283,12 @@ body: |-
283
283
}
284
284
const keys = JSON.parse(keysEnvVar);
285
285
286
-
// load the JWT or UserRefreshClient from the keys
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -297,7 +297,7 @@ console.log(res.data);
297
297
The parameters for the JWT auth client including how to use it with a `.pem` file are explained in [samples/jwt.js](https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/jwt.js).
298
298
299
299
#### Loading credentials from environment variables
300
-
Instead of loading credentials from a key file, you can also provide them using an environment variable and the `GoogleAuth.fromJSON()` method. This is particularly convenient for systems that deploy directly from source control (Heroku, App Engine, etc).
300
+
Instead of loading credentials from a key file, you can also provide them using an environment variable. This is particularly convenient for systems that deploy directly from source control (Heroku, App Engine, etc).
301
301
302
302
Start by exporting your credentials:
303
303
@@ -318,7 +318,7 @@ $ export CREDS='{
318
318
Now you can create a new client from the credentials:
319
319
320
320
```js
321
-
const {auth} =require('google-auth-library');
321
+
const {JWT} =require('google-auth-library');
322
322
323
323
// load the environment variable with our keys
324
324
constkeysEnvVar=process.env['CREDS'];
@@ -327,9 +327,12 @@ if (!keysEnvVar) {
327
327
}
328
328
constkeys=JSON.parse(keysEnvVar);
329
329
330
-
// load the JWT or UserRefreshClient from the keys
* Object containing client_email and private_key properties, or the
98
-
* external account client options.
99
-
* Cannot be used with {@link GoogleAuthOptions.apiKey `apiKey`}.
123
+
* @deprecated This option is being deprecated because of a potential security risk.
100
124
*
101
-
* @remarks
125
+
* This option does not validate the credential configuration. The security
126
+
* risk occurs when a credential configuration is accepted from a source that
127
+
* is not under your control and used without validation on your side.
102
128
*
103
-
* **Important**: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud, 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 {@link https://cloud.google.com/docs/authentication/external/externally-sourced-credentials Validate credential configurations from external sources}.
129
+
* The recommended way to provide credentials is to create an `auth` object
130
+
* using `google-auth-library` and pass it to the client constructor.
131
+
* This will ensure that unexpected credential types with potential for
132
+
* malicious intent are not loaded unintentionally. For example:
* **Important**: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud, 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 {@link https://cloud.google.com/docs/authentication/external/externally-sourced-credentials Validate credential configurations from external sources}.
656
702
*
703
+
* @deprecated This method is being deprecated because of a potential security risk.
704
+
*
705
+
* This method does not validate the credential configuration. The security
706
+
* risk occurs when a credential configuration is accepted from a source that
707
+
* is not under your control and used without validation on your side.
708
+
*
709
+
* If you know that you will be loading credential configurations of a
710
+
* specific type, it is recommended to use a credential-type-specific
711
+
* constructor. This will ensure that an unexpected credential type with
712
+
* potential for malicious intent is not loaded unintentionally. You might
713
+
* still have to do validation for certain credential types. Please follow
714
+
* the recommendation for that method. For example, if you want to load only
715
+
* service accounts, you can use the `JWT` constructor:
0 commit comments