Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@interval/envoy
Advanced tools
Envoy gives your TypeScript apps type safe access to environment variables.
Envoy gives your TypeScript apps type safe access to environment variables.
Envoy accepts an envoy.config.ts
file and an .env
file as input and generates a single env.ts
file which exports a constant for each variable as output.
There are a few major benefits to this approach:
envoy.config.ts
defines them all.envoy
step before starting your app, you can prevent it from starting/deploying unless all required environment variables are present..ts
env file, you get full editor support and static type checking. Mistyping a variable name will result in a compile time error, not a mysterious runtime bug.Using yarn:
yarn add @interval/envoy
You'll next need to create an Envoy config file. This defines the variables that Envoy will expect.
⚙️ envoy.config.ts
import { EnvoyVariableSpec } from '@interval/envoy'
const vars: EnvoyVariableSpec[] = ['DATABASE_URL', 'STRIPE_API_KEY']
export default vars
Commit this to your repo!
🔐 .env
This is a standard .env file in KEY=VALUE
format. Each key in this file should correspond to what you've defined in envoy.config.ts
.
The values in this file are either secrets which you can't commit or environment specific configuration details which you shouldn't.
DATABASE_URL=postgres://root@db.com:5432
STRIPE_API_KEY=sk_test_123456789101112131415
Don't commit this file!
Running yarn envoy
will look for a .env
and envoy.config.ts
file in your current working directory and will output an env.ts
file that looks like this:
// THIS FILE WAS AUTOMATICALLY GENERATED BY ENVOY
// TO ADD A NEW ENVIRONMENT VARIABLE, RUN ENVOY
// DO NOT EDIT THIS FILE DIRECTLY
const DATABASE_URL = 'postgres://root@db.com:5432'
const STRIPE_KEY = 'sk_test_123456789101112131415'
export { STRIPE_KEY, DATABASE_URL }
You can use this like any other TypeScript file. Just be sure that you don't commit this file as it contains your secrets that you defined manually in your .env
file.
If you define a variable in .env
but exclude it from your envoy.config.ts
, the resulting env.ts
file will not contain that variable.
If you define a variable in envoy.config.ts
, but don't define it in your .env
, Envoy will fail and will exit with code 1.
We suggest you run yarn envoy
each time your app compiles. For example, at Interval, our yarn start:dev
command runs yarn envoy && yarn ts:node
.
Note that this library effectively hard codes your secrets into each build. Depending on your infrastructure, this may be a non-starter.
FAQs
Envoy gives your TypeScript apps type safe access to environment variables.
The npm package @interval/envoy receives a total of 0 weekly downloads. As such, @interval/envoy popularity was classified as not popular.
We found that @interval/envoy 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.