Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
import-locals
Advanced tools
Allows you to import local variables, functions and classes from other modules
npm i import-locals
import locals from "import-locals";
const locals = require("import-locals"); // ES5 usage
locals.export("request/lib/cookies", "RequestJar");
locals.export("request/lib/cookies", "CookieJar");
locals.export("request/lib/cookies", "CookieJar", "LocalJar");
import { RequestJar, CookieJar, LocalJar } from "request/lib/cookies"; // ES6 works
const { RequestJar, CookieJar, LocalJar } = require("request/lib/cookies");
// you can access internal GlobalPatcher
global.locals.separator = "\n\n";
global.locals.global.locals.unpatch();
global.locals.compile.call(module, content, filename);
export(request: String, variable: String, name: String = variable);
request
- module name or path
variable
- name of variable (or function, class, etc) to export
name
- name to use for export, by default the same as variable
/* Usage example */
patcher.export("request/lib/cookies", "RequestJar");
patcher.export("request/lib/cookies", "CookieJar", "LocalJar");
import { RequestJar, LocalJar } from "request/lib/cookies";
unexport(request: String, variable: String = null, name: String = variable);
request
- module name or path
variable
- if null
unexports all variables
name
- name used for export, by default the same as variable
/* Usage example */
patcher.unexport("request/lib/cookies", "RequestJar");
patcher.unexport("request/lib/cookies", "CookieJar", "LocalJar");
patcher.unexport("request/lib/cookies");
exports[name]=variable
to requested source file, so you can require itvar foo = ["bar"];
// this module adds:
exports["foo"] = foo;
Released under MIT license
FAQs
Allows you to import local variables, functions and classes from other modules
We found that import-locals 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.