mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
⚡ TheHive: Add Mark as Read operation to alerts (#1541)
* ⚡ Add Mark as Read operation to TheHive 4 Alerts * Remove version check from Mark as Read operation * Add Mark as Unread operation * Show Alert ID for markAsUnread operation * ⚡ Add Ignore SSL Issues parameter to credentials * ⚡ Add TheHive and Cortex SVG logos Co-authored-by: Mika Luhta <12100880+mluhta@users.noreply.github.com>
This commit is contained in:
parent
c39504719a
commit
d56c3da3dd
|
@ -41,5 +41,11 @@ export class TheHiveApi implements ICredentialType {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Ignore SSL Issues',
|
||||
name: 'allowUnauthorizedCerts',
|
||||
type: 'boolean' as NodePropertyTypes,
|
||||
default: false,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export class Cortex implements INodeType {
|
|||
description: INodeTypeDescription = {
|
||||
displayName: 'Cortex',
|
||||
name: 'cortex',
|
||||
icon: 'file:cortex.png',
|
||||
icon: 'file:cortex.svg',
|
||||
group: ['transform'],
|
||||
subtitle: '={{$parameter["resource"]+ ": " + $parameter["operation"]}}',
|
||||
version: 1,
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 837 B |
1
packages/nodes-base/nodes/Cortex/cortex.svg
Normal file
1
packages/nodes-base/nodes/Cortex/cortex.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><defs><style>.cls-1{fill:#54c4c4;}.cls-2{fill:#fff;}</style></defs><title>cortex-logo</title><path class="cls-1" d="M290,150A140,140,0,1,1,150,10,140,140,0,0,1,290,150"/><path class="cls-2" d="M231.17,159.29c0-12.87-6.51-14.17-18-15.36-10.18-1.06-21.71-2.25-26.73-16.65a1.9,1.9,0,0,1,.08-1.46,1.93,1.93,0,0,1,3.55.2c4.22,12.09,14,13.1,23.5,14.09,4.68.48,10,1,14.12,3.4a1.4,1.4,0,0,0,1.45,0,1.39,1.39,0,0,0,.64-1.3c-2.23-25.82-13.16-38.79-21.94-45.12a35.47,35.47,0,0,0-12.07-5.8,1.39,1.39,0,0,0-1.56,2,49.56,49.56,0,0,1,4,11c2.18,7.91,4.06,14.74,12.62,16.44a1.93,1.93,0,0,1,1.51,2.26,1.93,1.93,0,0,1-1.88,1.55,1.58,1.58,0,0,1-.38,0c-10.9-2.16-13.28-10.82-15.59-19.23-1.55-5.61-3-10.91-7-14.2-5.61-4.65-15-7.78-23.37-7.78a29.19,29.19,0,0,0-4.05.27,18.5,18.5,0,0,0-9.68,4.07,1.41,1.41,0,0,0-.47,1,1.38,1.38,0,0,0,.37,1,73.85,73.85,0,0,1,11.13,16.84,1.92,1.92,0,0,1-.85,2.58,2,2,0,0,1-2.59-.86c-3.87-7.76-8.11-13.86-12.58-18.12h0l0,0c-6.31-6-11.94-7.25-15.56-7.25a14.73,14.73,0,0,0-2.85.27c-5.1,1-8.5,4.35-9.51,7a1.44,1.44,0,0,0,.12,1.23,32.6,32.6,0,0,1,2.62,5.94c2.32,6.38,4.51,12.4,15.48,12.91a1.88,1.88,0,0,1,1.33.62,1.91,1.91,0,0,1,.5,1.39,1.89,1.89,0,0,1-2,1.83h0c-13.53-.62-16.52-8.84-18.91-15.44a25.62,25.62,0,0,0-2.62-5.75,1,1,0,0,0-.14-.16,2,2,0,0,1-.24-.32,1.84,1.84,0,0,0-.17-.22,5.88,5.88,0,0,0-4.76-1.9c-4.69,0-8.26,1.47-10.62,4.4a13.45,13.45,0,0,0-2.12,3.84,2,2,0,0,0-.07.26,2.16,2.16,0,0,1-.15.5.87.87,0,0,0-.07.17,25.75,25.75,0,0,0-.3,12.29c1.6,7.48,6.24,16.89,19.27,19.25a22.45,22.45,0,0,0,3.92.32,70.9,70.9,0,0,0,9.77-1,83.59,83.59,0,0,1,12-1.12,33.73,33.73,0,0,1,17,4.21,1.43,1.43,0,0,0,1.16.1,1.41,1.41,0,0,0,.83-.81c2.3-5.79,5.74-9.55,8.51-12.57,5.55-6.06,9.56-10.44,3.79-25.68a1.92,1.92,0,0,1,.05-1.47,1.9,1.9,0,0,1,1.07-1A2,2,0,0,1,175.07,93c6.6,17.45,1.43,23.1-4.56,29.65-3,3.23-6.32,6.89-8.31,12.79a1.4,1.4,0,0,0,.51,1.58c13.47,9.74,20.52,13,27.92,13a25.17,25.17,0,0,0,2.83-.16,1.93,1.93,0,0,1,1.7,3.12,1.88,1.88,0,0,1-1.29.7,30.3,30.3,0,0,1-3.33.19c-8.5,0-16.58-3.82-32-15.17a29.36,29.36,0,0,0-18.21-5.8A79.71,79.71,0,0,0,128.78,134a73.31,73.31,0,0,1-10.3,1,25.76,25.76,0,0,1-4.62-.39c-11.8-2.14-19.74-10-22.36-22.22a33.7,33.7,0,0,1-.69-6.26,1.41,1.41,0,0,0-2.36-1c-11,10.25-11.68,20.34-11.09,25.44.93,8.21,5.87,14.26,10.27,16a13,13,0,0,0,4.89.84,47.14,47.14,0,0,0,6.16-.58,61.45,61.45,0,0,1,8.46-.72c8.41,0,16.19,2.86,24.51,9a1.92,1.92,0,0,1,.42,2.68,2,2,0,0,1-2.69.42c-7.63-5.62-14.69-8.23-22.21-8.23a57.85,57.85,0,0,0-8,.69,50.8,50.8,0,0,1-6.68.6,16.82,16.82,0,0,1-6.29-1.1c-5.42-2.14-10.13-8.22-12-15.48A1.4,1.4,0,0,0,73,133.67a1.38,1.38,0,0,0-1.41.81c-5.25,11.33-2.3,22.75,3,29a19,19,0,0,0,14.9,7.15,26.43,26.43,0,0,0,13-3.8,1.38,1.38,0,0,0,.67-.88,25.77,25.77,0,0,1,2.83-7,2,2,0,0,1,2.64-.65,1.93,1.93,0,0,1,.65,2.64c-3.74,6.18-4.8,16.88.58,24.55,4.11,5.85,11,8.82,20.56,8.82.83,0,1.68,0,2.55-.07a1.42,1.42,0,0,0,1.2-.82A1.37,1.37,0,0,0,134,192c-4.91-6.44.5-13.39,5.74-20.11s10.6-13.6,8.48-21.23a1.92,1.92,0,0,1,1.33-2.36,1.94,1.94,0,0,1,2.37,1.33c2.64,9.49-3.9,17.88-9.15,24.62-5.94,7.63-9.1,12.15-4.85,16.4a6.77,6.77,0,0,0,5,2.35c2.73,0,5.92-1.69,12-5.46,5.24-3.23,12.41-7.66,21.64-10.41a1.41,1.41,0,0,0,.2-2.61,16.22,16.22,0,0,1-6-4.52c-2.39-3.06-3-6.84-1.91-11.24a2,2,0,0,1,2.33-1.39,1.93,1.93,0,0,1,1.4,2.34c-.81,3.19-.4,5.86,1.21,7.93,2,2.64,7.28,6,20.7,6.82,2.23,0,4.41,0,6.69.2a54.18,54.18,0,0,0,19.34-3.53,1.4,1.4,0,0,0,.52-2.23c-1.3-1.45-3.14-2.3-5.59-3.35-3.81-1.61-8.54-3.62-9.18-10.19a1.93,1.93,0,0,1,1.73-2.11,1.91,1.91,0,0,1,2.1,1.73c.41,4.29,3.25,5.5,6.86,7,2.53,1.08,5.68,2.41,7.72,5.3a1.41,1.41,0,0,0,2,.28c2.95-2.4,4.45-5.21,4.45-8.34"/><path class="cls-2" d="M200,177.4c-1.1,0-2.15-.09-3.29-.15-17.52.28-29,7.36-37.35,12.52a65.71,65.71,0,0,1-8.53,4.69,1.4,1.4,0,0,0-.22,2.47,37.57,37.57,0,0,0,4.61,2.42,19.8,19.8,0,0,0,5.63,1.44c5,.74,9,1.33,10.77,15.26a1.4,1.4,0,0,0,1.39,1.22h9.87a1.4,1.4,0,0,0,1.39-1.6c-1.93-13.8-.17-14.81,3.71-17a28,28,0,0,0,4.37-2.93c3.83-3.23,7.8-6.56,9-16.75a1.38,1.38,0,0,0-.33-1.08,1.39,1.39,0,0,0-1-.48"/></svg>
|
After Width: | Height: | Size: 4 KiB |
|
@ -29,6 +29,7 @@ export async function theHiveApiRequest(this: IHookFunctions | IExecuteFunctions
|
|||
qs: query,
|
||||
uri: uri || `${credentials.url}/api${resource}`,
|
||||
body,
|
||||
rejectUnauthorized: credentials.allowUnauthorizedCerts as boolean,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ export class TheHive implements INodeType {
|
|||
description: INodeTypeDescription = {
|
||||
displayName: 'TheHive',
|
||||
name: 'theHive',
|
||||
icon: 'file:thehive.png',
|
||||
icon: 'file:thehive.svg',
|
||||
group: ['transform'],
|
||||
subtitle: '={{$parameter["operation"]}} : {{$parameter["resource"]}}',
|
||||
version: 1,
|
||||
|
@ -216,6 +216,8 @@ export class TheHive implements INodeType {
|
|||
{ name: 'Execute Responder', value: 'executeResponder', description: 'Execute a responder on the specified alert' },
|
||||
{ name: 'Get', value: 'get', description: 'Get an alert' },
|
||||
{ name: 'Get All', value: 'getAll', description: 'Get all alerts' },
|
||||
{ name: 'Mark as Read', value: 'markAsRead', description: 'Mark the alert as read' },
|
||||
{ name: 'Mark as Unread', value: 'markAsUnread', description: 'Mark the alert as unread' },
|
||||
{ name: 'Merge', value: 'merge', description: 'Merge alert into an existing case' },
|
||||
{ name: 'Promote', value: 'promote', description: 'Promote an alert into a case' },
|
||||
{ name: 'Update', value: 'update', description: 'Update alert' },
|
||||
|
@ -535,6 +537,26 @@ export class TheHive implements INodeType {
|
|||
);
|
||||
}
|
||||
|
||||
if (operation === 'markAsRead') {
|
||||
const alertId = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/alert/${alertId}/markAsRead`,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'markAsUnread') {
|
||||
const alertId = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/alert/${alertId}/markAsUnread`,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'merge') {
|
||||
const alertId = this.getNodeParameter('id', i) as string;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export class TheHiveTrigger implements INodeType {
|
|||
description: INodeTypeDescription = {
|
||||
displayName: 'TheHive Trigger',
|
||||
name: 'theHiveTrigger',
|
||||
icon: 'file:thehive.png',
|
||||
icon: 'file:thehive.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
description: 'Starts the workflow when a TheHive event occurs.',
|
||||
|
|
|
@ -82,6 +82,8 @@ export const alertFields = [
|
|||
],
|
||||
operation: [
|
||||
'promote',
|
||||
'markAsRead',
|
||||
'markAsUnread',
|
||||
'merge',
|
||||
'update',
|
||||
'executeResponder',
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 819 B |
1
packages/nodes-base/nodes/TheHive/thehive.svg
Normal file
1
packages/nodes-base/nodes/TheHive/thehive.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><defs><style>.cls-1{fill:#f3d02f;}.cls-2{fill:#fff;}</style></defs><title>th-logo</title><path class="cls-1" d="M290,150A140,140,0,1,1,150,10,140,140,0,0,1,290,150"/><path class="cls-2" d="M204.62,210.6a15.13,15.13,0,0,1-6.68,1.38,17.49,17.49,0,0,1-16.11-10.93L177,189.45l-7.31-18.28a5.05,5.05,0,0,0-.7-2.12l-10.1-25.31c16.15,2.86,45.93,20.16,55.68,43.72,3.48,9.49-.76,19.66-9.9,23.14m-54.87,27.21c-11.58,0-21-8.5-24.85-21.5l49.85.16c-3.9,13.33-13.41,21.38-25,21.34m-48-26.14a14.3,14.3,0,0,1-6.67-1.43c-8.76-3.89-13.29-14.09-9.4-22.85,9.91-23.85,39.81-40.95,56-43.36L131,170l-7.79,19.29-5,11.57a18.34,18.34,0,0,1-16.53,10.83m42.63-45.16L150,152.84l5.57,13.71Zm-7.79,19.29,3.19-8.06,20.37.07,3.13,8.08Zm-5,11.57,36.17.12,3.13,8.09-42.48-.15Zm18.56-90.87c9.48,0,17.53,9.18,17.5,16.56,0,8.77-14.43,9.43-17.23,9.41-3.16,0-17.21-.4-17.18-9.53-.67-7.38,7.43-16.48,16.91-16.44"/><path class="cls-2" d="M136.88,106.1a3.75,3.75,0,0,1-3.39-2.15l-5.81-12.34a3.74,3.74,0,1,1,6.77-3.19l5.81,12.34a3.74,3.74,0,0,1-1.79,5,3.79,3.79,0,0,1-1.59.36"/><path class="cls-2" d="M163.12,106.1a3.79,3.79,0,0,1-1.59-.36,3.74,3.74,0,0,1-1.79-5l5.82-12.35a3.74,3.74,0,1,1,6.77,3.2L166.51,104a3.75,3.75,0,0,1-3.39,2.15"/><path class="cls-2" d="M204.36,157.81a3.74,3.74,0,0,1-3.26-5.56l14.41-25.87-32.87-56.7H117.36L84.54,126.3l15.66,25.83A3.74,3.74,0,0,1,93.8,156L77,128.28a3.72,3.72,0,0,1,0-3.81l35-60.41a3.77,3.77,0,0,1,3.24-1.87h69.6A3.75,3.75,0,0,1,188,64.06l35,60.41a3.73,3.73,0,0,1,0,3.7l-15.44,27.72a3.75,3.75,0,0,1-3.28,1.92"/></svg>
|
After Width: | Height: | Size: 1.6 KiB |
Loading…
Reference in a new issue