From 416ea9315780f36c7cd9e29e5d700cc73f799738 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Mon, 11 Apr 2022 15:23:26 -0700 Subject: [PATCH 1/4] chore(deps): Update `gtoken`'s minimum version (#1390) Helps customers avoid using an insecure version of `gtoken` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 70450d2a..2af0488c 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "fast-text-encoding": "^1.0.0", "gaxios": "^4.0.0", "gcp-metadata": "^4.2.0", - "gtoken": "^5.0.4", + "gtoken": "^5.3.2", "jws": "^4.0.0", "lru-cache": "^6.0.0" }, From 9c02941e52514f8e3b07fedb01439fc313046063 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Tue, 12 Apr 2022 13:29:40 -0700 Subject: [PATCH 2/4] refactor!: remove deprecated DeprecatedGetClientOptions (#1393) --- src/auth/googleauth.ts | 10 +--------- src/auth/oauth2client.ts | 1 - test/test.googleauth.ts | 8 -------- test/test.oauth2.ts | 8 -------- 4 files changed, 1 insertion(+), 26 deletions(-) diff --git a/src/auth/googleauth.ts b/src/auth/googleauth.ts index 19f05f3d..e84402ce 100644 --- a/src/auth/googleauth.ts +++ b/src/auth/googleauth.ts @@ -59,9 +59,6 @@ export interface CredentialCallback { (err: Error | null, result?: JSONClient): void; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface -interface DeprecatedGetClientOptions {} - export interface ADCCallback { (err: Error | null, credential?: AuthClient, projectId?: string | null): void; } @@ -790,12 +787,7 @@ export class GoogleAuth { * Automatically obtain a client based on the provided configuration. If no * options were passed, use Application Default Credentials. */ - async getClient(options?: DeprecatedGetClientOptions) { - if (options) { - throw new Error( - 'Passing options to getClient is forbidden in v5.0.0. Use new GoogleAuth(opts) instead.' - ); - } + async getClient() { if (!this.cachedCredential) { if (this.jsonContent) { this._cacheClientFromJSON(this.jsonContent, this.clientOptions); diff --git a/src/auth/oauth2client.ts b/src/auth/oauth2client.ts index 0fdf8dcf..34ff13d4 100644 --- a/src/auth/oauth2client.ts +++ b/src/auth/oauth2client.ts @@ -709,7 +709,6 @@ export class OAuth2Client extends AuthClient { /** * Retrieves the access token using refresh token * - * @deprecated use getRequestHeaders instead. * @param callback callback */ refreshAccessToken(): Promise; diff --git a/test/test.googleauth.ts b/test/test.googleauth.ts index 8ec8f264..f9b601cb 100644 --- a/test/test.googleauth.ts +++ b/test/test.googleauth.ts @@ -1496,14 +1496,6 @@ describe('googleauth', () => { ); }); - it('should throw if options are passed to getClient()', async () => { - const auth = new GoogleAuth(); - await assert.rejects( - auth.getClient({hello: 'world'}), - /Passing options to getClient is forbidden in v5.0.0/ - ); - }); - it('getRequestHeaders populates x-goog-user-project with quota_project if present', async () => { const tokenReq = mockApplicationDefaultCredentials( './test/fixtures/config-with-quota' diff --git a/test/test.oauth2.ts b/test/test.oauth2.ts index ea85ff1e..763eb329 100644 --- a/test/test.oauth2.ts +++ b/test/test.oauth2.ts @@ -900,14 +900,6 @@ describe('oauth2', () => { }); }); - it('should not emit warning on refreshAccessToken', async () => { - let warned = false; - sandbox.stub(process, 'emitWarning').callsFake(() => (warned = true)); - client.refreshAccessToken(() => { - assert.strictEqual(warned, false); - }); - }); - it('should return error in callback on refreshAccessToken', done => { client.refreshAccessToken((err, result) => { assert.strictEqual(err!.message, 'No refresh token is set.'); From 3614c16ce8e66db2f397060a26d95687016bf60c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 10:54:21 -0700 Subject: [PATCH 3/4] build: make ci testing conditional on engines field in package.json, move configs to Node 12 (#1418) (#1395) * build: make ci testing conditional on engines field in package.json, move configs to Node 12 Co-authored-by: Benjamin E. Coe Source-Link: https://github.com/googleapis/synthtool/commit/2800f5a85af0e0399c71a63169a53ade3e0d42f6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:dc7bfb4c4bf50496abbdd24bd9e4aaa833dc75248c0a9e3a7f807feda5258873 Co-authored-by: Owl Bot Co-authored-by: Benjamin E. Coe --- .github/.OwlBot.lock.yaml | 4 ++-- .github/workflows/ci.yaml | 2 +- .kokoro/common.cfg | 2 +- .kokoro/release/docs.cfg | 2 +- .kokoro/samples-test.sh | 2 +- .kokoro/system-test.sh | 2 +- .kokoro/test.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b4c08f9a..11e07e9c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest - digest: sha256:f74e740638e66be7ced1540626217dbb72980eb73885b2339a70592f38c9ff2c -# created: 2022-04-06T18:36:33.987617127Z + digest: sha256:dc7bfb4c4bf50496abbdd24bd9e4aaa833dc75248c0a9e3a7f807feda5258873 +# created: 2022-04-14T17:36:54.629564643Z diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 35414632..25251dbb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [10, 12, 14, 16] + node: [10, 12, 14] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index 03e6b50b..8e9e508e 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -16,7 +16,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/release/docs.cfg b/.kokoro/release/docs.cfg index 8f8a1316..02c51cf2 100644 --- a/.kokoro/release/docs.cfg +++ b/.kokoro/release/docs.cfg @@ -11,7 +11,7 @@ before_action { # doc publications use a Python image. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } # Download trampoline resources. diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index f249d3e4..fbc058a4 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -56,7 +56,7 @@ fi # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh index 0a840452..87fa0653 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -49,7 +49,7 @@ npm run system-test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/test.sh b/.kokoro/test.sh index af1ce7e3..a5c7ac04 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -39,7 +39,7 @@ npm test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then From e4a5430eef1f28288c6634986aecfb0cb5e8faae Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 21:56:20 +0000 Subject: [PATCH 4/4] build: add srs yaml file (#1396) * build: add sync-repo-settings and change branch protection Source-Link: https://github.com/googleapis/synthtool/commit/ed8079c3d155b3ec820361f3d4d847715c7c1623 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:80bfa0c67226453b37b501be7748b2fa2a2676cfeec0012e79e3a1a8f1cbe6a3 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/sync-repo-settings.yaml | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .github/sync-repo-settings.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 11e07e9c..4ed84dc1 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest - digest: sha256:dc7bfb4c4bf50496abbdd24bd9e4aaa833dc75248c0a9e3a7f807feda5258873 -# created: 2022-04-14T17:36:54.629564643Z + digest: sha256:80bfa0c67226453b37b501be7748b2fa2a2676cfeec0012e79e3a1a8f1cbe6a3 +# created: 2022-04-14T19:57:08.518420247Z diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml new file mode 100644 index 00000000..1b362683 --- /dev/null +++ b/.github/sync-repo-settings.yaml @@ -0,0 +1,17 @@ +branchProtectionRules: + - pattern: main + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - "ci/kokoro: Samples test" + - "ci/kokoro: System test" + - docs + - lint + - test (10) + - test (12) + - test (14) + - cla/google + - windows + - OwlBot Post Processor