
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
A perfect typescript class environment variables library.
Let's pretend we have very simple
.env
IS_SOMETHING_ENABLED=1
How can we describe it using classenv
environment.ts
import { Env } from 'classenv';
export class Environment {
@Env() // Auto UPPER_SNAKE_CASE conversion
static isSomethingEnabled: number; // process.env.IS_SOMETHING_ENABLED
@Env() // Instance properties supported
isSomethingEnabled: number;
@Env() // Won't throw, because got default value
static withDefault: string = 'yeah its me'
@Env('IS_SOMETHING_ENABLED')
static isEnabledStr: string;
@Env('IS_SOMETHING_ENABLED')
static isEnabledNmbr: number;
@Env('IS_SOMETHING_ENABLED')
static isEnabledBln: boolean;
}
@Env
property data type should be scalar (string, number or boolean).
main.ts
import {Environment} from './environment.ts'
console.log(typeof Environment.isEnabledStr, Environment.isEnabledStr)
// string 1
console.log(typeof Environment.isEnabledNmbr, Environment.isEnabledNmbr)
// number 1
console.log(typeof Environment.isEnabledBln, Environment.isEnabledBln)
// boolean true
console.log(typeof Environment.isSomethingEnabled, Environment.isSomethingEnabled)
// number 1
Environment.isEnabledBln = false;
// TypeError: Cannot assign to read only property 'isEnabledBln' of function 'class Test{}'
// Let's check instance properties
const env = new Environment();
console.log(env.isSomethingEnabled) // 1
npm i reflect-metadata
And then import it somewhere close to your entry point (index.ts
/main.ts
/etc...).
Should be imported before any of your environment classes.
import 'reflect-metadata';
These settings should be enabled
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
FAQs
Describe your environment variables contract with TypeScript class decorator
The npm package classenv receives a total of 94 weekly downloads. As such, classenv popularity was classified as not popular.
We found that classenv 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.