
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
express for client side requests. Uses a middleware-like strategy to build up a http request method tailored to your specific needs.
$ npm install --save kwest
This is just a prototype, use at your own risk!
Rougly the same API as the request library (for now). Kwest uses promises instead of callbacks though. With the addition of a .use()
method kwest can be extended with middleware.
kwest aims to provide a simple core and have higher level modules handle functionality such as redirection, gzip, authentication, caching...
The most simple example is the following middleware, which is basically just the identity.
var kwest = require('kwest');
var request = kwest();
request.use(function (req, next) {
return next(req);
});
request(url)
.then(function (res) {
// response is exactly the same as without the middleware
})
Example: You can make kwest reject its result when the server responds with a bad statuscode. This functionality is actually provided in the kwest-handle-error module.
var request = kwest();
request.use(function rejectBadStatus(req, next) {
return next(req)
.then(function (res) {
if (res.statusCode !== 200) throw new Error('Bad status');
return res;
});
});
request(url)
.catch(function (err) {
// this promise will be rejected when the server returns a bad statuscode
})
Or you can augment functionality. This example is actually provided in the kwest-gzip module
var request = kwest();
request.use(function rejectBadStatus(req, next) {
req.setHeader('accept-encoding', 'gzip');
return next(req)
.then(function (res) {
// handle gzip ...
return unzipped;
});
});
request(url)
.then(function (res) {
// Can have gzipped responses now
})
Creates a request function that can make the most basic http requests. Optionally an argument can be provided that represents the last request in the middleware chain. This is useful for e.g. mocking, browserify,...
request
can be called either with a string or with an options object to make the actual request. available options are:
uri
: string or parsed url. This is mandatorymethod
: cdefaults to GET
headers
: headers for this requestAdds a middleware to the chain. This is a function of the form
function (request, next) {
return next(request);
}
request contains all request parameters and is intended to be modified by middleware. It always has following properties:
uri
: this is a parsed url object with the current url.method
: current http method for this requestheaders
: map of the headers for this requestsetHeader
, getHeader
, hasHeader
, removeHeader
: Utility methods provided by caseless.httpify
.The middleware function is expected to return a promise with a response object. next
can be called with request
as parameter to receive promise of the response provided kwest. This response is passed on to the next middleware and can be transformed as you wish.
returns a new instance based on the current one that can be used to add extra middleware.
Convenience function. Defaults to method GET
.
...
FAQs
express for client requests.
We found that kwest 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.