Add risk assessment system to CLI, MCP, and N8N

Expose the full risk assessment hierarchy (assessments, scopes, nodes,
processes, threats, scenarios) with CRUD operations and scenario
linking across all three interfaces.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-05-20 16:24:55 +02:00
parent 797e3da52f
commit 883031830f
86 changed files with 10720 additions and 11 deletions

View File

@@ -0,0 +1,113 @@
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { proboApiRequest } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'Process ID',
name: 'processId',
type: 'string',
displayOptions: {
show: {
resource: ['riskAssessment'],
operation: ['updateProcess'],
},
},
default: '',
description: 'The ID of the process to update',
required: true,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['riskAssessment'],
operation: ['updateProcess'],
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The name of the process',
},
{
displayName: 'Source Node ID',
name: 'sourceNodeId',
type: 'string',
default: '',
description: 'The ID of the source node',
},
{
displayName: 'Target Node ID',
name: 'targetNodeId',
type: 'string',
default: '',
description: 'The ID of the target node',
},
],
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const processId = this.getNodeParameter('processId', itemIndex) as string;
const additionalFields = this.getNodeParameter('additionalFields', itemIndex, {}) as {
name?: string;
sourceNodeId?: string;
targetNodeId?: string;
};
const query = `
mutation UpdateRiskAssessmentProcess($input: UpdateRiskAssessmentProcessInput!) {
updateRiskAssessmentProcess(input: $input) {
riskAssessmentProcess {
id
riskAssessmentScopeId
sourceNodeId
targetNodeId
name
createdAt
updatedAt
}
}
}
`;
const input: Record<string, unknown> = { id: processId };
if (additionalFields.name) input.name = additionalFields.name;
if (additionalFields.sourceNodeId) input.sourceNodeId = additionalFields.sourceNodeId;
if (additionalFields.targetNodeId) input.targetNodeId = additionalFields.targetNodeId;
if (Object.keys(input).length === 1) {
throw new Error('At least one field must be provided to update');
}
const responseData = await proboApiRequest.call(this, query, { input });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}