VDB
Sign up
MEDIUM

GHSA-vwrf-r5r4-7775

Incorrect handling of CORS preflight request headers in hapi

Quick fix

GHSA-vwrf-r5r4-7775 — hapi: upgrade to the fixed version with the command below.

npm install hapi@11.0.0

Details

Versions of `hapi` prior to 11.0.0 implement CORS incorrectly, allowing for configurations that at best return inconsistent headers, and at worst allow cross-origin activities that are expected to be forbidden.

If the connection has CORS enabled but one route has it off, and the route is not GET, the OPTIONS prefetch request will return the default CORS headers and then the actual request will go through and return no CORS headers. This defeats the purpose of turning CORS on the route.

## Recommendation

Update to version 11.0.0 or later.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/hapi
Introduced in: 0Fixed in: 11.0.0
Fixnpm install hapi@11.0.0

References