Skip to content

[CORS] Old library makes exploitable CORS configuration (need to update dependency) #5745

Open
@hsanjuan

Description

Version information:

master

Type:

Bug

Description:

When Access-Control-Allow-Origin is set to * (think this is the default), the CORS library we use automatically sets it to the value of the Origin header of the request. However we also set or recommend to set Access-Control-Allow-Credentials: true (not sure why).

The result is that this is going around a browser security feature where Access-Control-Allow-Credentials: true is not allowed when Allow-Origin: *. The library we use for that patched this behaviour and we should upgrade accordingly.

More info: https://github.com/rs/cors#allow--with-credentials-security-protection (and linked issues and linked discussions from those issues).

Also, since the go-ipfs APIs have nothing with credentials, cookies etc, I'm not sure why Access-Control-Allow-Credentials: true is there (and the documentation invites the user to configure it at least - web UI too). There's probably a reason so I'd love to know (cc. @olizilla, @lidel)

Also not clear why Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length is hardcoded, since probably (?) these headers are not relevant as part of requests made against the API (only responses, that's why Expose-Headers is set as well), but I might be wrong.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    topic/CORSIssues related to CORS on HTTP endpointstopic/apiTopic apitopic/rpc-apiIssues related to Kubo RPC API at /api/v0topic/securityTopic security

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions