Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
restjs-api
Advanced tools
This node module provides a set of methods to interact with REST services. The module was created as part of KidoZen project, as a connector for its Enterprise API feature.
This module is based on module Request.
Use npm to install the module:
> npm install restjs-api
Use npm to run the set of tests:
> npm test
Due to the asynchronous nature of Nodejs, this module uses callbacks in requests. All callbacks have 2 arguments: err
and data
.
function callback (err, data) {
// err contains an Error class instance, if any
// data contains the resulting data
}
The module exports a class and its constructor requires a configuration object with following property:
endpoint
: Required string. URL to the service.headers
: Optional object containing http headers, defaults to {}.var Rest = require("restjs-api");
var rest = new Rest({ endpoint: "http://your-service" });
All public methods has the same signature, their have two arguments: options
and callback
:
options
must be an object instance containig all parameters for the method.callback
must be a function.This method sends an HTTP request to the REST service.
Parameters:
options
(object) Required. Specifies headers, body, timeout, etc. The option 'method' is the only one that is required.
`method`: string. HTTP method. i.e.: GET, POST, DELETE, etc.
`path`: string. resource.
`qs`: object containing querystring values to be appended to the uri
`headers`: http headers, defaults to {}
`body`: entity body for PATCH, POST and PUT requests. Must be buffer or string.
`followRedirect`: follow HTTP 3xx responses as redirects. defaults to true
`followAllRedirects`: follow non-GET HTTP 3xx responses as redirects. defaults to false.
`maxRedirects`: the maximum number of redirects to follow, defaults to 10.
`encoding`: Encoding to be used on setEncoding of response data. If set to null, the body is returned as a Buffer.
`timeout`: Integer containing the number of milliseconds to wait for a request to respond before aborting the request
`proxy`: An HTTP proxy to be used. Support proxy Auth with Basic Auth by embedding the auth info in the uri.
`jar`: Set to false if you don't want cookies to be remembered for future use or define your custom cookie jar
`auth`: A hash containing user, password and sendImmediately. See documentation at https://github.com/mikeal/request#http-authentication
`oauth`: Options for OAuth HMAC-SHA1 signing, see documentation at https://github.com/mikeal/request#oauth-signing
`aws`: Object containing aws signing information, should have the properties key and secret as well as bucket unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket.
callback
: A required function for callback.This method is a shortcut to invoke the method exec
with the option method = "GET"
This method is a shortcut to invoke the method exec
with the option method = "PUT"
This method is a shortcut to invoke the method exec
with the option method = "POST"
This method is a shortcut to invoke the method exec
with the option method = "DELETE"
FAQs
Kidozen's connector to invoke REST services
The npm package restjs-api receives a total of 2 weekly downloads. As such, restjs-api popularity was classified as not popular.
We found that restjs-api 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.