
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
github.com/kucjac/uni-db
Package unidb contains unified database Errors converted from third-party package errors.
In order to create the RESTful API that is indepenedent of the database type, the database errors must be converted into single form. This package defines database Errors with some Prototypes that are the most common error categories.
// Unified database error
type Error struct {
ID uint
Title string
Message string
}
// database error prototypes
var (
...
ErrIntegrityConstViolation = Error{
ID: 6,
Title: "Integrity constraint violation",
}
...
)
In order to maintaing uniform form of the error converting, every database driver should implement the 'Converter' interface with it's custom error converter.
// Converter interface
type Converter interface {
Convert(err error) *unidb.Error
}
...
type CustomConverter struct {
// Contains some kind of error mapper
// from custom errors into unidb.ErrPrototype
}
func (c *CustomConverter) Convert(err error) *unidb.Error {
// get unidb.ErrPrototype from the mapping and
// create new *unidb.Error on it's base
customErr := err.(CustomErrorType)
proto, ok := mapping[customErr]
if !ok {
return unidb.ErrUnspecifiedError.New()
}
return proto.New()
}
...
Good examples on how to write error converters are the converters defined in the mysqlconv, pgconv, sqliteconv or gormconv packages.
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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.