Skip to content

Incorrect CORS response when origin is set to a String #365

@ShanikaEdiriweera

Description

@ShanikaEdiriweera

Environment information

Version: 2.8.5

Platform: Microsoft Windows NT 10.0.26100.0 x64

Node.js version: v20.19.4

Any other relevant information:

What steps will reproduce the bug?

  const corsOptions = {
    methods: ['OPTIONS', 'GET', 'POST'],
    origin: 'https://example.com',
  };
  • Requests will respond to any request with access-control-allow-origin : https://example.com

  • If cors options origin is type String,

    } else if (isString(options.origin)) {
    does not check for isOriginAllowed
    function isOriginAllowed(origin, allowedOrigin) {

  • Is this intended CORS behavior or access-control-allow-origin response header should not be sent when origin does not match?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions