
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
The has-cors npm package is a simple utility to check if the browser or environment supports Cross-Origin Resource Sharing (CORS). It is primarily used in web development to determine if CORS is enabled in the user's environment, which is crucial for making cross-origin requests in web applications.
Check CORS support
This feature allows developers to programmatically check if the current browser or environment supports CORS. The package exports a boolean value indicating the presence of CORS support. This is useful for conditionally enabling or disabling functionality based on CORS availability.
var hasCORS = require('has-cors');
console.log(hasCORS); // Outputs: true or false
Unlike has-cors, which is used for checking if CORS is supported, the 'cors' package is a middleware that can be used to enable CORS with various options. It is more comprehensive and is typically used in Node.js applications to set up CORS policies.
While not directly similar to has-cors, 'cross-fetch' provides a way to make cross-origin requests in both browser and Node.js environments. It's a polyfill for the Fetch API that supports CORS, but it doesn't offer functionality to check for CORS support.
Detects support for Cross-Origin Resource Sharing
Install with component(1):
$ component install component/has-cors
Exports true
if the user-agent supports CORS, or false
otherwise.
var hasCORS = require('has-cors');
console.log(hasCORS);
// true
MIT
FAQs
Detects support for Cross-Origin Resource Sharing
The npm package has-cors receives a total of 1,673,941 weekly downloads. As such, has-cors popularity was classified as popular.
We found that has-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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.