Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration Flag to run Gateway in Trustless-Only Mode #9167

Closed
lidel opened this issue Aug 3, 2022 · 4 comments
Closed

Configuration Flag to run Gateway in Trustless-Only Mode #9167

lidel opened this issue Aug 3, 2022 · 4 comments
Labels
effort/days Estimated to take multiple days, but less than a week good first issue Good issue for new contributors help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up topic/gateway Topic gateway

Comments

@lidel
Copy link
Member

lidel commented Aug 3, 2022

tldr

Add a configuration option that limits Gateway to trustless Block and CAR response types.

More details in the specification at /ipfs/specs/http-gateways/TRUSTLESS_GATEWAY.md

Details

Context

Kubo 0.13 shipped support for Block and CAR response types (#8758).

These "trustless" response types disable IPLD deserialization and website hosting, and enable clients to verify the data is matching the requested CID, removing the need to trust that the gateway sent the correct bytes.

Why

Right now, Kubo supports both trusted and trustless response types, and there is no way to disable trusted ones: text/html and other deserialized responses have to be blocked on reverse proxy running in front of Kubo.

I believe we should have a clear config Flag that allows people to limit their gateway to Block and CAR responses for direct CID at /ipfs/{cid} (and nothing more).

Value added:

  • allows more people to run public gateway without worrying about their DNS name being used for hosting questionable content such as text/html used in phishing campaigns
  • encourages ecosystem to shift towards fetching verifiable HTTP responses (light clients, service workers)

How

We already have Gateway.NoDNSLink (bool) which can be used globally or be limited to specific hostname defined in Gateway.PublicGateways (see docs/condif.md)

The idea here is to add Gateway.NoTrust (name TBD, ideas welcome), working in analogous fashion.

Some pointer for implementer:

@lidel lidel added kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue topic/gateway Topic gateway P2 Medium: Good to have, but can wait until someone steps up good first issue Good issue for new contributors effort/days Estimated to take multiple days, but less than a week labels Aug 3, 2022
@lidel lidel added this to the Best Effort Track milestone Aug 3, 2022
@Jorropo
Copy link
Contributor

Jorropo commented Aug 3, 2022

I'm surprised people would care about that, it seems like it's a client issue if they aren't using trustless but if someone needs it then fair we can have it.

@lidel
Copy link
Member Author

lidel commented Aug 3, 2022

People running gateways start to care, especially when their domain name gets blocked by Google. This is not limited to IPFS ecosystem.

This flag enables a safer deployment option. A Trustless-Only Gateway provides content-addressed data to HTTP contexts (CLI, light clients, JS, Service Workers), but can't be used for website hosting, so won't be marked as the Origin of deserialized, third-party data.

@lidel lidel changed the title Configuration Flag to run Gateway in Trustless Mode Configuration Flag to run Gateway in Trustless-Only Mode Aug 3, 2022
@eleijonmarck
Copy link

@Jorropo @lidel do you agree that this option would be valuable to have? If so; I would love to take a stab at this.

Also curious to hear your thoughts on making kudo more secure by default by instead making this an opt-out feature?

@lidel
Copy link
Member Author

lidel commented Jun 13, 2023

This was implemented in #9789 as opt-out Gateway.DeserializedResponses config flag.
It can be tested in Kubo v0.21.0-rc1.
See release notes here.

The upstream boxo/gateway library has this flag disabled by default: ipfs/boxo#252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week good first issue Good issue for new contributors help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up topic/gateway Topic gateway
Projects
No open projects
Archived in project
Development

No branches or pull requests

3 participants