-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1274 from guardian/nt/cloudbuster3
Write cloudbuster findings to cloudquery
- Loading branch information
Showing
11 changed files
with
215 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/common/prisma/migrations/20240930103347_create_fsbp_table/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CREATE TABLE "cloudbuster_fsbp_vulnerabilities" ( | ||
"arn" TEXT NOT NULL, | ||
"aws_account_id" TEXT NOT NULL, | ||
"aws_account_name" TEXT, | ||
"aws_region" TEXT NOT NULL, | ||
"control_id" TEXT NOT NULL, | ||
"first_observed_at" TIMESTAMP(6), | ||
"repo" TEXT, | ||
"stack" TEXT, | ||
"stage" TEXT, | ||
"app" TEXT, | ||
"severity" TEXT NOT NULL, | ||
"title" TEXT NOT NULL, | ||
"within_sla" BOOLEAN NOT NULL, | ||
"remediation" TEXT, | ||
|
||
CONSTRAINT "cloudbuster_fsbp_vulnerabilities_pkey" PRIMARY KEY ("arn","control_id") | ||
); | ||
|
||
GRANT ALL ON public.cloudbuster_fsbp_vulnerabilities TO cloudbuster; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import type { aws_securityhub_findings, PrismaClient } from '@prisma/client'; | ||
import type { SecurityHubSeverity } from './types'; | ||
import type { SecurityHubFinding, SecurityHubSeverity } from './types'; | ||
/** | ||
* Queries the database for FSBP findings | ||
*/ | ||
|
||
export async function getFsbpFindings( | ||
prisma: PrismaClient, | ||
severities: SecurityHubSeverity[], | ||
): Promise<aws_securityhub_findings[]> { | ||
const findings = await prisma.aws_securityhub_findings.findMany({ | ||
where: { | ||
OR: severities.map((s) => ({ | ||
severity: { path: ['Label'], equals: s }, | ||
})), | ||
AND: { | ||
generator_id: { | ||
startsWith: 'aws-foundational-security-best-practices/v/1.0.0', | ||
): Promise<SecurityHubFinding[]> { | ||
const findings: aws_securityhub_findings[] = | ||
await prisma.aws_securityhub_findings.findMany({ | ||
where: { | ||
OR: severities.map((s) => ({ | ||
severity: { path: ['Label'], equals: s }, | ||
})), | ||
AND: { | ||
generator_id: { | ||
startsWith: 'aws-foundational-security-best-practices/v/1.0.0', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
return findings; | ||
return findings as unknown as SecurityHubFinding[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 2 additions & 22 deletions
24
packages/obligatron/src/obligations/aws-vulnerabilities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.