fission icon indicating copy to clipboard operation
fission copied to clipboard

CLI to browser linking sometimes fails

Open bgins opened this issue 4 years ago โ€ข 38 comments

Summary

Problem

In some cases, linking an account from the CLI to a web browser cannot be completed.

Impact

Some user accounts cannot be linked from the CLI to the browser.

Solution

Unknown.

Detail

Describe the bug

When a user attempts to link from the CLI to the browser, the confirmation code is never displayed in the browser or at the CLI. Linking cannot be completed.

To Reproduce Steps to reproduce the behavior:

  1. Create an account in the browser
  2. Link from the browser to the CLI with fission setup
  3. Delete the user in the browser
  4. Run fission login at the CLI to initiate CLI-to-web linking
  5. Open the auth lobby, and click sign in
  6. The auth lobby updates to show it is waiting, but the CLI does not respond

Expected behavior

We expect the auth lobby and the CLI to show the confirmation code to allow us to complete the linking process.

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Browser: Firefox (in a container)
  • Version: 2.13.0.0

Additional context

The linking process works in at least one case where the account was initially created at the CLI.

bgins avatar May 10 '21 22:05 bgins

Browser: Firefox (in a container)

@bgins can you tell me more about this? Is FF in a Docker container, or do you mean the page is in a FF Container?

expede avatar May 10 '21 22:05 expede

@expede a FF container.

bgins avatar May 10 '21 22:05 bgins

Okay, thanks. And which version of FF?

expede avatar May 10 '21 22:05 expede

@bgins sorry, I also wanted to check that you're using the same environment for both? This is prod auth.fission.codes and CLI pointed at prod?

expede avatar May 10 '21 22:05 expede

Firefox version 88.0. (Regular Firefox, not developer edition or anything special.)

bgins avatar May 10 '21 22:05 bgins

Yes, that is correct. Production auth.fission.codes in both cases.

bgins avatar May 10 '21 22:05 bgins

Comparing CLI-to-web linking with an account created at the CLI to the failing case reveals some evidence.

When linking fission login -v, verbose mode reveals that in both cases the CLI gets past the "๐Ÿ“ž๐Ÿ—ฃ๏ธ Sending over pubsub:" and the log step right after that.

In the successful case, the CLI contiues steps 4 and 5 of linking and through the rest of the process.

In the failing case, no further steps are logged. In addition, the console in the browser logs this error: "Couldn't decrypt message, probably not intended for this device".

bgins avatar May 10 '21 23:05 bgins

Hmmm I'm having a hard time reproducing the issue. I've now linked expede-0404 back and forth several times, wiping the keys from the provider after each round and making them the consumer (this UCAN chain must be enormous!)

expede avatar May 10 '21 23:05 expede

In addition, the console in the browser logs this error: "Couldn't decrypt message, probably not intended for this device".

Can you check which version of the auth lobby you have? You can find it with VERSION in the console

expede avatar May 10 '21 23:05 expede

Yep, the VERSION logs 1620400698.

bgins avatar May 10 '21 23:05 bgins

One thing to note. The user that is failing to link is the currently signed in user in Firefox outisde of the container. Maybe it would be worth signing them out there?

bgins avatar May 10 '21 23:05 bgins

That's the same as me. Same browser version, also in a FF Container, same version of Drive. I can't reproduce the issue ๐Ÿคจ

Works on my machine:tm:

I wonder what's different ๐Ÿค”

expede avatar May 10 '21 23:05 expede

One thing to note. The user that is failing to link is the currently signed in user in Firefox outisde of the container. Maybe it would be worth signing them out there?

Ooooh, how many auth lobbies do you have open at once? You can only have one at a time

expede avatar May 10 '21 23:05 expede

I only had one open when the failure occurred. (Just tried again to be sure.)

bgins avatar May 10 '21 23:05 bgins

Can you try outside of a container?

And just to double check, you're starting this process in the CLI, and afterwards in the browser pressing "sign in" and entering the username, correct?

expede avatar May 10 '21 23:05 expede

(also this is the yeti account, correct?)

expede avatar May 10 '21 23:05 expede

And just to double check, you're starting this process in the CLI, and afterwards in the browser pressing "sign in" and entering the username, correct?

Yep.

(also this is the yeti account, correct?)

That's right, yeti.

Will sign out outside the container, then attempt to link again from the CLI.

bgins avatar May 10 '21 23:05 bgins

