-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Description
Found that CORS header Access-Control-Allow-Origin is still generated for any Origin ignoring origins filter.
This is related to already reported and closed issues #449, #331, #2850 and pr #452
Steps to reproduce (here is full commit with reproduction scenario in my app):
- Create server instance and restrict origins as:
const io = SocketIo(server, { origins: 'http://localhost:8888' });
- Use curl and send GET request (note the terminating slash):
curl -GET -H "Origin: http://wertwertffff.com" --verbose http://localhost:8888/socket.io/
Expected behavior:
403 HTTP code and corresponding error is generated, no Access-Control-Allow-* headers are present in response.
Actual result:
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8888 (#0)
> GET /socket.io/ HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.47.0
> Accept: */*
> Origin: http://wertwertffff.com
>
< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: http://wertwertffff.com
< Date: Mon, 04 Mar 2019 16:06:20 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
{"code":0,"message":"Transport unknown"}
Moreover, such behavior also causes security scanner (was tested with Burp Suite) to report websockets url as faulty.
mrfambo and icebob
Metadata
Metadata
Assignees
Labels
No labels