
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@6river/configr
Advanced tools
Configr is a library that provides a set of TypeScript decorators to inject configuration params into class properties.
Configr is a library that provides a set of TypeScript decorators to inject configuration params into class properties.
// Given is expected configuration received from some remote service or
// is read from the file or....
const config = {
env: 'debug',
log: {
level: 'DEBUG',
format: '%h %l %u %t \"%r\" %>s %b'
}
};
// Basic Usage
@Config()
class Foo {
@ConfigParam()
readonly env: string;
// by default property name is used as a path to access config parameter,
// but path can elso be specified:
@ConfigParam('log.level')
readonly logLevel: string;
// with default specified
@ConfigParam('log.format')
readonly logFormat: string = ''%h %l %u';
}
// The root path can be specified on class level
@Config({root: 'log'})
class Logger {
@ConfigParam()
level string;
@ConfigParam()
format string;
}
// suppose we have configuration fetched from remote service
function loadConfig() {
return fetch('http://example.com/config.json')
.then(function(response) {
return response.json();
})
.then(function(cfg) {
// Apply loaded config to annotated properties.
// This method should be calledonce.
// It's not forbidden to call it many times but
// all subsequent calls just have no effect.
return configResolve(cfg);
});
}
// as soon as config is loaded and resolved it's safe to use
// our objects that rely on its parameters:
async function useit() {
await loadConfig(cfg);
const foo = new Foo();
const log = new Logger();
}
Parser can be specified as an additional option for @ConfigParam
decorator:
const cfg = {
logLevels: ['ERROR', 'INFO', 'DEBUG']
};
class LogLevel {
constructor(public label: string) {}
}
function parseLogLevels(levels: string[]): LogLevel[] {
return labels.map((level) => new LogLevel(level));
}
@Config()
class Foo {
@ConfigParam({parser: parseLogLevels})
readonly logLevels: LogLevel[];
}
FAQs
Configr is a library that provides a set of TypeScript decorators to inject configuration params into class properties.
We found that @6river/configr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
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.