Add SecurityScorecard node (#1371)

* Add SecurityScorecard node

* Move portfolio:edit fields to the main view.

The API request uses PUT so it will replace undefined fields if they are not set.

* Style improvements

*  Improvements to #1247

*  Improvements

*  Minor improvements on SecurityScorecard Node

Co-authored-by: Mika Luhta <12100880+mluhta@users.noreply.github.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Ricardo Espinoza
2021-01-28 12:31:37 -05:00
committed by GitHub
parent 8764171989
commit d0b896da38
11 changed files with 2024 additions and 0 deletions

View File

@@ -0,0 +1,253 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const companyOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'company',
],
},
},
options: [
{
name: 'Get Factor Scores',
value: 'getFactor',
description: 'Get company factor scores and issue counts',
},
{
name: 'Get Historical Factor Scores',
value: 'getFactorHistorical',
description: 'Get company\'s historical factor scores',
},
{
name: 'Get Historical Scores',
value: 'getHistoricalScore',
description: 'Get company\'s historical scores',
},
{
name: 'Get Information and Scorecard',
value: 'getScorecard',
description: 'Get company information and summary of their scorecard',
},
{
name: 'Get Score Plan',
value: 'getScorePlan',
description: 'Get company\'s score improvement plan',
},
],
default: 'getFactor',
},
] as INodeProperties[];
export const companyFields = [
{
displayName: 'Scorecard Identifier',
name: 'scorecardIdentifier',
description: 'Primary identifier of a company or scorecard, i.e. domain',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getScorecard',
'getFactor',
'getFactorHistorical',
'getHistoricalScore',
'getScorePlan',
],
},
},
},
{
displayName: 'Score',
name: 'score',
description: 'Score target',
type: 'number',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getScorePlan',
],
},
},
required: true,
default: 0,
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactor',
'getFactorHistorical',
'getHistoricalScore',
'getScorePlan',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactor',
'getFactorHistorical',
'getHistoricalScore',
'getScorePlan',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 100,
description: 'Number of results to return.',
},
{
displayName: 'Simple',
name: 'simple',
type: 'boolean',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactorHistorical',
'getHistoricalScore',
],
},
},
default: true,
description: 'Simplify the response.',
},
// company:getFactor
{
displayName: 'Filters',
name: 'filters',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactor',
],
},
},
type: 'collection',
placeholder: 'Add Filter',
default: {},
options: [
{
displayName: 'Severity',
name: 'severity',
type: 'string',
default: '',
placeholder: '',
},
{
displayName: 'Severity In',
description: 'Filter issues by comma separated severity list',
name: 'severity_in',
type: 'string',
default: '',
placeholder: '',
},
],
},
// company:getFactorHistorical
// company:getHistoricalScore
{
displayName: 'Options',
name: 'options',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactorHistorical',
'getHistoricalScore',
],
},
},
type: 'collection',
placeholder: 'Add Option',
default: {},
options: [
{
displayName: 'Date From',
description: 'History start date',
name: 'date_from',
type: 'dateTime',
default: '',
required: false,
},
{
displayName: 'Date To',
description: 'History end date',
name: 'date_to',
type: 'dateTime',
default: '',
required: false,
},
{
displayName: 'Timing',
description: 'Date granularity',
name: 'timing',
type: 'options',
options: [
{
name: 'Daily',
value: 'daily',
},
{
name: 'Weekly',
value: 'weekly',
},
{
name: 'Monthly',
value: 'monthly',
},
],
default: 'daily',
required: false,
},
],
},
] as INodeProperties[];

View File

@@ -0,0 +1,173 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const industryOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'industry',
],
},
},
options: [
{
name: 'Get Factor Scores',
value: 'getFactor',
},
{
name: 'Get Historical Factor Scores',
value: 'getFactorHistorical',
},
{
name: 'Get Score',
value: 'getScore',
},
],
default: 'getFactor',
},
] as INodeProperties[];
export const industryFields = [
{
displayName: 'Industry',
name: 'industry',
type: 'options',
options: [
{
name: 'Food',
value: 'food',
},
{
name: 'Healthcare',
value: 'healthcare',
},
{
name: 'Manofacturing',
value: 'manofacturing',
},
{
name: 'Retail',
value: 'retail',
},
{
name: 'Technology',
value: 'technology',
},
],
required: true,
displayOptions: {
show: {
resource: [
'industry',
],
operation: [
'getScore',
'getFactor',
'getFactorHistorical',
],
},
},
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'industry',
],
operation: [
'getFactor',
'getFactorHistorical',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'industry',
],
operation: [
'getFactor',
'getFactorHistorical',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 100,
description: 'Number of results to return.',
},
{
displayName: 'Simple',
name: 'simple',
type: 'boolean',
displayOptions: {
show: {
resource: [
'industry',
],
operation: [
'getFactor',
'getFactorHistorical',
],
},
},
default: true,
description: 'Simplify the response.',
},
{
displayName: 'Options',
name: 'options',
displayOptions: {
show: {
resource: [
'industry',
],
operation: [
'getFactorHistorical',
],
},
},
type: 'collection',
placeholder: 'Add Option',
default: {},
options: [
{
displayName: 'Date From',
description: 'History start date',
name: 'from',
type: 'dateTime',
default: '',
required: false,
},
{
displayName: 'Date To',
description: 'History end date',
name: 'to',
type: 'dateTime',
default: '',
required: false,
},
],
},
] as INodeProperties[];

