Skip to content

Commit

Permalink
filter out suppressed findings
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemberTang committed Oct 10, 2024
1 parent a7cd69c commit 6be145a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cloudbuster/src/findings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('findingsToGuardianFormat', () => {
first_observed_at: new Date('2020-01-01'),
product_fields: { ControlId: 'S.1' },
resources: [resource1, resource2],
workflow: { Status: 'NEW' },
};
it('should return n elements if n resources are associated with a finding', () => {
const actual = findingsToGuardianFormat(x);
Expand Down
4 changes: 3 additions & 1 deletion packages/cloudbuster/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export async function main() {
`Starting Cloudbuster. Level of severities that will be scanned: ${severities.join(', ')}`,
);

const dbResults = await getFsbpFindings(prisma, severities);
const dbResults = (await getFsbpFindings(prisma, severities)).filter(
(f) => f.workflow.Status !== 'SUPPRESSED',
);

const tableContents: cloudbuster_fsbp_vulnerabilities[] = dbResults.flatMap(
findingsToGuardianFormat,
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@ export type SecurityHubFinding = Pick<
severity: { Label: SecurityHubSeverity; Normalized: number };
resources: Resource[];
product_fields: { ControlId: string };
workflow: { Status: 'NEW' | 'NOTIFIED' | 'SUPPRESSED' | 'RESOLVED' }; //https://docs.aws.amazon.com/securityhub/latest/userguide/findings-workflow-status.html
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('The dependency vulnerabilities obligation', () => {
aws_account_id: '0123456',
first_observed_at: new Date('2020-01-01'),
product_fields: { ControlId: 'S.1' },
workflow: { Status: 'NEW' },
};

const twoResourceFinding: SecurityHubFinding = {
Expand Down

0 comments on commit 6be145a

Please sign in to comment.