
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.
See this library in action with this stackblitz demo.
Add the package to your project
npm i --save fl-node-di
# or
yarn add fl-node-di
Import the decorators with
import { FlModule, Component, Injectable, Inject } from 'fl-node-di'
NodeJS dependency injection module on top of inversify for using backend DI in a way similar to Angulars DI. E.g. you can use the following snippet throughout your complete application
@FlModule({
imports: [ AuthModule, Http2Module ],
declarations: [ AppComponent ],
providers: [ AuthService ],
exports: [ ]
})
export class AppModule {}
The other two decorators are
@Component()
export class AppComponent {
constructor (@Inject(AuthService) authService: AuthService) {}
}
which treats the decorator as an inversify @injectable
and directly creates an instance when the
parent module gets instanciated. The other one is the @Injectable()
decorator
@Injectable()
export class AuthService {}
which returns an inversify @injectable
decorator, but does not directly creates an instance but
instanciates itself when an @Inject(serviceIdentifier)
is used as a constructor parameter in the
same or a childs containers class.
The DI system is hierarchical.
The decorators:
Decorator | Description | Parameters | Return value |
---|---|---|---|
@FlModule() | Creates a container where the classes are stored, imports child-FlModules | config: { imports?: any[], declarations?: any[], providers?: any[], exports?: any[] } | Returns a custom decorator where a container object is created in the constructor |
@Injectable() | Make class bindable to an FlModules container | - | Inversify @injectable() |
@Component() | Make class bindable to an FlModules container | - | Inversify @injectable() |
@Inject(serviceIdentifier) | Let the DI know that a class instance is needed, if not exist, create class | serviceIdentifier | - |
The @FlModule()
parameters:
Input parameter | Description |
---|---|
imports | Creates an instance of the imported FlModule() , reads the exports parameter of the instantiated object and stores the exports in its own container. The instance is handled as a child of this module, so Inject()s will work in the child even if the child does not contain the instance itself, but its parent. |
declarations | Binds @Component() decorated classes to the container and after creating all imports it directly creates an instance. |
providers | Binds @Injectable() decorated classes to the container |
exports | Binds @Injectable() or @Component() decorated classes to the parents container |
FAQs
NodeJS dependency injection inspired by Angular
The npm package fl-node-di receives a total of 2 weekly downloads. As such, fl-node-di popularity was classified as not popular.
We found that fl-node-di 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
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.