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

Fix AV scan #11519

Merged
merged 10 commits into from
Nov 15, 2023
Merged

Fix AV scan #11519

merged 10 commits into from
Nov 15, 2023

Conversation

gmrabian
Copy link
Contributor

@gmrabian gmrabian commented Nov 14, 2023

Description

Our virus scan started failing after upgrading the lambda runtime to node 18 because node 16 and below included aws-sdkv2 and node18+ includes aws-sdkv3

V2 to V3 upgrade suggestion from this forum and confirmed by AWS announcement

Explanation of changes:

  • Import changed from all of aws-sdk to modulized @aws-sdk/client-s3
  • v2 required .promise() on awaits and v3 does not
  • The client.{commandType}(params) syntax has changed to
const command = new {CommandType}(params)
const response = client.send(command)

AWS-SDKv3 S3 docs

Related ticket(s)

CMDCT-3013


How to test

  • Get on ZScaler
  • Go into AWS mcr-dev
  • Go to S3 -> uploads-virus-scan-3013-attachments-446712541566
  • Drag and drop a file into the bucket
  • Go to lambda -> uploads-virus-scan-3013-avScan -> Monitor tab -> View Cloudwatch logs
  • Go to latest log
  • Confirm it scanned your file successfully
  • In the bucket click on your object and verify it has the CLEAN tag

Verify MCPAR template was tagged CLEAN


Author checklist

  • I have performed a self-review of my code

@gmrabian gmrabian changed the title Virus scan 3013 [WIP] – Fix av scan Nov 14, 2023
@gmrabian gmrabian changed the title [WIP] – Fix av scan Fix AV scan Nov 14, 2023
@gmrabian gmrabian added the ready for review Ready for all the reviews! label Nov 14, 2023
@gmrabian gmrabian marked this pull request as ready for review November 14, 2023 21:48
Copy link
Contributor

@benmartin-coforma benmartin-coforma left a comment

Choose a reason for hiding this comment

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

I have not tested, but this looks about right!

services/uploads/src/antivirus.js Show resolved Hide resolved
services/uploads/src/clamav.js Show resolved Hide resolved
karla-vm
karla-vm previously approved these changes Nov 15, 2023
Copy link
Collaborator

@karla-vm karla-vm left a comment

Choose a reason for hiding this comment

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

Confirmed behavior in CloudTamer 💯
Screenshot 2023-11-15 at 10 32 42 AM

@gmrabian gmrabian added in progress In progress and removed ready for review Ready for all the reviews! labels Nov 15, 2023
Copy link

codeclimate bot commented Nov 15, 2023

Code Climate has analyzed commit 2844ff5 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (90% is the threshold).

This pull request will bring the total coverage in the repository to 96.0% (0.0% change).

View more on Code Climate.

@gmrabian gmrabian requested a review from karla-vm November 15, 2023 17:21
@gmrabian gmrabian removed the in progress In progress label Nov 15, 2023
@gmrabian gmrabian added the ready for review Ready for all the reviews! label Nov 15, 2023
Copy link
Contributor

@benmartin-coforma benmartin-coforma left a comment

Choose a reason for hiding this comment

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

LGTM!

@gmrabian gmrabian merged commit 4af77a0 into main Nov 15, 2023
@gmrabian gmrabian deleted the virus-scan-3013 branch November 15, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review Ready for all the reviews!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants