Skip to content
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

Feature/bai 1461 manual rerequest filescanning #1633

Merged
merged 12 commits into from
Dec 10, 2024

Conversation

ARADDCC002
Copy link
Member

No description provided.

@PE39806
Copy link
Contributor

PE39806 commented Dec 3, 2024

The "Last ran at..." text does not appear when viruses are found, neither does the scanner version tag, and I think it would be helpful to see the time for when a scan was last run to check whether re-running a scan has completed or not.
image

if (!file) {
throw BadReq('Cannot find requested file', { modelId: modelId, fileId: fileId })
}
const auth = await authorisation.model(user, model, ModelAction.Update)
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a FileAction.Update?

Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to add tests for this new route.

@@ -152,3 +156,28 @@ export async function getTotalFileSize(fileIds: string[]) {
})
return totalSize.at(0).totalSize
}

export async function rerunFileScan(user: UserInterface, modelId, fileId: string) {
Copy link
Member

Choose a reason for hiding this comment

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

To prevent the scanners being overloaded, we could first check if a scan is already underway?

@@ -152,3 +156,28 @@ export async function getTotalFileSize(fileIds: string[]) {
})
return totalSize.at(0).totalSize
}

export async function rerunFileScan(user: UserInterface, modelId, fileId: string) {
Copy link
Member

Choose a reason for hiding this comment

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

Test this new function.

JR40159
JR40159 previously requested changes Dec 4, 2024
Copy link
Member

@JR40159 JR40159 left a comment

Choose a reason for hiding this comment

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

As mentioned in the ticket, this might require a migration as files that existing prior to adding the ability to scan them might be missing the avScan property. Could you check this please?

@ARADDCC002
Copy link
Member Author

As mentioned in the ticket, this might require a migration as files that existing prior to adding the ability to scan them might be missing the avScan property. Could you check this please?

Does migration 009 not cover this use case?

@PE39806
Copy link
Contributor

PE39806 commented Dec 5, 2024

Test what happens when a scanner is killed off part way through a scan - we want to be able to catch this and update the scan result to "could not complete" rather than indefinitely reporting "virus scan in progress".


let av: NodeClam
export const clamAvToolName = 'Clam AV'
const maxInitRetries = 5
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like the max retry count maxInitRetries = 5 and delay between pings 10000 to be configurable like retryDelayInMinutes e.g. connectors.fileScanners.maxInitRetries and connectors.fileScanners.initRetryDelay.

@@ -113,8 +113,8 @@ describe('clients > modelScan', () => {
)
})

test('scanStream > rejected', async () => {
fetchMock.default.mockRejectedValueOnce('Unable to communicate with the inferencing service.')
test('scanFile > rejected', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert scanFile to scanStream

@ARADDCC002 ARADDCC002 merged commit e8a6b58 into main Dec 10, 2024
18 checks passed
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.

3 participants