Skip to content

Commit

Permalink
fix(check): checked the arn split
Browse files Browse the repository at this point in the history
  • Loading branch information
maira-samtek committed Jul 18, 2024
1 parent 4153d69 commit ac12477
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/macpro-security-hub-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,21 @@ export class SecurityHubJiraSync {
if (findingId.startsWith("arn:")) {
// Extract region and account ID from the ARN
const arnParts = findingId.split(":");
region = arnParts[3];
accountId = arnParts[4];
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("/");
region = parts[1];
accountId = parts[2];
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}`;
Expand Down

0 comments on commit ac12477

Please sign in to comment.