@enterprise-cmcs/macpro-security-hub-sync
Advanced tools
Comparing version 1.12.0 to 1.13.0
@@ -9,2 +9,3 @@ import { Remediation, AwsSecurityFinding } from "@aws-sdk/client-securityhub"; | ||
export interface SecurityHubFinding { | ||
id?: string; | ||
title?: string; | ||
@@ -32,2 +33,3 @@ region?: string; | ||
getAllActiveFindings(): Promise<{ | ||
id?: string | undefined; | ||
title?: string | undefined; | ||
@@ -34,0 +36,0 @@ region?: string | undefined; |
@@ -98,2 +98,3 @@ "use strict"; | ||
return { | ||
id: finding.Id, | ||
title: finding.Title, | ||
@@ -100,0 +101,0 @@ region: finding.Region, |
@@ -32,2 +32,3 @@ import { Resource, SecurityHubFinding } from "./libs"; | ||
makeResourceList(resources: Resource[] | undefined): string; | ||
createSecurityHubFindingUrlThroughFilters(findingId: string): string; | ||
createIssueBody(finding: SecurityHubFinding): string; | ||
@@ -34,0 +35,0 @@ createSecurityHubFindingUrl(standardsControlArn?: string): string; |
@@ -113,4 +113,33 @@ "use strict"; | ||
} | ||
createSecurityHubFindingUrlThroughFilters(findingId) { | ||
let region, accountId; | ||
if (findingId.startsWith("arn:")) { | ||
// Extract region and account ID from the ARN | ||
const arnParts = findingId.split(":"); | ||
if (arnParts.length >= 5) { | ||
region = arnParts[3]; | ||
accountId = arnParts[4]; | ||
} | ||
else { | ||
return "Invalid URL"; | ||
} | ||
} | ||
else { | ||
// Extract region and account ID from the non-ARN format | ||
const parts = findingId.split("/"); | ||
if (parts.length >= 3) { | ||
region = parts[1]; | ||
accountId = parts[2]; | ||
} | ||
else { | ||
return "Invalid URL"; | ||
} | ||
} | ||
const baseUrl = `https://${region}.console.aws.amazon.com/securityhub/home?region=${region}`; | ||
const searchParam = `Id%3D%255Coperator%255C%253AEQUALS%255C%253A${findingId}`; | ||
const url = `${baseUrl}#/findings?search=${searchParam}`; | ||
return url; | ||
} | ||
createIssueBody(finding) { | ||
const { remediation: { Recommendation: { Url: remediationUrl = "", Text: remediationText = "", } = {}, } = {}, title = "", description = "", accountAlias = "", awsAccountId = "", severity = "", standardsControlArn = "", } = finding; | ||
const { remediation: { Recommendation: { Url: remediationUrl = "", Text: remediationText = "", } = {}, } = {}, id = "", title = "", description = "", accountAlias = "", awsAccountId = "", severity = "", standardsControlArn = "", } = finding; | ||
return `---- | ||
@@ -148,3 +177,5 @@ | ||
h2. SecurityHubFindingUrl: | ||
${this.createSecurityHubFindingUrl(standardsControlArn)} | ||
${standardsControlArn | ||
? this.createSecurityHubFindingUrl(standardsControlArn) | ||
: this.createSecurityHubFindingUrlThroughFilters(id)} | ||
@@ -151,0 +182,0 @@ h2. Resources: |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"description": "NPM module to create Jira issues for all findings in Security Hub for the current AWS account..", | ||
@@ -10,0 +10,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51111
914