Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Combine analyst emails #1628

Merged
merged 15 commits into from
Mar 17, 2020
Merged

Combine analyst emails #1628

merged 15 commits into from
Mar 17, 2020

Conversation

sastels
Copy link
Contributor

@sastels sastels commented Mar 5, 2020

Fixes #1652
Fixes #1579
Fixes #1450

Description

Use nodemailer library to combine files and report into a single email. This means we don't have to use makemime anymore.

Also, if LDAP_UID and MAIL_TO are empty then the unencrypted report will be emailed to the user if contactinfo.email is filled in.

Any new packages installed?

no, we were already using nodemailer to connect to the SMTP server.

Checklist:

  • I have looked at my code on GitHub and it all looks good (ex: no random commented out code or console.logs)
  • I have added and needed tests for my changes (in particular for new screens)
  • I have added a comment to any confusing code

@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 5, 2020 16:19 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 5, 2020 16:23 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 5, 2020 16:37 Inactive
@ngosset ngosset self-requested a review March 5, 2020 20:30
ngosset
ngosset previously requested changes Mar 5, 2020
Copy link
Contributor

@ngosset ngosset left a comment

Choose a reason for hiding this comment

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

Uploaded: puppy, borat, virus

Got single E-mail with: puppy, borat (yay)

Problem: Body of e-mail only lists "file details" for the virus (which was not attached)
But does not list the content moderator scores for Borat or the details around the puppy.

Logs:

Availability configured
Self harm word list: agile,lean,mvp,scrum
WARNING: Notify environment variable NOTIFY_API_KEY is missing. Emailing links will probably not work.
WARNING: Notify environment variable NOTIFY_API_BASE_URL is missing. Emailing links will probably not work.
WARNING: Notify environment variable NOTIFY_CONFIRMATION_TEMPLATE_ID is missing. Emailing links will probably not work.
Notify client NOT created
Fetching uid for 000146484
Listening at port 3000
Encrypted Mail: Found LDAP entry for 000146484
Encrypted Mail: Certificate for 000146484 Saved!
New Request. {"numberOfSubmissions":0,"numberOfRequests":1,"lastRequested":"2020-03-05T20:25:27.926Z"}
New Request. {"numberOfSubmissions":0,"numberOfRequests":2,"lastRequested":"2020-03-05T20:26:58.237Z"}
Error in Content Moderator: Error
ncfrs0t82gqy32ha
(node:1) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Encrypted Mail: Message encrypted
Create container ncfrs0t82gqy32ha successfully 7582b764-a01e-0022-4c2c-f35897000000
{
name: 'eicar.com.txt',
type: 'text/plain',
size: 68,
fileDescription: '',
path: '/tmp/upload_482108b4f75e61d165b1b1fb60126140.txt',
sha1: '3395856ce81f2b7382dee72602f798b642f14140',
malwareScanDetail: 'stream: Win.Test.EICAR_HDB-1 FOUND\u0000',
malwareIsClean: false,
adultClassificationScore: 'Could not scan'
}
Upload block blob 3395856ce81f2b7382dee72602f798b642f14140 successfully 7582b796-a01e-0022-672c-f35897000000
{
name: 'evidence (1).jpg',
type: 'image/jpeg',
size: 72972,
fileDescription: '',
path: '/tmp/upload_4bf380f714b1668332bdb6dbf30fa353.jpg',
sha1: 'b61b601eeadbaa15ecfd4f34ed47c82ee95c6dc8',
malwareScanDetail: 'stream: OK\u0000',
malwareIsClean: true,
isImageRacyClassified: false,
isImageAdultClassified: false,
adultClassificationScore: 0.029178058728575706,
racyClassificationScore: 0.04097716510295868
}
Report NCFRS-0t82gqy32ha saved to CosmosDB
Upload block blob b61b601eeadbaa15ecfd4f34ed47c82ee95c6dc8 successfully 7582b7c4-a01e-0022-032c-f35897000000
{
name: 'borat.jpg',
type: 'image/jpeg',
size: 34587,
fileDescription: '',
path: '/tmp/upload_241e1e3df65859d13805c14e76f0cd6d.jpg',
sha1: '83ef6584ed252001b581d5d906cd2155d93fb9e7',
malwareScanDetail: 'stream: OK\u0000',
malwareIsClean: true,
isImageRacyClassified: true,
isImageAdultClassified: false,
adultClassificationScore: 0.06528254598379135,
racyClassificationScore: 0.49934738874435425
}
Upload block blob 83ef6584ed252001b581d5d906cd2155d93fb9e7 successfully 7582b803-a01e-0022-2f2c-f35897000000
Encrypted Mail: Message sent to Norman.Gosset@rcmp-grc.gc.ca: e85e28b1-1a19-9a9c-525d-2c6029e30c67@r4jb6af.m.notification.alpha.canada.ca

