Skip to content

Engine.io to not set CORS headers on error response #449

@jdolega

Description

@jdolega

I have an issue similar to #331 but related to the error situations which are eventually handled by the sendErrorMessage (https://github.com/socketio/engine.io/blob/master/lib/server.js#L236)
I have socket.io configured to allow only certain origins and in case of origin that is not passing validation I can see verify method failing (https://github.com/socketio/engine.io/blob/master/lib/server.js#L159) due to not allowed request. Unfortunately the error response generated by sendErrorMessage is having that unallowed origin set in Access-Control-Allow-Origin header which is
a) a bit confusing as my response about not allowed origin at the same time claims to allow it via Access-Control-Allow-Origin header
b) such responses are picked up by the security scans

Is there any reason sendErrorMessage explicitly sets the CORS headers? Could we add some way to somehow control their presence?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions