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

[MV3 Beta Bug] Automatic mode does not work automatically on Brave or Chrome #1204

Closed
Tracked by #1152
whizzzkid opened this issue May 19, 2023 · 12 comments · Fixed by #1224
Closed
Tracked by #1152

[MV3 Beta Bug] Automatic mode does not work automatically on Brave or Chrome #1204

whizzzkid opened this issue May 19, 2023 · 12 comments · Fixed by #1224
Assignees
Labels
area/brave Issues related to Brave Browser area/MV3 Issues related to Manifest V3 version kind/bug A bug in existing code (including security flaws) mv3-beta-bugs

Comments

@whizzzkid
Copy link
Contributor

Gateways only get invoked when the first-class "IPFS” button in the address bar is hit manually.

@whizzzkid whizzzkid added kind/bug A bug in existing code (including security flaws) area/brave Issues related to Brave Browser area/MV3 Issues related to Manifest V3 version mv3-beta-bugs labels May 19, 2023
@whizzzkid whizzzkid self-assigned this May 19, 2023
@whizzzkid
Copy link
Contributor Author

@BigLep I was not able to reproduce the issue, did you connect to the Brave's internal node at:

Kubo RPC: http://127.0.0.1:45005
gateway: http://localhost:48084

@BigLep
Copy link
Contributor

BigLep commented May 31, 2023

@whizzzkid : my feedback on this was under the heading "Experience with fresh install on Brave without using Kubo (neither Brave-managed Kubo or external Kubo)"

I'm intentionally not using Kubo.

https://www.notion.so/pl-strflt/Dogfooding-4560b1a6cd7a494ca5ac5b1bc7d6cd4a?pvs=4#a39d3a036f494c9c8427efd739a1ce19

@BigLep BigLep changed the title [MV3 Beta Bug][Brave] Automatic mode does not work automatically [MV3 Beta Bug] Automatic mode does not work automatically on Brave or Chrome Jun 13, 2023
@BigLep
Copy link
Contributor

BigLep commented Jun 13, 2023

@whizzzkid : when is Automatic mode supposed to work?

From the settings menu it says "Automatically switch from your local gateway to your default public gateway if the Kubo RPC is unavailable."

If I don't have a Kubo node running (and thus not Kubo RPC endpoint and no local gateway) visiting sites like ipfs.tech don't redirect to my external gateway (e.g., ipfs.io). I would expect when visiting ipfs.tech to be redirected to https://ipfs-tech.ipns.dweb.link/.

I can confirm this doesn't appear to work with "IPFS Companion RC-MV3 (Beta @ 9f4981c)" on both Chrome and Brave.

@whizzzkid
Copy link
Contributor Author

@BigLep thanks for confirming, this makes sense, however this is what the behaviour is with current mv2.

This setting only effect the current url if it's being loaded from local kubo, it then gets redirected to public gateway. If the kubo rpc api is unreachable, it does not touch the request and let it resolve over the network. So, ipfs.tech will not redirect to ipfs.io. However if you don't have kubo available then http://docs.ipfs.tech.ipns.localhost:8081/ would get redirected.

@BigLep
Copy link
Contributor

BigLep commented Jun 13, 2023

@whizzzkid : maybe quickest to have a verbal conversation. It's probably on my end, but I guess I don't understand the purpose of "automatic mode". I am interpreting it as, "if your Kubo node isn't working is unavailable for some reason, we'l use your public default gateway for all URLs where we have a regex that matches to a CID or IPNS name."

@BigLep
Copy link
Contributor

BigLep commented Jun 19, 2023

Thanks @whizzzkid . I was able to ask @lidel some more companion questions during a 1 on 1.

I'm still struggling with this option to make sure I understand what it does.

If I use companion, have "automatic mode" enabled, and visit http://docs.ipfs.tech.ipns.localhost:8080/, I don't get automatically redirected. I get a redirect indirect I need to interact with (which make sense from a security regard) (see below). That said, I see this interstitial regardless of whether I have "automatic mode" enabled or not.

