Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@stamp/privatize
Advanced tools
Makes all properties and optional methods private
Inspired by the private-class
module. NOTE! Requires WeakMap, thus won't work in IE10.
This stamp (aka behavior) will create a proxy object. Its methods would delegate all the calls to the original object instance.
All the properties are made private. Methods privatization is optional and can be done via the privatizeMethods
static function.
import Privatize from '@stamp/privatize';
import Auth from './stamps/auth';
const AuthWithPrivateProperties = Auth.compose(Privatize);
const AuthWithPrivatePropertiesAndMethod = Auth.compose(Privatize).privatizeMethods('setPassword');
let accessPassword, accessSetPassword;
const Original = compose({
properties: {password: '123'},
methods: {
setPassword(value) { this.password = value; },
checkAccess() {
accessPassword = this.password;
accessSetPassword = this.setPassword;
}
}
});
// Add Privatize behavior, additionally protect the 'setPassword' method
const Stamp = Original.compose(Privatize).privatizeMethods('setPassword');
// All properties and the method 'setPassword' are undefined
const instance = Stamp();
expect(instance.password).toBeUndefined();
expect(instance.setPassword).toBeUndefined();
// But the 'checkAccess' method have access to the properties and 'setPassword'
instance.checkAccess();
expect(accessPassword).toBe('123');
expect(accessSetPassword).toBe(Original.compose.methods.setPassword);
FAQs
Protect private properties
The npm package @stamp/privatize receives a total of 14 weekly downloads. As such, @stamp/privatize popularity was classified as not popular.
We found that @stamp/privatize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.