From 1794e2fc07e77de8f6fac6b92e1753b211d13586 Mon Sep 17 00:00:00 2001 From: Jan Jurzitza Date: Mon, 18 Mar 2024 20:09:18 +0100 Subject: [PATCH] expose findings API in frontend --- kraken_frontend/src/api/api.ts | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/kraken_frontend/src/api/api.ts b/kraken_frontend/src/api/api.ts index 25bc7c75e..938555bea 100644 --- a/kraken_frontend/src/api/api.ts +++ b/kraken_frontend/src/api/api.ts @@ -8,7 +8,9 @@ import { Configuration, CreateAppRequest, CreateDomainRequest, + CreateFindingAffectedRequest, CreateFindingDefinitionRequest, + CreateFindingRequest, CreateGlobalTagRequest, CreateHostRequest, CreateLeechRequest, @@ -19,6 +21,7 @@ import { CreateWorkspaceRequest, CreateWorkspaceTagRequest, DomainsApi, + FindingsApi, GlobalTagsApi, HostsApi, KnowledgeBaseApi, @@ -32,6 +35,8 @@ import { SettingsManagementApi, UpdateAppRequest, UpdateDomainRequest, + UpdateFindingAffectedRequest, + UpdateFindingRequest, UpdateGlobalTag, UpdateHostRequest, UpdateLeechRequest, @@ -63,6 +68,7 @@ const configuration = new Configuration({ const userAdminManagement = new UserAdminManagementApi(configuration); const adminWorkspaces = new AdminWorkspacesApi(configuration); const attacks = new AttacksApi(configuration); +const findings = new FindingsApi(configuration); // const authentication = new generated.AuthenticationApi(configuration); const leechManagement = new LeechManagementApi(configuration); const userManagement = new UserManagementApi(configuration); @@ -175,6 +181,52 @@ export const Api = { attacks: { all: (uuid: UUID) => handleError(attacks.getWorkspaceAttacks({ uuid })), }, + findings: { + all: (workspace: UUID) => handleError(findings.getAllFindings({ uuid: workspace })), + create: (workspace: UUID, options: CreateFindingRequest) => + handleError(findings.createFinding({ uuid: workspace, createFindingRequest: options })), + get: (workspace: UUID, finding: UUID) => + handleError(findings.getFinding({ wUuid: workspace, fUuid: finding })), + update: (workspace: UUID, finding: UUID, options: UpdateFindingRequest) => + handleError( + findings.updateFinding({ wUuid: workspace, fUuid: finding, updateFindingRequest: options }), + ), + delete: (workspace: UUID, finding: UUID) => + handleError(findings.deleteFinding({ wUuid: workspace, fUuid: finding })), + addAffected: (workspace: UUID, finding: UUID, affected: CreateFindingAffectedRequest) => + handleError( + findings.createFindingAffected({ + wUuid: workspace, + fUuid: finding, + createFindingAffectedRequest: affected, + }), + ), + getAffected: (workspace: UUID, finding: UUID, affected: UUID) => + handleError( + findings.getFindingAffected({ + wUuid: workspace, + fUuid: finding, + aUuid: affected, + }), + ), + updateAffected: (workspace: UUID, finding: UUID, affected: UUID, options: UpdateFindingAffectedRequest) => + handleError( + findings.updateFindingAffected({ + wUuid: workspace, + fUuid: finding, + aUuid: affected, + updateFindingAffectedRequest: options, + }), + ), + removeAffected: (workspace: UUID, finding: UUID, affected: UUID) => + handleError( + findings.deleteFindingAffected({ + wUuid: workspace, + fUuid: finding, + aUuid: affected, + }), + ), + }, invitations: { all: (uuid: UUID) => handleError(workspaces.getAllWorkspaceInvitations({ uuid })), create: (uuid: UUID, user: UUID) =>