
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.
ZeroStep is a small library to organize, wire and manage the lifecycle of modules.
'use strict'
const ZeroStep = require('../index')
const zs = new ZeroStep()
zs
.register((() => {
let secret = 'S3C43T'
let obj = {
destroy: () => console.log(`Destroying obj with secret:= ${secret}`),
}
return {
name: 'Secret and initValue usage in destroy',
init: () => obj,
destroy: (ctx, obj) => obj.destroy(),
}
})())
.register({
name: 'Module which was added by chaining register calls!',
init: () => console.log('Hello from chained module!'),
})
zs.init().then(() => zs.destroy())
Will print:
ZeroStep:- Initializing module Secret and initValue usage in destroy() -> []
ZeroStep:- Initializing module Module which was added by chaining register calls!() -> []
Hello from chained module!
ZeroStep:- Destroying module Module which was added by chaining register calls!
ZeroStep:- Destroying module Secret and initValue usage in destroy
Destroying obj with secret:= S3C43T
ZeroStep:- Destroyed all modules
const ZeroStep = require('zerostep')
const zs = new ZeroStep()
zs.register({
name: 'hello-world',
init: () => console.log('hello, world'),
destroy: () => console.log('goodbye, world')
})
zs.init().then(() => zs.destroy())
Will print:
ZeroStep:- Initializing module hello-world() -> []
hello, world
ZeroStep:- Destroying module hello-world
goodbye, world
const ZeroStep = require('../index.js')
const zs = new ZeroStep()
zs.register({
name: 'hello-world',
env: [
{
name: 'message',
// optional attributes
default: 'Hello, world!',
valid: (value) => value === 'Hello, world!',
showValue: true,
hint: 'Please provide a message to display to the user'
}
],
init: (ctx) => console.log(ctx.env.message),
})
zs.init().then(() => zs.destroy())
Will print:
ZeroStep:- Module hello-world env[message] := <Hello, world!>
ZeroStep:- Initializing module <hello-world>() -> []
Hello, world!
ZeroStep:- Initialization of all registered modules completed successfully for <ZeroStep>
ZeroStep:- Destroying module hello-world
ZeroStep:- Destroyed all modules for <ZeroStep>
const ZeroStep = require('zerostep')
const zs = new ZeroStep()
zs.register({
name: 'one',
export: 'symbolFromOne',
init: () => {
console.log('hello from 1')
return 'Message from one'
},
destroy: () => console.log('goodbye from 1')
})
zs.register({
name: 'two',
imports: ['symbolFromOne'],
init: (ctx) => {
console.log('hello from 2')
console.log(`got ${ctx.symbolFromOne}`)
},
destroy: () => console.log('goodbye from 2')
})
zs.init().then(() => zs.destroy())
Will print:
ZeroStep:- Initializing module one() -> [symbolFromOne]
hello from 1
ZeroStep:- Initializing module two(symbolFromOne) -> []
hello from 2
got Message from one
ZeroStep:- Destroying module two
goodbye from 2
ZeroStep:- Destroying module one
goodbye from 1
Note Module two gets initialized after module one but destroyed before module one. This is almost always what you want!
Create a new instance.
Note The context object for init/destroy is created once for the init method and provided to the destroy method Note You can get a handle to destroy an object by just returning it from init - it will be provided to destroy w/o a need to export it
Initialize all registered modules in the order of their registration.
See ZeroStep.prototype.initAsApplicationCore() if you want ZeroStep to take care of SIGINT, SIGTERM and SIGUSR2.
Destroy all registered modules in the opposite order in which they where registered.
Registers a handler for disconnect, uncaughtException, unhandledRejection, error, SIGINT, SIGTERM and SIGUSR2 which will call ZeroStep.prototype.destroy() and calls ZeroStep.prototype.init().
Pull requests are welcome. Please write tests for your changes & run npm test before making a pull request.
FAQs
ZeroStep is a small library to wire modules and manage their lifecycles
The npm package zerostep receives a total of 12 weekly downloads. As such, zerostep popularity was classified as not popular.
We found that zerostep demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.