
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.
@evokegroup/aws-config
Advanced tools
Configuration base class for AWS Lambda functions
Parameters | Type | Default | Description |
---|---|---|---|
event | EvokeAws.Event , object | The event data passed to the Lambda function |
const EvokeAwsConfig = require('@evokegroup/aws-config');
class Config extends EvokeAwsConfig {
site = null;
environment = null;
constructor(event) {
super(event);
this.init();
}
}
exports.handler = async (event) => {
return new Promise((resolve, reject) => {
const config = new Config(event);
resolve({
statusCode: 200
});
});
};
Property | Type | Description |
---|---|---|
event | EvokeAws.Event | The event data |
Get the value of a configuration property or a new object containing the specified properties and default values. If the property does not exist it will be added to the object using the default value or null.
Parameters | Type | Default | Description |
---|---|---|---|
args[0] | object , Array<string> , string | A string , Array<string> or object specifying the property/properties to return | |
args[1] | any | If args[0] is a string the default value to return. If args[1] is a function the value returned will result of that function. |
const EvokeAwsConfig = require('@evokegroup/aws-config');
// Simulate the setting of environment variables from Lambda
const env = Object.freeze({
site: 'test.com',
environment: 'dev',
severity: 'error'
});
Object.keys(env).forEach((key) => {
process.env[key] = env[key];
});
function parseSeverity(val) {
if (val !== undefined && val !== null) {
switch (val.toString().toLowerCase()) {
case '0':
case 'error':
return 0;
case '1':
case 'debug':
return 1;
default:
return -1;
}
} else {
return -1;
}
}
class Config extends EvokeAwsConfig {
site = null;
environment = null;
severity = parseSeverity;
constructor(event) {
super(event);
this.init();
}
}
// Simulate the API Gateway sending in stage variables
const event = {
stageVariables: {
environment: 'stage'
}
};
const config = new Config(event);
console.log(config.site); // Expected result (from process.env): 'test.com'
console.log(config.get('environment', 'dev')); // Expected result (overridden by the event.stageVariables): stage
console.log(config.severity); // Expected result (from parseSeverity(process.env['severity'])): 0
console.log(config.doesNotExist); // Expected result: undefined
console.log(config.get('doesNotExist', 'abc123')); // Expected result: abc123
console.log(config.doesNotExist); // Expected result (doesNotExist was created during the above get call): abc123
console.log(config.get({
site: null,
environment: 'dev',
severity: -1
})); // Expected result: { site: 'test.com', environment: 'stage', severity: 0 }
console.log(config.get(['site','environment'])); // Expected result: { site: 'test.com', environment: 'stage' }
Initializes the EvokeAwsConfig
instance.
Parameters | Type | Default | Description |
---|---|---|---|
config | EvokeAwsConfig | this | The EvokeAwsConfig instance used during initialization. |
const EvokeAwsConfig = require('@evokegroup/aws-config');
// Simulate the setting of environment variables from Lambda
const env = Object.freeze({
site: 'test.com',
environment: 'dev'
});
Object.keys(env).forEach((key) => {
process.env[key] = env[key];
});
const event = {};
// Preferred approach, declare a class
class Config extends EvokeAwsConfig {
site = null;
environment = null;
constructor(event) {
super(event);
this.init();
}
}
const config = new Config(event);
// Quick and dirty, probably fine for just a few properties or creating a config inline
const evokeAwsConfig = new EvokeAwsConfig(event);
evokeAwsConfig.init({
site: null,
environment: null
});
Serializes the instance.
FAQs
Configuration base class for AWS Lambda functions
We found that @evokegroup/aws-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
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.