
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-route-versioning
Advanced tools
Express middleware that re-routes requests based on HTTP header value
#express-route-versioning A Connect style middleware to re-direct the execution flow into multiple branches based on HTTP header values. Tested and used for REST API versioning with Express routes but other applications might be suiting.
##Features
Customize the extraction of the version via version.use(options)
for:
header
, i.e. version.use({header: 'Accept-Version'})
grab
, i.e. version.use({grab: /vnd.my.company.()})
Customize the HTTP status code for a failed re-routing using the error
, i.e. version.use({error: 404})
##Example
Re-route based on version in HTTP header Accept: vnd.mycompany.com+json; version=1
.
var express = require('express');
version = require('express-version-reroute');
version.use({
'header': 'accept',
'grab': /vnd.mycompany.com\+json; version=(\d+)(,|$)/,
'error': 406,
});
var router = express.Router()
.all('/ping',
version.reroute({
1: function(req, res, next) { res.json('pong'); },
2: function(req, res, next) { res.status(200).end(); },
})
);
express().use(router).listen(5000, function() {});
cURL examples that give different behavior based on version.
➜ ~ curl -i -X GET 'http://127.0.0.1:5000/ping' -H 'Accept: vnd.mycompany.com+json; version=2'
HTTP/1.1 200 OK
X-Powered-By: Express
Date: Wed, 05 Nov 2014 10:09:50 GMT
Connection: keep-alive
Transfer-Encoding: chunked
➜ ~ curl -i -X GET 'http://127.0.0.1:5000/ping' -H 'Accept: vnd.mycompany.com+json; version=1'
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 6
ETag: W/"6-dca458aa"
Date: Wed, 05 Nov 2014 10:09:56 GMT
Connection: keep-alive
"pong"%
➜ ~ curl -i -X GET 'http://127.0.0.1:5000/ping' -H 'Accept: vnd.mycompany.com+json; version=0'
HTTP/1.1 406 Not Acceptable
X-Powered-By: Express
Date: Wed, 05 Nov 2014 10:09:58 GMT
Connection: keep-alive
Transfer-Encoding: chunked
npm install
npm test
FAQs
Express middleware that re-routes requests based on HTTP header value
We found that express-route-versioning 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.