Closed gobengo closed 1 year ago
Note:
@web3-storage/access
agent gets session proofs without worrying much about the issue of those sessions and whether they are issued by the other end of the connection. that's probably how we can test/fix https://github.com/web3-storage/w3up/blob/main/packages/access-client/src/agent.js#L263When testing locally, I witnessed the provider/add invocation going out with only one session proof, i.e. only one proof of ucan/attest
. And that proof was issued by did:web:web3.storage
not the did:web:staging.web3.storage
that corresponds to the W3UPSERVICE env vars I'm using.
So I think we can fix this like
I've been debugging this this morning, and found out that part of the issue is in @web3-storage/access
Agent #delegations method https://github.com/web3-storage/w3up/blob/main/packages/access-client/src/agent.js#L186
When that is called internally to find UCANs to send to the provider/add invocation, it finds a delegation in the agent data for the relevant key/capability, so it calls _caps.delete(cap)
there. But it shouldn't. Because the delegation it found and determined to authorize the action may not actually authorize it if it requires a session proof issued by a different ID (e.g. did:web:staging.web3.storage instead of did:web:web3.storage)
I tested w3cli@4.6.0 and was unable to reproduce this issue, which leads me to believe this issue is fixed! 🎈
Motivation:
But when I did this for a new space, I was unable to register it using w3cli
How to Reproduce Issue
Reproduction Steps
(this is what works for me while reporting this. Due to the nature of it, there may be further setup required to reproduce. e.g. you probably need to have done a
w3 authorize
once before without the env vars to reproduce from scratch)In terminal
export W3UP_SERVICE_DID='did:web:staging.web3.storage'; export W3UP_SERVICE_URL='https://staging.up.web3.storage'
w3 up ~/Pictures/sharkDAO/GOPR0788.JPG
would fail right now due to having no storage provider. So we need to do aw3 space register
w3 space register -e bengo@dag.house
Expected Behavior
the space is registered, and then I can upload stuff to the space using
w3 up ~/Pictures/sharkDAO/GOPR0788.JPG
Actual Behavior
Interesting things about this error
Unable to resolve 'did:web:web3.storage' key"
. remember that because this is all running withW3UP_SERVICE_URL=https://staging.up.web3.storage
, we/w3cli shouldn't expect proofs issued by did:web:web3.storage to be accepted by the similar-software-but-otherwise-separate did:web:staging.web3.storage