Skip to content

In-depth lesson · CORS

Typical fixes

Every point the CORS reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 14 of 14
  1. Check the origin against an exact allowlist rather than reflecting it, and do not allow credentials for unknown origins.

    Seen in 12 reports
  2. Fix case sensitivity, regex path matching and inconsistent matching in flask-cors.

    Seen in 3 reports
  3. Validate the embedding page's origin and use the postMessage target origin rather than relying on the Referer header.

    Seen in 2 reports
  4. Validate the sender's origin before forwarding messages from content scripts to the background page.

    Seen in 2 reports
  5. Honour the request's credentials mode when attaching cookies in background fetches.

    Seen in 2 reports
  6. Validate the Origin and Content-Type headers on local JSON-RPC interfaces.

    Seen in 1 report
  7. Do not add a wildcard cross-origin header to local file responses.

    Seen in 1 report
  8. Set cache-control headers on authenticated API responses and restrict the cross-origin policy.

    Seen in 1 report
  9. Apply the same private network and mixed content checks to service worker fetches as to normal page fetches.

    Seen in 1 report
  10. Add authentication and origin validation to local HTTP and WebSocket interfaces.

    Seen in 1 report
  11. Isolate HTML embeds from the parent site's origin so their scripts cannot read authenticated responses.

    Seen in 1 report
  12. Sanitise user-controlled input reflected into response headers and restrict the cross-origin policy.

    Seen in 1 report
  13. Validate the origin and narrow the URL patterns covered by the cross-origin filter.

    Seen in 1 report
  14. Require HTTPS for trusted origins and verify a CSRF token on the profile endpoint.

    Seen in 1 report