Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
nj-request-scope
Advanced tools
Performant express request scope dependency injection for NestJS framework
Performant request scope dependency injection for NestJS framework using express server
nj-request-scope library solves NestJs request-scope dependency injection problems:
This solution is based on the build-in javascript Proxy design pattern. For every request, only the proxy's target object is changed to the new request-scope instance instead of creating all injection chain objects.
npm install nj-request-scope
nj-request-scope was tested with NestJs 8.x & 9.x
To use nj-request-scope in NestJS module you have to add import of RequestScopeModule
in the module class decorator:
import { RequestScopeModule } from 'nj-request-scope';
@Module({
imports: [RequestScopeModule],
})
Next, there are two ways of using nj-request-scope.
NJRS_REQUEST
token:import { NJRS_REQUEST } from 'nj-request-scope';
[...]
constructor(@Inject(NJRS_REQUEST) private readonly request: Request) {}
@RequestScope()
decorator:import { RequestScope } from 'nj-request-scope';
@Injectable()
@RequestScope()
export class RequestScopeService {
Proxy handler implements only most common methods:
get
has
set
getPrototypeOf
getOwnPropertyDescriptor
ownKeys
If you need other methods implemented please feel free to contribute. ProxyHandler implementation
https://github.com/kugacz/nj-request-scope-example
nj-request-scope is MIT licensed.
FAQs
Performant express request scope dependency injection for NestJS framework
The npm package nj-request-scope receives a total of 1,357 weekly downloads. As such, nj-request-scope popularity was classified as popular.
We found that nj-request-scope 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.