Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@lambda-middleware/cors
Advanced tools
AWS lambda middleware for automatically adding CORS headers
AWS lambda middleware for automatically adding CORS headers.
This middleware is part of the lambda middleware series. It can be used independently.
import { cors } from "@lambda-middleware/cors";
import { APIGatewayProxyResult } from "aws-lambda";
// This is your AWS handler
async function helloWorld(): Promise<APIGatewayProxyResult> {
return {
statusCode: 200,
body: "",
};
}
/**
* Wrap the handler with the middleware. It can be used just with
* default options or configured in detail.
* If you are using an API Gateway or Serverless to deploy, please note
* that they will overwrite some of these settings and need to be configured
* separately.
*/
export const handler = cors({
/**
* Configures the Access-Control-Allow-Headers CORS header.
* If not set will mirror Access-Control-Request-Headers from the request.
*/
allowedHeaders: [],
/** Configures the Cache-Control header for the preflight response. */
cacheControl: "max-age: 300",
/** Configures the Access-Control-Allow-Credentials CORS header. */
allowCredentials: true,
/** Configures the Access-Control-Expose-Headers CORS header. */
exposedHeaders: ["X-Custom-Header"],
/** Configures the Access-Control-Max-Age CORS header. */
maxAge: 300,
/** Configures the Access-Control-Allow-Methods CORS header. */
allowedMethods: ["GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"],
/** Provides a status code to use for successful OPTIONS requests, since some legacy browsers (IE11, various SmartTVs) choke on 204. */
optionsSuccessStatus: 204,
/** Configures the Access-Control-Allow-Origin CORS header. An empty array will set the header to '*'. */
allowedOrigins: ["https://example.com"],
/** Whether to call the next middleware or handler in case of a OPTIONS request. */
preflightContinue: false,
})(helloWorld);
FAQs
AWS lambda middleware for automatically adding CORS headers
We found that @lambda-middleware/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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.