fix(deps): update dependency nodemailer to v8 [security]#4270
fix(deps): update dependency nodemailer to v8 [security]#4270renovate-bot wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
Conversation
|
/gcbrun |
There was a problem hiding this comment.
Code Review
This pull request updates the nodemailer dependency in compute/package.json to version 8.0.4. The review feedback identifies an opportunity to simplify the project by removing the deprecated nodemailer-smtp-transport package, which is now redundant as SMTP transport is built into the newer version of nodemailer.
| "@google-cloud/compute": "^4.0.0", | ||
| "@sendgrid/mail": "^8.0.0", | ||
| "nodemailer": "^6.0.0", | ||
| "nodemailer": "^8.0.4", |
There was a problem hiding this comment.
With this major version upgrade of nodemailer, it's a good opportunity to also remove the deprecated nodemailer-smtp-transport package. SMTP transport is included in nodemailer by default, so this dependency is no longer needed.
Removing it would require updating compute/mailjet.js to use the built-in transport. This would simplify the code and remove a dependency that hasn't been updated in a long time.
Here's how compute/mailjet.js could be updated:
const mailer = require('nodemailer');
// const smtp = require('nodemailer-smtp-transport'); // This can be removed
async function mailjet() {
const transport = mailer.createTransport({
host: 'in.mailjet.com',
port: 2525,
auth: {
user: process.env.MAILJET_API_KEY || '<your-mailjet-api-key',
pass: process.env.MAILJET_API_SECRET || '<your-mailjet-api-secret>',
},
});
// ...
}The corresponding test file compute/test/mailjet.test.js would also need to be updated to reflect these changes.
c0a674c to
3e9d27b
Compare
|
/gcbrun |
3e9d27b to
e020892
Compare
|
/gcbrun |
e020892 to
850aed2
Compare
|
/gcbrun |
850aed2 to
a86144e
Compare
|
/gcbrun |
a86144e to
a9fadca
Compare
|
/gcbrun |
a9fadca to
48ef02d
Compare
|
/gcbrun |
48ef02d to
f3583b7
Compare
|
/gcbrun |
f3583b7 to
22d530f
Compare
|
/gcbrun |
22d530f to
0754fcd
Compare
|
/gcbrun |
0754fcd to
49e740a
Compare
|
/gcbrun |
This PR contains the following updates:
^6.0.0→^8.0.4GitHub Vulnerability Alerts
GHSA-c7w3-x93f-qmm8
Summary
When a custom
envelopeobject is passed tosendMail()with asizeproperty containing CRLF characters (\r\n), the value is concatenated directly into the SMTPMAIL FROMcommand without sanitization. This allows injection of arbitrary SMTP commands, includingRCPT TO— silently adding attacker-controlled recipients to outgoing emails.Details
In
lib/smtp-connection/index.js(lines 1161-1162), theenvelope.sizevalue is concatenated into the SMTPMAIL FROMcommand without any CRLF sanitization:This contrasts with other envelope parameters in the same function that ARE properly sanitized:
from,to): validated for[\r\n<>]at lines 1107-1127dsn.ret,dsn.envid,dsn.orcpt): encoded viaencodeXText()at lines 1167-1183The
sizeproperty reaches this code path throughMimeNode.setEnvelope()inlib/mime-node/index.js(lines 854-858), which copies all non-standard envelope properties verbatim:Since
_sendCommand()writes the command string followed by\r\nto the raw TCP socket, a CRLF in thesizevalue terminates theMAIL FROMcommand and starts a new SMTP command.Note: by default, Nodemailer constructs the envelope automatically from the message's
from/tofields and does not includesize. This vulnerability requires the application to explicitly pass a customenvelopeobject with asizeproperty tosendMail().While this limits the attack surface, applications that expose envelope configuration to users are affected.
PoC
ave the following as
poc.jsand run withnode poc.js:Expected output:
The
RCPT TO:<attacker@evil.com>line is injected by the CRLF in thesizefield, silently adding an extra recipient to the email.Impact
This is an SMTP command injection vulnerability. An attacker who can influence the
envelope.sizeproperty in asendMail()call can:RCPT TOcommands, receiving copies of all emails sent through the affected transportRSET, additionalMAIL FROMto send entirely separate emails through the server)The severity is mitigated by the fact that the
envelopeobject must be explicitly provided by the application. Nodemailer's default envelope construction from message headers does not includesize. Applications that pass through user-controlled data to the envelope options (e.g., via API parameters, admin panels, or template configurations) are vulnerable.Affected versions: at least v8.0.3 (current); likely all versions where
envelope.sizeis supported.Release Notes
nodemailer/nodemailer (nodemailer)
v8.0.4Compare Source
Bug Fixes
v8.0.3Compare Source
Bug Fixes
v8.0.2Compare Source
Bug Fixes
v8.0.1Compare Source
Bug Fixes
v8.0.0Compare Source
⚠ BREAKING CHANGES
Bug Fixes
v7.0.13Compare Source
Bug Fixes
v7.0.12Compare Source
Bug Fixes
v7.0.11Compare Source
Bug Fixes
v7.0.10Compare Source
Bug Fixes
v7.0.9Compare Source
Bug Fixes
v7.0.7Compare Source
Bug Fixes
v7.0.6Compare Source
Bug Fixes
v7.0.5Compare Source
Bug Fixes
v7.0.4Compare Source
Bug Fixes
v7.0.3Compare Source
Bug Fixes
v7.0.2Compare Source
Bug Fixes
v7.0.1Compare Source
Bug Fixes
v7.0.0Compare Source
⚠ BREAKING CHANGES
Features
v6.10.1Compare Source
Bug Fixes
v6.10.0Compare Source
Features
Bug Fixes
v6.9.16Compare Source
Bug Fixes
v6.9.15Compare Source
Bug Fixes
v6.9.14Compare Source
Bug Fixes
v6.9.13Compare Source
Bug Fixes
v6.9.12Compare Source
Bug Fixes
v6.9.11Compare Source
Bug Fixes
v6.9.10Compare Source
Bug Fixes
v6.9.9Compare Source
Bug Fixes
v6.9.8Compare Source
Bug Fixes
v6.9.7Compare Source
Bug Fixes
v6.9.6Compare Source
Bug Fixes
v6.9.5Compare Source
Bug Fixes
v6.9.4Compare Source
v6.9.3Compare Source
v6.9.2Compare Source
v6.9.1Compare Source
Bug Fixes
v6.9.0Compare Source
v6.8.0Compare Source
v6.7.8Compare Source
v6.7.7Compare Source
v6.7.6Compare Source
v6.7.5Compare Source
v6.7.4Compare Source
v6.7.3Compare Source
v6.7.2Compare Source
v6.7.1Compare Source
v6.7.0Compare Source
v6.6.5Compare Source
v6.6.4Compare Source
v6.6.3Compare Source
"/* secret */"v6.6.2Compare Source
v6.6.1Compare Source
v6.6.0Compare Source
newlinefor MailComposerv6.5.0Compare Source
v6.4.18Compare Source
v6.4.17Compare Source
v6.4.16Compare Source
v6.4.15Compare Source
v6.4.14Compare Source
v6.4.13Compare Source
v6.4.12Compare Source
1787f22]v6.4.11Compare Source
v6.4.10Compare Source
v6.4.8Compare Source
v6.4.7Compare Source
v6.4.6Compare Source
requeueAttempts=nshould requeuentimes (Patrick Malouin) [a27ed2f]v6.4.5Compare Source
v6.4.4Compare Source
options.forceAuthfor SMTP (Patrick Malouin) [a27ed2f]v6.4.3Compare Source
8a927f5]v6.4.2Compare Source
v6.4.1Compare Source
v6.4.0Compare Source
f419b09]5c4c8ca]v6.3.1Compare Source
72bade9]250b1a8]2391aa4]v6.3.0Compare Source
v6.2.1Compare Source
v6.1.1Compare Source
authMethodpropertyv6.1.0Compare Source
ampfor providing AMP4EMAIL contentConfiguration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.