Signing out outside of the container, then attempting to re-link (outside of the container) produces the same error.

Note that this was the context where yeti was originally created in the browser.

bgins avatar May 10 '21 23:05 bgins

Does fission whoami work?

expede avatar May 10 '21 23:05 expede

Yep, it does:

$ fission whoami
๐Ÿ’ป Currently logged in as: yeti

bgins avatar May 10 '21 23:05 bgins

What's the result of cat ~/.config/fission/ucan/store.json?

expede avatar May 10 '21 23:05 expede

The result is:

$ cat ~/.config/fission/ucan/store.json
{"bafybeieghec5m6oa7tj2v6avzf3fnmr3eqeei3j2pf2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7VUsUFbl4CDRQmXOY9oqpFjgu1tjrk2D6Elde2AJ4IwIxxefTGysy-ivRAEOaAoT6rKTaP2_YY_BsXKPaUa2UrE0senWX0_s-asWmZN_d8hI870HaxCfXLtbiIOFVqw"}

bgins avatar May 10 '21 23:05 bgins

Follow up: yeti is an older account, so we're going to wait to see if this is replicatable with newer accounts. I think that it's failing at a bootstrapping step pre-linking, but I'm currently unable to reproduce it on my system, so hard to tell.

expede avatar May 12 '21 01:05 expede

That also fails on my machine (Fedora 33, FF).

  • Created a fresh account with a new email address on CLI
  • opened auth.fission.codes, account linking works
  • opened drive.fission.codes, fails with:

20210516_18h40m19s_grim

  • when trying dashboard.fission.codes it fails with (JS Console)

Uncaught (in promise) Error: `mkdir` only accepts directory paths

just noted: when I create a new account in my FF browser first (without any linking) that also fails... :(

elmariachi111 avatar May 16 '21 16:05 elmariachi111

Thanks @elmariachi111 โ€” looks like Drive and Dashboard need some updates.

@matheus23 can you please prioritize / research updates here.

bmann avatar May 16 '21 17:05 bmann

looks like Drive and Dashboard need some updates.

The dashboard is still running webnative v0.23.0 (0.24.1 is the most up-to-date version). The error is actually from the auth lobby not handling backcompatibility correctly in a trickier case. I've created a PR to fix that.

I've already updated the development version of the dashboard to webnative 0.24 (https://dashboard-develop.fission.app) and as we're going to demo it this week & probably publish very soon, I don't want to do the upgrade to 0.24 dance a second time for what's currently published.

Should we maybe already push the big red button and publish the new version of the dashboard with the secure backup feature to dashboard.fission.codes?

matheus23 avatar May 17 '21 13:05 matheus23

By the way - thanks @elmariachi111! These are great error reports.

matheus23 avatar May 17 '21 13:05 matheus23

opened drive.fission.codes, fails with:

I can't quite reproduce this, however. I've created a new account on the CLI, linked it to my browser's auth lobby at auth.fission.codes, opened drive.fission.codes and was able to log in fine.

From the error message I can see that it could be some very weird edge-case, where the drive is up-to-date when it redirects to the auth lobby, but somehow is not up-to-date when the auth lobby (auth.fission.codes) redirects back to it. One might ask "what, why would it load an older version when it already had a newer one?". I've seen this happen in firefox, where reloading a page with Shift+R will load the up-to-date version, but loading with F5 or via a normal page load will not bypass the service worker and therefore load a possibly stale version.

The 'fix' would be to either (1) wait a couple of seconds while drive.fission.codes is open for the service worker to load the new version and reload or (2) when you get the error just try to hard-reload with Shift+R. I hope that helps.

matheus23 avatar May 17 '21 13:05 matheus23

so, I created several accounts on several machines, and at least one seems to work right now (alternativestadolf, had to reload the drive app twice, then it started working :man_shrugging: :muscle: ). I just published an app using the CLI (fission app register / publish) and it showed up (https://long-junior-blue-kitten.fission.app/) and entered my dashboard which als started working. When I enter the Apps section, runfission.com/app responds with 422 Unprocessable entity, response payload is Signature does not match content.

image

I analysed the authorization header's JWT and its content seems to be a mix of DID & binary data...

image

elmariachi111 avatar May 17 '21 13:05 elmariachi111

Can you try https://dashboard-test2.fission.app @elmariachi111 ?

It's what the new version of the dashboard will be soon.

matheus23 avatar May 17 '21 14:05 matheus23