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.
A collection of Vows macros for easy HTTP server testing.
Tastes great with Express and Connect.
Works with Node.js v0.2.5 and later.
npm i pact
// Pact works with http.Server instances.
// This includes express.Server, connect.Server, etc.
// This method returns a new express.Server:
var createServer = require("../lib/app").createServer;
require("vows").describe("HTTP Server").addBatch({
"A server in development" : {
// Start a server for testing with httpify
// Give it a new http.Server
topic : httpify(createServer()),
"when /foo is requested" : {
topic : request(), // knows the URL from context name
"should fail" : code(400) // check status code
}
"when /foo?bar=baz is requested" : {
topic : request(),
"should succeed" : code(200),
"should return response time header" : function (topic) {
// header names are lowercased for easy testing
assert.include(topic.headers, "x-response-time");
},
"should be correct size" : function (topic) {
// response is available as topic.body
assert.equal(topic.body.length, 11);
}
},
"when making a bogus request" : {
// you can always specify your own URL
// POST requests work as well
topic : request({
url : "/bogus",
method : "POST",
body : "quux=0"
}),
"should fail" : code(404)
}
},
"A server in production" : {
topic : function () {
// Example: wrap httpify for testing
// with a new environment
var oldEnv = process.env.NODE_ENV;
process.env.NODE_ENV = "production";
var server = app.createServer();
httpify(server).apply(this);
process.env.NODE_ENV = oldEnv;
},
"when / is requested" : {
topic : request(),
"should fail" : code(404)
}
}
}).export(module);
Requires Vows.
make test
Authored by Reid Burke, copyright Yahoo! Inc., and provided under the BSD license. See LICENSE file.
Pact is used at Yahoo! for testing Node.js servers. It's based on the embedded Vows macros from the YUI Labs Yeti project.
Submit bugs and pull requests to Pact on GitHub.
FAQs
Pact for all things Javascript
The npm package pact receives a total of 1,262 weekly downloads. As such, pact popularity was classified as popular.
We found that pact 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’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.