-
Notifications
You must be signed in to change notification settings - Fork 69
[Buganizer ID: 494154345] Feature: Add List Resource Vulnerability Findings action to Wiz integration #683
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
Open
sedovolosiy
wants to merge
9
commits into
main
Choose a base branch
from
494154345-wiz-action-list-resource-vulnerability-findings-
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8023110
feat(wiz): Add List Resource Vulnerability Findings action (b/494154345)
sedovolosiy 72cc1ca
added widget template for action
sedovolosiy a48eaf0
The fix ensures that the generated GraphQL query matches the structur…
sedovolosiy 3e4e35f
Wiz: Update List Resource Vulnerability Findings widget
sedovolosiy 8b79b7a
feat(wiz): Standardize vulnerability findings output and update widget
sedovolosiy 4e0561c
updated logo in wiz template widget
sedovolosiy 7b11e52
Merge branch 'main' into 494154345-wiz-action-list-resource-vulnerabi…
sedovolosiy 512158d
updated default_value to 500 for "Max Findings To Return" params in w…
sedovolosiy 3bef4be
use DEFAULT_MAX_FINDINGS in action as default value; wiz b/494154345
sedovolosiy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 186 additions & 0 deletions
186
...onse_integrations/third_party/partner/wiz/actions/list_resource_vulnerability_findings.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| # Copyright 2026 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. | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING, Any | ||
|
|
||
| from TIPCommon.base.action import Action | ||
| from TIPCommon.extraction import extract_action_param | ||
|
|
||
| from ..core import action_init, api_client, constants | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import NoReturn | ||
|
|
||
| from TIPCommon.types import SingleJson | ||
|
|
||
|
|
||
| class ListResourceVulnerabilityFindings(Action): | ||
| def __init__(self) -> None: | ||
| super().__init__(constants.LIST_RESOURCE_VULNERABILITY_FINDINGS_SCRIPT_NAME) | ||
|
|
||
| def _extract_action_parameters(self) -> None: | ||
| self.params.resource_names = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Resource Name", | ||
| is_mandatory=True, | ||
| print_value=True, | ||
| ) | ||
| self.params.severity = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Severity", | ||
| is_mandatory=False, | ||
| print_value=True, | ||
| ) | ||
| self.params.related_issue_severity = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Related Issue Severity", | ||
| is_mandatory=False, | ||
| print_value=True, | ||
| ) | ||
| self.params.has_fix = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Has Fix", | ||
| is_mandatory=False, | ||
| print_value=True, | ||
| default_value="Select One", | ||
| ) | ||
| self.params.has_public_exploit = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Has Public Exploit", | ||
| is_mandatory=False, | ||
| print_value=True, | ||
| default_value="Select One", | ||
| ) | ||
| self.params.cve_ids = extract_action_param( | ||
| self.soar_action, | ||
| param_name="CVE IDs", | ||
| is_mandatory=False, | ||
| print_value=True, | ||
| ) | ||
| self.params.max_findings = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Max Findings To Return", | ||
| is_mandatory=False, | ||
| print_value=True, | ||
| default_value=str(constants.DEFAULT_MAX_FINDINGS), | ||
| ) | ||
|
|
||
| def _init_api_clients(self) -> api_client.WizApiClient: | ||
| return action_init.create_api_client(self.soar_action) | ||
|
|
||
| def _perform_action(self, _: Any) -> None: | ||
| resource_list = [r.strip() for r in self.params.resource_names.split(",") if r.strip()] | ||
| severity_list = None | ||
| if self.params.severity: | ||
| severity_list = [ | ||
| s.strip().upper() for s in self.params.severity.split(",") if s.strip() | ||
| ] | ||
|
|
||
| cve_ids_list = None | ||
| if self.params.cve_ids: | ||
| cve_ids_list = [ | ||
| c.strip() for c in self.params.cve_ids.split(",") if c.strip() | ||
| ] | ||
|
|
||
| related_issue_severity_list = None | ||
| if self.params.related_issue_severity: | ||
| related_issue_severity_list = [ | ||
| s.strip().upper() | ||
| for s in self.params.related_issue_severity.split(",") | ||
| if s.strip() | ||
| ] | ||
|
|
||
| has_fix = self._map_ddl_to_bool(self.params.has_fix) | ||
| has_exploit = self._map_ddl_to_bool(self.params.has_public_exploit) | ||
|
|
||
| max_findings = constants.DEFAULT_MAX_FINDINGS | ||
|
|
||
| try: | ||
| val = int(self.params.max_findings) | ||
| if 0 < val <= constants.DEFAULT_MAX_FINDINGS: | ||
| max_findings = val | ||
| else: | ||
| self.logger.warning( | ||
| f"Max Findings ({val}) is out of bounds. " | ||
| f"Defaulting to {constants.DEFAULT_MAX_FINDINGS}." | ||
| ) | ||
| except (ValueError, TypeError): | ||
| self.logger.warning( | ||
| "Invalid or empty Max Findings value. " | ||
| f"Defaulting to {constants.DEFAULT_MAX_FINDINGS}." | ||
| ) | ||
|
|
||
| all_findings = [] | ||
| resources_with_findings = [] | ||
| for resource in resource_list: | ||
| self.logger.info(f"Fetching findings for resource: {resource}") | ||
| findings = self.api_client.get_resource_vulnerability_findings( | ||
| resource_name=resource, | ||
| severity=severity_list, | ||
| has_fix=has_fix, | ||
| has_exploit=has_exploit, | ||
| cve_ids=cve_ids_list, | ||
| related_issue_severity=related_issue_severity_list, | ||
| first=max_findings, | ||
| ) | ||
| if findings: | ||
| resources_with_findings.append(resource) | ||
| all_findings.append({ | ||
| "Entity": resource, | ||
| "EntityResult": [f.to_json() for f in findings] | ||
| }) | ||
|
|
||
| self.json_results: SingleJson = all_findings | ||
|
|
||
| if not all_findings: | ||
| if len(resource_list) == 1: | ||
| self.output_message = ( | ||
| "No vulnerabilities found that match provided filters " | ||
| f"for the following resources in Wiz: {resource_list[0]}" | ||
| ) | ||
| else: | ||
| self.output_message = ( | ||
| "No vulnerabilities found that match provided filters " | ||
| "for the provided resources." | ||
| ) | ||
| else: | ||
| self.output_message = ( | ||
| "Successfully found vulnerabilities that match provided filters " | ||
| f"for the following resources in Wiz: {', '.join(resources_with_findings)}" | ||
| ) | ||
|
|
||
| def _map_ddl_to_bool(self, value: str) -> bool | None: | ||
| """Map DDL string value to boolean or None. | ||
|
|
||
| Args: | ||
| value: The string value to map ('Yes', 'No', or others). | ||
|
|
||
| Returns: | ||
| True if 'Yes', False if 'No', None otherwise. | ||
| """ | ||
| if value == "Yes": | ||
| return True | ||
| if value == "No": | ||
| return False | ||
| return None | ||
|
|
||
|
|
||
| def main() -> NoReturn: | ||
| ListResourceVulnerabilityFindings().run() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
52 changes: 52 additions & 0 deletions
52
...se_integrations/third_party/partner/wiz/actions/list_resource_vulnerability_findings.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| creator: admin | ||
| description: Use the List Resource Vulnerability Findings action to retrieve a list of vulnerability findings associated with specific resources in Wiz. Results are returned as a JSON object keyed by resource name. | ||
| dynamic_results_metadata: | ||
| - result_example_path: resources/list_resource_vulnerability_findings_JsonResult_example.json | ||
| result_name: JsonResult | ||
| show_result: true | ||
| integration_identifier: Wiz | ||
| name: List Resource Vulnerability Findings | ||
| parameters: | ||
| - default_value: '' | ||
| description: A comma-separated list of resource names to retrieve findings for (for example, demos.azurecr.io/sb-nginx@6d06ab19, demo-m138-event-handler-00001-9qs). | ||
| is_mandatory: true | ||
| name: Resource Name | ||
| type: string | ||
| - default_value: '' | ||
| description: The technical severity levels of the vulnerability findings to return. | ||
| is_mandatory: false | ||
| name: Severity | ||
|
sedovolosiy marked this conversation as resolved.
|
||
| type: string | ||
| - default_value: '' | ||
| description: The severity levels of the Wiz Issues associated with the vulnerability findings to return. | ||
| is_mandatory: false | ||
| name: Related Issue Severity | ||
| type: string | ||
| - default_value: 'Select One' | ||
| description: "The criteria used to filter the vulnerability findings to return based on whether a fix or patch is available. Select One: Returns all findings. Yes: Only returns findings with an available fix. No: Only returns findings without an available fix." | ||
| is_mandatory: false | ||
| name: Has Fix | ||
| optional_values: | ||
| - Select One | ||
| - 'Yes' | ||
| - 'No' | ||
| type: ddl | ||
| - default_value: 'Select One' | ||
| description: "The criteria used to filter the vulnerability findings to return based on whether a known public exploit exists. Select One: Returns all vulnerability findings. Yes: Only returns findings with a known public exploit. No: Only returns findings without a known public exploit." | ||
| is_mandatory: false | ||
| name: Has Public Exploit | ||
| optional_values: | ||
| - Select One | ||
| - 'Yes' | ||
| - 'No' | ||
| type: ddl | ||
| - default_value: '' | ||
| description: A comma-separated list of CVE IDs used to filter the vulnerability findings to return. | ||
| is_mandatory: false | ||
| name: CVE IDs | ||
| type: string | ||
| - default_value: '500' | ||
| description: "The maximum number of vulnerability findings to return for each resource. Maximum: 500." | ||
| is_mandatory: false | ||
| name: Max Findings To Return | ||
| type: string | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ | |
|
|
||
| if TYPE_CHECKING: | ||
| import requests | ||
|
|
||
| from TIPCommon.types import ChronicleSOAR | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.