
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
github.com/faroffemerg/go-email-validator
go get -u github.com/faroffemerg/go-email-validator
NewSyntaxValidator()
- mail.ParseAddress from built-in libraryNewSyntaxRegexValidator(emailRegex *regexp.Regexp)
- validation based on regular expressiondisposableValidator based on mailchecker by default (set is replaceable)
roleValidator bases on role-based-email-addresses by default (set is replaceable)
to use proxy connection, DialFunc need to be changed in Checker. There is evsmtp.H12IODial, implementing for h12w.
banWordsUsernameValidator looks for banned words in username
blackListEmailsValidator blocked emails from list
blackListValidator blocked emails with domains from black list
whiteListValidator accepts only emails from white list
gravatarValidator check existing of user on gravatar.com
package main
import (
"fmt"
"github.com/faroffemerg/go-email-validator/pkg/ev"
"github.com/faroffemerg/go-email-validator/pkg/ev/evmail"
)
func main() {
// create defaults DepValidator with GetDefaultFactories() as list of validators
builder := ev.NewDepBuilder(nil).Build()
/*
to set another list of initial validators
builder := NewDepBuilder(&ValidatorMap{
ev.ValidatorName: ev.Validator,
}).Build()
*/
// builder.Set(ev.ValidatorName, NewValidator()) builder
// builder.Has(names ...ev.ValidatorName) bool
// builder.Delete(names ...ev.ValidatorName) bool
validator := builder.Build()
v := validator.Validate(NewInput(evmail.FromString("test@evmail.com")))
if !v.IsValid() {
panic("email is invalid")
}
fmt.Println(v)
}
package main
import (
"fmt"
"github.com/faroffemerg/go-email-validator/pkg/ev"
"github.com/faroffemerg/go-email-validator/pkg/ev/evmail"
)
func main() {
var v = ev.NewSyntaxValidator().Validate(ev.NewInput(evmail.FromString("some@evmail.here"))) // ev.ValidationResult
if !v.IsValid() {
panic("email is invalid")
}
fmt.Println(v)
}
To set options for different validators, use NewInput(..., NewKVOption(ValidatorName, Options))
NewInput(
evmail.FromString("test@evmail.com"),
NewKVOption(SMTPValidatorName, evsmtp.NewOptions(evsmtp.OptionsDTO{
Port: 465,
})),
)
Use function New...(...) to create structure instead of public.
To add own validator, just implement ev.Validator interface. For validator without dependencies, you can use structure ev.AValidatorWithoutDeps
IsValid()
in ValidationResult.evcache.Interface
or use gocache implementation by evcache.NewCache
. See Test_Cache as example.Notice, to use msgpack you should have exported fields or implement custom encoding/decoding (doc)
Package use zap.
To use logging see in log package. Default level is zap.ErrorLevel.
The StackOverflow thread could be helpful.
telnet
OPEN gmail-smtp-in.l.google.com 25
EHLO localhost
MAIL FROM: <user@example.org>
rcpt to: <some.email@gmail.com>
quit
For example:
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.