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.
CORS middleware for Koa
Inspired by the great node-cors module.
$ npm install koa-cors
var koa = require('koa');
var route = require('koa-route');
var cors = require('koa-cors');
var app = koa();
app.use(cors());
app.use(route.get('/', function() {
this.body = { msg: 'Hello World!' };
}));
app.listen(3000);
Configures the Access-Control-Allow-Origin CORS header. Expects a string (ex: http://example.com). Set to true
to reflect the request origin, as defined by req.header('Origin')
. Set to false
to disable CORS. Can also be set to a function, which takes the request as the first parameter.
Configures the Access-Control-Allow-Methods CORS header. Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: ['GET', 'PUT', 'POST']
).
Configures the Access-Control-Allow-Headers CORS header. Expects a comma-delimited string (ex: 'Content-Type,Authorization') or an array (ex: ['Content-Type', 'Authorization]
). If not specified, defaults to reflecting the headers specified in the request's Access-Control-Request-Headers header.
Configures the Access-Control-Allow-Credentials CORS header. Set to true
to pass the header, otherwise it is omitted.
Configures the Access-Control-Allow-Max-Age CORS header. Set to an integer to pass the header, otherwise it is omitted.
For details on the effect of each CORS header, read this article on HTML5 Rocks.
FAQs
CORS middleware for Koa
The npm package koa-cors receives a total of 29,654 weekly downloads. As such, koa-cors popularity was classified as popular.
We found that koa-cors 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
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.