View File

@@ -0,0 +1,178 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const inviteOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'invite',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create an invite for a company/user',
},
],
default: 'create',
},
] as INodeProperties[];
export const inviteFields = [
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'invite',
],
operation: [
'create',
],
},
},
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'invite',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Last Name',
name: 'lastName',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'invite',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Message',
name: 'message',
description: 'Message for the invitee',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'invite',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'invite',
],
operation: [
'create',
],
},
},
default: {},
options: [
{
displayName: 'Days to Resolve Issue',
description: 'Minimum days to resolve a scorecard issue',
name: 'days_to_resolve_issue',
type: 'number',
default: 0,
},
{
displayName: 'Domain',
description: 'Invitee company domain',
name: 'domain',
type: 'string',
default: '',
},
{
displayName: 'Grade to Maintain',
description: 'Request the invitee\'s organisation to maintain a minimum grade',
name: 'grade_to_maintain',
type: 'string',
default: '',
},
{
displayName: 'Is Organisation Point of Contact',
description: 'Is the invitee organisation\'s point of contact',
name: 'is_organization_point_of_contact',
type: 'boolean',
default: false,
},
{
displayName: 'Issue Description',
name: 'issue_desc',
type: 'string',
default: '',
},
{
displayName: 'Issue Title',
name: 'issue_title',
type: 'string',
default: '',
},
{
displayName: 'Issue Type',
name: 'issue_type',
type: 'string',
default: '',
},
{
displayName: 'Send Me a Copy',
name: 'sendme_copy',
description: 'Send a copy of the invite to the requesting user',
type: 'boolean',
default: false,
},
{
displayName: 'Target URL',
name: 'target_url',
type: 'string',
description: 'Optional URL to take the invitee to when arriving to the platform',
default: '',
},
],
},
] as INodeProperties[];

View File

@@ -0,0 +1,188 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const portfolioCompanyOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'portfolioCompany',
],
},
},
options: [
{
name: 'Add',
value: 'add',
description: 'Add a company to portfolio',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all companies in a portfolio',
},
{
name: 'Remove',
value: 'remove',
description: 'Remove a company from portfolio',
},
],
default: 'add',
},
] as INodeProperties[];
export const portfolioCompanyFields = [
{
displayName: 'Portfolio ID',
name: 'portfolioId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'portfolioCompany',
],
operation: [
'getAll',
'add',
'remove',
],
},
},
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'portfolioCompany',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'portfolioCompany',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 100,
description: 'Number of results to return.',
},
{
displayName: 'Filters',
name: 'filters',
displayOptions: {
show: {
resource: [
'portfolioCompany',
],
operation: [
'getAll',
],
},
},
type: 'collection',
placeholder: 'Add Filter',
default: {},
options: [
{
displayName: 'Grade',
name: 'grade',
type: 'string',
placeholder: '',
default: '',
description: 'Company score grade filter',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
placeholder: '',
default: '',
description: 'Industry filter',
},
{
displayName: 'Issue Type',
name: 'issueType',
type: 'string',
placeholder: '',
description: 'Issue type filter',
default: '',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
options: [
{
name: 'Active',
value: 'active',
},
{
name: 'Inactive',
value: 'inactive',
},
],
default: '',
},
{
displayName: 'Vulnerability',
name: 'vulnerability',
type: 'string',
placeholder: '',
description: 'CVE vulnerability filter',
default: '',
},
],
},
{
displayName: 'Domain',
name: 'domain',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'portfolioCompany',
],
operation: [
'add',
'remove',
],
},
},
description: 'Company\'s domain name',
},
] as INodeProperties[];

View File

