
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.
Dotenv-schema makes dotenv schemaful.
Write .env
and .env_schema
:
$ cat .env
DB_HOST=db.example.com
DB_PORT=3306
$ cat .env_schema
DB_HOST:
DB_PORT:
Add this line to your application's Gemfile:
gem 'dotenv-shcmea-rails'
# DO NOT load dotenv-rails gem! Use dotenv-schema-rails instead.
And then execute:
$ bundle
$ rails server
It fails Dotenv::Schema::ValidationError if the validation failed.
$ gem install dotenv
require 'dotenv-schema'
Dotenv.load # raises Dotenv::Schema::ValidationError if the validation failed.
.env_schema
format.env_schema
is based on YAML format.
It fails validation If any variables which are defined in .env_schema
don't exist in .env
.
# .env_schema
DB_HOST:
DB_PORT:
# .env
DB_HOST=db.example.com
# => Dotenv::Schema::ValidationError: ENV['DB_PORT'] must exist
It fails validation If any variables which aren't defined in .env_schema
exist in .env
.
# .env_schema
DB_HOST:
# .env
DB_HOST=db.example.com
DB_PORT=3306
# => Dotenv::Schema::ValidationError: Undefined variable(s): DB_PORT; Please add them into .env_schema
In default, it fails if any environment variables in .env
are empty string.
# .env_schema
DB_HOST:
# .env
DB_HOST=
# => Dotenv::Schema::ValidationError: ENV['DB_HOST'] must not be empty string
You can allow it by using allow_empty_string
option.
# .env_schema
DB_HOST:
allow_empty_string: true
# .env
DB_HOST=
# => Passes validation even though DB_HOST is empty
# .env_schema
DB_HOST:
DB_PORT:
allow_not_exists: true
# .env
DB_HOST=
# => Passes validation even though DB_PORT doesn't exist
FAQs
Unknown package
We found that dotenv-schema-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.