
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.
Automatically cast process.env environment variables into native types (boolean, number, json object)
Environment variables like MAX_THREADS=5
, ENABLE_DEBUG=false
are usually imported into process.env as strings.
This leads to subtle bugs when treating them like booleans or numbers e.g. if (process.env['ENABLE_DEBUG'])...
because "false" equals true in JS
castenv
uses JSON.parse() to convert env variables into native types. castenv.cast()
will modify process.env,
and castenv.env()
will leave process.env unmodified.
Install it via npm:
npm install castenv
Include in your project:
// cast process.env in place
require("castenv").cast()
// alternatively, don't modify process.env
var env = require("castenv").env()
process.env["TEST_NUMBER_VALUE"] = "5"
console.log(typeof process.env["TEST_NUMBER_VALUE"])
// "string"
require("castenv").cast()
console.log(typeof process.env["TEST_NUMBER_VALUE"])
// number
0x123
and 0123
will return as strings--JSON doesn't support those literalsMIT
FAQs
Automatically cast process.env environment variables into native types (boolean, number, json object)
The npm package castenv receives a total of 0 weekly downloads. As such, castenv popularity was classified as not popular.
We found that castenv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.
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.