
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@fluvial/cors
Advanced tools
@fluvial/cors
Middleware for Cross-Origin-Resource-Sharing (CORS) headers. CORS explains to the browser what is and is not allowed in HTTP requests. This includes loading assets (such as JavaScript, CSS, and images) and API calls. These CORS policies are often provided in response to preflight requests the browser sends prior to
CORS-related headers include the following:
Access-Control-Allow-Origin
, which governs what origins the server will acceptAccess-Control-Allow-Credentials
, which allows or denies JavaScript to access the credentials-related parts of the responseAccess-Control-Allow-Methods
, which specifies what HTTP methods are permitted (e.g., GET, POST, etc.)Access-Control-Allow-Headers
, which specifies what headers are permittedAccess-Control-Max-Age
, which tells the browser how long the results of preflight requests are cachedAccess-Control-Expose-Headers
, which tells the browser what headers are permitted to be accessed by JavaScriptMore documentation about CORS can be found on MDN:
// in a router or application file
import { cors } from '@fluvial/cors';
app.use(cors());
cors(options?: CorsOptions)
Allows you to configure the way the CORS middleware behaves and what it includes in its headers.
Arguments:
options
(optional) - CorsOptions
, which includes the following properties:
continuePreflight
(optional) - boolean
, which indicates if you want the CORS middleware to not short-circuit in the case of a preflight request; default is false
continueOnFailure
(optional) - boolean
, which indicates if requests that fail the CORS checks will continue past the CORS middleware; default is false
preflightStatusCode
(optional) - number
, which is the status code that returned preflight requests should have; default is 204
failureStatusCode
(optional) - number
, which is the status code that failed requests are given; default is 405
for invalid/disallowed methods and 406
for anything elseallowedOrigins
(optional) - string[]
, which contains all of the origins that are allowed; default is [ '*' ]
credentialsAllowed
(optional) - boolean
, which controls the Access-Control-Allow-Credentials
header; default is true
allowedMethods
(optional) - string[]
containing the methods that are allowed; default includes GET
, POST
, PUT
, PATCH
, DELETE
, HEAD
, and OPTIONS
allowedHeaders
(optional) - string[]
specifying the header names allowed; defaults to the headers in the current requestmaxAge
(optional) - number
representing the number of seconds that the CORS options are cached in the requestexposedHeaders
(optional) - string[]
, which contains the headers that are allowed to be exposed to the code running on the page; defaults to all headers allowedReturns a middleware function that can be use
d in an Application or Router.
See something you want this middleware to do? Find a bug? Feel free to open an issue or a PR with the fix or feature you want to add.
FAQs
A fluvial-compatible Cross-Origin Resource Sharing middleware
The npm package @fluvial/cors receives a total of 1 weekly downloads. As such, @fluvial/cors popularity was classified as not popular.
We found that @fluvial/cors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.