-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create obligatron mode for AWS infrastructure vulnerabilities #1200
Conversation
export async function evaluateFsbpVulnerabilities( | ||
client: PrismaClient, | ||
): Promise<ObligationResult[]> { | ||
const findings = (await getFsbpFindings(client, ['CRITICAL', 'HIGH'])).map( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these severities were passed via configuration, would it make local development easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would it make local development easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was thinking of this within cloudbuster
service-catalogue/packages/cloudbuster/src/config.ts
Lines 29 to 31 in eb35b3e
const severities: SecurityHubSeverity[] = isDev | |
? ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'INFORMATION'] // Using all severities in DEV for more data. | |
: ['CRITICAL', 'HIGH']; |
packages/obligatron/src/obligations/aws-vulnerabilities.test.ts
Outdated
Show resolved
Hide resolved
client: PrismaClient, | ||
): Promise<ObligationResult[]> { | ||
const findings = (await getFsbpFindings(client, ['CRITICAL', 'HIGH'])).map( | ||
(v) => v as unknown as SecurityHubFinding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a bit of a spooky typecast! Are we sure that our schema will always match AWSs? Could lead to some annoying to debug errors if not!
We're quite explicit with type checking in the TAGGING job (maybe too much!), I wonder if we could have any shared behaviour for checking the schema matches?
service-catalogue/packages/obligatron/src/obligations/tagging.ts
Lines 40 to 44 in ba13195
const isFindingResource = (resource: unknown): resource is FindingResource => | |
typeof resource === 'object' && | |
resource != null && | |
'Id' in resource && | |
'Tags' in resource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as unknown as <CUSTOM TYPE>
is a pretty common pattern across the service catalogue, especially in repocop. If we want to move away from it, could that be a separate piece of work?
c96ab84
to
3390d60
Compare
What does this change
Creates a new obligatron mode that collects information about AWS infrastructure vulnerabilities. Currently, it only logs the output and does not write to the table. This is because we are currently not filtering out results that are within SLA. This will need to be done as a separate PR as further work is needed to unify:
Severity
typesSo, that work will be done as a follow up PR. At that point, we will start writing to the DB
Why?
So we can track departmental progress against our obligation to keep our AWS infrastructure compliant with AWS FSBP
How has it been verified?
Verified locally. Added unit tests to confirm expected behaviour