I am wanting to make sure I understand what "Use Automatic Mode - Automatically switch from your local gateway to your default public gateway if the Kubo RPC is unavailable" means. When does this "automatic mode" get invoked? What is the difference in behavior between enabling it vs. disabling it?

image

@whizzzkid
Copy link
Contributor Author

I see what you mean here, based on the language presented by the options screen. However, this was broken from before: #1090 as the node would never load and the extension would not redirect those requests "automatically". So this is the existing behaviour, not introduced by mv3.

Now that I think more about it, it should be fixed in both the places. I think it should be straightforward to implement and will take a look at this.

On a side note @lidel do you know of a different reason of why localhost requests that were failing did not redirect to public gatways when "automatic mode" was on? Maybe I missed something.

@whizzzkid
Copy link
Contributor Author

@BigLep I created #1223 to validate this, the problem seems to be deeper than just redirecting if automatic mode is on, it fails to redirect to localhost if automatic mode is off. I feel we should just have the recovery screen and let the client be recovered. The automatic mode implementation seems to be opposite of what it's actually supposed to be.

@lidel
Copy link
Member

lidel commented Jun 20, 2023

Some historic notes:

  • "Automatic Mode" was introduced to disable redirect to local gateway when it was down, and re-enable it when it gets back online.
    • It was never applied to public gateways, as we did not want to centralize all requests to PL-controlled gateway (back then, we did not even have Cloudflare gateway, so any decentralization via community-run gateways we could get, was a win).
    • So there is no automatic redirect when local node is not present. Instead, for non-local HTTP, we use preferred gateway only for error recovery: if a request to public HTTP server fails, but Companion knows it is a public gateway URL or DNSLink website, we recover via local or public gateway URL (depending on automatic mode state).

      2023-06-20_17-57

    • I guess there could be a separate "Force use of preferred public gateway" toggle in Companion's Preferences, but it would not be related to "Automatic Mode".

On a side note @lidel do you know of a different reason of why localhost requests that were failing did not redirect to public gatways when "automatic mode" was on?

Well, we've introduced a nice UX in #1125 – when local node goes/is offline, and localhost page load fails, we don't magically redirect user to public gateway (which could leak their browser history, and suddenly have no integrity check, as its delegated to third party HTTP server).

  • Instead, Companion shows this nice recovery HTML page, which allows user to either retry (after starting local node) or open via public gateway (but this is explicit decision by user, prefaced with security/privacy warning).

So with that in mind, I would not change the behavior of "Automatic Mode" or Recovery Page when local node is not available.

The behavior @BigLep described in #1204 (comment) is what we want.

Perhaps all we need is to clarify "Automatic Mode" label and description in readme, to note that all it does is toggling redirect to LOCAL gateway?

Use Automatic Mode - redirect to your local gateway only when Kubo RPC is available.

@BigLep
Copy link
Contributor

BigLep commented Jun 21, 2023

Thanks @whizzzkid and @lidel for explaining the intent. This makes sense to me now. Hopefully I make the time up to you guys by being self-sufficient in future in helping others or improving/reviewing docs.

Anyways, I think updating the settings text to be more clear.

Use Automatic Mode - redirect to your local gateway only when Kubo RPC is available.

Maybe also add extra text or help note:

Disabling this still triggers redirects even if the Kubo RPC endpoint is unavailable.

Basically I think we want to get the message across that "If your local gateway's availability is corroborated with the Kubo RPC endpoint availability, then you likely only want to redirect if your gateway and Kubo RPC are up."

@whizzzkid
Copy link
Contributor Author

Thanks for the detailed explanation @lidel, the language bits need clarification, I'll create a PR for that.

@BigLep no worries at all, it was genuinely confusing and it needs fixing!

@whizzzkid
Copy link
Contributor Author

I dunno why the PR doesn't close the issue automatically 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/brave Issues related to Brave Browser area/MV3 Issues related to Manifest V3 version kind/bug A bug in existing code (including security flaws) mv3-beta-bugs
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants