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.
Typescript library to read and write records of HTTP exchanges in the HTTP types format.
$ npm install http-types
Using HttpExchangeWriter
a recording of HTTP traffic can be serialised for use with any program that can handle the HTTP Types format.
const writer = new HttpExchangeWriter();
const request = HttpRequestBuilder.fromPath({
timestamp: timestamp,
method: HttpMethod.GET,
protocol: HttpProtocol.HTTPS,
host: "example.com",
headers: {
"accept-encoding": "gzip, deflate, br",
"cache-control": ["no-cache", "no-store"]
},
path: "/my/path?a=b&q=1&q=2",
body: "request string body"
});
const response = HttpResponseBuilder.from({
headers: {
"accept-encoding": "gzip, deflate, br",
"cache-control": "no-cache"
},
statusCode: 404,
body: "response string body"
});
writer.write({ request, response });
// [...] (write multiple exchanges)
// writer.buffer contains the exchanges in the HTTP types JSON Lines format.
console.log(writer.buffer);
A HTTP request can also be created from query parameters as an object. The below request is identical to the one created above:
const request = HttpRequestBuilder.fromPathnameAndQuery({
timestamp: timestamp,
method: HttpMethod.GET,
protocol: HttpProtocol.HTTPS,
host: "example.com",
headers: {
"accept-encoding": "gzip, deflate, br",
"cache-control": ["no-cache", "no-store"]
},
pathname: "/my/path",
query: {
a: "b",
q: ["1", "2"]
},
body: "request string body"
});
With HttpExchangeReader
HTTP Types recordings can be read for processing:
HttpExchangeReader.fromJsonLines(writer.buffer, exchange => {
expect(exchange.request.host).toBe("example.com");
expect(exchange.request.query.get("a")).toEqual("b");
});
FAQs
Library for JSON serialisation of HTTP exchanges
We found that http-types 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.