-
Notifications
You must be signed in to change notification settings - Fork 18
Bai 2223 generalise scanners away from security #3139
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
base: main
Are you sure you want to change the base?
Conversation
…ed documentation, and new Scan model properties
|
Closes #2349 |
…and display more scan states
| @@ -54,13 +56,21 @@ export class ModelScanFileScanningConnector extends BaseQueueFileScanningConnect | |||
| const viruses: string[] = isInfected | |||
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.
ModelScan doesn't really have viruses (and therefore infected files) so I would drop these consts as they are superseded by vulnerabilities and update the log below.
| } | ||
|
|
||
| async initialiseScanners() { | ||
| for (const scanner of this.scanners) { |
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.
Could this be parallelised with
| for (const scanner of this.scanners) { | |
| await Promise.all(this.scanners.map(async (scanner) => { |
This would allow each artefact scanner to initialise at the same time which is faster. This may require a little extra error handling as Promise.all resolves once all promises in the array resolve, or rejects as soon as one of them rejects.
| // export async function up() { | ||
| // await ScanModel.updateMany( | ||
| // {}, | ||
| // { $rename: { viruses: 'vulnerabilities', isInfected: 'isVulnerable' } }, | ||
| // { strict: false }, | ||
| // ) | ||
| // } |
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 needs implementing.
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.
Also update the config key avScanning to artefactScanning
| export type FileInterfaceDoc = FileInterface & SoftDeleteDocument | ||
| // `id` is used by the python API so we need to keep this to prevent a breaking change | ||
| export type FileWithScanResultsInterface = FileInterface & { avScan: ScanInterface[]; id: string } | ||
| export type FileWithScanResultsInterface = FileInterface & { scanResult: ScanInterface[]; id: string } |
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.
| export type FileWithScanResultsInterface = FileInterface & { scanResult: ScanInterface[]; id: string } | |
| export type FileWithScanResultsInterface = FileInterface & { scanResults: ScanInterface[]; id: string } |
| info: vi.fn(() => []), | ||
| scan: vi.fn(() => new Promise(() => [fileScanResult])), | ||
| scannersInfo: vi.fn(() => []), | ||
| startScanners: vi.fn(() => new Promise(() => [fileScanResult])), |
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.
startScanners doesn't exist. Should this be startScans?
| }) | ||
|
|
||
| // @ts-expect-error calling protected method | ||
| expect(() => exporter._init()).toThrowError(expectedErr) |
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.
I'm getting a test failure here?
| <ul> | ||
| {scanResult.vulnerabilities.map((vulnerability) => ( | ||
| <li | ||
| //this surely needs to change |
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.
Does this need updating?
As Bailo moves towards more generalised scanners — the scanning of images and scanning of "vulnerabilities" over "viruses" — the file scanning functionality needs to be generalised/repurposed for the inclusion of other artefact types.