Skip to content

Conversation

@IR96334
Copy link
Member

@IR96334 IR96334 commented Jan 26, 2026

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.

@IR96334
Copy link
Member Author

IR96334 commented Jan 27, 2026

Closes #2349

@IR96334 IR96334 marked this pull request as ready for review January 29, 2026 11:07
@PE39806 PE39806 linked an issue Jan 30, 2026 that may be closed by this pull request
Comment on lines 55 to 56
@@ -54,13 +56,21 @@ export class ModelScanFileScanningConnector extends BaseQueueFileScanningConnect
const viruses: string[] = isInfected
Copy link
Contributor

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) {
Copy link
Contributor

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

Suggested change
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.

Comment on lines 3 to 9
// export async function up() {
// await ScanModel.updateMany(
// {},
// { $rename: { viruses: 'vulnerabilities', isInfected: 'isVulnerable' } },
// { strict: false },
// )
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs implementing.

Copy link
Contributor

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 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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])),
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need updating?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generalise scanners away from security

5 participants