Skip to content

Fully prevent the use of path-based IPFS gateways #7698

@rekmarks

Description

@rekmarks

Currently, we allow users to set whatever IPFS gateway they want except gateway.ipfs.io. We should prevent all path-based gateways by implementing the fix suggested below.

Original comment by @lidel:

To make this more bullet proof, you could add a quick validation, to ensure provided hostname is a real subdomain gateway, and refuse to save invalid ones.

Try fetching a small, well-known hash (for example: string hello is bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am) and see if returned value matches expectations:

https://bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am.ipfs.dweb.link
https://bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am.ipfs.cf-ipfs.com
This would also protect you from users setting path-based gateways (which do not provide Origin-based isolation.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions