-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from rapid7/description
Description validator
- Loading branch information
Showing
10 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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
27 changes: 27 additions & 0 deletions
27
icon_validator/rules/workflow_validators/workflow_description_validator.py
This file contains 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,27 @@ | ||
from icon_validator.rules.validator import KomandPluginValidator | ||
from icon_validator.exceptions import ValidationException | ||
|
||
|
||
class WorkflowDescriptionValidator(KomandPluginValidator): | ||
|
||
@staticmethod | ||
def validate_workflow_description_exists(spec): | ||
if "description" not in spec.spec_dictionary(): | ||
raise ValidationException("Workflow description in yaml is missing.") | ||
|
||
description = spec.spec_dictionary()["description"] | ||
if description == "": | ||
raise ValidationException("Workflow description in yaml can not be blank") | ||
|
||
@staticmethod | ||
def validate_workflow_description_punctuation(description): | ||
if not description.endswith("."): | ||
raise ValidationException("Description does not end with a period when it should.") | ||
if description[0].islower(): | ||
raise ValidationException("Description should not start with a lower case letter.") | ||
if description[0].isspace(): | ||
raise ValidationException("Description should not start with a whitespace character.") | ||
|
||
def validate(self, spec): | ||
WorkflowDescriptionValidator.validate_workflow_description_exists(spec) | ||
WorkflowDescriptionValidator.validate_workflow_description_punctuation(spec.spec_dictionary()["description"]) |
This file contains 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 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
21 changes: 21 additions & 0 deletions
21
unit_test/workflow_examples/description_tests/workflow_blank_description.spec.yaml
This file contains 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,21 @@ | ||
extension: workflow | ||
products: ["insightconnect"] | ||
name: Automated_Indicator_Enrichment | ||
title: "Automated Indicator Enrichment" | ||
description: "" | ||
version: 1.0.0 | ||
vendor: rapid7 | ||
support: rapid7 | ||
status: [] | ||
hub_tags: | ||
use_cases: [alerting_and_notifications, threat_detection_and_response] | ||
keywords: [enrichment, slack, url, ip] | ||
features: [] | ||
resources: | ||
source_url: https://github.com/rapid7/insightconnect-workflows/tree/master/workflows/Automated_Indicator_Enrichment | ||
license_url: https://github.com/rapid7/insightconnect-workflows/blob/master/LICENSE | ||
screenshots: | ||
- name: Automated_Indicator_Enrichment_Job.png | ||
title: Example Job Output | ||
- name: Automated_Indicator_Enrichment_Snapshot.png | ||
title: Workflow View |
21 changes: 21 additions & 0 deletions
21
unit_test/workflow_examples/description_tests/workflow_lower_case.spec.yaml
This file contains 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,21 @@ | ||
extension: workflow | ||
products: ["insightconnect"] | ||
name: Automated_Indicator_Enrichment | ||
title: "Automated Indicator Enrichment" | ||
description: "this workflow triggers from directly slack messaging the chatbot to \"!investigate\" the defined indicator. To date, this workflow supports automatically looking up URLs and IPs in open source threat intelligence such as VirusTotal and Whois. Lastly, the workflow will post back results to the specific user." | ||
version: 1.0.0 | ||
vendor: rapid7 | ||
support: rapid7 | ||
status: [] | ||
hub_tags: | ||
use_cases: [alerting_and_notifications, threat_detection_and_response] | ||
keywords: [enrichment, slack, url, ip] | ||
features: [] | ||
resources: | ||
source_url: https://github.com/rapid7/insightconnect-workflows/tree/master/workflows/Automated_Indicator_Enrichment | ||
license_url: https://github.com/rapid7/insightconnect-workflows/blob/master/LICENSE | ||
screenshots: | ||
- name: Automated_Indicator_Enrichment_Job.png | ||
title: Example Job Output | ||
- name: Automated_Indicator_Enrichment_Snapshot.png | ||
title: Workflow View |
20 changes: 20 additions & 0 deletions
20
unit_test/workflow_examples/description_tests/workflow_no_description.spec.yaml
This file contains 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,20 @@ | ||
extension: workflow | ||
products: ["insightconnect"] | ||
name: Automated_Indicator_Enrichment | ||
title: "Automated Indicator Enrichment" | ||
version: 1.0.0 | ||
vendor: rapid7 | ||
support: rapid7 | ||
status: [] | ||
hub_tags: | ||
use_cases: [alerting_and_notifications, threat_detection_and_response] | ||
keywords: [enrichment, slack, url, ip] | ||
features: [] | ||
resources: | ||
source_url: https://github.com/rapid7/insightconnect-workflows/tree/master/workflows/Automated_Indicator_Enrichment | ||
license_url: https://github.com/rapid7/insightconnect-workflows/blob/master/LICENSE | ||
screenshots: | ||
- name: Automated_Indicator_Enrichment_Job.png | ||
title: Example Job Output | ||
- name: Automated_Indicator_Enrichment_Snapshot.png | ||
title: Workflow View |
21 changes: 21 additions & 0 deletions
21
unit_test/workflow_examples/description_tests/workflow_no_period.spec.yaml
This file contains 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,21 @@ | ||
extension: workflow | ||
products: ["insightconnect"] | ||
name: Automated_Indicator_Enrichment | ||
title: "Automated Indicator Enrichment" | ||
description: "This workflow triggers from directly slack messaging the chatbot to \"!investigate\" the defined indicator. To date, this workflow supports automatically looking up URLs and IPs in open source threat intelligence such as VirusTotal and Whois. Lastly, the workflow will post back results to the specific user" | ||
version: 1.0.0 | ||
vendor: rapid7 | ||
support: rapid7 | ||
status: [] | ||
hub_tags: | ||
use_cases: [alerting_and_notifications, threat_detection_and_response] | ||
keywords: [enrichment, slack, url, ip] | ||
features: [] | ||
resources: | ||
source_url: https://github.com/rapid7/insightconnect-workflows/tree/master/workflows/Automated_Indicator_Enrichment | ||
license_url: https://github.com/rapid7/insightconnect-workflows/blob/master/LICENSE | ||
screenshots: | ||
- name: Automated_Indicator_Enrichment_Job.png | ||
title: Example Job Output | ||
- name: Automated_Indicator_Enrichment_Snapshot.png | ||
title: Workflow View |
21 changes: 21 additions & 0 deletions
21
unit_test/workflow_examples/description_tests/workflow_whitespace.spec.yaml
This file contains 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,21 @@ | ||
extension: workflow | ||
products: ["insightconnect"] | ||
name: Automated_Indicator_Enrichment | ||
title: "Automated Indicator Enrichment" | ||
description: " This workflow triggers from directly slack messaging the chatbot to \"!investigate\" the defined indicator. To date, this workflow supports automatically looking up URLs and IPs in open source threat intelligence such as VirusTotal and Whois. Lastly, the workflow will post back results to the specific user." | ||
version: 1.0.0 | ||
vendor: rapid7 | ||
support: rapid7 | ||
status: [] | ||
hub_tags: | ||
use_cases: [alerting_and_notifications, threat_detection_and_response] | ||
keywords: [enrichment, slack, url, ip] | ||
features: [] | ||
resources: | ||
source_url: https://github.com/rapid7/insightconnect-workflows/tree/master/workflows/Automated_Indicator_Enrichment | ||
license_url: https://github.com/rapid7/insightconnect-workflows/blob/master/LICENSE | ||
screenshots: | ||
- name: Automated_Indicator_Enrichment_Job.png | ||
title: Example Job Output | ||
- name: Automated_Indicator_Enrichment_Snapshot.png | ||
title: Workflow View |