-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(securitycenter): Add Resource SCC Management API Org ETD Custom … #3943
base: main
Are you sure you want to change the base?
Conversation
Here is the summary of changes. You are about to add 5 region tags.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lovenishs04 and reviewers,
I'm currently reviewing this pull request and will provide my feedback in a few minutes. In the meantime, I'm providing this summary of the pull request's content to help you and other reviewers quickly understand the changes and intent.
This pull request, titled "feat(securitycenter): Add Resource SCC Management API Org ETD Custom …", aims to add code samples for the Security Command Center (SCC) Management API's Organization Event Threat Detection Custom Module. The description mentions that it addresses several internal Google issues (b/347347710, b/347347103, b/347347367, b/347347656, b/347347732).
Here's a summary of the changes:
- New files added:
security-center/snippets/management_api/createEventThreatDetectionCustomModule.js
: This file contains code to create a new event threat detection custom module. (Lines 1-94)security-center/snippets/management_api/deleteEventThreatDetectionCustomModule.js
: This file provides code for deleting an existing event threat detection custom module. (Lines 1-63)security-center/snippets/management_api/getEventThreatDetectionCustomModule.js
: This file shows how to retrieve an existing event threat detection custom module. (Lines 1-60)security-center/snippets/management_api/listEventThreatDetectionCustomModules.js
: This file demonstrates listing all event threat detection custom modules under a given parent resource. (Lines 1-58)security-center/snippets/management_api/updateEventThreatDetectionCustomModule.js
: This file contains code to update an existing event threat detection custom module. (Lines 1-73)security-center/snippets/system-test/management_api/eventThreatDetectionCustomModule.test.js
: This file includes system tests for the new custom module functionalities. (Lines 1-181)
security-center/snippets/package.json
updated: The@google-cloud/securitycentermanagement
dependency was added. (Line 18)
The pull request includes comprehensive unit tests. The author has also diligently checked off all items in the provided checklist.
And now, a little haiku to lighten the mood:
Code flows like a stream,
Tests run, a green light appears,
Bugs flee in the night.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lovenishs04 and reviewers,
I'm currently reviewing this pull request and will provide feedback shortly. In the meantime, here's a summary to help everyone get up to speed:
This pull request, feat(securitycenter): Add Resource SCC Management API Org ETD Custom …
, aims to add code samples for the Security Command Center (SCC) Management API's Organization Event Threat Detection Custom Module. Specifically, it includes samples for creating, deleting, listing, getting, and updating custom modules.
Here's a breakdown of the changes:
- New files added:
security-center/snippets/management_api/createEventThreatDetectionCustomModule.js
(lines 1-94): Implements the creation of a new event threat detection custom module.security-center/snippets/management_api/deleteEventThreatDetectionCustomModule.js
(lines 1-63): Implements the deletion of an existing event threat detection custom module.security-center/snippets/management_api/getEventThreatDetectionCustomModule.js
(lines 1-60): Implements retrieving an existing event threat detection custom module.security-center/snippets/management_api/listEventThreatDetectionCustomModules.js
(lines 1-58): Implements listing all event threat detection custom modules under a given parent resource.security-center/snippets/management_api/updateEventThreatDetectionCustomModule.js
(lines 1-73): Implements updating an existing event threat detection custom module.security-center/snippets/system-test/management_api/eventThreatDetectionCustomModule.test.js
(lines 1-181): Adds comprehensive tests for the new functionality.
security-center/snippets/package.json
(line 14-18): Updated dependencies to include@google-cloud/securitycentermanagement
.
The PR addresses issues b/347347710, b/347347103, b/347347367, b/347347656, and b/347347732.
The author has indicated that all tests and lint checks have passed. They have also stated that they have followed all contributing guidelines.
I'll be looking at the code quality, test coverage, and overall functionality in more detail shortly.
And now, a little haiku to brighten your day:
Code flows like a stream,
Tests run green, a joyful sight,
Bugs flee in the night.
Gemini encountered an error creating the review. You can try again by commenting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lovenishs04 and reviewers,
I'm currently reviewing this pull request and will provide my feedback in a few minutes. In the meantime, I'm giving you a summary of the pull request's content to help you and other reviewers quickly understand the changes and their purpose.
This pull request, titled "feat(securitycenter): Add Resource SCC Management API Org ETD Custom …", aims to add code samples for the Security Command Center (SCC) Management API's Organization Event Threat Detection Custom Module. The description mentions it addresses several internal Google issues (b/347347710, b/347347103, b/347347367, b/347347656, b/347347732).
Here's a summary of the changes:
- New files added:
security-center/snippets/management_api/createEventThreatDetectionCustomModule.js
- Adds functionality to create a new event threat detection custom module. (Lines 1-94)security-center/snippets/management_api/deleteEventThreatDetectionCustomModule.js
- Adds functionality to delete an existing event threat detection custom module. (Lines 1-63)security-center/snippets/management_api/getEventThreatDetectionCustomModule.js
- Adds functionality to retrieve an existing event threat detection custom module. (Lines 1-60)security-center/snippets/management_api/listEventThreatDetectionCustomModules.js
- Adds functionality to list all event threat detection custom modules under a given parent resource. (Lines 1-58)security-center/snippets/management_api/updateEventThreatDetectionCustomModule.js
- Adds functionality to update an existing event threat detection custom module. (Lines 1-73)security-center/snippets/system-test/management_api/eventThreatDetectionCustomModule.test.js
- Adds comprehensive test cases for the above functionalities. (Lines 1-181)
security-center/snippets/package.json
updated: Added@google-cloud/securitycentermanagement
as a dependency. (Line 18)
The code samples cover the Create, Delete, List, Get, and Update operations for the SCC Management API's Organization Event Threat Detection Custom Module. The test file includes unit tests to verify the functionality of each sample.
I'll be looking at the code closely to ensure it meets our quality standards. I'll also check for proper error handling, documentation, and adherence to style guidelines.
And now, a little haiku to lighten the mood:
Code flows like a stream,
Tests run, a green light appears,
Bugs flee in the night.
Gemini encountered an error creating the review. You can try again by commenting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lovenishs04 and reviewers,
I'm currently reviewing this pull request and will provide feedback in a few minutes. In the meantime, I'm providing this summary to help you and other reviewers quickly understand the changes and intent.
This pull request, feat(securitycenter): Add Resource SCC Management API Org ETD Custom …
, aims to add code samples for the Security Command Center (SCC) Management API's Organization Event Threat Detection Custom Module. Specifically, it includes samples for creating, deleting, listing, getting, and updating custom modules.
Here's a breakdown of the changes:
- New files added:
security-center/snippets/management_api/createEventThreatDetectionCustomModule.js
(lines 1-94): Implements the creation of a new event threat detection custom module.security-center/snippets/management_api/deleteEventThreatDetectionCustomModule.js
(lines 1-63): Implements the deletion of an existing event threat detection custom module.security-center/snippets/management_api/getEventThreatDetectionCustomModule.js
(lines 1-60): Implements retrieving an existing event threat detection custom module.security-center/snippets/management_api/listEventThreatDetectionCustomModules.js
(lines 1-58): Implements listing all event threat detection custom modules under a given parent resource.security-center/snippets/management_api/updateEventThreatDetectionCustomModule.js
(lines 1-73): Implements updating an existing event threat detection custom module.security-center/snippets/system-test/management_api/eventThreatDetectionCustomModule.test.js
(lines 1-181): Adds comprehensive test cases for the new functionality.
security-center/snippets/package.json
(lines 14-18): Updated dependencies to include@google-cloud/securitycentermanagement
.
The pull request addresses issues b/347347710, b/347347103, b/347347367, b/347347656, and b/347347732. The author has also completed the provided checklist.
I'll be looking at code style, test coverage, and overall functionality in my full review.
And now, a little haiku to lighten the mood:
Code flows like a stream,
Tests run, green lights fill the screen,
A bug's silent scream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request adds Security Command Center Management API organization-level event threat detection custom modules code samples. The samples cover Create, Delete, List, Get, and Update operations. Overall, the code is well-structured and easy to understand. However, there are a few minor improvements that can be made.
//TODO(developer): Update the following references for your own environment before running the sample. | ||
// const organizationId = 'YOUR_ORGANIZATION_ID'; | ||
// const location = 'LOCATION_ID'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using TODO(developer)
, consider using JSDoc style comments to explain the parameters and provide examples.
//TODO(developer): Update the following references for your own environment before running the sample. | |
// const organizationId = 'YOUR_ORGANIZATION_ID'; | |
// const location = 'LOCATION_ID'; | |
/** | |
* @param {string} organizationId Your organization's ID. | |
* @param {string} customModuleDisplayName The human readable name to be displayed for the module. | |
* @param {string} [location=global] The location for the module. | |
*/ |
// define the event threat detection custom module configuration, update the EnablementState | ||
// below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment about updating EnablementState is not clear. Rephrase it to be more descriptive and explain the purpose of EnablementState.
// define the event threat detection custom module configuration, update the EnablementState | |
// below | |
// The enablement state can be ENABLED or DISABLED. | |
// Set to ENABLED to activate the custom module. |
const {describe, it, before, after} = require('mocha'); | ||
const uuid = require('uuid').v4; | ||
|
||
// TODO(developer): update for your own environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Creates a new client. | ||
const client = new SecurityCenterManagementClient(); | ||
|
||
// cleanupExistingCustomModules clean up all the existing custom module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// define the metadata and other config parameters severity, description, | ||
// recommendation and ips below | ||
const config = { | ||
fields: { | ||
metadata: { | ||
structValue: { | ||
fields: { | ||
severity: {stringValue: 'MEDIUM'}, | ||
description: {stringValue: 'add your description here'}, | ||
recommendation: {stringValue: 'add your recommendation'}, | ||
}, | ||
}, | ||
}, | ||
ips: { | ||
listValue: { | ||
values: [{stringValue: '0.0.0.0'}], | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hardcoding the severity, description, and recommendation, consider using variables or environment variables to make the test more flexible and avoid hardcoding values within the tests.
const severity = process.env.SEVERITY || 'MEDIUM';
const description = process.env.DESCRIPTION || 'add your description here';
const recommendation = process.env.RECOMMENDATION || 'add your recommendation';
const ips = process.env.IPS || ['0.0.0.0'];
// define the metadata and other config parameters severity, description,
// recommendation and ips
const config = {
fields: {
metadata: {
structValue: {
fields: {
severity: {stringValue: severity},
description: {stringValue: description},
recommendation: {stringValue: recommendation},
},
},
},
ips: {
listValue: {
values: ips.map(ip => ({stringValue: ip})),
},
},
},
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lovenishs04 and reviewers,
I'm currently reviewing this pull request and will provide a full review shortly. In the meantime, here's a summary to help everyone quickly understand the changes:
This pull request, feat(securitycenter): Add Resource SCC Management API Org ETD Custom …
, aims to add code samples for the Security Command Center (SCC) Management API's Organization Event Threat Detection Custom Module. Specifically, it includes samples for creating, deleting, listing, getting, and updating these custom modules.
Here's a breakdown of the changes:
- New files added:
security-center/snippets/management_api/createEventThreatDetectionCustomModule.js
(lines 1-94): Implements the creation of a new event threat detection custom module.security-center/snippets/management_api/deleteEventThreatDetectionCustomModule.js
(lines 1-63): Implements the deletion of an existing event threat detection custom module.security-center/snippets/management_api/getEventThreatDetectionCustomModule.js
(lines 1-60): Implements retrieving an existing event threat detection custom module.security-center/snippets/management_api/listEventThreatDetectionCustomModules.js
(lines 1-58): Implements listing all event threat detection custom modules under a given parent resource.security-center/snippets/management_api/updateEventThreatDetectionCustomModule.js
(lines 1-73): Implements updating an existing event threat detection custom module.security-center/snippets/system-test/management_api/eventThreatDetectionCustomModule.test.js
(lines 1-181): Adds comprehensive system tests for all the above functionalities.
security-center/snippets/package.json
(line 14-18): Updates the dependencies to include@google-cloud/securitycentermanagement
.
The PR addresses issues b/347347710, b/347347103, b/347347367, b/347347656, and b/347347732.
The author has also included a checklist to ensure all necessary steps have been followed (testing, linting, etc.).
I'll provide a more detailed review shortly.
A little coding haiku for your enjoyment:
Code flows like a stream,
Tests run green, a joyful sight,
Bugs flee in the night.
Gemini encountered an error creating the review. You can try again by commenting |
…modules
Description
Fixes # b/347347710, b/347347103, b/347347367, b/347347656, b/347347732
This PR adds SCC Managament API Org Event Threat Detection Custom Module Code Samples for Create, Delete, List ,Get & Update.
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
npm test
(see Testing)npm run lint
(see Style)GoogleCloudPlatform/nodejs-docs-samples
. Not a fork.