@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 5, 2020 20:47 Inactive
})

let attachments = data.evidence.files
.filter(file => !isProductionSystem || file.malwareIsClean)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

right now we're not connecting to Clam outside prod - just a hack so that we'll get files attached anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got our own clam and removed this hack.

@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 6, 2020 16:43 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 6, 2020 18:36 Inactive
@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2020

This pull request introduces 1 alert when merging ae576c4 into 6195d7a - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 6, 2020 18:44 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 6, 2020 18:59 Inactive
@sastels sastels requested a review from ngosset March 6, 2020 19:09
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-xhbsg6 March 10, 2020 16:49 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-wygvj9 March 16, 2020 14:13 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-wygvj9 March 16, 2020 15:09 Inactive
@sastels sastels dismissed ngosset’s stale review March 16, 2020 15:15

It appears to be working now.

@kevinyang06
Copy link
Contributor

image
I'm not able to received files attachment on outlook

@sastels
Copy link
Contributor Author

sastels commented Mar 17, 2020

I'm not able to received files attachment on outlook

I'm not sure why the file info table is messed up ☝️ but (I think) the reason you didn't get a file attached is that the virus scanner didn't run (so the system defaults to assuming the file has a malware and doesn't attach). You might need a new CLAM_URL

@sastels sastels temporarily deployed to rac-prototyp-replace-ma-wygvj9 March 17, 2020 15:17 Inactive
@sastels sastels temporarily deployed to rac-prototyp-replace-ma-wygvj9 March 17, 2020 16:17 Inactive
Copy link
Contributor

@ngosset ngosset left a comment

Choose a reason for hiding this comment

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

LGTM!

@sastels sastels temporarily deployed to rac-prototyp-replace-ma-wygvj9 March 17, 2020 19:51 Inactive
@sastels sastels merged commit b5b5dc8 into master Mar 17, 2020
@sastels sastels deleted the replace-makemime branch March 17, 2020 20:05
sastels added a commit that referenced this pull request Mar 19, 2020
* Minor copy change (typo) (#1639)

* extract data from formidable manually (#1641)

* fix: upgrade mongodb from 3.5.2 to 3.5.3 (#1632)

* fix: upgrade react-scripts from 3.3.1 to 3.4.0 (#1642)

* Fix for Logs in another Azure Subscription (#1619)

* Updating IMAGE_NAME reference (#1597)

* change GNCC to GNC3 (#1655)

* use redirect for equifax links (#1651)

* clear file input after alert (#1662)

* fix keyboard nav (#1660)

* add moneyLost.methodOther field to analyst report (#1647)

* more detailed p and text stories (#1643)

* added stuff to sb docs (#1671)

* added getting started page to storybook (#1661)

* FIX CORS for HTTPS (#1665) (#1669)

* clean up logging a bit (#1663)

* tweak skiplink style (#1658)

* fix target area for upload button (#1653)

* change "go back" button's height to the same height as "cancel report" button (#1666)

* added Messages component.  (#1644)

* fix: upgrade async from 3.1.1 to 3.2.0 (#1680)

* Reports a day counter (#1664)

* Form validation - bump (#1510)

* added helmet in server.js (#1674)

* Combine analyst emails (#1628)

* Prod version number (#1656)

* Fixed Field, added container and layout to sb (#1675)

* Get email addresses from ldap query (#1682)

* restrict file number and size on server (#1648)

* remove submit button if already submitted (#1683)

* Fix for Continuous Deployment (#1690)

* Validation for location fields (#1689)

* cypress pack initial commit (#1247)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants