
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
Tomahawk provide you with a minimal http server, that can be started on the command line to serve static content.
npm install -g tomahawk
To serve the current directory using the default port 8080
tomahawk
To serve "web/public" from the current directory using the default port 8080
tomahawk --www=web/public
To use a different port (e.g. 3000)
tomahawk --port=3000
How can I prefix my static content with MyApp (e.g. http://localhost:8080/MyApp insead of the default http://localhost:8080/)
tomahawk --context=/MyApp
How about less logging?
tomahawk --level=error
tomahawk --config=config.development.json
or
tomahawk --headers='["Access-Control-Allow-Origin:*","Access-Control-Allow-Methods:GET,PUT,POST,DELETE","Access-Control-Allow-Headers:Content-Type","X-Frame-Options:ALLOWALL"]'
tomahawk --cgi='[{"route":"/echo","method":"POST","command":"/bin/sh", "args":["-c", "read line ; echo $line"], "encoding":"utf8"}]'
echo allo | curl -X POST -d @- http://localhost:8080/echo
Can I save the configration, to avoid typing it every time?
Your configuration file should look like:
{
"level" : "error",
"www" : ".",
"context" : "/MyApp",
"port" : 9000,
"headers" : [
"Access-Control-Allow-Origin:*",
"X-Frame-Options:ALLOWALL"
],
"cgi" : [
{
"route" : "/version",
"method" : "GET",
"command" : "/bin/sh",
"args" : ["-c", "echo '{\"version\":\"1.0.0\"}'"]
}
]
}
You can look at the sample code under the sample directory:
samples/sample_server.js:
var app = require('tomahawk').create({port:8080,routes:[__dirname + '/lib/routes']}).start();
samples/lib/routes.js':
module.exports = function () {
function routes(app, config, io) {
var database = {
captains : {
"jim" : "James Tiberius Kirk",
"picard" : "Jean-Luc Picard"
},
starShips : {
"jim": "NCC1701-A",
"picard": "NCC1701-D"
}
};
// GET
app.get('/api/v1/captain/:id?', function (req, res) {
var withStarship = req.query.starship === 'true';
if (req.params.id) {
res.json(withStarship ?
{id:req.params.id,name:database.captains[req.params.id], starship:database.starShips[req.params.id]} :
{id:req.params.id,name:database.captains[req.params.id]});
} else {
res.json(database.captains);
}
res.end();
});
// PUT
app.put('/api/v1/captain/:id', function (req, res) {
database.captains[req.params.id] = req.body;
io.sockets.emit('new:captain', {id:req.params.id, name:req.body}); // Optional, if you want to use websocket
res.json({id:req.params.id,operation:"put",status:"OK"});
res.end();
});
// DELETE
app.delete('/api/v1/captain/:id', function (req, res) {
delete database.captains[req.params.id];
io.sockets.emit('del:captain', {id:req.params.id}); // Optional, if you want to use websocket
res.json({id:req.params.id,operation:"delete", status:"OK"});
res.end();
});
}
return routes;
}();
Run:
node sample_server.js
FAQs
Minimal HTTP Server
The npm package tomahawk receives a total of 13,458 weekly downloads. As such, tomahawk popularity was classified as popular.
We found that tomahawk 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.