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.
require-like
Advanced tools
Generates require functions that act as if they were operating in a given path.
Generates require functions that act as if they were operating in a given path.
npm install require-like
A require function that acts as if it was executed in './lib/bar'
:
var requireLike = require('require-like');
var myRequire = requireLike(__dirname + '/lib/bar.js');
var myFoo = myRequire('./foo.js');
var foo = require('./lib/foo');
require('assert').strictEqual(myFoo, foo);
Returns a require function that acts as if it was operating in the given
path
.
Setting the uncached
parameter to true returns a function that by-passes the
module cache.
This module works by accessing some private node APIs. You shouldn't worry about that so, since I will make sure this module does not break in the future by either patching it, or making a patch for node that makes the needed APIs public.
I use this library for dependency injection in unit tests. However, you could also use it to create experimental require addons yourself.
require-like is licensed under the MIT license.
FAQs
Generates require functions that act as if they were operating in a given path.
The npm package require-like receives a total of 766,929 weekly downloads. As such, require-like popularity was classified as popular.
We found that require-like 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.