@@ -0,0 +1,178 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const portfolioOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'portfolio',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a portfolio',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a portfolio',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all portfolios',
},
{
name: 'Update',
value: 'update',
description: 'Update a portfolio',
},
],
default: 'create',
},
] as INodeProperties[];
export const portfolioFields = [
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'portfolio',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'portfolio',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 100,
description: 'Number of results to return.',
},
{
displayName: 'Portfolio ID',
name: 'portfolioId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'portfolio',
],
operation: [
'update',
'delete',
],
},
},
},
{
displayName: 'Portfolio Name',
name: 'name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'portfolio',
],
operation: [
'create',
'update',
],
},
},
description: 'Name of the portfolio',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
required: false,
default: '',
displayOptions: {
show: {
resource: [
'portfolio',
],
operation: [
'create',
'update',
],
},
},
description: 'Description',
},
{
displayName: 'Privacy',
name: 'privacy',
type: 'options',
required: false,
displayOptions: {
show: {
resource: [
'portfolio',
],
operation: [
'create',
'update',
],
},
},
options: [
{
name: 'Private',
value: 'private',
description: 'Only visible to you',
},
{
name: 'Shared',
value: 'shared',
description: 'Visible to everyone in your company',
},
{
name: 'Team',
value: 'team',
description: 'Visible to the people on your team',
},
],
default: 'shared',
},
] as INodeProperties[];

View File

@@ -0,0 +1,383 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const reportOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'report',
],
},
},
options: [
{
name: 'Download',
value: 'download',
description: 'Download a generated report',
},
{
name: 'Generate',
value: 'generate',
description: 'Generate a report',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get list of recently generated report',
},
],
default: 'getAll',
},
] as INodeProperties[];
export const reportFields = [
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 100,
description: 'Number of results to return.',
},
{
displayName: 'Report',
name: 'report',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
},
},
options: [
{
name: 'Company Detailed',
value: 'detailed',
},
{
name: 'Company Events',
value: 'events-json',
},
{
name: 'Company Issues',
value: 'issues',
},
{
name: 'Company Partnership',
value: 'partnership',
},
{
name: 'Company Summary',
value: 'summary',
},
{
name: 'Full Scorecard',
value: 'full-scorecard-json',
},
{
name: 'Portfolio',
value: 'portfolio',
},
{
name: 'Scorecard Footprint',
value: 'scorecard-footprint',
},
],
default: 'detailed',
},
{
displayName: 'Scorecard Identifier',
name: 'scorecardIdentifier',
description: 'Primary identifier of a company or scorecard, i.e. domain',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
report: [
'detailed',
'events-json',
'full-scorecard-json',
'issues',
'partnership',
'scorecard-footprint',
'summary',
],
},
},
},
{
displayName: 'Portfolio ID',
name: 'portfolioId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
report: [
'portfolio',
],
},
},
description: 'Portfolio ID',
},
{
displayName: 'Branding',
name: 'branding',
type: 'options',
required: false,
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
report: [
'detailed',
'summary',
],
},
},
options: [
{
name: 'SecurityScorecard',
value: 'securityscorecard',
},
{
name: 'Company and SecurityScorecard',
value: 'company_and_securityscorecard',
},
{
name: 'Company',
value: 'company',
},
],
default: 'securityscorecard',
},
{
displayName: 'Date',
name: 'date',
type: 'dateTime',
required: true,
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
report: [
'events-json',
],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
required: false,
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
report: [
'issues',
'portfolio',
],
},
},
options: [
{
displayName: 'Format',
name: 'format',
type: 'options',
default: 'pdf',
options: [
{
name: 'CSV',
value: 'csv',
},
{
name: 'PDF',
value: 'pdf',
},
],
required: false,
},
],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
required: false,
default: {},
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'generate',
],
report: [
'scorecard-footprint',
],
},
},
options: [
{
displayName: 'Countries',
name: 'countries',
type: 'string',
typeOptions: {
multipleValues: true,
},
default: [],
required: false,
},
{
displayName: 'Format',
name: 'format',
type: 'options',
default: 'pdf',
options: [
{
name: 'CSV',
value: 'csv',
},
{
name: 'PDF',
value: 'pdf',
},
],
required: false,
},
{
displayName: 'IPs',
name: 'ips',
type: 'string',
typeOptions: {
multipleValues: true,
},
default: [],
required: false,
},
{
displayName: 'Subdomains',
name: 'subdomains',
type: 'string',
typeOptions: {
multipleValues: true,
},
default: [],
required: false,
},
],
},
{
displayName: 'Report URL',
name: 'url',
type: 'string',
default: '',
required: true,
description: 'URL to a generated report',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'download',
],
},
},
},
{
displayName: 'Binary Property',
name: 'binaryPropertyName',
type: 'string',
required: true,
default: 'data',
displayOptions: {
show: {
resource: [
'report',
],
operation: [
'download',
],
},
},
description: 'Name of the binary property to which to<br />write the data of the read file.',
},
] as INodeProperties[];