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

Delegate consumer/add on first authorization #518

Open
Gozala opened this issue Mar 9, 2023 · 3 comments
Open

Delegate consumer/add on first authorization #518

Gozala opened this issue Mar 9, 2023 · 3 comments
Assignees
Milestone

Comments

@Gozala
Copy link
Contributor

Gozala commented Mar 9, 2023

Currently registration flow is somewhat complex:

  1. Agent needs to authorize using access/authorize
  2. Pull delegations by invoking access/claim
  3. From received delegations deduce that it needs to create a new space (which is not trivial because it may have delegations from others).
  4. If it deduced that it space is needed it needs to generate new space and invoke provider/add to install a provider for it.
    • Not this will fail if account has already called provider/add prior.
  5. Delegate all space capabilities to the account.

We could simplify this a lot by just delegating consumer/add capability on first authorization so that in step 2 you'll have get it without having to guessing if you need to do provider/add. In other words with this flow the steps would change as follows:

  1. Agent needs to authorize using access/authorize
  2. Pull delegations by invoking access/claim.
  3. If you received delegation includes consumer/add where nb.consumer is agent DID
    1. Invoke it to complete registration.
    2. Delegate * to an account.
@Gozala Gozala added this to the w3up phase 3 milestone Mar 9, 2023
@Gozala Gozala self-assigned this Mar 9, 2023
@gobengo
Copy link
Contributor

gobengo commented Mar 9, 2023

customer/add do you mean consumer/add or a new hypothetical customer/add?

@Gozala
Copy link
Contributor Author

Gozala commented Mar 9, 2023

customer/add do you mean consumer/add or a new hypothetical customer/add?

Yes thanks for flagging

@Gozala
Copy link
Contributor Author

Gozala commented Mar 9, 2023

I have realized there is a major flaw with this proposal and I don't think we should do it, at least the way it has been proposed. Below I'll try to explain the flaw:

  1. Agent invoking authorization may only request store/list capability.
  2. If it is the first agent to perform authorization it will suddenly have complete authority over space.
  3. Even if we require that agent include { can: * with: ucan:* } delegation with authorization, it still could revoke it in a future.

This is especially a problem if agent happens to be generated by malicious website. In fact our current provider/add based flow is also problematic for the same reason.

What would be a proper approach here ?

I think proper solution would be to mediate space creation / registration with a user instead which can be done in a following way:

  1. Untrusted app Agent can requests access/authorize from the account.
  2. We forward that request to the target mailbox (further limiting time frame etc...).
  3. Link in the email takes you to the interactive webpage which initiates negotiation
  4. During negotiation we discover if the account already has a space.
  5. If account does not have a space webpage generates a space and delegates capabilities to the account.
  6. Then account account redelegates whatever agent requested (assuming user confirms that) from the space.

Difference here is that email takes to you to the page that allows you to create a space and register it as opposed to some agent that can be a malicious app.

Peeja pushed a commit to storacha/upload-service that referenced this issue Jan 17, 2025
🤖 I have created a release *beep* *boop*
---


##
[4.2.0](storacha/w3ui@vue-uploader-v4.1.0...vue-uploader-v4.2.0)
(2023-06-20)


### Features

* implement `uploadCAR` in uploader
([storacha#517](storacha/w3ui#517))
([40036ea](storacha/w3ui@40036ea))


### Bug Fixes

* inferred type error
([storacha#516](storacha/w3ui#516))
([1bf4cf2](storacha/w3ui@1bf4cf2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Travis Vachon <[email protected]>
Peeja pushed a commit to storacha/upload-service that referenced this issue Jan 29, 2025
🤖 I have created a release *beep* *boop*
---


##
[4.2.0](storacha/w3ui@vue-uploader-v4.1.0...vue-uploader-v4.2.0)
(2023-06-20)


### Features

* implement `uploadCAR` in uploader
([storacha#517](storacha/w3ui#517))
([a18d032](storacha/w3ui@a18d032))


### Bug Fixes

* inferred type error
([storacha#516](storacha/w3ui#516))
([adce6f5](storacha/w3ui@adce6f5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Travis Vachon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants