From 4153d69eb12bacf27cac5dbfe34f71463cabd0ad Mon Sep 17 00:00:00 2001 From: maira-samtek Date: Wed, 17 Jul 2024 18:34:07 -0400 Subject: [PATCH] fic(url): supported inspector url --- src/macpro-security-hub-sync.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/macpro-security-hub-sync.ts b/src/macpro-security-hub-sync.ts index 19247d6..06efeb6 100644 --- a/src/macpro-security-hub-sync.ts +++ b/src/macpro-security-hub-sync.ts @@ -177,9 +177,19 @@ export class SecurityHubJiraSync { return Table; } createSecurityHubFindingUrlThroughFilters(findingId: string) { - const arnParts = findingId.split(":"); - const region = arnParts[3]; - const accountId = arnParts[4]; + let region, accountId; + + if (findingId.startsWith("arn:")) { + // Extract region and account ID from the ARN + const arnParts = findingId.split(":"); + region = arnParts[3]; + accountId = arnParts[4]; + } else { + // Extract region and account ID from the non-ARN format + const parts = findingId.split("/"); + region = parts[1]; + accountId = parts[2]; + } const baseUrl = `https://${region}.console.aws.amazon.com/securityhub/home?region=${region}`; const searchParam = `Id%3D%255Coperator%255C%253AEQUALS%255C%253A${findingId}`;