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.
A simple key-value store that is truly a singleton. Use this to as an alternative to sticking values into global.
This package will never have breaking change and keeps everything simple and backward-compatible.
A simple key-value store singleton.
Sometimes you have to do horrible things, like use the global object to share a singleton or some values.
Instead of attaching values to the global object, which can lead to security concerns, this global-box
package provides a key-value store
which is guaranteed to be a singleton, so you can use it instead of the global object. Only code that are part of the same application bundle can access this store
, making it more secured.
package A
import { globalBox } from 'global-box';
const box = globalBox();
box.set('share.config.something', 123);
package B
import { globalBox } from 'global-box';
const box = globalBox();
box.get('share.config.something'); // 123;
For this to work correctly, there must be only a single copy of global-box
in node_modules
at all times. (Similar to how there must be only a single copy of react
.)
Note: This package will never have breaking change and keeps everything simple and backward-compatible.
global-box
directly, or have some libraries that depends on it.npm install global-box
peerDependencies
in package.json
. Listing it as dependencies
may cause the library consumers to have duplicates in the final application.In library
{
"peerDependencies": {
"global-box": "*"
},
"devDependencies": {
"global-box": "x.x"
}
}
vs. in application
{
"dependencies": {
"global-box": "x.x"
}
}
import { globalBox } from 'global-box';
const box = globalBox();
box.has(globalId);
box.get<string>(globalId); // must specify value type via generic
box.getOrCreate(globalId, factory);
box.remove(globalId);
box.set(globalId);
Inspired by global-cache
Apache-2.0
FAQs
A simple key-value store that is truly a singleton. Use this to as an alternative to sticking values into global.
The npm package global-box receives a total of 14,252 weekly downloads. As such, global-box popularity was classified as popular.
We found that global-box demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
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.