Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lws-cors

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lws-cors - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

25

index.js

@@ -23,2 +23,10 @@ import kcors from '@koa/cors'

description: 'Adds `Access-Control-Allow-Credentials` header.'
},
{
name: 'cors.opener-policy',
description: 'A value for the `Cross-Origin-Opener-Policy` header (specify `unsafe-none`, same-origin-allow-popups` or `same-origin`).'
},
{
name: 'cors.embedder-policy',
description: 'A value for the `Cross-Origin-Embedder-Policy` header (specify `unsafe-none` or `require-corp`).'
}

@@ -33,4 +41,19 @@ ]

if (config.corsCredentials) corsOptions.credentials = config.corsCredentials
if (config.corsOpenerPolicy) corsOptions.openerPolicy = config.corsOpenerPolicy
if (config.corsEmbedderPolicy) corsOptions.embedderPolicy = config.corsEmbedderPolicy
this.emit('verbose', 'middleware.cors.config', corsOptions)
return kcors(corsOptions)
const koaCorsMiddleware = kcors(corsOptions)
return async function (ctx, next) {
await koaCorsMiddleware(ctx, next)
if (ctx.response.get('Access-Control-Allow-Origin')) {
if (config.corsOpenerPolicy) {
ctx.response.set('Cross-Origin-Opener-Policy', config.corsOpenerPolicy)
}
if (config.corsEmbedderPolicy) {
ctx.response.set('Cross-Origin-Embedder-Policy', config.corsEmbedderPolicy)
}
}
}
}

@@ -37,0 +60,0 @@ }

6

package.json
{
"name": "lws-cors",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "4.0.0",
"version": "4.1.0",
"description": "Support for setting Cross-Origin Resource Sharing (CORS) headers to lws",

@@ -22,7 +22,7 @@ "repository": "https://github.com/lwsjs/cors.git",

"dependencies": {
"@koa/cors": "^3.1.0"
"@koa/cors": "^3.2.0"
},
"devDependencies": {
"lws": "^4.1.1",
"node-fetch": "^3.2.0",
"node-fetch": "^3.2.3",
"test-runner": "^0.10.1"

@@ -29,0 +29,0 @@ },

@@ -19,2 +19,6 @@ [![view on npm](https://badgen.net/npm/v/lws-cors)](https://www.npmjs.org/package/lws-cors)

--cors.credentials Adds `Access-Control-Allow-Credentials` header.
--cors.opener-policy string A value for the `Cross-Origin-Opener-Policy` header (specify `unsafe-none`,
same-origin-allow-popups` or `same-origin`).
--cors.embedder-policy string A value for the `Cross-Origin-Embedder-Policy` header (specify `unsafe-none`
or `require-corp`).
```

@@ -21,0 +25,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc