![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
shortstop
Advanced tools
Readme
Lead Maintainer: Poornima Venkat
Sometimes JSON just isn't enough for configuration needs. Occasionally it would be nice to use arbitrary types as values,
but JSON is necessarily a subset of all available JS types. shortstop
enables the use of protocols and handlers to
enable identification and special handling of json values.
var fs = require('fs');
var shortstop = require('shortstop');
function buffer(value) {
return new Buffer(value);
}
var resolver, json;
resolver = shortstop.create();
resolver.use('buffer', buffer);
resolver.use('file', fs.readFile);
json = {
"secret": "buffer:SGVsbG8sIHdvcmxkIQ==",
"ssl": {
"pfx": "file:foo/bar",
"key": "file:foo/baz.key",
}
};
resolver.resolve(json, function (err, data) {
console.log(data);
// {
// "secret": <Buffer ... >,
// "ssl" {
// "pfx": <Buffer ... >,
// "key": <Buffer ... >
// }
// }
});
parent
(Object, optional) - An optional shortstop resolver. Returns a resolver instance.protocol
(String) - The protocol used to identify a property to be processed, e.g. "file"handler
(Function) - The implementation of the given protocol with signature function (value, [callback])
This method returns a function when invoked will remove the handler from the stack for this protocol.
data
(Object) - The object, containing protocols in values, to be processed.callback
(Function) - The callback invoked when the processing is complete with signature function (err, result)
.path
(String) - The path to a file which is, or exports, JSON or a javascript object.callback
(Function) - The callback invoked when the processing is complete with signature function (err, result)
.Multiple handlers can be registered for a given protocol. They will be executed in the order registered and the output of one handler will be the input of the next handler in the chain.
var fs = require('fs'),
var path = require('path'),
var shortstop = require('shortstop');
function resolve(value) {
if (path.resolve(value) === value) {
// Is absolute path already
return value;
}
return path.join(process.cwd(), value);
}
var resolver, json;
resolver = shortstop.create();
resolver.use('path', resolve);
resolver.use('file', resolve);
resolver.use('file', fs.readFile);
json = {
"key": "file:foo/baz.key",
"certs": "path:certs/myapp"
};
resolver.resolve(json, function (err, data) {
console.log(data);
// {
// "key": <Buffer ... >,
// "certs": "/path/to/my/certs/myapp"
// }
});
When registered, handlers return an unregister
function you can call when you no longer want a handler in the chain.
var path = require('path');
var shortstop = require('shortstop');
function resolve(value) {
if (path.resolve(value) === value) {
// Is absolute path already
return value;
}
return path.join(process.cwd(), value);
}
var resolver, unuse, json;
resolver = shortstop.create();
unuse = resolver.use('path', resolve);
json = { "key": "path:foo/baz.key" };
resolver.resolve(json, function (err, data) {
console.log(data);
// {
// "key": "/path/to/my/foo/baz.key"
// }
unuse();
resolver.resolve(json, function (err, data) {
console.log(data);
// {
// "key": "path:foo/baz.key"
// }
});
});
FAQs
Unknown package
We found that shortstop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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 unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.