From 4518443b62f8c17d5e5f42a40dd103aabcdc75e4 Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Thu, 8 Nov 2018 11:05:13 -0800 Subject: [PATCH 01/82] add more scaffolding --- .eslintrc.yml | 3 +++ security-center/snippets/system-test/.eslintrc.yml | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 .eslintrc.yml create mode 100644 security-center/snippets/system-test/.eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000000..282535f55f --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +rules: + no-console: off diff --git a/security-center/snippets/system-test/.eslintrc.yml b/security-center/snippets/system-test/.eslintrc.yml new file mode 100644 index 0000000000..c0289282a6 --- /dev/null +++ b/security-center/snippets/system-test/.eslintrc.yml @@ -0,0 +1,5 @@ +--- +rules: + node/no-unpublished-require: off + node/no-unsupported-features: off + no-empty: off From efbd4b9895ed962b13600109f720df28109ca387 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 20 Nov 2018 11:16:39 -0800 Subject: [PATCH 02/82] refactor: fix lint rules and make consistent (#1) --- .eslintrc.yml | 1 + security-center/snippets/package.json | 15 +++++++++++++++ .../snippets/system-test/.eslintrc.yml | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 security-center/snippets/package.json diff --git a/.eslintrc.yml b/.eslintrc.yml index 282535f55f..0aa37ac630 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,3 +1,4 @@ --- rules: no-console: off + node/no-missing-require: off diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json new file mode 100644 index 0000000000..4e403b259c --- /dev/null +++ b/security-center/snippets/package.json @@ -0,0 +1,15 @@ +{ + "name": "nodejs-security-center-samples", + "main": "quickstart.js", + "private": true, + "scripts": { + "test": "mocha system-test" + }, + "license": "Apache-2.0", + "dependencies": { + "@google-cloud/security-center": "^0.1.0" + }, + "devDependencies": { + "mocha": "^5.2.0" + } +} diff --git a/security-center/snippets/system-test/.eslintrc.yml b/security-center/snippets/system-test/.eslintrc.yml index c0289282a6..0ab526f52b 100644 --- a/security-center/snippets/system-test/.eslintrc.yml +++ b/security-center/snippets/system-test/.eslintrc.yml @@ -1,5 +1,6 @@ --- +env: + mocha: true rules: node/no-unpublished-require: off - node/no-unsupported-features: off no-empty: off From 1bbd671abc0b41c5b9cf391e3f81485829da3585 Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Mon, 3 Dec 2018 10:10:56 -0800 Subject: [PATCH 03/82] add dummy no test yet file to system test and samples test dirs --- security-center/snippets/system-test/no-test.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 security-center/snippets/system-test/no-test.js diff --git a/security-center/snippets/system-test/no-test.js b/security-center/snippets/system-test/no-test.js new file mode 100644 index 0000000000..ed54b008e0 --- /dev/null +++ b/security-center/snippets/system-test/no-test.js @@ -0,0 +1 @@ +console.log('no tests yet'); From 6f1f7a5c614f2d4fcb99246e45160324fb27cd18 Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Thu, 3 Jan 2019 10:14:55 -0800 Subject: [PATCH 04/82] Release @google-cloud/security-center v0.1.1 (#28) * Release v0.1.1 * Update CHANGELOG.md --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 4e403b259c..deb4d399bf 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -7,7 +7,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^0.1.0" + "@google-cloud/security-center": "^0.1.1" }, "devDependencies": { "mocha": "^5.2.0" From 532a1d5c690e406e5f4dac071a8e5876bf0e168c Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Thu, 10 Jan 2019 11:17:02 -0800 Subject: [PATCH 05/82] samples: add quickstart (#33) * samples: add quickstart * sync quickstart to README.md * rm console.log * update README.md * npm run fix --- security-center/snippets/package.json | 5 +++++ security-center/snippets/system-test/no-test.js | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 security-center/snippets/system-test/no-test.js diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index deb4d399bf..11d3cf7493 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -2,6 +2,9 @@ "name": "nodejs-security-center-samples", "main": "quickstart.js", "private": true, + "engines": { + "node": ">=8" + }, "scripts": { "test": "mocha system-test" }, @@ -10,6 +13,8 @@ "@google-cloud/security-center": "^0.1.1" }, "devDependencies": { + "chai": "^4.2.0", + "execa": "^1.0.0", "mocha": "^5.2.0" } } diff --git a/security-center/snippets/system-test/no-test.js b/security-center/snippets/system-test/no-test.js deleted file mode 100644 index ed54b008e0..0000000000 --- a/security-center/snippets/system-test/no-test.js +++ /dev/null @@ -1 +0,0 @@ -console.log('no tests yet'); From c34f74aa1f46a1933eeef9692f337ea8d357d7dc Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Wed, 16 Jan 2019 16:35:19 -0800 Subject: [PATCH 06/82] Release v0.1.2 (#37) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 11d3cf7493..cbbd4eeef1 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -10,7 +10,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^0.1.1" + "@google-cloud/security-center": "^0.1.2" }, "devDependencies": { "chai": "^4.2.0", From a5c0f98305248d9f19df810229598ba72cef8e3f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Tue, 19 Feb 2019 10:04:13 -0800 Subject: [PATCH 07/82] chore(deps): update dependency mocha to v6 chore(deps): update dependency mocha to v6 This PR contains the following updates: | Package | Type | Update | Change | References | |---|---|---|---|---| | mocha | devDependencies | major | `^5.2.0` -> `^6.0.0` | [homepage](https://mochajs.org/), [source](https://togithub.com/mochajs/mocha) | --- ### Release Notes
mochajs/mocha ### [`v6.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​600--2019-02-18) [Compare Source](https://togithub.com/mochajs/mocha/compare/v5.2.0...v6.0.0) #### :tada: Enhancements - [#​3726](https://togithub.com/mochajs/mocha/issues/3726): Add ability to unload files from `require` cache ([**@​plroebuck**](https://togithub.com/plroebuck)) #### :bug: Fixes - [#​3737](https://togithub.com/mochajs/mocha/issues/3737): Fix falsy values from options globals ([**@​plroebuck**](https://togithub.com/plroebuck)) - [#​3707](https://togithub.com/mochajs/mocha/issues/3707): Fix encapsulation issues for `Suite#_onlyTests` and `Suite#_onlySuites` ([**@​vkarpov15**](https://togithub.com/vkarpov15)) - [#​3711](https://togithub.com/mochajs/mocha/issues/3711): Fix diagnostic messages dealing with plurality and markup of output ([**@​plroebuck**](https://togithub.com/plroebuck)) - [#​3723](https://togithub.com/mochajs/mocha/issues/3723): Fix "reporter-option" to allow comma-separated options ([**@​boneskull**](https://togithub.com/boneskull)) - [#​3722](https://togithub.com/mochajs/mocha/issues/3722): Fix code quality and performance of `lookupFiles` and `files` ([**@​plroebuck**](https://togithub.com/plroebuck)) - [#​3650](https://togithub.com/mochajs/mocha/issues/3650), [#​3654](https://togithub.com/mochajs/mocha/issues/3654): Fix noisy error message when no files found ([**@​craigtaub**](https://togithub.com/craigtaub)) - [#​3632](https://togithub.com/mochajs/mocha/issues/3632): Tests having an empty title are no longer confused with the "root" suite ([**@​juergba**](https://togithub.com/juergba)) - [#​3666](https://togithub.com/mochajs/mocha/issues/3666): Fix missing error codes ([**@​vkarpov15**](https://togithub.com/vkarpov15)) - [#​3684](https://togithub.com/mochajs/mocha/issues/3684): Fix exiting problem in Node.js v11.7.0+ ([**@​addaleax**](https://togithub.com/addaleax)) - [#​3691](https://togithub.com/mochajs/mocha/issues/3691): Fix `--delay` (and other boolean options) not working in all cases ([**@​boneskull**](https://togithub.com/boneskull)) - [#​3692](https://togithub.com/mochajs/mocha/issues/3692): Fix invalid command-line argument usage not causing actual errors ([**@​boneskull**](https://togithub.com/boneskull)) - [#​3698](https://togithub.com/mochajs/mocha/issues/3698), [#​3699](https://togithub.com/mochajs/mocha/issues/3699): Fix debug-related Node.js options not working in all cases ([**@​boneskull**](https://togithub.com/boneskull)) - [#​3700](https://togithub.com/mochajs/mocha/issues/3700): Growl notifications now show the correct number of tests run ([**@​outsideris**](https://togithub.com/outsideris)) - [#​3686](https://togithub.com/mochajs/mocha/issues/3686): Avoid potential ReDoS when diffing large objects ([**@​cyjake**](https://togithub.com/cyjake)) - [#​3715](https://togithub.com/mochajs/mocha/issues/3715): Fix incorrect order of emitted events when used programmatically ([**@​boneskull**](https://togithub.com/boneskull)) - [#​3706](https://togithub.com/mochajs/mocha/issues/3706): Fix regression wherein `--reporter-option`/`--reporter-options` did not support comma-separated key/value pairs ([**@​boneskull**](https://togithub.com/boneskull)) #### :book: Documentation - [#​3652](https://togithub.com/mochajs/mocha/issues/3652): Switch from Jekyll to Eleventy ([**@​Munter**](https://togithub.com/Munter)) #### :nut_and_bolt: Other - [#​3677](https://togithub.com/mochajs/mocha/issues/3677): Add error objects for createUnsupportedError and createInvalidExceptionError ([**@​boneskull**](https://togithub.com/boneskull)) - [#​3733](https://togithub.com/mochajs/mocha/issues/3733): Removed unnecessary processing in post-processing hook ([**@​wanseob**](https://togithub.com/wanseob)) - [#​3730](https://togithub.com/mochajs/mocha/issues/3730): Update nyc to latest version ([**@​coreyfarrell**](https://togithub.com/coreyfarrell)) - [#​3648](https://togithub.com/mochajs/mocha/issues/3648), [#​3680](https://togithub.com/mochajs/mocha/issues/3680): Fixes to support latest versions of [unexpected](https://npm.im/unexpected) and [unexpected-sinon](https://npm.im/unexpected-sinon) ([**@​sunesimonsen**](https://togithub.com/sunesimonsen)) - [#​3638](https://togithub.com/mochajs/mocha/issues/3638): Add meta tag to site ([**@​MartijnCuppens**](https://togithub.com/MartijnCuppens)) - [#​3653](https://togithub.com/mochajs/mocha/issues/3653): Fix parts of test suite failing to run on Windows ([**@​boneskull**](https://togithub.com/boneskull))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is stale, or if you modify the PR title to begin with "`rebase!`". :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#googleapis/nodejs-security-center). #54 automerged by dpebot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index cbbd4eeef1..dc879fc245 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -15,6 +15,6 @@ "devDependencies": { "chai": "^4.2.0", "execa": "^1.0.0", - "mocha": "^5.2.0" + "mocha": "^6.0.0" } } From acb4c2d6664fa93f4f4022e6323c27b4917aac1e Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Wed, 13 Mar 2019 04:02:37 -0700 Subject: [PATCH 08/82] Release @google-cloud/security-center v0.2.0 (#64) This pull request was generated using releasetool. --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index dc879fc245..11b82b1ee1 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -10,7 +10,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^0.1.2" + "@google-cloud/security-center": "^0.2.0" }, "devDependencies": { "chai": "^4.2.0", From 39e2c86b4dd2aaa02e74c781febdae2500606247 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Thu, 14 Mar 2019 17:54:52 -0700 Subject: [PATCH 09/82] Release @google-cloud/security-center v0.3.0 (#68) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 11b82b1ee1..de6e1d51c0 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -10,7 +10,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^0.2.0" + "@google-cloud/security-center": "^0.3.0" }, "devDependencies": { "chai": "^4.2.0", From 84ccb0dc2e4ecdcc7fb6c8225c648da00f594ef0 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Thu, 4 Apr 2019 12:34:52 -0700 Subject: [PATCH 10/82] refactor: use execSync for tests refactor: use execSync for tests #80 automerged by dpebot --- security-center/snippets/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index de6e1d51c0..fd6b67bad4 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "execa": "^1.0.0", "mocha": "^6.0.0" } } From d8af503a036d77eabfb15d714f86a89c8eb167cf Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 2 Jul 2019 15:00:49 -0700 Subject: [PATCH 11/82] fix: import run_asset_discovery_response.proto (#119) --- .eslintrc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.yml b/.eslintrc.yml index 0aa37ac630..59a8aeb576 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -2,3 +2,4 @@ rules: no-console: off node/no-missing-require: off + no-warning-comments: off \ No newline at end of file From 721ebf638edd880f1a584712ea6c46b165de6bc2 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 2 Jul 2019 15:17:23 -0700 Subject: [PATCH 12/82] chore: release 1.0.0 (#120) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index fd6b67bad4..d708220b17 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -10,7 +10,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^0.3.0" + "@google-cloud/security-center": "^1.0.0" }, "devDependencies": { "chai": "^4.2.0", From 4310462fd37ecdcf075fdea5d510e6aee0b6e51e Mon Sep 17 00:00:00 2001 From: emkornfield Date: Wed, 3 Jul 2019 08:29:31 -0700 Subject: [PATCH 13/82] docs(samples): add a comprehensive set of samples (#82) --- security-center/snippets/package.json | 6 +- .../system-test/v1/assetSecurityMarks.test.js | 91 ++++++++ .../snippets/system-test/v1/findings.test.js | 195 ++++++++++++++++++ .../system-test/v1/listAllAssets.test.js | 28 +++ .../v1/listAssetsAndChanges.test.js | 31 +++ .../system-test/v1/listAssetsAtTime.test.js | 27 +++ .../system-test/v1/listFilteredAssets.test.js | 30 +++ .../system-test/v1/orgSettings.test.js | 38 ++++ .../snippets/v1/addDeleteSecurityMarks.js | 50 +++++ .../snippets/v1/addFindingSecurityMarks.js | 50 +++++ .../snippets/v1/addSecurityMarks.js | 49 +++++ security-center/snippets/v1/createFinding.js | 61 ++++++ .../v1/createFindingSourceProperties.js | 66 ++++++ security-center/snippets/v1/createSource.js | 46 +++++ .../snippets/v1/deleteSecurityMarks.js | 49 +++++ .../snippets/v1/enableAssetDiscovery.js | 50 +++++ .../snippets/v1/getOrganizationSettings.js | 46 +++++ security-center/snippets/v1/getSource.js | 42 ++++ security-center/snippets/v1/getSourceIam.js | 45 ++++ security-center/snippets/v1/listAllAssets.js | 48 +++++ .../snippets/v1/listAllFindings.js | 47 +++++ security-center/snippets/v1/listAllSources.js | 45 ++++ .../snippets/v1/listAssetsAndChanges.js | 56 +++++ .../snippets/v1/listAssetsAtTime.js | 64 ++++++ .../v1/listAssetsWithSecurityMarks.js | 54 +++++ .../snippets/v1/listFilteredAssets.js | 55 +++++ .../snippets/v1/listFilteredFindings.js | 49 +++++ .../snippets/v1/listFindingsAtTime.js | 55 +++++ .../v1/listFindingsWithSecurityMarks.js | 49 +++++ .../snippets/v1/setFindingState.js | 53 +++++ security-center/snippets/v1/setSourceIam.js | 64 ++++++ security-center/snippets/v1/testIam.js | 59 ++++++ .../v1/updateFindingSourceProperties.js | 59 ++++++ security-center/snippets/v1/updateSource.js | 50 +++++ 34 files changed, 1804 insertions(+), 3 deletions(-) create mode 100644 security-center/snippets/system-test/v1/assetSecurityMarks.test.js create mode 100644 security-center/snippets/system-test/v1/findings.test.js create mode 100644 security-center/snippets/system-test/v1/listAllAssets.test.js create mode 100644 security-center/snippets/system-test/v1/listAssetsAndChanges.test.js create mode 100644 security-center/snippets/system-test/v1/listAssetsAtTime.test.js create mode 100644 security-center/snippets/system-test/v1/listFilteredAssets.test.js create mode 100644 security-center/snippets/system-test/v1/orgSettings.test.js create mode 100644 security-center/snippets/v1/addDeleteSecurityMarks.js create mode 100644 security-center/snippets/v1/addFindingSecurityMarks.js create mode 100644 security-center/snippets/v1/addSecurityMarks.js create mode 100644 security-center/snippets/v1/createFinding.js create mode 100644 security-center/snippets/v1/createFindingSourceProperties.js create mode 100644 security-center/snippets/v1/createSource.js create mode 100644 security-center/snippets/v1/deleteSecurityMarks.js create mode 100644 security-center/snippets/v1/enableAssetDiscovery.js create mode 100644 security-center/snippets/v1/getOrganizationSettings.js create mode 100644 security-center/snippets/v1/getSource.js create mode 100644 security-center/snippets/v1/getSourceIam.js create mode 100644 security-center/snippets/v1/listAllAssets.js create mode 100644 security-center/snippets/v1/listAllFindings.js create mode 100644 security-center/snippets/v1/listAllSources.js create mode 100644 security-center/snippets/v1/listAssetsAndChanges.js create mode 100644 security-center/snippets/v1/listAssetsAtTime.js create mode 100644 security-center/snippets/v1/listAssetsWithSecurityMarks.js create mode 100644 security-center/snippets/v1/listFilteredAssets.js create mode 100644 security-center/snippets/v1/listFilteredFindings.js create mode 100644 security-center/snippets/v1/listFindingsAtTime.js create mode 100644 security-center/snippets/v1/listFindingsWithSecurityMarks.js create mode 100644 security-center/snippets/v1/setFindingState.js create mode 100644 security-center/snippets/v1/setSourceIam.js create mode 100644 security-center/snippets/v1/testIam.js create mode 100644 security-center/snippets/v1/updateFindingSourceProperties.js create mode 100644 security-center/snippets/v1/updateSource.js diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index d708220b17..fb179903e4 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -1,12 +1,11 @@ { "name": "nodejs-security-center-samples", - "main": "quickstart.js", "private": true, "engines": { "node": ">=8" }, "scripts": { - "test": "mocha system-test" + "test": "mocha system-test/ --recursive --timeout 6000000" }, "license": "Apache-2.0", "dependencies": { @@ -14,6 +13,7 @@ }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^6.0.0" + "execa": "^1.0.0", + "mocha": "^6.0.2" } } diff --git a/security-center/snippets/system-test/v1/assetSecurityMarks.test.js b/security-center/snippets/system-test/v1/assetSecurityMarks.test.js new file mode 100644 index 0000000000..e0e2bd49f4 --- /dev/null +++ b/security-center/snippets/system-test/v1/assetSecurityMarks.test.js @@ -0,0 +1,91 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organizationId = process.env['GCLOUD_ORGANIZATION']; + +describe('client with security marks for assets', async () => { + let data; + before(async () => { + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + const [assetResults] = await client.listAssets({ + parent: client.organizationPath(organizationId), + }); + const randomAsset = + assetResults[Math.floor(Math.random() * assetResults.length)].asset; + console.log('random %j', randomAsset); + data = { + orgId: organizationId, + assetName: randomAsset.name, + }; + console.log('data %j', data); + }); + it('client can add security marks to asset.', async () => { + const output = await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + assert.match(output, new RegExp(data.assetName)); + assert.match(output, /key_a/); + assert.match(output, /value_a/); + assert.match(output, /key_b/); + assert.match(output, /value_b/); + assert.notMatch(output, /undefined/); + }); + + it('client can add and delete security marks', async () => { + // Ensure marks are set. + await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + + const output = await exec( + `node v1/addDeleteSecurityMarks.js ${data.assetName}` + ); + assert.match(output, /key_a/); + assert.match(output, /new_value_a/); + assert.notMatch(output, /key_b/); + assert.notMatch(output, /undefined/); + }); + + it('client can delete security marks', async () => { + // Ensure marks are set. + await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + + const output = await exec( + `node v1/deleteSecurityMarks.js ${data.assetName}` + ); + assert.notMatch(output, /key_a/); + assert.notMatch(output, /value_a/); + assert.notMatch(output, /key_b/); + assert.notMatch(output, /value_b/); + assert.match(output, new RegExp(data.assetName)); + assert.match(output, new RegExp(data.assetName)); + assert.notMatch(output, /undefined/); + }); + + it('client can list assets with security marks', async () => { + // Ensure marks are set. + await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + + const output = await exec( + `node v1/listAssetsWithSecurityMarks.js ${data.orgId}` + ); + assert.match(output, new RegExp(data.assetName)); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/system-test/v1/findings.test.js b/security-center/snippets/system-test/v1/findings.test.js new file mode 100644 index 0000000000..e5672c0b7d --- /dev/null +++ b/security-center/snippets/system-test/v1/findings.test.js @@ -0,0 +1,195 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organizationId = process.env['GCLOUD_ORGANIZATION']; + +describe('Client with SourcesAndFindings', async () => { + let data; + before(async () => { + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + const [source] = await client + .createSource({ + source: { + displayName: 'Customized Display Name', + description: 'A new custom source that does X', + }, + parent: client.organizationPath(organizationId), + }) + .catch(error => console.error(error)); + const eventTime = new Date(); + const createFindingTemplate = { + parent: source.name, + findingId: 'somefinding', + finding: { + state: 'ACTIVE', + // Resource the finding is associated with. This is an + // example any resource identifier can be used. + resourceName: + '//cloudresourcemanager.googleapis.com/organizations/11232', + // A free-form category. + category: 'MEDIUM_RISK_ONE', + // The time associated with discovering the issue. + eventTime: { + seconds: Math.floor(eventTime.getTime() / 1000), + nanos: (eventTime.getTime() % 1000) * 1e6, + }, + }, + }; + const [finding] = await client.createFinding(createFindingTemplate); + createFindingTemplate.findingId = 'untouchedFindingId'; + createFindingTemplate.finding.category = 'XSS'; + const [untouchedFinding] = await client + .createFinding(createFindingTemplate) + .catch(error => console.error(error)); + data = { + orgId: organizationId, + sourceName: source.name, + findingName: finding.name, + untouchedFindingName: untouchedFinding.name, + }; + console.log('my data %j', data); + }); + it('client can create source', async () => { + const output = await exec(`node v1/createSource.js ${data.orgId}`); + assert.match(output, new RegExp(data.orgId)); + assert.match(output, /New Source/); + assert.notMatch(output, /undefined/); + }); + it('client can get source', async () => { + const output = await exec(`node v1/getSource.js ${data.sourceName}`); + assert.match(output, new RegExp(data.sourceName)); + assert.match(output, /Source/); + assert.match(output, /"description":"A new custom source that does X"/); + assert.notMatch(output, /undefined/); + }); + it('client can list all sources', async () => { + const output = await exec(`node v1/listAllSources.js ${data.orgId}`); + assert.match(output, new RegExp(data.sourceName)); + assert.match(output, /Sources/); + assert.notMatch(output, /undefined/); + }); + it('client can update a source', async () => { + const output = await exec(`node v1/updateSource.js ${data.sourceName}`); + assert.match(output, new RegExp(data.sourceName)); + assert.match(output, /New Display Name/); + assert.match(output, /source that does X/); + assert.notMatch(output, /undefined/); + }); + it('client can create a finding', async () => { + const output = await exec(`node v1/createFinding.js ${data.sourceName}`); + assert.match(output, new RegExp(data.sourceName)); + assert.match(output, /New finding created/); + assert.notMatch(output, /undefined/); + }); + it('client can create a finding with source properties', async () => { + const output = await exec( + `node v1/createFindingSourceProperties.js ${data.sourceName}` + ); + assert.match(output, new RegExp(data.sourceName)); + assert.match(output, /New finding created/); + assert.match(output, /n_value/); + assert.notMatch(output, /undefined/); + }); + it('client can update a findings source properties', async () => { + const output = await exec( + `node v1/updateFindingSourceProperties.js ${data.findingName}` + ); + assert.match(output, new RegExp(data.findingName)); + assert.match(output, /Updated Finding/); + assert.match(output, /new_string_example/); + assert.notMatch(output, /undefined/); + }); + it('client can set finding state', async () => { + const output = await exec(`node v1/setFindingState.js ${data.findingName}`); + assert.match(output, new RegExp(data.findingName)); + assert.match(output, /INACTIVE/); + assert.notMatch(output, /undefined/); + }); + it('client can test IAM privileges', async () => { + const output = await exec(`node v1/testIam.js ${data.sourceName}`); + assert.equal( + (output.match(/true/g) || []).length, + 2, + `${output} contains true twice` + ); + assert.notMatch(output, /undefined/); + }); + it('client can list all findings', async () => { + const output = await exec(`node v1/listAllFindings.js ${data.orgId}`); + assert.match(output, new RegExp(data.findingName)); + assert.match(output, new RegExp(data.untouchedFindingName)); + assert.notMatch(output, /undefined/); + }); + it('client can list only some findings', async () => { + const output = await exec( + `node v1/listFilteredFindings.js ${data.sourceName}` + ); + assert.match(output, new RegExp(data.findingName)); + assert.notMatch(output, new RegExp(data.untouchedFindingName)); + assert.notMatch(output, /undefined/); + }); + it('client can list findings at a time.', async () => { + const output = await exec( + `node v1/listFindingsAtTime.js ${data.sourceName}` + ); + // Nothing was created for the source more then a few minutes ago, so + // days ago should return nothing. + assert.equal(output, ''); + }); + it('client can add security marks to finding', async () => { + const output = await exec( + `node v1/addFindingSecurityMarks.js ${data.findingName}` + ); + assert.match(output, new RegExp(data.findingName)); + assert.match(output, /key_a/); + assert.match(output, /value_a/); + assert.match(output, /key_b/); + assert.match(output, /value_b/); + assert.notMatch(output, /undefined/); + }); + it('client can list findings withe security marks', async () => { + // Ensure marks are set. + await exec(`node v1/addFindingSecurityMarks.js ${data.findingName}`); + + const output = await exec( + `node v1/listFindingsWithSecurityMarks.js ${data.sourceName}` + ); + assert.notMatch(output, new RegExp(data.findingName)); + assert.match(output, new RegExp(data.untouchedFindingName)); + assert.notMatch(output, /undefined/); + }); + it('client can get a sources policy', async () => { + const output = await exec(`node v1/getSourceIam.js ${data.sourceName}`); + assert.match(output, /Current policy/); + assert.notMatch(output, /undefined/); + }); + it('client set a sources policy', async () => { + const user = 'csccclienttest@gmail.com'; + const output = await exec( + `node v1/setSourceIam.js ${data.sourceName} ${user}` + ); + assert.match(output, /Updated policy/); + assert.match(output, new RegExp(user)); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/system-test/v1/listAllAssets.test.js b/security-center/snippets/system-test/v1/listAllAssets.test.js new file mode 100644 index 0000000000..290189e3c3 --- /dev/null +++ b/security-center/snippets/system-test/v1/listAllAssets.test.js @@ -0,0 +1,28 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organization_id = process.env['GCLOUD_ORGANIZATION']; + +describe('listAllAssets', () => { + it('should print all assets in org', async () => { + const output = await exec(`node v1/listAllAssets.js ${organization_id}`); + assert.isAtLeast(output.match(/\n/g).length + 1, 62); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js b/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js new file mode 100644 index 0000000000..aa4ab020cf --- /dev/null +++ b/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js @@ -0,0 +1,31 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organization_id = process.env['GCLOUD_ORGANIZATION']; + +describe('listAssetsandChanges', () => { + it('should print projects with state changes', async () => { + const output = await exec( + `node v1/listAssetsAndChanges.js ${organization_id}` + ); + assert.match(output, /(ADDED|ACTIVE)/); + assert.equal(3, output.match(/\n/g).length + 1, '== number of projects'); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/system-test/v1/listAssetsAtTime.test.js b/security-center/snippets/system-test/v1/listAssetsAtTime.test.js new file mode 100644 index 0000000000..0f8797d2bc --- /dev/null +++ b/security-center/snippets/system-test/v1/listAssetsAtTime.test.js @@ -0,0 +1,27 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organization_id = process.env['GCLOUD_ORGANIZATION']; + +describe('listAssetsAttime', () => { + it('should print projects', async () => { + const output = await exec(`node v1/listAssetsAtTime.js ${organization_id}`); + assert.equal(3, output.match(/\n/g).length + 1, '== number of projects'); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/system-test/v1/listFilteredAssets.test.js b/security-center/snippets/system-test/v1/listFilteredAssets.test.js new file mode 100644 index 0000000000..6b001b3b32 --- /dev/null +++ b/security-center/snippets/system-test/v1/listFilteredAssets.test.js @@ -0,0 +1,30 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organization_id = process.env['GCLOUD_ORGANIZATION']; + +describe('listAllAssets', () => { + it('should print all assets in org', async () => { + const output = await exec( + `node v1/listFilteredAssets.js ${organization_id}` + ); + assert.isAtLeast(3, output.match(/\n/g).length + 1); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/system-test/v1/orgSettings.test.js b/security-center/snippets/system-test/v1/orgSettings.test.js new file mode 100644 index 0000000000..61fed645f7 --- /dev/null +++ b/security-center/snippets/system-test/v1/orgSettings.test.js @@ -0,0 +1,38 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +const {assert} = require('chai'); +const execa = require('execa'); +const exec = async cmd => (await execa.shell(cmd)).stdout; + +const organizationId = process.env['GCLOUD_ORGANIZATION']; + +describe('client with organization settings', async () => { + it('client can enable asset discovery', async () => { + const output = await exec( + `node v1/enableAssetDiscovery.js ${organizationId}` + ); + assert.match(output, new RegExp(organizationId)); + assert.match(output, /true/); + assert.notMatch(output, /undefined/); + }); + + it('client can get organization settings', async () => { + const output = await exec( + `node v1/getOrganizationSettings.js ${organizationId}` + ); + assert.match(output, new RegExp(organizationId)); + }); +}); diff --git a/security-center/snippets/v1/addDeleteSecurityMarks.js b/security-center/snippets/v1/addDeleteSecurityMarks.js new file mode 100644 index 0000000000..0524afb77b --- /dev/null +++ b/security-center/snippets/v1/addDeleteSecurityMarks.js @@ -0,0 +1,50 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demostrates adding/updating at the same time as deleting security + * marks from an asset. + */ +function main(assetName = 'full asset path to add marks to') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function addDeleteSecurityMarks() { + // assetName is the full resource path for the asset to update. + /* + * TODO(developer): Uncomment the following lines + */ + // assetName = "organizations/123123342/assets/12312321"; + const [newMarks] = await client.updateSecurityMarks({ + securityMarks: { + name: `${assetName}/securityMarks`, + marks: {key_a: 'new_value_a'}, + }, + // Only update the enableAssetDiscovery field. + updateMask: {paths: ['marks.key_a', 'marks.key_b']}, + }); + + console.log('New marks: %j', newMarks); + } + addDeleteSecurityMarks(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/addFindingSecurityMarks.js b/security-center/snippets/v1/addFindingSecurityMarks.js new file mode 100644 index 0000000000..1eaf06aa37 --- /dev/null +++ b/security-center/snippets/v1/addFindingSecurityMarks.js @@ -0,0 +1,50 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demostrates adding security marks to a finding. + */ +function main(findingName = 'full finding path to add marks to') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function addFindingSecurityMarks() { + // findingName is the full resource path for the finding to update. + /* + * TODO(developer): Uncomment the following lines + */ + // const findingName = + // "organizations/123123342/sources/1213/findings/findingid"; + const [newMarks] = await client.updateSecurityMarks({ + securityMarks: { + name: `${findingName}/securityMarks`, + marks: {key_a: 'value_a', key_b: 'value_b'}, + }, + // Only update the marks with these keys. + updateMask: {paths: ['marks.key_a', 'marks.key_b']}, + }); + + console.log('New marks: %j', newMarks); + } + addFindingSecurityMarks(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/addSecurityMarks.js b/security-center/snippets/v1/addSecurityMarks.js new file mode 100644 index 0000000000..64363349e8 --- /dev/null +++ b/security-center/snippets/v1/addSecurityMarks.js @@ -0,0 +1,49 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demostrates adding security marks to an asset. + */ +function main(assetName = 'full asset path to add marks to') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function addSecurityMarks() { + // assetName is the full resource path for the asset to update. + /* + * TODO(developer): Uncomment the following lines + */ + // const assetName = "organizations/123123342/assets/12312321"; + const [newMarks] = await client.updateSecurityMarks({ + securityMarks: { + name: `${assetName}/securityMarks`, + marks: {key_a: 'value_a', key_b: 'value_b'}, + }, + // Only update the marks with these keys. + updateMask: {paths: ['marks.key_a', 'marks.key_b']}, + }); + + console.log('New marks: %', newMarks); + } + addSecurityMarks(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createFinding.js b/security-center/snippets/v1/createFinding.js new file mode 100644 index 0000000000..b91f580e09 --- /dev/null +++ b/security-center/snippets/v1/createFinding.js @@ -0,0 +1,61 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demonstrates how to create a new security finding in CSCC. + */ +function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the full resource name of the source the finding should + // be associated with. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + + // Use now as the eventTime for the security finding. + const eventTime = new Date(); + async function createFinding() { + const [newFinding] = await client.createFinding({ + parent: sourceName, + findingId: 'samplefindingid', + finding: { + state: 'ACTIVE', + // Resource the finding is associated with. This is an + // example any resource identifier can be used. + resourceName: + '//cloudresourcemanager.googleapis.com/organizations/11232', + // A free-form category. + category: 'MEDIUM_RISK_ONE', + // The time associated with discovering the issue. + eventTime: { + seconds: Math.floor(eventTime.getTime() / 1000), + nanos: (eventTime.getTime() % 1000) * 1e6, + }, + }, + }); + console.log('New finding created: %j', newFinding); + } + createFinding(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createFindingSourceProperties.js b/security-center/snippets/v1/createFindingSourceProperties.js new file mode 100644 index 0000000000..e63882c773 --- /dev/null +++ b/security-center/snippets/v1/createFindingSourceProperties.js @@ -0,0 +1,66 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demonstrates how to create a new security finding in CSCC with source + * properties. + */ +function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the full resource name of the source the finding should + // be associated with. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + + // Use now as the eventTime for the security finding. + const eventTime = new Date(); + async function createFinding() { + const [newFinding] = await client.createFinding({ + parent: sourceName, + findingId: 'findingwithprops', + finding: { + state: 'ACTIVE', + // Resource the finding is associated with. This is an + // example any resource identifier can be used. + resourceName: + '//cloudresourcemanager.googleapis.com/organizations/11232', + // A free-form category. + category: 'MEDIUM_RISK_ONE', + // The time associated with discovering the issue. + eventTime: { + seconds: Math.floor(eventTime.getTime() / 1000), + nanos: (eventTime.getTime() % 1000) * 1e6, + }, + sourceProperties: { + s_value: {stringValue: 'string_example'}, + n_value: {numberValue: 1234}, + }, + }, + }); + console.log('New finding created: %j', newFinding); + } + createFinding(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createSource.js b/security-center/snippets/v1/createSource.js new file mode 100644 index 0000000000..8fcc7cded7 --- /dev/null +++ b/security-center/snippets/v1/createSource.js @@ -0,0 +1,46 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * createSource demonstrates how to create a new security finding source. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is numeric organization identifier. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "1234567777"; + async function createSource() { + const [source] = await client.createSource({ + source: { + displayName: 'Customized Display Name', + description: 'A new custom source that does X', + }, + parent: client.organizationPath(organizationId), + }); + console.log('New Source: %j', source); + } + createSource(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/deleteSecurityMarks.js b/security-center/snippets/v1/deleteSecurityMarks.js new file mode 100644 index 0000000000..d0f15fdb82 --- /dev/null +++ b/security-center/snippets/v1/deleteSecurityMarks.js @@ -0,0 +1,49 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demostrates deleting security marks on an asset. + */ +function main(assetName = 'full asset path to add marks to') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function deleteSecurityMarks() { + // assetName is the full resource path for the asset to update. + /* + * TODO(developer): Uncomment the following lines + */ + // const assetName = "organizations/123123342/assets/12312321"; + const [newMarks] = await client.updateSecurityMarks({ + securityMarks: { + name: `${assetName}/securityMarks`, + // Intentionally, not setting marks to delete them. + }, + // Only delete marks for the following keys. + updateMask: {paths: ['marks.key_a', 'marks.key_b']}, + }); + + console.log('Updated marks: %j', newMarks); + } + deleteSecurityMarks(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/enableAssetDiscovery.js b/security-center/snippets/v1/enableAssetDiscovery.js new file mode 100644 index 0000000000..9bfa877e41 --- /dev/null +++ b/security-center/snippets/v1/enableAssetDiscovery.js @@ -0,0 +1,50 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demostrates enabling asset discovery for an organization. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function updateOrgSettings() { + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "111122222444"; + const orgName = client.organizationPath(organizationId); + const [newSettings] = await client.updateOrganizationSettings({ + organizationSettings: { + name: `${orgName}/organizationSettings`, + enableAssetDiscovery: true, + }, + // Only update the enableAssetDiscovery field. + updateMask: {paths: ['enable_asset_discovery']}, + }); + + console.log('New settings: %j', newSettings); + } + updateOrgSettings(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getOrganizationSettings.js b/security-center/snippets/v1/getOrganizationSettings.js new file mode 100644 index 0000000000..646e907cc7 --- /dev/null +++ b/security-center/snippets/v1/getOrganizationSettings.js @@ -0,0 +1,46 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/* + * Demostrates retrieving the current organization settings for CSCC. This + * includes the current status of asset recovery. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function getOrgSettings() { + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizaionId = "111122222444"; + const orgName = client.organizationPath(organizationId); + const [settings] = await client.getOrganizationSettings({ + name: `${orgName}/organizationSettings`, + }); + + console.log('Current settings: %j', settings); + } + getOrgSettings(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getSource.js b/security-center/snippets/v1/getSource.js new file mode 100644 index 0000000000..557c44911b --- /dev/null +++ b/security-center/snippets/v1/getSource.js @@ -0,0 +1,42 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demonstrates how to update fields on a security findings + * source. + */ +function main(sourceName = 'FULL_PATH_TO_SOURCE') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the full resource name of the source to be retrieved. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + async function getSource() { + const [source] = await client.getSource({name: sourceName}); + console.log('Source: %j', source); + } + + getSource(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getSourceIam.js b/security-center/snippets/v1/getSourceIam.js new file mode 100644 index 0000000000..035c2e5143 --- /dev/null +++ b/security-center/snippets/v1/getSourceIam.js @@ -0,0 +1,45 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/* + * Demostrates retrieving the current IAM policy for a source. + */ +function main(sourceName = 'FULL_PATH_TO_SOURCE') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function getSourceIamPolicy() { + // sourceName is the full resource name to retrieve the policy for. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + + const [existingPolicy] = await client.getIamPolicy({ + resource: sourceName, + }); + + console.log('Current policy: %j', existingPolicy); + } + getSourceIamPolicy(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllAssets.js b/security-center/snippets/v1/listAllAssets.js new file mode 100644 index 0000000000..ecc65b8ec0 --- /dev/null +++ b/security-center/snippets/v1/listAllAssets.js @@ -0,0 +1,48 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** Prints all assets in an organization. */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "111122222444"; + const orgName = client.organizationPath(organizationId); + // Call the API with automatic pagination. + async function listAssets() { + const [response] = await client.listAssets({parent: orgName}); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.asset.name} ${ + result.asset.securityCenterProperties.resourceName + }` + ) + ); + } + + listAssets(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllFindings.js b/security-center/snippets/v1/listAllFindings.js new file mode 100644 index 0000000000..269aba9d9a --- /dev/null +++ b/security-center/snippets/v1/listAllFindings.js @@ -0,0 +1,47 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** Prints all findings across all sources. */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "1234567777"; + + async function listAllFindings() { + const [response] = await client.listFindings({ + // List findings across all sources. + parent: `organizations/${organizationId}/sources/-`, + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.finding.name} ${result.finding.resourceName}` + ) + ); + } + listAllFindings(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllSources.js b/security-center/snippets/v1/listAllSources.js new file mode 100644 index 0000000000..2e06587353 --- /dev/null +++ b/security-center/snippets/v1/listAllSources.js @@ -0,0 +1,45 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** Prints all sources in an organization. */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizaionId = "111122222444"; + const orgName = client.organizationPath(organizationId); + // Call the API with automatic pagination. + async function listSources() { + const [response] = await client.listSources({parent: orgName}); + let count = 0; + console.log('Sources:'); + Array.from(response).forEach(source => + console.log('%d %j', ++count, source) + ); + } + + listSources(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAssetsAndChanges.js b/security-center/snippets/v1/listAssetsAndChanges.js new file mode 100644 index 0000000000..a3f7f3eb6f --- /dev/null +++ b/security-center/snippets/v1/listAssetsAndChanges.js @@ -0,0 +1,56 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Prints project assets for the organization and there state changes from 30 + * days ago. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "1234567777"; + const orgName = client.organizationPath(organizationId); + // Call the API with automatic pagination. + async function listAssetsAndChanges() { + const [response] = await client.listAssets({ + parent: orgName, + compareDuration: {seconds: 30 * /*Second in Day=*/ 86400, nanos: 0}, + filter: + 'security_center_properties.resource_type="google.cloud.resourcemanager.Project"', + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.asset.name} ${ + result.asset.securityCenterProperties.resourceName + } ${result.stateChange}` + ) + ); + } + + listAssetsAndChanges(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAssetsAtTime.js b/security-center/snippets/v1/listAssetsAtTime.js new file mode 100644 index 0000000000..f97f057fbc --- /dev/null +++ b/security-center/snippets/v1/listAssetsAtTime.js @@ -0,0 +1,64 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Prints project assets for the organization as of yesterday. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "1234567777"; + const orgName = client.organizationPath(organizationId); + + const oneDayAgo = new Date(); + oneDayAgo.setDate(oneDayAgo.getDate() - 1); + + // Call the API with automatic pagination. + async function listAssetsAtTime() { + const [response] = await client.listAssets({ + parent: orgName, + filter: + 'security_center_properties.resource_type="google.cloud.resourcemanager.Project"', + // readTime must be in the form of a google.protobuf.Timestamp object + // which takes seconds and nanoseconds. + readTime: { + seconds: Math.floor(oneDayAgo.getTime() / 1000), + nanos: (oneDayAgo.getTime() % 1000) * 1e6, + }, + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.asset.name} ${ + result.asset.securityCenterProperties.resourceName + }` + ) + ); + } + + listAssetsAtTime(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAssetsWithSecurityMarks.js b/security-center/snippets/v1/listAssetsWithSecurityMarks.js new file mode 100644 index 0000000000..e263d41fb1 --- /dev/null +++ b/security-center/snippets/v1/listAssetsWithSecurityMarks.js @@ -0,0 +1,54 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Prints assets with security mark of key_a == value_a. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "1234567777"; + const orgName = client.organizationPath(organizationId); + + // Call the API with automatic pagination. + async function listAssetsWithSecurityMarks() { + const [response] = await client.listAssets({ + parent: orgName, + filter: 'security_marks.marks.key_a="value_a"', + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.asset.name} ${ + result.asset.securityCenterProperties.resourceName + }` + ) + ); + } + + listAssetsWithSecurityMarks(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFilteredAssets.js b/security-center/snippets/v1/listFilteredAssets.js new file mode 100644 index 0000000000..473fd6956c --- /dev/null +++ b/security-center/snippets/v1/listFilteredAssets.js @@ -0,0 +1,55 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Prints current project assets for the organization. + */ +function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // organizationId is the numeric ID of the organization. + /* + * TODO(developer): Uncomment the following lines + */ + // const organizationId = "1234567777"; + const orgName = client.organizationPath(organizationId); + + // Call the API with automatic pagination. + async function listFilteredAssets() { + const [response] = await client.listAssets({ + parent: orgName, + filter: + 'security_center_properties.resource_type="google.cloud.resourcemanager.Project"', + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.asset.name} ${ + result.asset.securityCenterProperties.resourceName + } ${result.stateChange}` + ) + ); + } + + listFilteredAssets(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFilteredFindings.js b/security-center/snippets/v1/listFilteredFindings.js new file mode 100644 index 0000000000..077f4a919a --- /dev/null +++ b/security-center/snippets/v1/listFilteredFindings.js @@ -0,0 +1,49 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** Demonstrates listing only specific findings. */ +function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the full resource path of the source to search for + // findings. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + + async function listFilteredFindings() { + const [response] = await client.listFindings({ + // List findings across all sources. + parent: sourceName, + filter: `category="MEDIUM_RISK_ONE"`, + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.finding.name} ${result.finding.resourceName}` + ) + ); + } + listFilteredFindings(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFindingsAtTime.js b/security-center/snippets/v1/listFindingsAtTime.js new file mode 100644 index 0000000000..438d2def3d --- /dev/null +++ b/security-center/snippets/v1/listFindingsAtTime.js @@ -0,0 +1,55 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** Demonstrates listing findings at a point in time. */ +function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the fully qualified source name to search for findings + // under. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + + const fiveDaysAgo = new Date(); + fiveDaysAgo.setDate(fiveDaysAgo.getDate() - 5); + + async function listFindingsAtTime() { + const [response] = await client.listFindings({ + // List findings across all sources. + parent: sourceName, + readTime: { + seconds: Math.floor(fiveDaysAgo.getTime() / 1000), + nanos: (fiveDaysAgo.getTime() % 1000) * 1e6, + }, + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.finding.name} ${result.finding.resourceName}` + ) + ); + } + listFindingsAtTime(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFindingsWithSecurityMarks.js b/security-center/snippets/v1/listFindingsWithSecurityMarks.js new file mode 100644 index 0000000000..81ef50f486 --- /dev/null +++ b/security-center/snippets/v1/listFindingsWithSecurityMarks.js @@ -0,0 +1,49 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** Demonstrates listing findings by filtering on security marks. */ +function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the full resource path of the source to search for + // findings. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + + async function listFindingsWithSecurityMarks() { + const [response] = await client.listFindings({ + // List findings across all sources. + parent: sourceName, + filter: `NOT security_marks.marks.key_a="value_a"`, + }); + let count = 0; + Array.from(response).forEach(result => + console.log( + `${++count} ${result.finding.name} ${result.finding.resourceName}` + ) + ); + } + listFindingsWithSecurityMarks(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/setFindingState.js b/security-center/snippets/v1/setFindingState.js new file mode 100644 index 0000000000..a4e1b1fa60 --- /dev/null +++ b/security-center/snippets/v1/setFindingState.js @@ -0,0 +1,53 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demonstrates how to update a security finding's state in + * CSCC. + */ +function main(findingName = 'FULL_FINDING_PATH') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + // findingName is the full resource name of the source the finding should + // be associated with. + /* + * TODO(developer): Uncomment the following lines + */ + // const findingName = + // "organizations/111122222444/sources/1234/findings/findingid"; + async function setFindingState() { + const eventTime = new Date(); + const [updatedFinding] = await client.setFindingState({ + name: findingName, + state: 'INACTIVE', + // use now as the time when the new state takes effect. + startTime: { + seconds: Math.floor(eventTime.getTime() / 1000), + nanos: (eventTime.getTime() % 1000) * 1e6, + }, + }); + console.log('Updated Finding: %j', updatedFinding); + } + setFindingState(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/setSourceIam.js b/security-center/snippets/v1/setSourceIam.js new file mode 100644 index 0000000000..d6c131071e --- /dev/null +++ b/security-center/snippets/v1/setSourceIam.js @@ -0,0 +1,64 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/* + * setSourceIamPolicy grants user roles/securitycenter.findingsEditor permision + * for a source. */ +function main( + sourceName = 'FULL_PATH_TO_SOURCE', + user = 'someuser@domain.com' +) { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + async function setSourceIamPolicy() { + // sourceName is the full resource name of the source to be + // updated. + // user is an email address that IAM can grant permissions to. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + // const user = "someuser@domain.com"; + const [existingPolicy] = await client.getIamPolicy({ + resource: sourceName, + }); + + const [updatedPolicy] = await client.setIamPolicy({ + resource: sourceName, + policy: { + // Enables partial update of existing policy + etag: existingPolicy.etag, + bindings: [ + { + role: 'roles/securitycenter.findingsEditor', + // New IAM Binding for the user. + members: [`user:${user}`], + }, + ], + }, + }); + console.log('Updated policy: %j', updatedPolicy); + } + setSourceIamPolicy(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/testIam.js b/security-center/snippets/v1/testIam.js new file mode 100644 index 0000000000..3c84f8a0c5 --- /dev/null +++ b/security-center/snippets/v1/testIam.js @@ -0,0 +1,59 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demonstrates how to determine if your service user has appropriate + * access to create and update findings. + */ +function main(sourceName = 'FULL_SOURCE_PATH') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + // sourceName is the full resource name of the source to test for permissions. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + async function testIam() { + { + const [policy] = await client.testIamPermissions({ + resource: sourceName, + permissions: ['securitycenter.findings.update'], + }); + console.log( + `Permissions to create/update findings? ${policy.permissions.length > + 0}` + ); + } + { + const [policy] = await client.testIamPermissions({ + resource: sourceName, + permissions: ['securitycenter.findings.setState'], + }); + console.log( + `Permissions to update state? ${policy.permissions.length > 0}` + ); + } + } + testIam(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/updateFindingSourceProperties.js b/security-center/snippets/v1/updateFindingSourceProperties.js new file mode 100644 index 0000000000..f4191e4da3 --- /dev/null +++ b/security-center/snippets/v1/updateFindingSourceProperties.js @@ -0,0 +1,59 @@ +/* + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * Demonstrates how to update a security finding in CSCC. + */ +function main(findingName = 'FULL_FINDING_PATH') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + + // findingName is the full resource name of the finding to update. + /* + * TODO(developer): Uncomment the following lines + */ + // const findingName = + // "organizations/111122222444/sources/1234/findings/findingid"; + + // Use now as the eventTime for the security finding. + const eventTime = new Date(); + console.log(findingName); + async function updateFinding() { + const [newFinding] = await client.updateFinding({ + updateMask: {paths: ['event_time', 'source_properties.s_value']}, + finding: { + name: findingName, + // The time associated with discovering the issue. + eventTime: { + seconds: Math.floor(eventTime.getTime() / 1000), + nanos: (eventTime.getTime() % 1000) * 1e6, + }, + sourceProperties: { + s_value: {stringValue: 'new_string_example'}, + }, + }, + }); + console.log('Updated Finding: %j', newFinding); + } + updateFinding(); + // [END demo] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/updateSource.js b/security-center/snippets/v1/updateSource.js new file mode 100644 index 0000000000..32aeb0d73e --- /dev/null +++ b/security-center/snippets/v1/updateSource.js @@ -0,0 +1,50 @@ +/** + * Copyright 2019, Google, LLC. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +/** + * updateSource demonstrates how to update fields on a security findings + * source. + */ +function main(sourceName = 'FULL_PATH_TO_SOURCE') { + // [START demo] + // Imports the Google Cloud client library. + const {SecurityCenterClient} = require('@google-cloud/security-center'); + + // Creates a new client. + const client = new SecurityCenterClient(); + // sourceName is the full resource path to the update target. + /* + * TODO(developer): Uncomment the following lines + */ + // const sourceName = "organizations/111122222444/sources/1234"; + async function updateSource() { + const [source] = await client.updateSource({ + source: { + name: sourceName, + displayName: 'New Display Name', + }, + // Only update the display name field (if not set all mutable + // fields of the source will be updated. + updateMask: {paths: ['display_name']}, + }); + console.log('Updated source: %j', source); + } + + updateSource(); + // [END demo] +} + +main(...process.argv.slice(2)); From 4cfe8860329131809e4d1bbb670b426c3aa77e16 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 23 Jul 2019 09:11:11 -0700 Subject: [PATCH 14/82] chore: release 2.0.0 (#123) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index fb179903e4..2604a22997 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -9,7 +9,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^1.0.0" + "@google-cloud/security-center": "^2.0.0" }, "devDependencies": { "chai": "^4.2.0", From b73ac8abc5bd6702f42b0a05827fa5aca7b3ceba Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 5 Aug 2019 10:04:48 -0700 Subject: [PATCH 15/82] chore: release 2.0.1 (#136) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 2604a22997..6c90548cfd 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -9,7 +9,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.0.0" + "@google-cloud/security-center": "^2.0.1" }, "devDependencies": { "chai": "^4.2.0", From 59173524bf3893dbcfe32ebff97e5083161be625 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 25 Aug 2019 19:17:29 -0700 Subject: [PATCH 16/82] refactor: drop dependency on execa (#131) --- security-center/snippets/package.json | 1 - .../snippets/system-test/.eslintrc.yml | 1 - .../system-test/v1/assetSecurityMarks.test.js | 46 ++++---- .../snippets/system-test/v1/findings.test.js | 100 ++++++++++-------- .../system-test/v1/listAllAssets.test.js | 37 +++---- .../v1/listAssetsAndChanges.test.js | 41 ++++--- .../system-test/v1/listAssetsAtTime.test.js | 40 +++---- .../system-test/v1/listFilteredAssets.test.js | 41 ++++--- .../system-test/v1/orgSettings.test.js | 19 ++-- 9 files changed, 162 insertions(+), 164 deletions(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 6c90548cfd..947d8001f5 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "execa": "^1.0.0", "mocha": "^6.0.2" } } diff --git a/security-center/snippets/system-test/.eslintrc.yml b/security-center/snippets/system-test/.eslintrc.yml index 0ab526f52b..73f7bbc946 100644 --- a/security-center/snippets/system-test/.eslintrc.yml +++ b/security-center/snippets/system-test/.eslintrc.yml @@ -3,4 +3,3 @@ env: mocha: true rules: node/no-unpublished-require: off - no-empty: off diff --git a/security-center/snippets/system-test/v1/assetSecurityMarks.test.js b/security-center/snippets/system-test/v1/assetSecurityMarks.test.js index e0e2bd49f4..cd5d070815 100644 --- a/security-center/snippets/system-test/v1/assetSecurityMarks.test.js +++ b/security-center/snippets/system-test/v1/assetSecurityMarks.test.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2019, Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,19 +11,19 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; +const {SecurityCenterClient} = require('@google-cloud/security-center'); const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organizationId = process.env['GCLOUD_ORGANIZATION']; describe('client with security marks for assets', async () => { let data; before(async () => { - const {SecurityCenterClient} = require('@google-cloud/security-center'); - // Creates a new client. const client = new SecurityCenterClient(); @@ -39,9 +39,9 @@ describe('client with security marks for assets', async () => { }; console.log('data %j', data); }); - it('client can add security marks to asset.', async () => { - const output = await exec(`node v1/addSecurityMarks.js ${data.assetName}`); - assert.match(output, new RegExp(data.assetName)); + it('client can add security marks to asset.', () => { + const output = exec(`node v1/addSecurityMarks.js ${data.assetName}`); + assert.include(output, data.assetName); assert.match(output, /key_a/); assert.match(output, /value_a/); assert.match(output, /key_b/); @@ -49,43 +49,37 @@ describe('client with security marks for assets', async () => { assert.notMatch(output, /undefined/); }); - it('client can add and delete security marks', async () => { + it('client can add and delete security marks', () => { // Ensure marks are set. - await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + exec(`node v1/addSecurityMarks.js ${data.assetName}`); - const output = await exec( - `node v1/addDeleteSecurityMarks.js ${data.assetName}` - ); + const output = exec(`node v1/addDeleteSecurityMarks.js ${data.assetName}`); assert.match(output, /key_a/); assert.match(output, /new_value_a/); assert.notMatch(output, /key_b/); assert.notMatch(output, /undefined/); }); - it('client can delete security marks', async () => { + it('client can delete security marks', () => { // Ensure marks are set. - await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + exec(`node v1/addSecurityMarks.js ${data.assetName}`); - const output = await exec( - `node v1/deleteSecurityMarks.js ${data.assetName}` - ); + const output = exec(`node v1/deleteSecurityMarks.js ${data.assetName}`); assert.notMatch(output, /key_a/); assert.notMatch(output, /value_a/); assert.notMatch(output, /key_b/); assert.notMatch(output, /value_b/); - assert.match(output, new RegExp(data.assetName)); - assert.match(output, new RegExp(data.assetName)); + assert.include(output, data.assetName); + assert.include(output, data.assetName); assert.notMatch(output, /undefined/); }); - it('client can list assets with security marks', async () => { + it('client can list assets with security marks', () => { // Ensure marks are set. - await exec(`node v1/addSecurityMarks.js ${data.assetName}`); + exec(`node v1/addSecurityMarks.js ${data.assetName}`); - const output = await exec( - `node v1/listAssetsWithSecurityMarks.js ${data.orgId}` - ); - assert.match(output, new RegExp(data.assetName)); + const output = exec(`node v1/listAssetsWithSecurityMarks.js ${data.orgId}`); + assert.include(output, data.assetName); assert.notMatch(output, /undefined/); }); }); diff --git a/security-center/snippets/system-test/v1/findings.test.js b/security-center/snippets/system-test/v1/findings.test.js index e5672c0b7d..5f7f22fbf6 100644 --- a/security-center/snippets/system-test/v1/findings.test.js +++ b/security-center/snippets/system-test/v1/findings.test.js @@ -11,22 +11,21 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; +const {SecurityCenterClient} = require('@google-cloud/security-center'); const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organizationId = process.env['GCLOUD_ORGANIZATION']; describe('Client with SourcesAndFindings', async () => { let data; before(async () => { - const {SecurityCenterClient} = require('@google-cloud/security-center'); - // Creates a new client. const client = new SecurityCenterClient(); - const [source] = await client .createSource({ source: { @@ -69,40 +68,46 @@ describe('Client with SourcesAndFindings', async () => { }; console.log('my data %j', data); }); - it('client can create source', async () => { - const output = await exec(`node v1/createSource.js ${data.orgId}`); + + it('client can create source', () => { + const output = exec(`node v1/createSource.js ${data.orgId}`); assert.match(output, new RegExp(data.orgId)); assert.match(output, /New Source/); assert.notMatch(output, /undefined/); }); - it('client can get source', async () => { - const output = await exec(`node v1/getSource.js ${data.sourceName}`); + + it('client can get source', () => { + const output = exec(`node v1/getSource.js ${data.sourceName}`); assert.match(output, new RegExp(data.sourceName)); assert.match(output, /Source/); assert.match(output, /"description":"A new custom source that does X"/); assert.notMatch(output, /undefined/); }); - it('client can list all sources', async () => { - const output = await exec(`node v1/listAllSources.js ${data.orgId}`); + + it('client can list all sources', () => { + const output = exec(`node v1/listAllSources.js ${data.orgId}`); assert.match(output, new RegExp(data.sourceName)); assert.match(output, /Sources/); assert.notMatch(output, /undefined/); }); - it('client can update a source', async () => { - const output = await exec(`node v1/updateSource.js ${data.sourceName}`); + + it('client can update a source', () => { + const output = exec(`node v1/updateSource.js ${data.sourceName}`); assert.match(output, new RegExp(data.sourceName)); assert.match(output, /New Display Name/); assert.match(output, /source that does X/); assert.notMatch(output, /undefined/); }); - it('client can create a finding', async () => { - const output = await exec(`node v1/createFinding.js ${data.sourceName}`); + + it('client can create a finding', () => { + const output = exec(`node v1/createFinding.js ${data.sourceName}`); assert.match(output, new RegExp(data.sourceName)); assert.match(output, /New finding created/); assert.notMatch(output, /undefined/); }); - it('client can create a finding with source properties', async () => { - const output = await exec( + + it('client can create a finding with source properties', () => { + const output = exec( `node v1/createFindingSourceProperties.js ${data.sourceName}` ); assert.match(output, new RegExp(data.sourceName)); @@ -110,8 +115,9 @@ describe('Client with SourcesAndFindings', async () => { assert.match(output, /n_value/); assert.notMatch(output, /undefined/); }); - it('client can update a findings source properties', async () => { - const output = await exec( + + it('client can update a findings source properties', () => { + const output = exec( `node v1/updateFindingSourceProperties.js ${data.findingName}` ); assert.match(output, new RegExp(data.findingName)); @@ -119,14 +125,16 @@ describe('Client with SourcesAndFindings', async () => { assert.match(output, /new_string_example/); assert.notMatch(output, /undefined/); }); - it('client can set finding state', async () => { - const output = await exec(`node v1/setFindingState.js ${data.findingName}`); + + it('client can set finding state', () => { + const output = exec(`node v1/setFindingState.js ${data.findingName}`); assert.match(output, new RegExp(data.findingName)); assert.match(output, /INACTIVE/); assert.notMatch(output, /undefined/); }); - it('client can test IAM privileges', async () => { - const output = await exec(`node v1/testIam.js ${data.sourceName}`); + + it('client can test IAM privileges', () => { + const output = exec(`node v1/testIam.js ${data.sourceName}`); assert.equal( (output.match(/true/g) || []).length, 2, @@ -134,30 +142,30 @@ describe('Client with SourcesAndFindings', async () => { ); assert.notMatch(output, /undefined/); }); - it('client can list all findings', async () => { - const output = await exec(`node v1/listAllFindings.js ${data.orgId}`); + + it('client can list all findings', () => { + const output = exec(`node v1/listAllFindings.js ${data.orgId}`); assert.match(output, new RegExp(data.findingName)); assert.match(output, new RegExp(data.untouchedFindingName)); assert.notMatch(output, /undefined/); }); - it('client can list only some findings', async () => { - const output = await exec( - `node v1/listFilteredFindings.js ${data.sourceName}` - ); + + it('client can list only some findings', () => { + const output = exec(`node v1/listFilteredFindings.js ${data.sourceName}`); assert.match(output, new RegExp(data.findingName)); assert.notMatch(output, new RegExp(data.untouchedFindingName)); assert.notMatch(output, /undefined/); }); - it('client can list findings at a time.', async () => { - const output = await exec( - `node v1/listFindingsAtTime.js ${data.sourceName}` - ); + + it('client can list findings at a time.', () => { + const output = exec(`node v1/listFindingsAtTime.js ${data.sourceName}`); // Nothing was created for the source more then a few minutes ago, so // days ago should return nothing. assert.equal(output, ''); }); - it('client can add security marks to finding', async () => { - const output = await exec( + + it('client can add security marks to finding', () => { + const output = exec( `node v1/addFindingSecurityMarks.js ${data.findingName}` ); assert.match(output, new RegExp(data.findingName)); @@ -167,29 +175,29 @@ describe('Client with SourcesAndFindings', async () => { assert.match(output, /value_b/); assert.notMatch(output, /undefined/); }); - it('client can list findings withe security marks', async () => { - // Ensure marks are set. - await exec(`node v1/addFindingSecurityMarks.js ${data.findingName}`); - const output = await exec( + it('client can list findings withe security marks', () => { + // Ensure marks are set. + exec(`node v1/addFindingSecurityMarks.js ${data.findingName}`); + const output = exec( `node v1/listFindingsWithSecurityMarks.js ${data.sourceName}` ); assert.notMatch(output, new RegExp(data.findingName)); assert.match(output, new RegExp(data.untouchedFindingName)); assert.notMatch(output, /undefined/); }); - it('client can get a sources policy', async () => { - const output = await exec(`node v1/getSourceIam.js ${data.sourceName}`); + + it('client can get a sources policy', () => { + const output = exec(`node v1/getSourceIam.js ${data.sourceName}`); assert.match(output, /Current policy/); assert.notMatch(output, /undefined/); }); - it('client set a sources policy', async () => { + + it('client set a sources policy', () => { const user = 'csccclienttest@gmail.com'; - const output = await exec( - `node v1/setSourceIam.js ${data.sourceName} ${user}` - ); + const output = exec(`node v1/setSourceIam.js ${data.sourceName} ${user}`); assert.match(output, /Updated policy/); - assert.match(output, new RegExp(user)); + assert.include(output, user); assert.notMatch(output, /undefined/); }); }); diff --git a/security-center/snippets/system-test/v1/listAllAssets.test.js b/security-center/snippets/system-test/v1/listAllAssets.test.js index 290189e3c3..714c771c60 100644 --- a/security-center/snippets/system-test/v1/listAllAssets.test.js +++ b/security-center/snippets/system-test/v1/listAllAssets.test.js @@ -1,27 +1,28 @@ -/* - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organization_id = process.env['GCLOUD_ORGANIZATION']; describe('listAllAssets', () => { - it('should print all assets in org', async () => { - const output = await exec(`node v1/listAllAssets.js ${organization_id}`); + it('should print all assets in org', () => { + const output = exec(`node v1/listAllAssets.js ${organization_id}`); assert.isAtLeast(output.match(/\n/g).length + 1, 62); assert.notMatch(output, /undefined/); }); diff --git a/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js b/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js index aa4ab020cf..3232e22272 100644 --- a/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js +++ b/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js @@ -1,31 +1,30 @@ -/* - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organization_id = process.env['GCLOUD_ORGANIZATION']; describe('listAssetsandChanges', () => { - it('should print projects with state changes', async () => { - const output = await exec( - `node v1/listAssetsAndChanges.js ${organization_id}` - ); + it('should print projects with state changes', () => { + const output = exec(`node v1/listAssetsAndChanges.js ${organization_id}`); assert.match(output, /(ADDED|ACTIVE)/); - assert.equal(3, output.match(/\n/g).length + 1, '== number of projects'); + assert.equal(4, output.match(/\n/g).length + 1, '== number of projects'); assert.notMatch(output, /undefined/); }); }); diff --git a/security-center/snippets/system-test/v1/listAssetsAtTime.test.js b/security-center/snippets/system-test/v1/listAssetsAtTime.test.js index 0f8797d2bc..3107b6184b 100644 --- a/security-center/snippets/system-test/v1/listAssetsAtTime.test.js +++ b/security-center/snippets/system-test/v1/listAssetsAtTime.test.js @@ -1,27 +1,29 @@ -/* - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organization_id = process.env['GCLOUD_ORGANIZATION']; describe('listAssetsAttime', () => { - it('should print projects', async () => { - const output = await exec(`node v1/listAssetsAtTime.js ${organization_id}`); - assert.equal(3, output.match(/\n/g).length + 1, '== number of projects'); + it('should print projects', () => { + const output = exec(`node v1/listAssetsAtTime.js ${organization_id}`); + assert.equal(4, output.match(/\n/g).length + 1, '== number of projects'); assert.notMatch(output, /undefined/); }); }); diff --git a/security-center/snippets/system-test/v1/listFilteredAssets.test.js b/security-center/snippets/system-test/v1/listFilteredAssets.test.js index 6b001b3b32..497affbe68 100644 --- a/security-center/snippets/system-test/v1/listFilteredAssets.test.js +++ b/security-center/snippets/system-test/v1/listFilteredAssets.test.js @@ -1,30 +1,29 @@ -/* - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organization_id = process.env['GCLOUD_ORGANIZATION']; describe('listAllAssets', () => { - it('should print all assets in org', async () => { - const output = await exec( - `node v1/listFilteredAssets.js ${organization_id}` - ); - assert.isAtLeast(3, output.match(/\n/g).length + 1); + it('should print all assets in org', () => { + const output = exec(`node v1/listFilteredAssets.js ${organization_id}`); + assert.isAtLeast(4, output.match(/\n/g).length + 1); assert.notMatch(output, /undefined/); }); }); diff --git a/security-center/snippets/system-test/v1/orgSettings.test.js b/security-center/snippets/system-test/v1/orgSettings.test.js index 61fed645f7..0da3001a25 100644 --- a/security-center/snippets/system-test/v1/orgSettings.test.js +++ b/security-center/snippets/system-test/v1/orgSettings.test.js @@ -11,28 +11,25 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; const {assert} = require('chai'); -const execa = require('execa'); -const exec = async cmd => (await execa.shell(cmd)).stdout; +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); const organizationId = process.env['GCLOUD_ORGANIZATION']; -describe('client with organization settings', async () => { - it('client can enable asset discovery', async () => { - const output = await exec( - `node v1/enableAssetDiscovery.js ${organizationId}` - ); +describe('client with organization settings', () => { + it('client can enable asset discovery', () => { + const output = exec(`node v1/enableAssetDiscovery.js ${organizationId}`); assert.match(output, new RegExp(organizationId)); assert.match(output, /true/); assert.notMatch(output, /undefined/); }); - it('client can get organization settings', async () => { - const output = await exec( - `node v1/getOrganizationSettings.js ${organizationId}` - ); + it('client can get organization settings', () => { + const output = exec(`node v1/getOrganizationSettings.js ${organizationId}`); assert.match(output, new RegExp(organizationId)); }); }); From b9e5237b95032b577906df74c3e25a325c2bc96c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 6 Sep 2019 08:33:49 -0700 Subject: [PATCH 17/82] chore: release 2.1.0 (#143) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 947d8001f5..39cd9495ce 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -9,7 +9,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.0.1" + "@google-cloud/security-center": "^2.1.0" }, "devDependencies": { "chai": "^4.2.0", From 7b0c24242d70301cd70d7597094aeabfa1a80229 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2019 13:31:38 -0700 Subject: [PATCH 18/82] chore: release 2.2.1 (#159) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 39cd9495ce..bd4a2a187b 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -9,7 +9,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.1.0" + "@google-cloud/security-center": "^2.2.1" }, "devDependencies": { "chai": "^4.2.0", From d23c331b05b7ff723a5a1bb93d8393b7a6cd95f7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 12:17:54 -0800 Subject: [PATCH 19/82] chore: release 2.2.2 (#168) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index bd4a2a187b..52f3add663 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -9,7 +9,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.2.1" + "@google-cloud/security-center": "^2.2.2" }, "devDependencies": { "chai": "^4.2.0", From 0ed1321d9a4a49518228f93f9cb560eda61bd6e8 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 25 Nov 2019 08:57:42 -0800 Subject: [PATCH 20/82] chore: update license headers (#176) --- .../snippets/v1/addDeleteSecurityMarks.js | 27 +++++++++--------- .../snippets/v1/addFindingSecurityMarks.js | 27 +++++++++--------- .../snippets/v1/addSecurityMarks.js | 28 +++++++++---------- .../snippets/v1/deleteSecurityMarks.js | 28 +++++++++---------- .../snippets/v1/enableAssetDiscovery.js | 28 +++++++++---------- .../snippets/v1/getOrganizationSettings.js | 28 +++++++++---------- security-center/snippets/v1/getSource.js | 28 +++++++++---------- security-center/snippets/v1/getSourceIam.js | 28 +++++++++---------- security-center/snippets/v1/listAllAssets.js | 28 +++++++++---------- security-center/snippets/v1/listAllSources.js | 28 +++++++++---------- .../snippets/v1/listAssetsAndChanges.js | 28 +++++++++---------- security-center/snippets/v1/setSourceIam.js | 28 +++++++++---------- security-center/snippets/v1/updateSource.js | 28 +++++++++---------- 13 files changed, 180 insertions(+), 182 deletions(-) diff --git a/security-center/snippets/v1/addDeleteSecurityMarks.js b/security-center/snippets/v1/addDeleteSecurityMarks.js index 0524afb77b..74cf3115a2 100644 --- a/security-center/snippets/v1/addDeleteSecurityMarks.js +++ b/security-center/snippets/v1/addDeleteSecurityMarks.js @@ -1,17 +1,16 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. 'use strict'; /** diff --git a/security-center/snippets/v1/addFindingSecurityMarks.js b/security-center/snippets/v1/addFindingSecurityMarks.js index 1eaf06aa37..6117078f21 100644 --- a/security-center/snippets/v1/addFindingSecurityMarks.js +++ b/security-center/snippets/v1/addFindingSecurityMarks.js @@ -1,17 +1,16 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. 'use strict'; /** diff --git a/security-center/snippets/v1/addSecurityMarks.js b/security-center/snippets/v1/addSecurityMarks.js index 64363349e8..24d607c05d 100644 --- a/security-center/snippets/v1/addSecurityMarks.js +++ b/security-center/snippets/v1/addSecurityMarks.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** diff --git a/security-center/snippets/v1/deleteSecurityMarks.js b/security-center/snippets/v1/deleteSecurityMarks.js index d0f15fdb82..de0811c3cf 100644 --- a/security-center/snippets/v1/deleteSecurityMarks.js +++ b/security-center/snippets/v1/deleteSecurityMarks.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** diff --git a/security-center/snippets/v1/enableAssetDiscovery.js b/security-center/snippets/v1/enableAssetDiscovery.js index 9bfa877e41..617c432761 100644 --- a/security-center/snippets/v1/enableAssetDiscovery.js +++ b/security-center/snippets/v1/enableAssetDiscovery.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** diff --git a/security-center/snippets/v1/getOrganizationSettings.js b/security-center/snippets/v1/getOrganizationSettings.js index 646e907cc7..9ec421afb7 100644 --- a/security-center/snippets/v1/getOrganizationSettings.js +++ b/security-center/snippets/v1/getOrganizationSettings.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /* diff --git a/security-center/snippets/v1/getSource.js b/security-center/snippets/v1/getSource.js index 557c44911b..28be020833 100644 --- a/security-center/snippets/v1/getSource.js +++ b/security-center/snippets/v1/getSource.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** diff --git a/security-center/snippets/v1/getSourceIam.js b/security-center/snippets/v1/getSourceIam.js index 035c2e5143..0dd157d9c2 100644 --- a/security-center/snippets/v1/getSourceIam.js +++ b/security-center/snippets/v1/getSourceIam.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /* diff --git a/security-center/snippets/v1/listAllAssets.js b/security-center/snippets/v1/listAllAssets.js index ecc65b8ec0..99badddf48 100644 --- a/security-center/snippets/v1/listAllAssets.js +++ b/security-center/snippets/v1/listAllAssets.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** Prints all assets in an organization. */ diff --git a/security-center/snippets/v1/listAllSources.js b/security-center/snippets/v1/listAllSources.js index 2e06587353..4b5b68d1b0 100644 --- a/security-center/snippets/v1/listAllSources.js +++ b/security-center/snippets/v1/listAllSources.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** Prints all sources in an organization. */ diff --git a/security-center/snippets/v1/listAssetsAndChanges.js b/security-center/snippets/v1/listAssetsAndChanges.js index a3f7f3eb6f..7712b8bbf7 100644 --- a/security-center/snippets/v1/listAssetsAndChanges.js +++ b/security-center/snippets/v1/listAssetsAndChanges.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** diff --git a/security-center/snippets/v1/setSourceIam.js b/security-center/snippets/v1/setSourceIam.js index d6c131071e..a501ae95af 100644 --- a/security-center/snippets/v1/setSourceIam.js +++ b/security-center/snippets/v1/setSourceIam.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /* diff --git a/security-center/snippets/v1/updateSource.js b/security-center/snippets/v1/updateSource.js index 32aeb0d73e..245910b612 100644 --- a/security-center/snippets/v1/updateSource.js +++ b/security-center/snippets/v1/updateSource.js @@ -1,17 +1,17 @@ -/** - * Copyright 2019, Google, LLC. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + 'use strict'; /** From 020bd4cdb125b12201d53be6e16b881dc3a58386 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2019 15:02:34 -0800 Subject: [PATCH 21/82] chore: release 2.3.0 (#181) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 52f3add663..91894d1f71 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -9,7 +9,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.2.2" + "@google-cloud/security-center": "^2.3.0" }, "devDependencies": { "chai": "^4.2.0", From d248754bed0b4aea7c59866385a0b0c9cf4482a3 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 30 Dec 2019 12:02:12 -0800 Subject: [PATCH 22/82] refactor: use explicit mocha imports (#187) --- .eslintrc.yml | 2 -- security-center/snippets/package.json | 4 ++++ security-center/snippets/system-test/.eslintrc.yml | 5 ----- .../snippets/system-test/v1/assetSecurityMarks.test.js | 3 ++- security-center/snippets/system-test/v1/findings.test.js | 1 + .../snippets/system-test/v1/listAllAssets.test.js | 1 + .../snippets/system-test/v1/listAssetsAndChanges.test.js | 1 + .../snippets/system-test/v1/listAssetsAtTime.test.js | 1 + .../snippets/system-test/v1/listFilteredAssets.test.js | 1 + security-center/snippets/system-test/v1/orgSettings.test.js | 1 + 10 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 security-center/snippets/system-test/.eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml index 59a8aeb576..282535f55f 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,5 +1,3 @@ --- rules: no-console: off - node/no-missing-require: off - no-warning-comments: off \ No newline at end of file diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 91894d1f71..5758f4cb3d 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -1,6 +1,10 @@ { "name": "nodejs-security-center-samples", "private": true, + "files": [ + "**/*.js", + "!system-test/" + ], "engines": { "node": ">=8" }, diff --git a/security-center/snippets/system-test/.eslintrc.yml b/security-center/snippets/system-test/.eslintrc.yml deleted file mode 100644 index 73f7bbc946..0000000000 --- a/security-center/snippets/system-test/.eslintrc.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -env: - mocha: true -rules: - node/no-unpublished-require: off diff --git a/security-center/snippets/system-test/v1/assetSecurityMarks.test.js b/security-center/snippets/system-test/v1/assetSecurityMarks.test.js index cd5d070815..77c417535f 100644 --- a/security-center/snippets/system-test/v1/assetSecurityMarks.test.js +++ b/security-center/snippets/system-test/v1/assetSecurityMarks.test.js @@ -1,4 +1,4 @@ -// Copyright 2019, Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ const {SecurityCenterClient} = require('@google-cloud/security-center'); const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); diff --git a/security-center/snippets/system-test/v1/findings.test.js b/security-center/snippets/system-test/v1/findings.test.js index 5f7f22fbf6..d1f5173ad2 100644 --- a/security-center/snippets/system-test/v1/findings.test.js +++ b/security-center/snippets/system-test/v1/findings.test.js @@ -16,6 +16,7 @@ const {SecurityCenterClient} = require('@google-cloud/security-center'); const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); diff --git a/security-center/snippets/system-test/v1/listAllAssets.test.js b/security-center/snippets/system-test/v1/listAllAssets.test.js index 714c771c60..516c8c8a84 100644 --- a/security-center/snippets/system-test/v1/listAllAssets.test.js +++ b/security-center/snippets/system-test/v1/listAllAssets.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const {describe, it} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); diff --git a/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js b/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js index 3232e22272..c8975d9d15 100644 --- a/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js +++ b/security-center/snippets/system-test/v1/listAssetsAndChanges.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const {describe, it} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); diff --git a/security-center/snippets/system-test/v1/listAssetsAtTime.test.js b/security-center/snippets/system-test/v1/listAssetsAtTime.test.js index 3107b6184b..cad70cb513 100644 --- a/security-center/snippets/system-test/v1/listAssetsAtTime.test.js +++ b/security-center/snippets/system-test/v1/listAssetsAtTime.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const {describe, it} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); diff --git a/security-center/snippets/system-test/v1/listFilteredAssets.test.js b/security-center/snippets/system-test/v1/listFilteredAssets.test.js index 497affbe68..ef544da721 100644 --- a/security-center/snippets/system-test/v1/listFilteredAssets.test.js +++ b/security-center/snippets/system-test/v1/listFilteredAssets.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const {describe, it} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); diff --git a/security-center/snippets/system-test/v1/orgSettings.test.js b/security-center/snippets/system-test/v1/orgSettings.test.js index 0da3001a25..a3fc8498fc 100644 --- a/security-center/snippets/system-test/v1/orgSettings.test.js +++ b/security-center/snippets/system-test/v1/orgSettings.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const {describe, it} = require('mocha'); const {execSync} = require('child_process'); const exec = cmd => execSync(cmd, {encoding: 'utf8'}); From bb2959b84d024a34f02b3c782cd1ecc6f0e67176 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2020 10:46:57 -0800 Subject: [PATCH 23/82] chore: release 2.3.1 * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 5758f4cb3d..e73c02cea0 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.3.0" + "@google-cloud/security-center": "^2.3.1" }, "devDependencies": { "chai": "^4.2.0", From 1b7b458de3b6f7dc9532b68019b842695bee6e1e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 14 Jan 2020 03:22:31 +0100 Subject: [PATCH 24/82] chore(deps): update dependency mocha to v7 (#190) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index e73c02cea0..773b9bd363 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -17,6 +17,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^6.0.2" + "mocha": "^7.0.0" } } From 355801857a569296ac0e251d7972bffcd41cde75 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 21:04:40 -0800 Subject: [PATCH 25/82] chore: release 2.3.2 (#200) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 773b9bd363..7229bf7087 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.3.1" + "@google-cloud/security-center": "^2.3.2" }, "devDependencies": { "chai": "^4.2.0", From 6fd3d61b60e71bf6506cc9b15fda737a9a9ffd24 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2020 11:25:38 -0800 Subject: [PATCH 26/82] chore: release 3.0.0 (#204) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 7229bf7087..1a60ea610a 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^2.3.2" + "@google-cloud/security-center": "^3.0.0" }, "devDependencies": { "chai": "^4.2.0", From c54115f1f75124e7fef6950d046a457f608f9d49 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2020 12:52:44 -0800 Subject: [PATCH 27/82] chore: release 3.0.1 (#208) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 1a60ea610a..4c8b30e318 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/security-center": "^3.0.0" + "@google-cloud/security-center": "^3.0.1" }, "devDependencies": { "chai": "^4.2.0", From 00c98dbd6bddc447a2f2746f2cd5a87d408cdc87 Mon Sep 17 00:00:00 2001 From: tdh911 Date: Thu, 20 Feb 2020 12:43:13 -0800 Subject: [PATCH 28/82] docs: Add v1p1beta1 notifications samples (#214) --- security-center/snippets/package.json | 4 +- .../v1p1beta1/notifications.test.js | 115 ++++++++++++++++++ .../v1p1beta1/createNotificationConfig.js | 54 ++++++++ .../v1p1beta1/deleteNotificationConfig.js | 41 +++++++ .../v1p1beta1/getNotificationConfig.js | 43 +++++++ .../v1p1beta1/listNotificationConfigs.js | 40 ++++++ .../v1p1beta1/receiveNotifications.js | 60 +++++++++ .../v1p1beta1/updateNotificationConfig.js | 55 +++++++++ 8 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 security-center/snippets/system-test/v1p1beta1/notifications.test.js create mode 100644 security-center/snippets/v1p1beta1/createNotificationConfig.js create mode 100644 security-center/snippets/v1p1beta1/deleteNotificationConfig.js create mode 100644 security-center/snippets/v1p1beta1/getNotificationConfig.js create mode 100644 security-center/snippets/v1p1beta1/listNotificationConfigs.js create mode 100644 security-center/snippets/v1p1beta1/receiveNotifications.js create mode 100644 security-center/snippets/v1p1beta1/updateNotificationConfig.js diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 4c8b30e318..a3e79fb625 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,10 +13,12 @@ }, "license": "Apache-2.0", "dependencies": { + "@google-cloud/pubsub": "^1.5.0", "@google-cloud/security-center": "^3.0.1" }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^7.0.0" + "mocha": "^7.0.0", + "uuid": "^3.4.0" } } diff --git a/security-center/snippets/system-test/v1p1beta1/notifications.test.js b/security-center/snippets/system-test/v1p1beta1/notifications.test.js new file mode 100644 index 0000000000..f9afca273e --- /dev/null +++ b/security-center/snippets/system-test/v1p1beta1/notifications.test.js @@ -0,0 +1,115 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const { + SecurityCenterClient, +} = require('@google-cloud/security-center').v1p1beta1; +const uuidv1 = require('uuid/v1'); +const {assert} = require('chai'); +const {describe, it, before, after} = require('mocha'); +const {execSync} = require('child_process'); +const exec = cmd => execSync(cmd, {encoding: 'utf8'}); + +const organizationId = process.env['GCLOUD_ORGANIZATION']; +const orgName = 'organizations/' + organizationId; +const pubsubTopic = 'projects/project-a-id/topics/notifications-sample-topic'; + +describe('Client with Notifications', async () => { + const createConfig = 'notif-config-test-node-create' + uuidv1(); + const deleteConfig = 'notif-config-test-node-delete' + uuidv1(); + const getConfig = 'notif-config-test-node-get' + uuidv1(); + const listConfig = 'notif-config-test-node-list' + uuidv1(); + const updateConfig = 'notif-config-test-node-update' + uuidv1(); + + before(async () => { + const client = new SecurityCenterClient(); + async function createNotificationConfig(configId) { + /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "^_" }]*/ + const [_response] = await client.createNotificationConfig({ + parent: orgName, + configId: configId, + notificationConfig: { + description: 'Sample config for node.js', + pubsubTopic: pubsubTopic, + eventType: 'FINDING', + streamingConfig: {filter: 'state = "ACTIVE"'}, + }, + }); + } + + await createNotificationConfig(deleteConfig); + await createNotificationConfig(getConfig); + await createNotificationConfig(listConfig); + await createNotificationConfig(updateConfig); + }); + + after(async () => { + const client = new SecurityCenterClient(); + async function deleteNotificationConfig(configId) { + const name = client.notificationConfigPath(organizationId, configId); + await client.deleteNotificationConfig({name: name}); + } + + await deleteNotificationConfig(createConfig); + await deleteNotificationConfig(getConfig); + await deleteNotificationConfig(listConfig); + await deleteNotificationConfig(updateConfig); + }); + + it('client can create config', () => { + const output = exec( + `node v1p1beta1/createNotificationConfig.js ${organizationId} ${createConfig} ${pubsubTopic}` + ); + assert.include(output, createConfig); + assert.match(output, /Notification config creation succeeded/); + assert.notMatch(output, /undefined/); + }); + + it('client can delete config', () => { + const output = exec( + `node v1p1beta1/deleteNotificationConfig.js ${organizationId} ${deleteConfig}` + ); + assert.include(output, 'Notification config deleted'); + assert.notMatch(output, /undefined/); + }); + + it('client can get config', () => { + const output = exec( + `node v1p1beta1/getNotificationConfig.js ${organizationId} ${getConfig}` + ); + assert.include(output, getConfig); + assert.match(output, /Notification config/); + assert.notMatch(output, /undefined/); + }); + + it('client can list configs', () => { + const output = exec( + `node v1p1beta1/listNotificationConfigs.js ${organizationId}` + ); + assert.include(output, listConfig); + assert.match(output, /Received Notification configs/); + assert.notMatch(output, /undefined/); + }); + + it('client can update configs', () => { + const output = exec( + `node v1p1beta1/updateNotificationConfig.js ${organizationId} ${updateConfig} ${pubsubTopic}` + ); + assert.include(output, updateConfig); + assert.match(output, /notification config update succeeded/); + assert.notMatch(output, /undefined/); + }); +}); diff --git a/security-center/snippets/v1p1beta1/createNotificationConfig.js b/security-center/snippets/v1p1beta1/createNotificationConfig.js new file mode 100644 index 0000000000..81e9085a2f --- /dev/null +++ b/security-center/snippets/v1p1beta1/createNotificationConfig.js @@ -0,0 +1,54 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +function main( + organizationId = 'your-org-id', + configId = 'your-config-name', + pubsubTopic = 'projects/{your-project}/topics/{your-topic}' +) { + // [START scc_create_notification_config] + // npm install @google-cloud/security-center/ + const { + SecurityCenterClient, + } = require('@google-cloud/security-center').v1p1beta1; + + const client = new SecurityCenterClient(); + + // organizationId = "your-org-id"; + // configId = "your-config-name"; + // pubsubTopic = "projects/{your-project}/topics/{your-topic}"; + // Ensure this Service Account has the "pubsub.topics.setIamPolicy" permission on this topic. + + const orgName = client.organizationPath(organizationId); + + async function createNotificationConfig() { + const [response] = await client.createNotificationConfig({ + parent: orgName, + configId: configId, + notificationConfig: { + description: 'Sample config for node.js', + pubsubTopic: pubsubTopic, + eventType: 'FINDING', + streamingConfig: {filter: 'state = "ACTIVE"'}, + }, + }); + console.log('Notification config creation succeeded: ', response); + } + + createNotificationConfig(); + // [END scc_create_notification_config] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1p1beta1/deleteNotificationConfig.js b/security-center/snippets/v1p1beta1/deleteNotificationConfig.js new file mode 100644 index 0000000000..db1ae04ff6 --- /dev/null +++ b/security-center/snippets/v1p1beta1/deleteNotificationConfig.js @@ -0,0 +1,41 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +function main(organizationId = 'your-org-id', configId = 'your-config-id') { + // [START scc_delete_notification_config] + // npm install @google-cloud/security-center/ + const { + SecurityCenterClient, + } = require('@google-cloud/security-center').v1p1beta1; + + const client = new SecurityCenterClient(); + + // organizationId = "your-org-id"; + // configId = "your-config-id"; + const formattedConfigName = client.notificationConfigPath( + organizationId, + configId + ); + + async function deleteNotificationConfg() { + await client.deleteNotificationConfig({name: formattedConfigName}); + console.log('Notification config deleted: ', formattedConfigName); + } + + deleteNotificationConfg(); + // [END scc_delete_notification_config] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1p1beta1/getNotificationConfig.js b/security-center/snippets/v1p1beta1/getNotificationConfig.js new file mode 100644 index 0000000000..43bcba8ab3 --- /dev/null +++ b/security-center/snippets/v1p1beta1/getNotificationConfig.js @@ -0,0 +1,43 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +function main(organizationId = 'your-org-id', configId = 'your-config-id') { + // [START scc_get_notification_configs] + // npm install @google-cloud/security-center/ + const { + SecurityCenterClient, + } = require('@google-cloud/security-center').v1p1beta1; + + const client = new SecurityCenterClient(); + + // organizationId = "your-org-id"; + // configId = "your-config-id"; + const formattedConfigName = client.notificationConfigPath( + organizationId, + configId + ); + + async function getNotificationConfg() { + const [response] = await client.getNotificationConfig({ + name: formattedConfigName, + }); + console.log('Notification config: ', response); + } + + getNotificationConfg(); + // [END scc_get_notification_configs] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1p1beta1/listNotificationConfigs.js b/security-center/snippets/v1p1beta1/listNotificationConfigs.js new file mode 100644 index 0000000000..de50807e28 --- /dev/null +++ b/security-center/snippets/v1p1beta1/listNotificationConfigs.js @@ -0,0 +1,40 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +function main(organizationId = 'your-org-id') { + // [END scc_list_notification_configs] + // npm install @google-cloud/security-center/ + const { + SecurityCenterClient, + } = require('@google-cloud/security-center').v1p1beta1; + + const client = new SecurityCenterClient(); + + // organizationId = "your-org-id"; + const orgName = client.organizationPath(organizationId); + + async function listNotificationConfigs() { + const [resources] = await client.listNotificationConfigs({parent: orgName}); + console.log('Received Notification configs: '); + for (const resource of resources) { + console.log(resource); + } + } + + listNotificationConfigs(); + // [END scc_list_notification_configs] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1p1beta1/receiveNotifications.js b/security-center/snippets/v1p1beta1/receiveNotifications.js new file mode 100644 index 0000000000..d9318853cf --- /dev/null +++ b/security-center/snippets/v1p1beta1/receiveNotifications.js @@ -0,0 +1,60 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +function main( + projectId = 'your-project-id', + subscriptionId = 'your-subscription-id' +) { + // [START scc_receive_notifications] + const {PubSub} = require('@google-cloud/pubsub'); + const {StringDecoder} = require('string_decoder'); + + // projectId = 'your-project-id' + // subscriptionId = 'your-subscription-id' + + const subscriptionName = + 'projects/' + projectId + '/subscriptions/' + subscriptionId; + const pubSubClient = new PubSub(); + + function listenForMessages() { + const subscription = pubSubClient.subscription(subscriptionName); + + // message.data is a buffer array of json + // 1. Convert buffer to normal string + // 2. Convert json to NotificationMessage object + const messageHandler = message => { + const jsonString = new StringDecoder('utf-8').write(message.data); + const parsedNotificationMessage = JSON.parse(jsonString); + + console.log(parsedNotificationMessage); + console.log(parsedNotificationMessage.finding); + + // ACK when done with message + message.ack(); + }; + + subscription.on('message', messageHandler); + + // Set timeout to 10 seconds + setTimeout(() => { + subscription.removeListener('message', messageHandler); + }, 10000); + } + + listenForMessages(); + // [END scc_receive_notifications] +} + +main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1p1beta1/updateNotificationConfig.js b/security-center/snippets/v1p1beta1/updateNotificationConfig.js new file mode 100644 index 0000000000..9d7cdfeb49 --- /dev/null +++ b/security-center/snippets/v1p1beta1/updateNotificationConfig.js @@ -0,0 +1,55 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +'use strict'; + +function main( + organizationId = 'your-org-id', + configId = 'your-config-name', + pubsubTopic = 'projects/{your-project}/topics/{your-topic}' +) { + // [START scc_update_notification_config] + // npm install @google-cloud/security-center/ + const { + SecurityCenterClient, + } = require('@google-cloud/security-center').v1p1beta1; + + const client = new SecurityCenterClient(); + + // organizationId = "your-org-id"; + // configId = "your-config-id"; + const formattedConfigName = client.notificationConfigPath( + organizationId, + configId + ); + + // pubsubTopic = "projects/{your-project}/topics/{your-topic}"; + // Ensure this Service Account has the "pubsub.topics.setIamPolicy" permission on this topic. + + async function updateNotificationConfig() { + const [response] = await client.updateNotificationConfig({ + updateMask: {paths: ['description', 'pubsub_topic']}, + notificationConfig: { + name: formattedConfigName, + description: 'Updated config description', + pubsubTopic: pubsubTopic, + }, + }); + console.log('notification config update succeeded: ', response); + } + + updateNotificationConfig(); + // [END scc_update_notification_config] +} + +main(...process.argv.slice(2)); From 7403d019c3218f932430b07e14791a5481f0495b Mon Sep 17 00:00:00 2001 From: tdh911 Date: Mon, 2 Mar 2020 13:38:40 -0800 Subject: [PATCH 29/82] docs: Fix typo in sample label (#227) --- security-center/snippets/v1p1beta1/listNotificationConfigs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/v1p1beta1/listNotificationConfigs.js b/security-center/snippets/v1p1beta1/listNotificationConfigs.js index de50807e28..1ea5f94787 100644 --- a/security-center/snippets/v1p1beta1/listNotificationConfigs.js +++ b/security-center/snippets/v1p1beta1/listNotificationConfigs.js @@ -14,7 +14,7 @@ 'use strict'; function main(organizationId = 'your-org-id') { - // [END scc_list_notification_configs] + // [START scc_list_notification_configs] // npm install @google-cloud/security-center/ const { SecurityCenterClient, From bcf0c85bba8420efec9552e1eb45d4f7658f8ee2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2020 12:55:02 -0700 Subject: [PATCH 30/82] chore: release 3.1.0 (#218) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index a3e79fb625..273782ac86 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^1.5.0", - "@google-cloud/security-center": "^3.0.1" + "@google-cloud/security-center": "^3.1.0" }, "devDependencies": { "chai": "^4.2.0", From ea95500a1ddf586ecc5a4931b75fb6939d55e152 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 11 Mar 2020 13:08:22 -0700 Subject: [PATCH 31/82] chore: update to latest version of uuid (#235) --- security-center/snippets/package.json | 2 +- .../snippets/system-test/v1p1beta1/notifications.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 273782ac86..bcdb060c27 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -19,6 +19,6 @@ "devDependencies": { "chai": "^4.2.0", "mocha": "^7.0.0", - "uuid": "^3.4.0" + "uuid": "^7.0.2" } } diff --git a/security-center/snippets/system-test/v1p1beta1/notifications.test.js b/security-center/snippets/system-test/v1p1beta1/notifications.test.js index f9afca273e..ad5b10fe43 100644 --- a/security-center/snippets/system-test/v1p1beta1/notifications.test.js +++ b/security-center/snippets/system-test/v1p1beta1/notifications.test.js @@ -17,7 +17,7 @@ const { SecurityCenterClient, } = require('@google-cloud/security-center').v1p1beta1; -const uuidv1 = require('uuid/v1'); +const uuidv1 = require('uuid').v1; const {assert} = require('chai'); const {describe, it, before, after} = require('mocha'); const {execSync} = require('child_process'); From 4330fae2870b91dfad3d07077af5f022fce075c9 Mon Sep 17 00:00:00 2001 From: tdh911 Date: Thu, 12 Mar 2020 12:26:06 -0700 Subject: [PATCH 32/82] docs: update notification samples to v1 (#236) Notification feature work has been merged into v1, so we need to update the samples to match the updated version. --- .../{v1p1beta1 => v1}/notifications.test.js | 17 ++++++----------- .../createNotificationConfig.js | 5 +---- .../deleteNotificationConfig.js | 4 +--- .../{v1p1beta1 => v1}/getNotificationConfig.js | 4 +--- .../listNotificationConfigs.js | 4 +--- .../{v1p1beta1 => v1}/receiveNotifications.js | 0 .../updateNotificationConfig.js | 4 +--- 7 files changed, 11 insertions(+), 27 deletions(-) rename security-center/snippets/system-test/{v1p1beta1 => v1}/notifications.test.js (86%) rename security-center/snippets/{v1p1beta1 => v1}/createNotificationConfig.js (93%) rename security-center/snippets/{v1p1beta1 => v1}/deleteNotificationConfig.js (93%) rename security-center/snippets/{v1p1beta1 => v1}/getNotificationConfig.js (93%) rename security-center/snippets/{v1p1beta1 => v1}/listNotificationConfigs.js (93%) rename security-center/snippets/{v1p1beta1 => v1}/receiveNotifications.js (100%) rename security-center/snippets/{v1p1beta1 => v1}/updateNotificationConfig.js (94%) diff --git a/security-center/snippets/system-test/v1p1beta1/notifications.test.js b/security-center/snippets/system-test/v1/notifications.test.js similarity index 86% rename from security-center/snippets/system-test/v1p1beta1/notifications.test.js rename to security-center/snippets/system-test/v1/notifications.test.js index ad5b10fe43..5c51b726f1 100644 --- a/security-center/snippets/system-test/v1p1beta1/notifications.test.js +++ b/security-center/snippets/system-test/v1/notifications.test.js @@ -14,9 +14,7 @@ 'use strict'; -const { - SecurityCenterClient, -} = require('@google-cloud/security-center').v1p1beta1; +const {SecurityCenterClient} = require('@google-cloud/security-center'); const uuidv1 = require('uuid').v1; const {assert} = require('chai'); const {describe, it, before, after} = require('mocha'); @@ -44,7 +42,6 @@ describe('Client with Notifications', async () => { notificationConfig: { description: 'Sample config for node.js', pubsubTopic: pubsubTopic, - eventType: 'FINDING', streamingConfig: {filter: 'state = "ACTIVE"'}, }, }); @@ -71,7 +68,7 @@ describe('Client with Notifications', async () => { it('client can create config', () => { const output = exec( - `node v1p1beta1/createNotificationConfig.js ${organizationId} ${createConfig} ${pubsubTopic}` + `node v1/createNotificationConfig.js ${organizationId} ${createConfig} ${pubsubTopic}` ); assert.include(output, createConfig); assert.match(output, /Notification config creation succeeded/); @@ -80,7 +77,7 @@ describe('Client with Notifications', async () => { it('client can delete config', () => { const output = exec( - `node v1p1beta1/deleteNotificationConfig.js ${organizationId} ${deleteConfig}` + `node v1/deleteNotificationConfig.js ${organizationId} ${deleteConfig}` ); assert.include(output, 'Notification config deleted'); assert.notMatch(output, /undefined/); @@ -88,7 +85,7 @@ describe('Client with Notifications', async () => { it('client can get config', () => { const output = exec( - `node v1p1beta1/getNotificationConfig.js ${organizationId} ${getConfig}` + `node v1/getNotificationConfig.js ${organizationId} ${getConfig}` ); assert.include(output, getConfig); assert.match(output, /Notification config/); @@ -96,9 +93,7 @@ describe('Client with Notifications', async () => { }); it('client can list configs', () => { - const output = exec( - `node v1p1beta1/listNotificationConfigs.js ${organizationId}` - ); + const output = exec(`node v1/listNotificationConfigs.js ${organizationId}`); assert.include(output, listConfig); assert.match(output, /Received Notification configs/); assert.notMatch(output, /undefined/); @@ -106,7 +101,7 @@ describe('Client with Notifications', async () => { it('client can update configs', () => { const output = exec( - `node v1p1beta1/updateNotificationConfig.js ${organizationId} ${updateConfig} ${pubsubTopic}` + `node v1/updateNotificationConfig.js ${organizationId} ${updateConfig} ${pubsubTopic}` ); assert.include(output, updateConfig); assert.match(output, /notification config update succeeded/); diff --git a/security-center/snippets/v1p1beta1/createNotificationConfig.js b/security-center/snippets/v1/createNotificationConfig.js similarity index 93% rename from security-center/snippets/v1p1beta1/createNotificationConfig.js rename to security-center/snippets/v1/createNotificationConfig.js index 81e9085a2f..2edcb82543 100644 --- a/security-center/snippets/v1p1beta1/createNotificationConfig.js +++ b/security-center/snippets/v1/createNotificationConfig.js @@ -20,9 +20,7 @@ function main( ) { // [START scc_create_notification_config] // npm install @google-cloud/security-center/ - const { - SecurityCenterClient, - } = require('@google-cloud/security-center').v1p1beta1; + const {SecurityCenterClient} = require('@google-cloud/security-center'); const client = new SecurityCenterClient(); @@ -40,7 +38,6 @@ function main( notificationConfig: { description: 'Sample config for node.js', pubsubTopic: pubsubTopic, - eventType: 'FINDING', streamingConfig: {filter: 'state = "ACTIVE"'}, }, }); diff --git a/security-center/snippets/v1p1beta1/deleteNotificationConfig.js b/security-center/snippets/v1/deleteNotificationConfig.js similarity index 93% rename from security-center/snippets/v1p1beta1/deleteNotificationConfig.js rename to security-center/snippets/v1/deleteNotificationConfig.js index db1ae04ff6..fc90afd2a2 100644 --- a/security-center/snippets/v1p1beta1/deleteNotificationConfig.js +++ b/security-center/snippets/v1/deleteNotificationConfig.js @@ -16,9 +16,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { // [START scc_delete_notification_config] // npm install @google-cloud/security-center/ - const { - SecurityCenterClient, - } = require('@google-cloud/security-center').v1p1beta1; + const {SecurityCenterClient} = require('@google-cloud/security-center'); const client = new SecurityCenterClient(); diff --git a/security-center/snippets/v1p1beta1/getNotificationConfig.js b/security-center/snippets/v1/getNotificationConfig.js similarity index 93% rename from security-center/snippets/v1p1beta1/getNotificationConfig.js rename to security-center/snippets/v1/getNotificationConfig.js index 43bcba8ab3..f874e14167 100644 --- a/security-center/snippets/v1p1beta1/getNotificationConfig.js +++ b/security-center/snippets/v1/getNotificationConfig.js @@ -16,9 +16,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { // [START scc_get_notification_configs] // npm install @google-cloud/security-center/ - const { - SecurityCenterClient, - } = require('@google-cloud/security-center').v1p1beta1; + const {SecurityCenterClient} = require('@google-cloud/security-center'); const client = new SecurityCenterClient(); diff --git a/security-center/snippets/v1p1beta1/listNotificationConfigs.js b/security-center/snippets/v1/listNotificationConfigs.js similarity index 93% rename from security-center/snippets/v1p1beta1/listNotificationConfigs.js rename to security-center/snippets/v1/listNotificationConfigs.js index 1ea5f94787..00fe63dc2a 100644 --- a/security-center/snippets/v1p1beta1/listNotificationConfigs.js +++ b/security-center/snippets/v1/listNotificationConfigs.js @@ -16,9 +16,7 @@ function main(organizationId = 'your-org-id') { // [START scc_list_notification_configs] // npm install @google-cloud/security-center/ - const { - SecurityCenterClient, - } = require('@google-cloud/security-center').v1p1beta1; + const {SecurityCenterClient} = require('@google-cloud/security-center'); const client = new SecurityCenterClient(); diff --git a/security-center/snippets/v1p1beta1/receiveNotifications.js b/security-center/snippets/v1/receiveNotifications.js similarity index 100% rename from security-center/snippets/v1p1beta1/receiveNotifications.js rename to security-center/snippets/v1/receiveNotifications.js diff --git a/security-center/snippets/v1p1beta1/updateNotificationConfig.js b/security-center/snippets/v1/updateNotificationConfig.js similarity index 94% rename from security-center/snippets/v1p1beta1/updateNotificationConfig.js rename to security-center/snippets/v1/updateNotificationConfig.js index 9d7cdfeb49..4109c26d67 100644 --- a/security-center/snippets/v1p1beta1/updateNotificationConfig.js +++ b/security-center/snippets/v1/updateNotificationConfig.js @@ -20,9 +20,7 @@ function main( ) { // [START scc_update_notification_config] // npm install @google-cloud/security-center/ - const { - SecurityCenterClient, - } = require('@google-cloud/security-center').v1p1beta1; + const {SecurityCenterClient} = require('@google-cloud/security-center'); const client = new SecurityCenterClient(); From a515204d947d6431f00c7846ec143f53753a66b5 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 31 Mar 2020 13:44:50 -0700 Subject: [PATCH 33/82] feat!: drop node8 support, support for async iterators (#248) BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. New feature: methods with pagination now support async iteration. --- security-center/snippets/v1/listFilteredFindings.js | 2 +- security-center/snippets/v1/listFindingsWithSecurityMarks.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/security-center/snippets/v1/listFilteredFindings.js b/security-center/snippets/v1/listFilteredFindings.js index 077f4a919a..e66c57c46b 100644 --- a/security-center/snippets/v1/listFilteredFindings.js +++ b/security-center/snippets/v1/listFilteredFindings.js @@ -33,7 +33,7 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { const [response] = await client.listFindings({ // List findings across all sources. parent: sourceName, - filter: `category="MEDIUM_RISK_ONE"`, + filter: 'category="MEDIUM_RISK_ONE"', }); let count = 0; Array.from(response).forEach(result => diff --git a/security-center/snippets/v1/listFindingsWithSecurityMarks.js b/security-center/snippets/v1/listFindingsWithSecurityMarks.js index 81ef50f486..d7b2ede4be 100644 --- a/security-center/snippets/v1/listFindingsWithSecurityMarks.js +++ b/security-center/snippets/v1/listFindingsWithSecurityMarks.js @@ -33,7 +33,7 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { const [response] = await client.listFindings({ // List findings across all sources. parent: sourceName, - filter: `NOT security_marks.marks.key_a="value_a"`, + filter: 'NOT security_marks.marks.key_a="value_a"', }); let count = 0; Array.from(response).forEach(result => From 3f30f5fd0d06ae94dec48a451ee8a2e6d73c4a1c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 27 Apr 2020 12:20:15 -0700 Subject: [PATCH 34/82] build: new coverage action (#271) --- security-center/snippets/v1/testIam.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/security-center/snippets/v1/testIam.js b/security-center/snippets/v1/testIam.js index 3c84f8a0c5..248075670a 100644 --- a/security-center/snippets/v1/testIam.js +++ b/security-center/snippets/v1/testIam.js @@ -38,8 +38,9 @@ function main(sourceName = 'FULL_SOURCE_PATH') { permissions: ['securitycenter.findings.update'], }); console.log( - `Permissions to create/update findings? ${policy.permissions.length > - 0}` + `Permissions to create/update findings? ${ + policy.permissions.length > 0 + }` ); } { From b3eb13484a42cb6a73641b8cda7f04a176a432ab Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 1 May 2020 06:55:26 +0200 Subject: [PATCH 35/82] chore(deps): update dependency uuid to v8 (#272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | devDependencies | major | [`^7.0.2` -> `^8.0.0`](https://renovatebot.com/diffs/npm/uuid/7.0.3/8.0.0) | --- ### Release Notes
uuidjs/uuid ### [`v8.0.0`](https://togithub.com/uuidjs/uuid/blob/master/CHANGELOG.md#​800-httpsgithubcomuuidjsuuidcomparev703v800-2020-04-29) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) ##### âš  BREAKING CHANGES - For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export. ```diff -import uuid from 'uuid'; -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869' +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' ``` - Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported. Instead use the named exports that this module exports. For ECMAScript Modules (ESM): ```diff -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; uuidv4(); ``` For CommonJS: ```diff -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); uuidv4(); ``` ##### Features - native Node.js ES Modules (wrapper approach) ([#​423](https://togithub.com/uuidjs/uuid/issues/423)) ([2d9f590](https://togithub.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#​245](https://togithub.com/uuidjs/uuid/issues/245) [#​419](https://togithub.com/uuidjs/uuid/issues/419) [#​342](https://togithub.com/uuidjs/uuid/issues/342) - remove deep requires ([#​426](https://togithub.com/uuidjs/uuid/issues/426)) ([daf72b8](https://togithub.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba)) ##### Bug Fixes - add CommonJS syntax example to README quickstart section ([#​417](https://togithub.com/uuidjs/uuid/issues/417)) ([e0ec840](https://togithub.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0)) ##### [7.0.3](https://togithub.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31) ##### Bug Fixes - make deep require deprecation warning work in browsers ([#​409](https://togithub.com/uuidjs/uuid/issues/409)) ([4b71107](https://togithub.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#​408](https://togithub.com/uuidjs/uuid/issues/408) ##### [7.0.2](https://togithub.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04) ##### Bug Fixes - make access to msCrypto consistent ([#​393](https://togithub.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://togithub.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c)) - simplify link in deprecation warning ([#​391](https://togithub.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://togithub.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7)) - update links to match content in readme ([#​386](https://togithub.com/uuidjs/uuid/issues/386)) ([44f2f86](https://togithub.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4)) ##### [7.0.1](https://togithub.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25) ##### Bug Fixes - clean up esm builds for node and browser ([#​383](https://togithub.com/uuidjs/uuid/issues/383)) ([59e6a49](https://togithub.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc)) - provide browser versions independent from module system ([#​380](https://togithub.com/uuidjs/uuid/issues/380)) ([4344a22](https://togithub.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#​378](https://togithub.com/uuidjs/uuid/issues/378)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-security-center). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index bcdb060c27..d760ff620b 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -19,6 +19,6 @@ "devDependencies": { "chai": "^4.2.0", "mocha": "^7.0.0", - "uuid": "^7.0.2" + "uuid": "^8.0.0" } } From 939511b12278456a20b28ab0ea899d95b371f443 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 28 May 2020 00:14:40 +0200 Subject: [PATCH 36/82] fix(deps): update dependency @google-cloud/pubsub to v2 (#276) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index d760ff620b..f3d0a21963 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/pubsub": "^1.5.0", + "@google-cloud/pubsub": "^2.0.0", "@google-cloud/security-center": "^3.1.0" }, "devDependencies": { From 1377e23e3ce0039dbdef5965b30065a06382217f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 3 Jun 2020 18:18:25 -0700 Subject: [PATCH 37/82] chore: release 4.0.0 (#249) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index f3d0a21963..2cca2acf05 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^3.1.0" + "@google-cloud/security-center": "^4.0.0" }, "devDependencies": { "chai": "^4.2.0", From ccf331edafe0cef10fdb76c3860edf67c6e8ab00 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 17:47:24 +0200 Subject: [PATCH 38/82] chore(deps): update dependency mocha to v8 (#282) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/mocha/7.2.0/8.0.1) | --- ### Release Notes
mochajs/mocha ### [`v8.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​801--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v8.0.0...v8.0.1) The obligatory patch after a major. #### :bug: Fixes - [#​4328](https://togithub.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@​boneskull**](https://togithub.com/boneskull)) ### [`v8.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​800--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.2.0...v8.0.0) In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below. Let's welcome [**@​giltayar**](https://togithub.com/giltayar) and [**@​nicojs**](https://togithub.com/nicojs) to the maintenance team! #### :boom: Breaking Changes - [#​4164](https://togithub.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@​UlisesGascon**](https://togithub.com/UlisesGascon)) - [#​4175](https://togithub.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#​4260](https://togithub.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@​craigtaub**](https://togithub.com/craigtaub)) :sparkles: **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#​4315](https://togithub.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#​4309](https://togithub.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@​juergba**](https://togithub.com/juergba)) - [#​4282](https://togithub.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@​arvidOtt**](https://togithub.com/arvidOtt)) - [#​4223](https://togithub.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@​juergba**](https://togithub.com/juergba)) - [#​4178](https://togithub.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@​wnghdcjfe**](https://togithub.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` #### :tada: Enhancements - [#​4245](https://togithub.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@​boneskull**](https://togithub.com/boneskull)) :exclamation: See also [#​4244](https://togithub.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_ - [#​4304](https://togithub.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@​JacobLey**](https://togithub.com/JacobLey)) - [#​4299](https://togithub.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@​giltayar**](https://togithub.com/giltayar)) #### :book: Documentation - [#​4246](https://togithub.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@​boneskull**](https://togithub.com/boneskull)) #### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-security-center). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 2cca2acf05..078117a66f 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -18,7 +18,7 @@ }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^7.0.0", + "mocha": "^8.0.0", "uuid": "^8.0.0" } } From c9157a95a57fe87db7791e9150363a2a9af99d5a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2020 09:01:11 -0700 Subject: [PATCH 39/82] chore: release 5.0.0 (#287) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 078117a66f..4eb3f6d34a 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^4.0.0" + "@google-cloud/security-center": "^5.0.0" }, "devDependencies": { "chai": "^4.2.0", From 424f2b900ff686c0e15c996fae12fa3e0ac302f1 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2020 14:04:39 -0700 Subject: [PATCH 40/82] chore: release 5.0.1 (#291) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 4eb3f6d34a..a91a9b9d7a 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.0.0" + "@google-cloud/security-center": "^5.0.1" }, "devDependencies": { "chai": "^4.2.0", From 20acb12d90a0e767e69d4fe24d5475a9b47de900 Mon Sep 17 00:00:00 2001 From: hannah-tsai <64800225+hannah-tsai@users.noreply.github.com> Date: Wed, 15 Jul 2020 20:14:38 -0700 Subject: [PATCH 41/82] docs: Add filter field libary sample for UpdateNotificationConfig (#288) * Add filter field libary sample for UpdateNotificationConfig * Add filter field libary sample for UpdateNotificationConfig * docs: Add filter field libary sample for UpdateNotificationConfig * docs: Update Security Command Center UpdateNotificationConfig sample, adding filter to mutable field Co-authored-by: Justin Beckwith Co-authored-by: Benjamin E. Coe Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- security-center/snippets/v1/updateNotificationConfig.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/security-center/snippets/v1/updateNotificationConfig.js b/security-center/snippets/v1/updateNotificationConfig.js index 4109c26d67..4392f52a64 100644 --- a/security-center/snippets/v1/updateNotificationConfig.js +++ b/security-center/snippets/v1/updateNotificationConfig.js @@ -36,11 +36,14 @@ function main( async function updateNotificationConfig() { const [response] = await client.updateNotificationConfig({ - updateMask: {paths: ['description', 'pubsub_topic']}, + updateMask: { + paths: ['description', 'pubsub_topic', 'streaming_config.filter'], + }, notificationConfig: { name: formattedConfigName, description: 'Updated config description', pubsubTopic: pubsubTopic, + streamingConfig: {filter: 'state = "INACTIVE"'}, }, }); console.log('notification config update succeeded: ', response); From d2c0fae13a672024586e94da5937e97475793ce0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:52:07 +0000 Subject: [PATCH 42/82] chore: release 5.0.2 (#304) :robot: I have created a release \*beep\* \*boop\* --- ### [5.0.2](https://www.github.com/googleapis/nodejs-security-center/compare/v5.0.1...v5.0.2) (2020-07-27) ### Bug Fixes * add resource config to v1beta1 ([#307](https://www.github.com/googleapis/nodejs-security-center/issues/307)) ([5d99acf](https://www.github.com/googleapis/nodejs-security-center/commit/5d99acf9dea7a6e2d384ee709678365c769f3d6e)) * correct securitycenter grpc_service_configs, add Node 8 tests ([#302](https://www.github.com/googleapis/nodejs-security-center/issues/302)) ([4e4ec5b](https://www.github.com/googleapis/nodejs-security-center/commit/4e4ec5bbd9623dc952781e80da226320db3906af)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index a91a9b9d7a..6d154f4711 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.0.1" + "@google-cloud/security-center": "^5.0.2" }, "devDependencies": { "chai": "^4.2.0", From 5c7ccd6ac54b86624a969b614b5f18f0c826fae8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 30 Jul 2020 02:08:07 +0200 Subject: [PATCH 43/82] fix(deps): roll back dependency @google-cloud/security-center to ^5.0.1 (#309) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 6d154f4711..a91a9b9d7a 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.0.2" + "@google-cloud/security-center": "^5.0.1" }, "devDependencies": { "chai": "^4.2.0", From d5a8577163d0af92a8d8d744737b1936acba8988 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2020 20:24:19 -0700 Subject: [PATCH 44/82] chore: release 5.0.3 (#310) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index a91a9b9d7a..ca07777a6d 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.0.1" + "@google-cloud/security-center": "^5.0.3" }, "devDependencies": { "chai": "^4.2.0", From 6a602a9bfa2da5517f48183ae0243bc14c9019cd Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2020 10:06:31 -0700 Subject: [PATCH 45/82] chore: release 5.1.0 (#318) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index ca07777a6d..92eb9a5dde 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.0.3" + "@google-cloud/security-center": "^5.1.0" }, "devDependencies": { "chai": "^4.2.0", From 941253c5ca04c07b7f3d538c3dd8eb9985f0b5ed Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 17 Aug 2020 20:48:53 +0200 Subject: [PATCH 46/82] fix(deps): roll back dependency @google-cloud/security-center to ^5.0.3 (#319) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 92eb9a5dde..ca07777a6d 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.1.0" + "@google-cloud/security-center": "^5.0.3" }, "devDependencies": { "chai": "^4.2.0", From 3a4cca1775b2a8daca5b528a2cf876b657c33f38 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 09:40:36 -0700 Subject: [PATCH 47/82] chore: release 5.1.1 (#320) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index ca07777a6d..0ddb99b95e 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.0.3" + "@google-cloud/security-center": "^5.1.1" }, "devDependencies": { "chai": "^4.2.0", From 4275a62db8018a1a4ae888f4b20e51706306ffe5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2020 12:45:23 -0800 Subject: [PATCH 48/82] chore: release 5.1.2 (#338) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 0ddb99b95e..fb83d35cf5 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.1.1" + "@google-cloud/security-center": "^5.1.2" }, "devDependencies": { "chai": "^4.2.0", From 52068c64e4dc596ab7cfe85601e0937cfb33d04c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:42:18 +0000 Subject: [PATCH 49/82] chore: release 5.1.3 (#345) :robot: I have created a release \*beep\* \*boop\* --- ### [5.1.3](https://www.github.com/googleapis/nodejs-security-center/compare/v5.1.2...v5.1.3) (2020-11-25) ### Bug Fixes * check for fetch on window ([#344](https://www.github.com/googleapis/nodejs-security-center/issues/344)) ([85c6d55](https://www.github.com/googleapis/nodejs-security-center/commit/85c6d55fa245fb2508423d2f0ba94f2e1c25c53f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index fb83d35cf5..0156633906 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.1.2" + "@google-cloud/security-center": "^5.1.3" }, "devDependencies": { "chai": "^4.2.0", From 5377da3570f884f7314347dcf7b49a02edca0842 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 7 Jan 2021 11:45:58 -0800 Subject: [PATCH 50/82] chore: release 5.2.0 (#350) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 0156633906..a911d1d1ec 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.1.3" + "@google-cloud/security-center": "^5.2.0" }, "devDependencies": { "chai": "^4.2.0", From 07e2920857852688b86f98f731568b6acb92a087 Mon Sep 17 00:00:00 2001 From: Anthony Date: Wed, 27 Jan 2021 13:45:13 -0800 Subject: [PATCH 51/82] docs: wrap samples with future prefix (#348) --- security-center/snippets/v1/addDeleteSecurityMarks.js | 2 ++ security-center/snippets/v1/addFindingSecurityMarks.js | 2 ++ security-center/snippets/v1/addSecurityMarks.js | 2 ++ security-center/snippets/v1/createFinding.js | 2 ++ security-center/snippets/v1/createFindingSourceProperties.js | 2 ++ security-center/snippets/v1/createNotificationConfig.js | 2 ++ security-center/snippets/v1/createSource.js | 2 ++ security-center/snippets/v1/deleteNotificationConfig.js | 2 ++ security-center/snippets/v1/deleteSecurityMarks.js | 2 ++ security-center/snippets/v1/enableAssetDiscovery.js | 2 ++ security-center/snippets/v1/getNotificationConfig.js | 2 ++ security-center/snippets/v1/getOrganizationSettings.js | 2 ++ security-center/snippets/v1/getSource.js | 2 ++ security-center/snippets/v1/getSourceIam.js | 2 ++ security-center/snippets/v1/listAllAssets.js | 2 ++ security-center/snippets/v1/listAllFindings.js | 2 ++ security-center/snippets/v1/listAllSources.js | 2 ++ security-center/snippets/v1/listAssetsAndChanges.js | 2 ++ security-center/snippets/v1/listAssetsAtTime.js | 2 ++ security-center/snippets/v1/listAssetsWithSecurityMarks.js | 2 ++ security-center/snippets/v1/listFilteredAssets.js | 2 ++ security-center/snippets/v1/listFilteredFindings.js | 2 ++ security-center/snippets/v1/listFindingsAtTime.js | 2 ++ security-center/snippets/v1/listFindingsWithSecurityMarks.js | 2 ++ security-center/snippets/v1/listNotificationConfigs.js | 2 ++ security-center/snippets/v1/receiveNotifications.js | 2 ++ security-center/snippets/v1/setFindingState.js | 2 ++ security-center/snippets/v1/setSourceIam.js | 2 ++ security-center/snippets/v1/testIam.js | 2 ++ security-center/snippets/v1/updateFindingSourceProperties.js | 2 ++ security-center/snippets/v1/updateNotificationConfig.js | 2 ++ security-center/snippets/v1/updateSource.js | 2 ++ 32 files changed, 64 insertions(+) diff --git a/security-center/snippets/v1/addDeleteSecurityMarks.js b/security-center/snippets/v1/addDeleteSecurityMarks.js index 74cf3115a2..45096eba6e 100644 --- a/security-center/snippets/v1/addDeleteSecurityMarks.js +++ b/security-center/snippets/v1/addDeleteSecurityMarks.js @@ -18,6 +18,7 @@ * marks from an asset. */ function main(assetName = 'full asset path to add marks to') { + // [START securitycenter_add_delete_security_marks] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,6 +45,7 @@ function main(assetName = 'full asset path to add marks to') { } addDeleteSecurityMarks(); // [END demo] + // [END securitycenter_add_delete_security_marks] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/addFindingSecurityMarks.js b/security-center/snippets/v1/addFindingSecurityMarks.js index 6117078f21..c1516de62e 100644 --- a/security-center/snippets/v1/addFindingSecurityMarks.js +++ b/security-center/snippets/v1/addFindingSecurityMarks.js @@ -17,6 +17,7 @@ * Demostrates adding security marks to a finding. */ function main(findingName = 'full finding path to add marks to') { + // [START securitycenter_add_finding_security_marks] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,6 +45,7 @@ function main(findingName = 'full finding path to add marks to') { } addFindingSecurityMarks(); // [END demo] + // [END securitycenter_add_finding_security_marks] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/addSecurityMarks.js b/security-center/snippets/v1/addSecurityMarks.js index 24d607c05d..ce68e5f025 100644 --- a/security-center/snippets/v1/addSecurityMarks.js +++ b/security-center/snippets/v1/addSecurityMarks.js @@ -18,6 +18,7 @@ * Demostrates adding security marks to an asset. */ function main(assetName = 'full asset path to add marks to') { + // [START securitycenter_add_security_marks] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,6 +45,7 @@ function main(assetName = 'full asset path to add marks to') { } addSecurityMarks(); // [END demo] + // [END securitycenter_add_security_marks] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createFinding.js b/security-center/snippets/v1/createFinding.js index b91f580e09..5e8a7f8654 100644 --- a/security-center/snippets/v1/createFinding.js +++ b/security-center/snippets/v1/createFinding.js @@ -18,6 +18,7 @@ * Demonstrates how to create a new security finding in CSCC. */ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { + // [START securitycenter_create_finding] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -56,6 +57,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { } createFinding(); // [END demo] + // [END securitycenter_create_finding] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createFindingSourceProperties.js b/security-center/snippets/v1/createFindingSourceProperties.js index e63882c773..18f2a7e195 100644 --- a/security-center/snippets/v1/createFindingSourceProperties.js +++ b/security-center/snippets/v1/createFindingSourceProperties.js @@ -19,6 +19,7 @@ * properties. */ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { + // [START securitycenter_create_finding_source_properties] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -61,6 +62,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { } createFinding(); // [END demo] + // [END securitycenter_create_finding_source_properties] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createNotificationConfig.js b/security-center/snippets/v1/createNotificationConfig.js index 2edcb82543..d9539c2906 100644 --- a/security-center/snippets/v1/createNotificationConfig.js +++ b/security-center/snippets/v1/createNotificationConfig.js @@ -18,6 +18,7 @@ function main( configId = 'your-config-name', pubsubTopic = 'projects/{your-project}/topics/{your-topic}' ) { + // [START securitycenter_create_notification_config] // [START scc_create_notification_config] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -46,6 +47,7 @@ function main( createNotificationConfig(); // [END scc_create_notification_config] + // [END securitycenter_create_notification_config] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/createSource.js b/security-center/snippets/v1/createSource.js index 8fcc7cded7..e96af5f7cb 100644 --- a/security-center/snippets/v1/createSource.js +++ b/security-center/snippets/v1/createSource.js @@ -18,6 +18,7 @@ * createSource demonstrates how to create a new security finding source. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_create_source] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -41,6 +42,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } createSource(); // [END demo] + // [END securitycenter_create_source] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/deleteNotificationConfig.js b/security-center/snippets/v1/deleteNotificationConfig.js index fc90afd2a2..19d413121d 100644 --- a/security-center/snippets/v1/deleteNotificationConfig.js +++ b/security-center/snippets/v1/deleteNotificationConfig.js @@ -14,6 +14,7 @@ 'use strict'; function main(organizationId = 'your-org-id', configId = 'your-config-id') { + // [START securitycenter_delete_notification_config] // [START scc_delete_notification_config] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -34,6 +35,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { deleteNotificationConfg(); // [END scc_delete_notification_config] + // [END securitycenter_delete_notification_config] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/deleteSecurityMarks.js b/security-center/snippets/v1/deleteSecurityMarks.js index de0811c3cf..a5a988711d 100644 --- a/security-center/snippets/v1/deleteSecurityMarks.js +++ b/security-center/snippets/v1/deleteSecurityMarks.js @@ -18,6 +18,7 @@ * Demostrates deleting security marks on an asset. */ function main(assetName = 'full asset path to add marks to') { + // [START securitycenter_delete_security_marks] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,6 +45,7 @@ function main(assetName = 'full asset path to add marks to') { } deleteSecurityMarks(); // [END demo] + // [END securitycenter_delete_security_marks] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/enableAssetDiscovery.js b/security-center/snippets/v1/enableAssetDiscovery.js index 617c432761..3fdd401161 100644 --- a/security-center/snippets/v1/enableAssetDiscovery.js +++ b/security-center/snippets/v1/enableAssetDiscovery.js @@ -18,6 +18,7 @@ * Demostrates enabling asset discovery for an organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_enable_asset_discovery] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -45,6 +46,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } updateOrgSettings(); // [END demo] + // [END securitycenter_enable_asset_discovery] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getNotificationConfig.js b/security-center/snippets/v1/getNotificationConfig.js index f874e14167..2c3eadccca 100644 --- a/security-center/snippets/v1/getNotificationConfig.js +++ b/security-center/snippets/v1/getNotificationConfig.js @@ -14,6 +14,7 @@ 'use strict'; function main(organizationId = 'your-org-id', configId = 'your-config-id') { + // [START securitycenter_get_notification_configs] // [START scc_get_notification_configs] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -36,6 +37,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { getNotificationConfg(); // [END scc_get_notification_configs] + // [END securitycenter_get_notification_configs] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getOrganizationSettings.js b/security-center/snippets/v1/getOrganizationSettings.js index 9ec421afb7..5d058920db 100644 --- a/security-center/snippets/v1/getOrganizationSettings.js +++ b/security-center/snippets/v1/getOrganizationSettings.js @@ -19,6 +19,7 @@ * includes the current status of asset recovery. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_get_organization_settings] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -41,6 +42,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } getOrgSettings(); // [END demo] + // [END securitycenter_get_organization_settings] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getSource.js b/security-center/snippets/v1/getSource.js index 28be020833..4e0c855c51 100644 --- a/security-center/snippets/v1/getSource.js +++ b/security-center/snippets/v1/getSource.js @@ -19,6 +19,7 @@ * source. */ function main(sourceName = 'FULL_PATH_TO_SOURCE') { + // [START securitycenter_get_source] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -37,6 +38,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') { getSource(); // [END demo] + // [END securitycenter_get_source] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getSourceIam.js b/security-center/snippets/v1/getSourceIam.js index 0dd157d9c2..4ff3ae2529 100644 --- a/security-center/snippets/v1/getSourceIam.js +++ b/security-center/snippets/v1/getSourceIam.js @@ -18,6 +18,7 @@ * Demostrates retrieving the current IAM policy for a source. */ function main(sourceName = 'FULL_PATH_TO_SOURCE') { + // [START securitycenter_get_source_iam] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -40,6 +41,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') { } getSourceIamPolicy(); // [END demo] + // [END securitycenter_get_source_iam] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllAssets.js b/security-center/snippets/v1/listAllAssets.js index 99badddf48..32fb7e9b89 100644 --- a/security-center/snippets/v1/listAllAssets.js +++ b/security-center/snippets/v1/listAllAssets.js @@ -16,6 +16,7 @@ /** Prints all assets in an organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_all_assets] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -43,6 +44,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listAssets(); // [END demo] + // [END securitycenter_list_all_assets] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllFindings.js b/security-center/snippets/v1/listAllFindings.js index 269aba9d9a..6e2ecdbc5a 100644 --- a/security-center/snippets/v1/listAllFindings.js +++ b/security-center/snippets/v1/listAllFindings.js @@ -16,6 +16,7 @@ /** Prints all findings across all sources. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_all_findings] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -42,6 +43,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listAllFindings(); // [END demo] + // [END securitycenter_list_all_findings] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllSources.js b/security-center/snippets/v1/listAllSources.js index 4b5b68d1b0..b8517623d8 100644 --- a/security-center/snippets/v1/listAllSources.js +++ b/security-center/snippets/v1/listAllSources.js @@ -16,6 +16,7 @@ /** Prints all sources in an organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_all_sources] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -40,6 +41,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listSources(); // [END demo] + // [END securitycenter_list_all_sources] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAssetsAndChanges.js b/security-center/snippets/v1/listAssetsAndChanges.js index 7712b8bbf7..a735462014 100644 --- a/security-center/snippets/v1/listAssetsAndChanges.js +++ b/security-center/snippets/v1/listAssetsAndChanges.js @@ -19,6 +19,7 @@ * days ago. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_assets_and_changes] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -51,6 +52,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listAssetsAndChanges(); // [END demo] + // [END securitycenter_list_assets_and_changes] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAssetsAtTime.js b/security-center/snippets/v1/listAssetsAtTime.js index f97f057fbc..042be1d6f9 100644 --- a/security-center/snippets/v1/listAssetsAtTime.js +++ b/security-center/snippets/v1/listAssetsAtTime.js @@ -18,6 +18,7 @@ * Prints project assets for the organization as of yesterday. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_assets_at_time] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -59,6 +60,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listAssetsAtTime(); // [END demo] + // [END securitycenter_list_assets_at_time] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAssetsWithSecurityMarks.js b/security-center/snippets/v1/listAssetsWithSecurityMarks.js index e263d41fb1..10035529b9 100644 --- a/security-center/snippets/v1/listAssetsWithSecurityMarks.js +++ b/security-center/snippets/v1/listAssetsWithSecurityMarks.js @@ -18,6 +18,7 @@ * Prints assets with security mark of key_a == value_a. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_assets_with_security_marks] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -49,6 +50,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listAssetsWithSecurityMarks(); // [END demo] + // [END securitycenter_list_assets_with_security_marks] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFilteredAssets.js b/security-center/snippets/v1/listFilteredAssets.js index 473fd6956c..2e8228c7c2 100644 --- a/security-center/snippets/v1/listFilteredAssets.js +++ b/security-center/snippets/v1/listFilteredAssets.js @@ -18,6 +18,7 @@ * Prints current project assets for the organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_filtered_assets] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -50,6 +51,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listFilteredAssets(); // [END demo] + // [END securitycenter_list_filtered_assets] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFilteredFindings.js b/security-center/snippets/v1/listFilteredFindings.js index e66c57c46b..8c616f002a 100644 --- a/security-center/snippets/v1/listFilteredFindings.js +++ b/security-center/snippets/v1/listFilteredFindings.js @@ -16,6 +16,7 @@ /** Demonstrates listing only specific findings. */ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_filtered_findings] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,6 +45,7 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { } listFilteredFindings(); // [END demo] + // [END securitycenter_list_filtered_findings] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFindingsAtTime.js b/security-center/snippets/v1/listFindingsAtTime.js index 438d2def3d..3ead9c1c98 100644 --- a/security-center/snippets/v1/listFindingsAtTime.js +++ b/security-center/snippets/v1/listFindingsAtTime.js @@ -16,6 +16,7 @@ /** Demonstrates listing findings at a point in time. */ function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') { + // [START securitycenter_list_findings_at_time] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -50,6 +51,7 @@ function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') { } listFindingsAtTime(); // [END demo] + // [END securitycenter_list_findings_at_time] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFindingsWithSecurityMarks.js b/security-center/snippets/v1/listFindingsWithSecurityMarks.js index d7b2ede4be..3fca1cd24d 100644 --- a/security-center/snippets/v1/listFindingsWithSecurityMarks.js +++ b/security-center/snippets/v1/listFindingsWithSecurityMarks.js @@ -16,6 +16,7 @@ /** Demonstrates listing findings by filtering on security marks. */ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { + // [START securitycenter_list_findings_with_security_marks] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,6 +45,7 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { } listFindingsWithSecurityMarks(); // [END demo] + // [END securitycenter_list_findings_with_security_marks] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listNotificationConfigs.js b/security-center/snippets/v1/listNotificationConfigs.js index 00fe63dc2a..cca1fd77a7 100644 --- a/security-center/snippets/v1/listNotificationConfigs.js +++ b/security-center/snippets/v1/listNotificationConfigs.js @@ -14,6 +14,7 @@ 'use strict'; function main(organizationId = 'your-org-id') { + // [START securitycenter_list_notification_configs] // [START scc_list_notification_configs] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -33,6 +34,7 @@ function main(organizationId = 'your-org-id') { listNotificationConfigs(); // [END scc_list_notification_configs] + // [END securitycenter_list_notification_configs] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/receiveNotifications.js b/security-center/snippets/v1/receiveNotifications.js index d9318853cf..e1ab9d0b55 100644 --- a/security-center/snippets/v1/receiveNotifications.js +++ b/security-center/snippets/v1/receiveNotifications.js @@ -17,6 +17,7 @@ function main( projectId = 'your-project-id', subscriptionId = 'your-subscription-id' ) { + // [START securitycenter_receive_notifications] // [START scc_receive_notifications] const {PubSub} = require('@google-cloud/pubsub'); const {StringDecoder} = require('string_decoder'); @@ -55,6 +56,7 @@ function main( listenForMessages(); // [END scc_receive_notifications] + // [END securitycenter_receive_notifications] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/setFindingState.js b/security-center/snippets/v1/setFindingState.js index a4e1b1fa60..090753bed6 100644 --- a/security-center/snippets/v1/setFindingState.js +++ b/security-center/snippets/v1/setFindingState.js @@ -19,6 +19,7 @@ * CSCC. */ function main(findingName = 'FULL_FINDING_PATH') { + // [START securitycenter_set_finding_state] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -48,6 +49,7 @@ function main(findingName = 'FULL_FINDING_PATH') { } setFindingState(); // [END demo] + // [END securitycenter_set_finding_state] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/setSourceIam.js b/security-center/snippets/v1/setSourceIam.js index a501ae95af..5e4f8f93f0 100644 --- a/security-center/snippets/v1/setSourceIam.js +++ b/security-center/snippets/v1/setSourceIam.js @@ -21,6 +21,7 @@ function main( sourceName = 'FULL_PATH_TO_SOURCE', user = 'someuser@domain.com' ) { + // [START securitycenter_set_source_iam] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -59,6 +60,7 @@ function main( } setSourceIamPolicy(); // [END demo] + // [END securitycenter_set_source_iam] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/testIam.js b/security-center/snippets/v1/testIam.js index 248075670a..35c081726e 100644 --- a/security-center/snippets/v1/testIam.js +++ b/security-center/snippets/v1/testIam.js @@ -19,6 +19,7 @@ * access to create and update findings. */ function main(sourceName = 'FULL_SOURCE_PATH') { + // [START securitycenter_test_iam] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -55,6 +56,7 @@ function main(sourceName = 'FULL_SOURCE_PATH') { } testIam(); // [END demo] + // [END securitycenter_test_iam] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/updateFindingSourceProperties.js b/security-center/snippets/v1/updateFindingSourceProperties.js index f4191e4da3..09532cd6b1 100644 --- a/security-center/snippets/v1/updateFindingSourceProperties.js +++ b/security-center/snippets/v1/updateFindingSourceProperties.js @@ -18,6 +18,7 @@ * Demonstrates how to update a security finding in CSCC. */ function main(findingName = 'FULL_FINDING_PATH') { + // [START securitycenter_update_finding_source_properties] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -54,6 +55,7 @@ function main(findingName = 'FULL_FINDING_PATH') { } updateFinding(); // [END demo] + // [END securitycenter_update_finding_source_properties] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/updateNotificationConfig.js b/security-center/snippets/v1/updateNotificationConfig.js index 4392f52a64..f745bce0d7 100644 --- a/security-center/snippets/v1/updateNotificationConfig.js +++ b/security-center/snippets/v1/updateNotificationConfig.js @@ -18,6 +18,7 @@ function main( configId = 'your-config-name', pubsubTopic = 'projects/{your-project}/topics/{your-topic}' ) { + // [START securitycenter_update_notification_config] // [START scc_update_notification_config] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -51,6 +52,7 @@ function main( updateNotificationConfig(); // [END scc_update_notification_config] + // [END securitycenter_update_notification_config] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/updateSource.js b/security-center/snippets/v1/updateSource.js index 245910b612..fbb219e6be 100644 --- a/security-center/snippets/v1/updateSource.js +++ b/security-center/snippets/v1/updateSource.js @@ -19,6 +19,7 @@ * source. */ function main(sourceName = 'FULL_PATH_TO_SOURCE') { + // [START securitycenter_update_source] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -45,6 +46,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') { updateSource(); // [END demo] + // [END securitycenter_update_source] } main(...process.argv.slice(2)); From 76ef5e03f6a63ce0a0c3e86cafe7907d23fcef75 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 16 Feb 2021 16:41:28 -0800 Subject: [PATCH 52/82] docs: update new tags to match most used tag from other langs (#358) --- security-center/snippets/v1/createFindingSourceProperties.js | 4 ++-- security-center/snippets/v1/getNotificationConfig.js | 4 ++-- security-center/snippets/v1/getOrganizationSettings.js | 4 ++-- security-center/snippets/v1/listAllSources.js | 4 ++-- security-center/snippets/v1/listFilteredAssets.js | 4 ++-- security-center/snippets/v1/setFindingState.js | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/security-center/snippets/v1/createFindingSourceProperties.js b/security-center/snippets/v1/createFindingSourceProperties.js index 18f2a7e195..e752d46477 100644 --- a/security-center/snippets/v1/createFindingSourceProperties.js +++ b/security-center/snippets/v1/createFindingSourceProperties.js @@ -19,7 +19,7 @@ * properties. */ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { - // [START securitycenter_create_finding_source_properties] + // [START securitycenter_create_finding_with_source_properties] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -62,7 +62,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { } createFinding(); // [END demo] - // [END securitycenter_create_finding_source_properties] + // [END securitycenter_create_finding_with_source_properties] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getNotificationConfig.js b/security-center/snippets/v1/getNotificationConfig.js index 2c3eadccca..e587ef565f 100644 --- a/security-center/snippets/v1/getNotificationConfig.js +++ b/security-center/snippets/v1/getNotificationConfig.js @@ -14,7 +14,7 @@ 'use strict'; function main(organizationId = 'your-org-id', configId = 'your-config-id') { - // [START securitycenter_get_notification_configs] + // [START securitycenter_get_notification_config] // [START scc_get_notification_configs] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -37,7 +37,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { getNotificationConfg(); // [END scc_get_notification_configs] - // [END securitycenter_get_notification_configs] + // [END securitycenter_get_notification_config] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/getOrganizationSettings.js b/security-center/snippets/v1/getOrganizationSettings.js index 5d058920db..4b1a700847 100644 --- a/security-center/snippets/v1/getOrganizationSettings.js +++ b/security-center/snippets/v1/getOrganizationSettings.js @@ -19,7 +19,7 @@ * includes the current status of asset recovery. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { - // [START securitycenter_get_organization_settings] + // [START securitycenter_get_org_settings] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -42,7 +42,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } getOrgSettings(); // [END demo] - // [END securitycenter_get_organization_settings] + // [END securitycenter_get_org_settings] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listAllSources.js b/security-center/snippets/v1/listAllSources.js index b8517623d8..7567fbf49f 100644 --- a/security-center/snippets/v1/listAllSources.js +++ b/security-center/snippets/v1/listAllSources.js @@ -16,7 +16,7 @@ /** Prints all sources in an organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { - // [START securitycenter_list_all_sources] + // [START securitycenter_list_sources] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -41,7 +41,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listSources(); // [END demo] - // [END securitycenter_list_all_sources] + // [END securitycenter_list_sources] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/listFilteredAssets.js b/security-center/snippets/v1/listFilteredAssets.js index 2e8228c7c2..5d5815a981 100644 --- a/security-center/snippets/v1/listFilteredAssets.js +++ b/security-center/snippets/v1/listFilteredAssets.js @@ -18,7 +18,7 @@ * Prints current project assets for the organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { - // [START securitycenter_list_filtered_assets] + // [START securitycenter_list_assets_with_filter] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -51,7 +51,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { listFilteredAssets(); // [END demo] - // [END securitycenter_list_filtered_assets] + // [END securitycenter_list_assets_with_filter] } main(...process.argv.slice(2)); diff --git a/security-center/snippets/v1/setFindingState.js b/security-center/snippets/v1/setFindingState.js index 090753bed6..ed35206ef4 100644 --- a/security-center/snippets/v1/setFindingState.js +++ b/security-center/snippets/v1/setFindingState.js @@ -19,7 +19,7 @@ * CSCC. */ function main(findingName = 'FULL_FINDING_PATH') { - // [START securitycenter_set_finding_state] + // [START securitycenter_update_finding_state] // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -49,7 +49,7 @@ function main(findingName = 'FULL_FINDING_PATH') { } setFindingState(); // [END demo] - // [END securitycenter_set_finding_state] + // [END securitycenter_update_finding_state] } main(...process.argv.slice(2)); From 8062d54e5a48556918fde6dd29dc8294a3436ec0 Mon Sep 17 00:00:00 2001 From: Anthony Date: Mon, 8 Mar 2021 13:17:56 -0800 Subject: [PATCH 53/82] docs: remove unused region tags (#359) * fix unmatched region tag * fix lint * fix bad copy paste * fix another bad copy paste * add new region tags to different demos * update new tags to match most-used tag from other langs * docs: remove unused region tags Co-authored-by: Benjamin E. Coe Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- security-center/snippets/v1/addDeleteSecurityMarks.js | 2 -- security-center/snippets/v1/addFindingSecurityMarks.js | 2 -- security-center/snippets/v1/addSecurityMarks.js | 2 -- security-center/snippets/v1/createFinding.js | 2 -- security-center/snippets/v1/createFindingSourceProperties.js | 2 -- security-center/snippets/v1/createNotificationConfig.js | 2 -- security-center/snippets/v1/createSource.js | 2 -- security-center/snippets/v1/deleteNotificationConfig.js | 2 -- security-center/snippets/v1/deleteSecurityMarks.js | 2 -- security-center/snippets/v1/enableAssetDiscovery.js | 2 -- security-center/snippets/v1/getNotificationConfig.js | 2 -- security-center/snippets/v1/getOrganizationSettings.js | 2 -- security-center/snippets/v1/getSource.js | 2 -- security-center/snippets/v1/getSourceIam.js | 2 -- security-center/snippets/v1/listAllAssets.js | 2 -- security-center/snippets/v1/listAllFindings.js | 2 -- security-center/snippets/v1/listAllSources.js | 2 -- security-center/snippets/v1/listAssetsAndChanges.js | 2 -- security-center/snippets/v1/listAssetsAtTime.js | 2 -- security-center/snippets/v1/listAssetsWithSecurityMarks.js | 2 -- security-center/snippets/v1/listFilteredAssets.js | 2 -- security-center/snippets/v1/listFilteredFindings.js | 2 -- security-center/snippets/v1/listFindingsAtTime.js | 2 -- security-center/snippets/v1/listFindingsWithSecurityMarks.js | 2 -- security-center/snippets/v1/listNotificationConfigs.js | 2 -- security-center/snippets/v1/receiveNotifications.js | 2 -- security-center/snippets/v1/setFindingState.js | 2 -- security-center/snippets/v1/setSourceIam.js | 2 -- security-center/snippets/v1/testIam.js | 2 -- security-center/snippets/v1/updateFindingSourceProperties.js | 2 -- security-center/snippets/v1/updateNotificationConfig.js | 2 -- security-center/snippets/v1/updateSource.js | 2 -- 32 files changed, 64 deletions(-) diff --git a/security-center/snippets/v1/addDeleteSecurityMarks.js b/security-center/snippets/v1/addDeleteSecurityMarks.js index 45096eba6e..000f834625 100644 --- a/security-center/snippets/v1/addDeleteSecurityMarks.js +++ b/security-center/snippets/v1/addDeleteSecurityMarks.js @@ -19,7 +19,6 @@ */ function main(assetName = 'full asset path to add marks to') { // [START securitycenter_add_delete_security_marks] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,7 +43,6 @@ function main(assetName = 'full asset path to add marks to') { console.log('New marks: %j', newMarks); } addDeleteSecurityMarks(); - // [END demo] // [END securitycenter_add_delete_security_marks] } diff --git a/security-center/snippets/v1/addFindingSecurityMarks.js b/security-center/snippets/v1/addFindingSecurityMarks.js index c1516de62e..f834e0cb62 100644 --- a/security-center/snippets/v1/addFindingSecurityMarks.js +++ b/security-center/snippets/v1/addFindingSecurityMarks.js @@ -18,7 +18,6 @@ */ function main(findingName = 'full finding path to add marks to') { // [START securitycenter_add_finding_security_marks] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,7 +43,6 @@ function main(findingName = 'full finding path to add marks to') { console.log('New marks: %j', newMarks); } addFindingSecurityMarks(); - // [END demo] // [END securitycenter_add_finding_security_marks] } diff --git a/security-center/snippets/v1/addSecurityMarks.js b/security-center/snippets/v1/addSecurityMarks.js index ce68e5f025..203efef8f9 100644 --- a/security-center/snippets/v1/addSecurityMarks.js +++ b/security-center/snippets/v1/addSecurityMarks.js @@ -19,7 +19,6 @@ */ function main(assetName = 'full asset path to add marks to') { // [START securitycenter_add_security_marks] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,7 +43,6 @@ function main(assetName = 'full asset path to add marks to') { console.log('New marks: %', newMarks); } addSecurityMarks(); - // [END demo] // [END securitycenter_add_security_marks] } diff --git a/security-center/snippets/v1/createFinding.js b/security-center/snippets/v1/createFinding.js index 5e8a7f8654..4e360ae31e 100644 --- a/security-center/snippets/v1/createFinding.js +++ b/security-center/snippets/v1/createFinding.js @@ -19,7 +19,6 @@ */ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { // [START securitycenter_create_finding] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -56,7 +55,6 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { console.log('New finding created: %j', newFinding); } createFinding(); - // [END demo] // [END securitycenter_create_finding] } diff --git a/security-center/snippets/v1/createFindingSourceProperties.js b/security-center/snippets/v1/createFindingSourceProperties.js index e752d46477..8f15c79828 100644 --- a/security-center/snippets/v1/createFindingSourceProperties.js +++ b/security-center/snippets/v1/createFindingSourceProperties.js @@ -20,7 +20,6 @@ */ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { // [START securitycenter_create_finding_with_source_properties] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -61,7 +60,6 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') { console.log('New finding created: %j', newFinding); } createFinding(); - // [END demo] // [END securitycenter_create_finding_with_source_properties] } diff --git a/security-center/snippets/v1/createNotificationConfig.js b/security-center/snippets/v1/createNotificationConfig.js index d9539c2906..d08431c0d9 100644 --- a/security-center/snippets/v1/createNotificationConfig.js +++ b/security-center/snippets/v1/createNotificationConfig.js @@ -19,7 +19,6 @@ function main( pubsubTopic = 'projects/{your-project}/topics/{your-topic}' ) { // [START securitycenter_create_notification_config] - // [START scc_create_notification_config] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -46,7 +45,6 @@ function main( } createNotificationConfig(); - // [END scc_create_notification_config] // [END securitycenter_create_notification_config] } diff --git a/security-center/snippets/v1/createSource.js b/security-center/snippets/v1/createSource.js index e96af5f7cb..4d85070867 100644 --- a/security-center/snippets/v1/createSource.js +++ b/security-center/snippets/v1/createSource.js @@ -19,7 +19,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_create_source] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -41,7 +40,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { console.log('New Source: %j', source); } createSource(); - // [END demo] // [END securitycenter_create_source] } diff --git a/security-center/snippets/v1/deleteNotificationConfig.js b/security-center/snippets/v1/deleteNotificationConfig.js index 19d413121d..944f28b20e 100644 --- a/security-center/snippets/v1/deleteNotificationConfig.js +++ b/security-center/snippets/v1/deleteNotificationConfig.js @@ -15,7 +15,6 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { // [START securitycenter_delete_notification_config] - // [START scc_delete_notification_config] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -34,7 +33,6 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { } deleteNotificationConfg(); - // [END scc_delete_notification_config] // [END securitycenter_delete_notification_config] } diff --git a/security-center/snippets/v1/deleteSecurityMarks.js b/security-center/snippets/v1/deleteSecurityMarks.js index a5a988711d..7ed7e187ae 100644 --- a/security-center/snippets/v1/deleteSecurityMarks.js +++ b/security-center/snippets/v1/deleteSecurityMarks.js @@ -19,7 +19,6 @@ */ function main(assetName = 'full asset path to add marks to') { // [START securitycenter_delete_security_marks] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,7 +43,6 @@ function main(assetName = 'full asset path to add marks to') { console.log('Updated marks: %j', newMarks); } deleteSecurityMarks(); - // [END demo] // [END securitycenter_delete_security_marks] } diff --git a/security-center/snippets/v1/enableAssetDiscovery.js b/security-center/snippets/v1/enableAssetDiscovery.js index 3fdd401161..af11e12d48 100644 --- a/security-center/snippets/v1/enableAssetDiscovery.js +++ b/security-center/snippets/v1/enableAssetDiscovery.js @@ -19,7 +19,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_enable_asset_discovery] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -45,7 +44,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { console.log('New settings: %j', newSettings); } updateOrgSettings(); - // [END demo] // [END securitycenter_enable_asset_discovery] } diff --git a/security-center/snippets/v1/getNotificationConfig.js b/security-center/snippets/v1/getNotificationConfig.js index e587ef565f..a6742c9c73 100644 --- a/security-center/snippets/v1/getNotificationConfig.js +++ b/security-center/snippets/v1/getNotificationConfig.js @@ -15,7 +15,6 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { // [START securitycenter_get_notification_config] - // [START scc_get_notification_configs] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -36,7 +35,6 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') { } getNotificationConfg(); - // [END scc_get_notification_configs] // [END securitycenter_get_notification_config] } diff --git a/security-center/snippets/v1/getOrganizationSettings.js b/security-center/snippets/v1/getOrganizationSettings.js index 4b1a700847..3e169f0b87 100644 --- a/security-center/snippets/v1/getOrganizationSettings.js +++ b/security-center/snippets/v1/getOrganizationSettings.js @@ -20,7 +20,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_get_org_settings] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -41,7 +40,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { console.log('Current settings: %j', settings); } getOrgSettings(); - // [END demo] // [END securitycenter_get_org_settings] } diff --git a/security-center/snippets/v1/getSource.js b/security-center/snippets/v1/getSource.js index 4e0c855c51..1603221e03 100644 --- a/security-center/snippets/v1/getSource.js +++ b/security-center/snippets/v1/getSource.js @@ -20,7 +20,6 @@ */ function main(sourceName = 'FULL_PATH_TO_SOURCE') { // [START securitycenter_get_source] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -37,7 +36,6 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') { } getSource(); - // [END demo] // [END securitycenter_get_source] } diff --git a/security-center/snippets/v1/getSourceIam.js b/security-center/snippets/v1/getSourceIam.js index 4ff3ae2529..e2e37a6f89 100644 --- a/security-center/snippets/v1/getSourceIam.js +++ b/security-center/snippets/v1/getSourceIam.js @@ -19,7 +19,6 @@ */ function main(sourceName = 'FULL_PATH_TO_SOURCE') { // [START securitycenter_get_source_iam] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -40,7 +39,6 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') { console.log('Current policy: %j', existingPolicy); } getSourceIamPolicy(); - // [END demo] // [END securitycenter_get_source_iam] } diff --git a/security-center/snippets/v1/listAllAssets.js b/security-center/snippets/v1/listAllAssets.js index 32fb7e9b89..85c42cc437 100644 --- a/security-center/snippets/v1/listAllAssets.js +++ b/security-center/snippets/v1/listAllAssets.js @@ -17,7 +17,6 @@ /** Prints all assets in an organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_all_assets] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -43,7 +42,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listAssets(); - // [END demo] // [END securitycenter_list_all_assets] } diff --git a/security-center/snippets/v1/listAllFindings.js b/security-center/snippets/v1/listAllFindings.js index 6e2ecdbc5a..fba81eb297 100644 --- a/security-center/snippets/v1/listAllFindings.js +++ b/security-center/snippets/v1/listAllFindings.js @@ -17,7 +17,6 @@ /** Prints all findings across all sources. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_all_findings] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -42,7 +41,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { ); } listAllFindings(); - // [END demo] // [END securitycenter_list_all_findings] } diff --git a/security-center/snippets/v1/listAllSources.js b/security-center/snippets/v1/listAllSources.js index 7567fbf49f..44e21d87a3 100644 --- a/security-center/snippets/v1/listAllSources.js +++ b/security-center/snippets/v1/listAllSources.js @@ -17,7 +17,6 @@ /** Prints all sources in an organization. */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_sources] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -40,7 +39,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listSources(); - // [END demo] // [END securitycenter_list_sources] } diff --git a/security-center/snippets/v1/listAssetsAndChanges.js b/security-center/snippets/v1/listAssetsAndChanges.js index a735462014..233629bbf9 100644 --- a/security-center/snippets/v1/listAssetsAndChanges.js +++ b/security-center/snippets/v1/listAssetsAndChanges.js @@ -20,7 +20,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_assets_and_changes] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -51,7 +50,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listAssetsAndChanges(); - // [END demo] // [END securitycenter_list_assets_and_changes] } diff --git a/security-center/snippets/v1/listAssetsAtTime.js b/security-center/snippets/v1/listAssetsAtTime.js index 042be1d6f9..72aeef914f 100644 --- a/security-center/snippets/v1/listAssetsAtTime.js +++ b/security-center/snippets/v1/listAssetsAtTime.js @@ -19,7 +19,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_assets_at_time] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -59,7 +58,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listAssetsAtTime(); - // [END demo] // [END securitycenter_list_assets_at_time] } diff --git a/security-center/snippets/v1/listAssetsWithSecurityMarks.js b/security-center/snippets/v1/listAssetsWithSecurityMarks.js index 10035529b9..634401ddd4 100644 --- a/security-center/snippets/v1/listAssetsWithSecurityMarks.js +++ b/security-center/snippets/v1/listAssetsWithSecurityMarks.js @@ -19,7 +19,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_assets_with_security_marks] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -49,7 +48,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listAssetsWithSecurityMarks(); - // [END demo] // [END securitycenter_list_assets_with_security_marks] } diff --git a/security-center/snippets/v1/listFilteredAssets.js b/security-center/snippets/v1/listFilteredAssets.js index 5d5815a981..092db25279 100644 --- a/security-center/snippets/v1/listFilteredAssets.js +++ b/security-center/snippets/v1/listFilteredAssets.js @@ -19,7 +19,6 @@ */ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_assets_with_filter] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -50,7 +49,6 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') { } listFilteredAssets(); - // [END demo] // [END securitycenter_list_assets_with_filter] } diff --git a/security-center/snippets/v1/listFilteredFindings.js b/security-center/snippets/v1/listFilteredFindings.js index 8c616f002a..295aeb5aa2 100644 --- a/security-center/snippets/v1/listFilteredFindings.js +++ b/security-center/snippets/v1/listFilteredFindings.js @@ -17,7 +17,6 @@ /** Demonstrates listing only specific findings. */ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_filtered_findings] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,7 +43,6 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { ); } listFilteredFindings(); - // [END demo] // [END securitycenter_list_filtered_findings] } diff --git a/security-center/snippets/v1/listFindingsAtTime.js b/security-center/snippets/v1/listFindingsAtTime.js index 3ead9c1c98..c3032f5b13 100644 --- a/security-center/snippets/v1/listFindingsAtTime.js +++ b/security-center/snippets/v1/listFindingsAtTime.js @@ -17,7 +17,6 @@ /** Demonstrates listing findings at a point in time. */ function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') { // [START securitycenter_list_findings_at_time] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -50,7 +49,6 @@ function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') { ); } listFindingsAtTime(); - // [END demo] // [END securitycenter_list_findings_at_time] } diff --git a/security-center/snippets/v1/listFindingsWithSecurityMarks.js b/security-center/snippets/v1/listFindingsWithSecurityMarks.js index 3fca1cd24d..4eb6cde0f0 100644 --- a/security-center/snippets/v1/listFindingsWithSecurityMarks.js +++ b/security-center/snippets/v1/listFindingsWithSecurityMarks.js @@ -17,7 +17,6 @@ /** Demonstrates listing findings by filtering on security marks. */ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { // [START securitycenter_list_findings_with_security_marks] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -44,7 +43,6 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') { ); } listFindingsWithSecurityMarks(); - // [END demo] // [END securitycenter_list_findings_with_security_marks] } diff --git a/security-center/snippets/v1/listNotificationConfigs.js b/security-center/snippets/v1/listNotificationConfigs.js index cca1fd77a7..beb5e49c2f 100644 --- a/security-center/snippets/v1/listNotificationConfigs.js +++ b/security-center/snippets/v1/listNotificationConfigs.js @@ -15,7 +15,6 @@ function main(organizationId = 'your-org-id') { // [START securitycenter_list_notification_configs] - // [START scc_list_notification_configs] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -33,7 +32,6 @@ function main(organizationId = 'your-org-id') { } listNotificationConfigs(); - // [END scc_list_notification_configs] // [END securitycenter_list_notification_configs] } diff --git a/security-center/snippets/v1/receiveNotifications.js b/security-center/snippets/v1/receiveNotifications.js index e1ab9d0b55..604e17f7e7 100644 --- a/security-center/snippets/v1/receiveNotifications.js +++ b/security-center/snippets/v1/receiveNotifications.js @@ -18,7 +18,6 @@ function main( subscriptionId = 'your-subscription-id' ) { // [START securitycenter_receive_notifications] - // [START scc_receive_notifications] const {PubSub} = require('@google-cloud/pubsub'); const {StringDecoder} = require('string_decoder'); @@ -55,7 +54,6 @@ function main( } listenForMessages(); - // [END scc_receive_notifications] // [END securitycenter_receive_notifications] } diff --git a/security-center/snippets/v1/setFindingState.js b/security-center/snippets/v1/setFindingState.js index ed35206ef4..8857afe2db 100644 --- a/security-center/snippets/v1/setFindingState.js +++ b/security-center/snippets/v1/setFindingState.js @@ -20,7 +20,6 @@ */ function main(findingName = 'FULL_FINDING_PATH') { // [START securitycenter_update_finding_state] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -48,7 +47,6 @@ function main(findingName = 'FULL_FINDING_PATH') { console.log('Updated Finding: %j', updatedFinding); } setFindingState(); - // [END demo] // [END securitycenter_update_finding_state] } diff --git a/security-center/snippets/v1/setSourceIam.js b/security-center/snippets/v1/setSourceIam.js index 5e4f8f93f0..40d477e137 100644 --- a/security-center/snippets/v1/setSourceIam.js +++ b/security-center/snippets/v1/setSourceIam.js @@ -22,7 +22,6 @@ function main( user = 'someuser@domain.com' ) { // [START securitycenter_set_source_iam] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -59,7 +58,6 @@ function main( console.log('Updated policy: %j', updatedPolicy); } setSourceIamPolicy(); - // [END demo] // [END securitycenter_set_source_iam] } diff --git a/security-center/snippets/v1/testIam.js b/security-center/snippets/v1/testIam.js index 35c081726e..14f23379be 100644 --- a/security-center/snippets/v1/testIam.js +++ b/security-center/snippets/v1/testIam.js @@ -20,7 +20,6 @@ */ function main(sourceName = 'FULL_SOURCE_PATH') { // [START securitycenter_test_iam] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -55,7 +54,6 @@ function main(sourceName = 'FULL_SOURCE_PATH') { } } testIam(); - // [END demo] // [END securitycenter_test_iam] } diff --git a/security-center/snippets/v1/updateFindingSourceProperties.js b/security-center/snippets/v1/updateFindingSourceProperties.js index 09532cd6b1..1db64e3e8b 100644 --- a/security-center/snippets/v1/updateFindingSourceProperties.js +++ b/security-center/snippets/v1/updateFindingSourceProperties.js @@ -19,7 +19,6 @@ */ function main(findingName = 'FULL_FINDING_PATH') { // [START securitycenter_update_finding_source_properties] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -54,7 +53,6 @@ function main(findingName = 'FULL_FINDING_PATH') { console.log('Updated Finding: %j', newFinding); } updateFinding(); - // [END demo] // [END securitycenter_update_finding_source_properties] } diff --git a/security-center/snippets/v1/updateNotificationConfig.js b/security-center/snippets/v1/updateNotificationConfig.js index f745bce0d7..a66d327948 100644 --- a/security-center/snippets/v1/updateNotificationConfig.js +++ b/security-center/snippets/v1/updateNotificationConfig.js @@ -19,7 +19,6 @@ function main( pubsubTopic = 'projects/{your-project}/topics/{your-topic}' ) { // [START securitycenter_update_notification_config] - // [START scc_update_notification_config] // npm install @google-cloud/security-center/ const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -51,7 +50,6 @@ function main( } updateNotificationConfig(); - // [END scc_update_notification_config] // [END securitycenter_update_notification_config] } diff --git a/security-center/snippets/v1/updateSource.js b/security-center/snippets/v1/updateSource.js index fbb219e6be..586c0ef34d 100644 --- a/security-center/snippets/v1/updateSource.js +++ b/security-center/snippets/v1/updateSource.js @@ -20,7 +20,6 @@ */ function main(sourceName = 'FULL_PATH_TO_SOURCE') { // [START securitycenter_update_source] - // [START demo] // Imports the Google Cloud client library. const {SecurityCenterClient} = require('@google-cloud/security-center'); @@ -45,7 +44,6 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') { } updateSource(); - // [END demo] // [END securitycenter_update_source] } From 895d28f0d9f7890d3e133c6149feed61ec750f89 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 10:34:31 -0700 Subject: [PATCH 54/82] chore: release 5.3.0 (#381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: release 5.3.0 * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index a911d1d1ec..f0b88d10ee 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.2.0" + "@google-cloud/security-center": "^5.3.0" }, "devDependencies": { "chai": "^4.2.0", From a4c25574d623a99576edddf4157c7d701f6bd505 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 18:23:02 -0400 Subject: [PATCH 55/82] chore: release 5.3.1 (#386) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index f0b88d10ee..c3deaed11a 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.3.0" + "@google-cloud/security-center": "^5.3.1" }, "devDependencies": { "chai": "^4.2.0", From 3fe0a61657f594c4aa150f9d81c5c98b0d54007a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 09:38:50 -0700 Subject: [PATCH 56/82] chore: release 5.3.2 (#397) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index c3deaed11a..e32f1f2488 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.3.1" + "@google-cloud/security-center": "^5.3.2" }, "devDependencies": { "chai": "^4.2.0", From b47552e24ba88fd4a0f2241ef8e9cd0500a50e18 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 16:30:30 +0000 Subject: [PATCH 57/82] chore: release 5.3.3 (#402) :robot: I have created a release \*beep\* \*boop\* --- ### [5.3.3](https://www.github.com/googleapis/nodejs-security-center/compare/v5.3.2...v5.3.3) (2021-06-30) ### Bug Fixes * **deps:** google-gax v2.17.0 with mTLS ([#400](https://www.github.com/googleapis/nodejs-security-center/issues/400)) ([0f35393](https://www.github.com/googleapis/nodejs-security-center/commit/0f35393b8e64fdabc170eb264de5e5a54a0c6f2e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index e32f1f2488..da224d58ea 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.3.2" + "@google-cloud/security-center": "^5.3.3" }, "devDependencies": { "chai": "^4.2.0", From 01120477997a55d992cd0f83fc4b484cd680d2cd Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 22:22:29 +0000 Subject: [PATCH 58/82] chore: release 5.3.4 (#404) :robot: I have created a release \*beep\* \*boop\* --- ### [5.3.4](https://www.github.com/googleapis/nodejs-security-center/compare/v5.3.3...v5.3.4) (2021-07-12) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#403](https://www.github.com/googleapis/nodejs-security-center/issues/403)) ([5bc78fb](https://www.github.com/googleapis/nodejs-security-center/commit/5bc78fbd4b038320032d8905af064a42d62e0c2f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index da224d58ea..014f50a17e 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.3.3" + "@google-cloud/security-center": "^5.3.4" }, "devDependencies": { "chai": "^4.2.0", From 97aa779247f2960369cfd70a4dc1380e995cfdb3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 12:50:17 -0700 Subject: [PATCH 59/82] chore: release 5.3.5 (#406) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 014f50a17e..3d5e137512 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.3.4" + "@google-cloud/security-center": "^5.3.5" }, "devDependencies": { "chai": "^4.2.0", From df41b5d6e8840d0d36029d678b0baec2beab5c7b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 30 Jul 2021 19:36:27 +0000 Subject: [PATCH 60/82] chore: release 5.4.0 (#411) :robot: I have created a release \*beep\* \*boop\* --- ## [5.4.0](https://www.github.com/googleapis/nodejs-security-center/compare/v5.3.5...v5.4.0) (2021-07-30) ### Features * add finding_class and indicator fields in Finding ([#409](https://www.github.com/googleapis/nodejs-security-center/issues/409)) ([d0abd01](https://www.github.com/googleapis/nodejs-security-center/commit/d0abd013b359b1876c16e7f4ee6b8c873acc5014)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 3d5e137512..a5194e3cf6 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.3.5" + "@google-cloud/security-center": "^5.4.0" }, "devDependencies": { "chai": "^4.2.0", From ff2c0ca2f5ddb522f183b3b61c8407f14356c7b1 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:14:20 +0000 Subject: [PATCH 61/82] chore: release 5.4.1 (#416) :robot: I have created a release \*beep\* \*boop\* --- ### [5.4.1](https://www.github.com/googleapis/nodejs-security-center/compare/v5.4.0...v5.4.1) (2021-08-17) ### Bug Fixes * **deps:** google-gax v2.24.1 ([#415](https://www.github.com/googleapis/nodejs-security-center/issues/415)) ([aa77ac3](https://www.github.com/googleapis/nodejs-security-center/commit/aa77ac33ed9e20e75505fb4d31183a0f1f0d1f76)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index a5194e3cf6..db207583a8 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.4.0" + "@google-cloud/security-center": "^5.4.1" }, "devDependencies": { "chai": "^4.2.0", From 2c07ebf3da9cb0637d17358061c395a260eb20ff Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 18:40:14 +0000 Subject: [PATCH 62/82] chore: release 5.5.0 (#418) :robot: I have created a release \*beep\* \*boop\* --- ## [5.5.0](https://www.github.com/googleapis/nodejs-security-center/compare/v5.4.1...v5.5.0) (2021-08-23) ### Features * turns on self-signed JWT feature flag ([#417](https://www.github.com/googleapis/nodejs-security-center/issues/417)) ([ec4b179](https://www.github.com/googleapis/nodejs-security-center/commit/ec4b17916d42f9ff006b9c9d0c1a6c2dd0743fa7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index db207583a8..3e2e3d4cb7 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.4.1" + "@google-cloud/security-center": "^5.5.0" }, "devDependencies": { "chai": "^4.2.0", From 5055b1064495419f47a15a3379d90f197840ff4b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 10 Sep 2021 10:53:35 -0700 Subject: [PATCH 63/82] chore: release 5.5.1 (#421) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 3e2e3d4cb7..b65b485132 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.5.0" + "@google-cloud/security-center": "^5.5.1" }, "devDependencies": { "chai": "^4.2.0", From a4e4424541b7428fdefe11ec7fee0386a26dce39 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 09:19:16 -0700 Subject: [PATCH 64/82] feat: Added vulnerability field to the finding feat: Added type field to the resource which is surfaced in NotificationMessage (#428) PiperOrigin-RevId: 401787368 Source-Link: https://github.com/googleapis/googleapis/commit/a7a3440103e7821aae4a3531756f2ad22a270e77 Source-Link: https://github.com/googleapis/googleapis-gen/commit/169ba7febf00ee030446a0534ac77ad57f0bf83a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTY5YmE3ZmViZjAwZWUwMzA0NDZhMDUzNGFjNzdhZDU3ZjBiZjgzYSJ9 --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index b65b485132..4c50c616c4 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -6,7 +6,7 @@ "!system-test/" ], "engines": { - "node": ">=8" + "node": ">=10" }, "scripts": { "test": "mocha system-test/ --recursive --timeout 6000000" From 066036f82050f26ee38f6fccf33f0beffd557c76 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 16:26:16 +0000 Subject: [PATCH 65/82] chore: release 5.6.0 (#430) :robot: I have created a release \*beep\* \*boop\* --- ## [5.6.0](https://www.github.com/googleapis/nodejs-security-center/compare/v5.5.1...v5.6.0) (2021-10-14) ### Features * Added type field to the resource which is surfaced in NotificationMessage ([#428](https://www.github.com/googleapis/nodejs-security-center/issues/428)) ([924aaec](https://www.github.com/googleapis/nodejs-security-center/commit/924aaec714aec659a2cff0c995a00a9a269ca9d6)) * Added vulnerability field to the finding ([924aaec](https://www.github.com/googleapis/nodejs-security-center/commit/924aaec714aec659a2cff0c995a00a9a269ca9d6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 4c50c616c4..01e334e0a0 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.5.1" + "@google-cloud/security-center": "^5.6.0" }, "devDependencies": { "chai": "^4.2.0", From a643e21a946a838b7749a5bf5a23cf555a53bc28 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 15 Nov 2021 18:38:16 +0000 Subject: [PATCH 66/82] chore: release 5.7.0 (#439) :robot: I have created a release \*beep\* \*boop\* --- ## [5.7.0](https://www.github.com/googleapis/nodejs-security-center/compare/v5.6.0...v5.7.0) (2021-11-15) ### Features * Added mute related APIs, proto messages and fields ([#438](https://www.github.com/googleapis/nodejs-security-center/issues/438)) ([d432649](https://www.github.com/googleapis/nodejs-security-center/commit/d432649fed31f92a6048769b6b889666f5b9cced)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 01e334e0a0..04b4da2a4f 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.6.0" + "@google-cloud/security-center": "^5.7.0" }, "devDependencies": { "chai": "^4.2.0", From 9e88d7d7388303bec4d83d67ecc252cbcb26d59f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 29 Nov 2021 10:09:37 -0800 Subject: [PATCH 67/82] chore: release 5.8.0 (#442) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 04b4da2a4f..fbb82371c4 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.7.0" + "@google-cloud/security-center": "^5.8.0" }, "devDependencies": { "chai": "^4.2.0", From e18892d7a4451eda4911f0e50dde87d5f8ca70ec Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 7 Feb 2022 14:55:28 -0800 Subject: [PATCH 68/82] chore(main): release 5.9.0 (#458) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index fbb82371c4..d261126e82 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.8.0" + "@google-cloud/security-center": "^5.9.0" }, "devDependencies": { "chai": "^4.2.0", From b3af98e4bb007cb851ac13e4d14645e1011a6650 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 20:28:15 +0000 Subject: [PATCH 69/82] chore(main): release 5.10.0 (#471) :robot: I have created a release *beep* *boop* --- ## [5.10.0](https://github.com/googleapis/nodejs-security-center/compare/v5.9.0...v5.10.0) (2022-04-11) ### Features * Add iam_binding field to findings attributes. It represents particular IAM bindings, which captures a member's role addition, removal, or state ([#474](https://github.com/googleapis/nodejs-security-center/issues/474)) ([b29893c](https://github.com/googleapis/nodejs-security-center/commit/b29893c112a346a3277620a01e5ce391097f3c40)) * Add next_steps field to finding's list of attributes ([#476](https://github.com/googleapis/nodejs-security-center/issues/476)) ([326e8d2](https://github.com/googleapis/nodejs-security-center/commit/326e8d2242d0852df593474dbc028ea17fb8d600)) * AuditConfig for IAM v1 ([#470](https://github.com/googleapis/nodejs-security-center/issues/470)) ([2ec070f](https://github.com/googleapis/nodejs-security-center/commit/2ec070f504fe85bd1c9adf7436b7d8c902ec167b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index d261126e82..e67b9c4d6a 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.9.0" + "@google-cloud/security-center": "^5.10.0" }, "devDependencies": { "chai": "^4.2.0", From 71312f0f2ee83945e5b23bb1b256744b693399c9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 6 May 2022 12:53:24 -0700 Subject: [PATCH 70/82] chore(main): release 5.11.0 (#480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 5.11.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index e67b9c4d6a..a58c283408 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.10.0" + "@google-cloud/security-center": "^5.11.0" }, "devDependencies": { "chai": "^4.2.0", From 018a2516448ce06d09d256fa46dfe418e3a63769 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Wed, 18 May 2022 10:48:58 -0700 Subject: [PATCH 71/82] build!: update library to use Node 12 (#486) * build!: Update library to use Node 12 Co-authored-by: Owl Bot --- security-center/snippets/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index a58c283408..2ecec9af2e 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -6,7 +6,7 @@ "!system-test/" ], "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "scripts": { "test": "mocha system-test/ --recursive --timeout 6000000" @@ -21,4 +21,4 @@ "mocha": "^8.0.0", "uuid": "^8.0.0" } -} +} \ No newline at end of file From 2e912cec823c6d031df489c6d01a171949f1a3c5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:51:15 -0400 Subject: [PATCH 72/82] chore(main): release 6.0.0 (#488) See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 2ecec9af2e..cda68190c0 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^2.0.0", - "@google-cloud/security-center": "^5.11.0" + "@google-cloud/security-center": "^6.0.0" }, "devDependencies": { "chai": "^4.2.0", From ec6261db730b93b26c0c478fd702e354cfc89865 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 7 Jun 2022 22:07:25 +0200 Subject: [PATCH 73/82] chore(deps): update dependency @google-cloud/pubsub to v3 (#489) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index cda68190c0..bff756a32d 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -13,7 +13,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/pubsub": "^2.0.0", + "@google-cloud/pubsub": "^3.0.0", "@google-cloud/security-center": "^6.0.0" }, "devDependencies": { From 531cb09d46b3215603a0f033afa5173f82be1d0e Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 4 Jul 2022 14:42:38 -0400 Subject: [PATCH 74/82] chore(main): release 6.1.0 (#496) See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index bff756a32d..bcaea7bba5 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^3.0.0", - "@google-cloud/security-center": "^6.0.0" + "@google-cloud/security-center": "^6.1.0" }, "devDependencies": { "chai": "^4.2.0", From c45f26cda904537236aa62d91472192249939674 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 13:41:11 -0700 Subject: [PATCH 75/82] chore(main): release 6.2.0 (#500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 6.2.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index bcaea7bba5..db53298864 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^3.0.0", - "@google-cloud/security-center": "^6.1.0" + "@google-cloud/security-center": "^6.2.0" }, "devDependencies": { "chai": "^4.2.0", From cddbb86a205150d15ac257c034145d15db847fdc Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 26 Aug 2022 12:23:12 -0700 Subject: [PATCH 76/82] chore(main): release 6.3.0 (#502) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 6.3.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index db53298864..224d5bcd75 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^3.0.0", - "@google-cloud/security-center": "^6.2.0" + "@google-cloud/security-center": "^6.3.0" }, "devDependencies": { "chai": "^4.2.0", From 01fbe56d78e09720cc4c336a5e3c08827e20a310 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:06:19 -0400 Subject: [PATCH 77/82] chore(main): release 6.3.1 (#508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 6.3.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index 224d5bcd75..ee48074fdf 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/pubsub": "^3.0.0", - "@google-cloud/security-center": "^6.3.0" + "@google-cloud/security-center": "^6.3.1" }, "devDependencies": { "chai": "^4.2.0", From c27740c385eeb8d05485f6164754260f6380824d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 9 Sep 2022 04:03:21 +0200 Subject: [PATCH 78/82] chore(deps): update dependency uuid to v9 (#509) --- security-center/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security-center/snippets/package.json b/security-center/snippets/package.json index ee48074fdf..cb626bcbc6 100644 --- a/security-center/snippets/package.json +++ b/security-center/snippets/package.json @@ -19,6 +19,6 @@ "devDependencies": { "chai": "^4.2.0", "mocha": "^8.0.0", - "uuid": "^8.0.0" + "uuid": "^9.0.0" } } \ No newline at end of file From 53cf94522af7b9fc70540af975c8836885174315 Mon Sep 17 00:00:00 2001 From: Aaron Gabriel Neyer Date: Thu, 17 Nov 2022 11:24:09 -0700 Subject: [PATCH 79/82] add github workflow for security-center --- .../workflows/security-center-snippets.yaml | 68 +++++++++++++++++++ .github/workflows/workflows.json | 1 + 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/security-center-snippets.yaml diff --git a/.github/workflows/security-center-snippets.yaml b/.github/workflows/security-center-snippets.yaml new file mode 100644 index 0000000000..dfc4b7efcf --- /dev/null +++ b/.github/workflows/security-center-snippets.yaml @@ -0,0 +1,68 @@ +name: security-center-snippets +on: + push: + branches: + - main + paths: + - 'security-center/snippets/**' + pull_request: + paths: + - 'security-center/snippets/**' + pull_request_target: + types: [labeled] + paths: + - 'security-center/snippets/**' + schedule: + - cron: '0 0 * * 0' +jobs: + test: + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: 'write' + pull-requests: 'write' + id-token: 'write' + steps: + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.sha}} + - uses: 'google-github-actions/auth@v1.0.0' + with: + workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' + service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: security-center/snippets + - run: npm test + working-directory: security-center/snippets + env: + MOCHA_REPORTER_SUITENAME: security_center_snippets + MOCHA_REPORTER_OUTPUT: security_center_snippets_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; + } + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/workflows.json b/.github/workflows/workflows.json index 0be8f5d7f2..ebc7e8d809 100644 --- a/.github/workflows/workflows.json +++ b/.github/workflows/workflows.json @@ -57,6 +57,7 @@ "datacatalog/quickstart", "datastore/functions", "scheduler", + "security-center/snippets", "service-directory/snippets", "talent", "video-intelligence", From fb09fa07199987ec0f6a201dce129e65a3c65514 Mon Sep 17 00:00:00 2001 From: Aaron Gabriel Neyer Date: Thu, 17 Nov 2022 12:29:45 -0700 Subject: [PATCH 80/82] remove eslintrc --- .eslintrc.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 282535f55f..0000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -rules: - no-console: off From fda4e5110123118635d8580b09aad66f8f33e57b Mon Sep 17 00:00:00 2001 From: Aaron Gabriel Neyer Date: Fri, 18 Nov 2022 14:06:49 -0700 Subject: [PATCH 81/82] Update .github/workflows/security-center-snippets.yaml Co-authored-by: Nim Jayawardena --- .github/workflows/security-center-snippets.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/security-center-snippets.yaml b/.github/workflows/security-center-snippets.yaml index dfc4b7efcf..e138576fb6 100644 --- a/.github/workflows/security-center-snippets.yaml +++ b/.github/workflows/security-center-snippets.yaml @@ -14,6 +14,9 @@ on: - 'security-center/snippets/**' schedule: - cron: '0 0 * * 0' +env: + GCLOUD_PROJECT: project-a + GCLOUD_ORGANIZATION: 1081635000895 jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} From 1a035ee39a7ee8ef311bff01c56e8d0310196082 Mon Sep 17 00:00:00 2001 From: Aaron Gabriel Neyer Date: Fri, 18 Nov 2022 14:22:32 -0700 Subject: [PATCH 82/82] Update security-center-snippets.yaml --- .github/workflows/security-center-snippets.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/security-center-snippets.yaml b/.github/workflows/security-center-snippets.yaml index e138576fb6..260adf0e1b 100644 --- a/.github/workflows/security-center-snippets.yaml +++ b/.github/workflows/security-center-snippets.yaml @@ -15,7 +15,6 @@ on: schedule: - cron: '0 0 * * 0' env: - GCLOUD_PROJECT: project-a GCLOUD_ORGANIZATION: 1081635000895 jobs: test: