Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/likelihoood/mailyak
An elegant MIME mail library with support for attachments
io.Reader
)io.Writer
for convenience)go get -v github.com/domodwyer/mailyak
// Create a new email - specify the SMTP host and auth
mail := mailyak.New("mail.host.com:25", smtp.PlainAuth("", "user", "pass", "mail.host.com"))
mail.To("dom@itsallbroken.com")
mail.From("nigerianprince@justneedshelp.com")
mail.FromName("Prince Fournineteen")
mail.Subject("Business proposition")
// mail.HTML() and mail.Plain() implement io.Writer, so you can do handy things like
// parse a template directly into the email body
if err := t.ExecuteTemplate(mail.HTML(), "htmlEmail", data); err != nil {
panic(" 💣 ")
}
// Or set the body using a string setter
mail.Plain().Set("Get a real email client")
// And you're done!
if err := mail.Send(); err != nil {
panic(" 💣 ")
}
To send an attachment:
mail := mailyak.New("mail.host.com:25", smtp.PlainAuth("", "user", "pass", "mail.host.com"))
mail.To("dom@itsallbroken.com")
mail.From("oops@itsallbroken.com")
mail.Subject("I am a teapot")
mail.HTML().Set("Don't panic")
// input can be a bytes.Buffer, os.File, os.Stdin, etc.
// call multiple times to attach multiple files
mail.Attach("filename.txt", &input)
if err := mail.Send(); err != nil {
panic(" 💣 ")
}
Send()
to prevent holding onto multiple copies of the attachment in memory (source and email) - this means changing the attachment data between calling Attach()
and Send()
will change what's emailed out!FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.