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 from interactive signer to background signer for low-privilege actions #4406

Closed
Tracked by #5354
michaelfig opened this issue Jan 27, 2022 · 3 comments · Fixed by #5877
Closed
Tracked by #5354

delegate from interactive signer to background signer for low-privilege actions #4406

michaelfig opened this issue Jan 27, 2022 · 3 comments · Fixed by #5877
Assignees
Labels
enhancement New feature or request wallet
Milestone

Comments

@michaelfig
Copy link
Member

michaelfig commented Jan 27, 2022

What is the Problem Being Solved?

refs: #4398

The on-chain wallet backend needs explicit approvals for operations that withdraw from purses, but we don't want to require explicit approvals for most user gestures.

Description of the Design

Our CosmJS integration is intended to be used as follows:

  • start with a "warm" or "cold" keypair in the Signer (Keplr/MetaMask)
  • UI guides user through an optional preapproval process. If not preapproved, then the wallet uses the "warm" keypair for every chain-modifying operation tx (with the full Signer approval process)
    • generate a "hot" Agoric CosmJS keypair, store encrypted with user password in browser
    • submit a batch of authorisation messages as one Signer transaction:
      • feegrant from the cold account to the hot account
      • authz to allow MsgWalletAction from hot account on behalf of cold account
      • optional - authz to allow MsgWalletSpendAction from hot account on behalf of cold account
  • if user has a "hot" keypair, they must enter a password once on load to use it instead of the Signer
  • in order to withdraw anything from a purse, the eventual send needs to be done via "MsgWalletSpendAction", where the backend basically remaps the marshalled input slot references as:
    • refs.map(ref => (spendActionAmplifier.get(ref) || ref))
    • and then handles the eventual send in the same way as MsgWalletAction
  • categories of restricted "spend" behaviour:
    • sending from a purse to Zoe escrow as part of offer approval
    • sending from a bank purse (Cosmos-level account, urun, ubld) to anywhere else
    • NOT sending between purses otherwile

Security Considerations

Needs review by security folks.

Test Plan

@michaelfig michaelfig added enhancement New feature or request wallet labels Jan 27, 2022
@michaelfig michaelfig self-assigned this Jan 27, 2022
@Tartuffo Tartuffo added the MN-1 label Feb 1, 2022
@samsiegart samsiegart assigned samsiegart and unassigned michaelfig Feb 7, 2022
@Tartuffo Tartuffo removed the MN-1 label Feb 7, 2022
@Tartuffo Tartuffo added this to the Mainnet 1 milestone Mar 23, 2022
@dckc
Copy link
Member

dckc commented Jul 11, 2022

re

  • generate a "hot" Agoric CosmJS keypair, store encrypted with user password in browser

Managing another password is a pain both for users and for us.

@dtribble doesn't think we want any code dealing password management; nor do I. (I prototyped something like this in 2018 using tweetnacl, but I very much avoided productizing it: https://github.com/rchain-community/RSign/blob/master/src/sigTool.js )

localStorage APIs don't include encryption, though there are emerging web crypto APIs.

Outsourcing to keplr would be nice; there's some hint of this feature:

https://github.com/chainapsis/keplr-wallet/blob/a8f6e01783eabfd7fb181b3588dbca4566a1f22e/packages/background/src/secret-wasm/handler.ts#L23

But I don't see it in https://docs.keplr.app/api/

@dckc
Copy link
Member

dckc commented Jul 13, 2022

discussion yesterday suggested not managing a separate password but rather

  • storing the ephemeral key in localStorage in the clear
  • limiting the duration of authz grants

@dckc dckc self-assigned this Jul 14, 2022
@dckc dckc changed the title Wallet backend spend actions need more approval than other actions delegate from interactive signer to background signer for low-privilege actions Aug 4, 2022
@dckc
Copy link
Member

dckc commented Aug 4, 2022

@rowgraus referred to these as "background" actions, which @michaelfig and I like enough to go with for now, so I'm changing the title.

The scope still has some fuzzy edges around it...

I also like @turadg 's suggestion that the names should make clear just what authority we grant to the background signer; we came up with nonSpending but that didn't survive discussion with @michaelfig , whose position is that the background signer is limited to actions within the wallet itself, such as transferring between purses. I had assumed that getting an invitation was a background thing, but that's not the design that MFig has in mind.

Earlier, I asked @dtribble for uses of the "ephemeral" (aka background) key:

Creating a vault should get the subsidiary vault manager facet form the vault director and then get a vault from there. The old protocol did that in one step, but now it should be two pipelined messages. Most things you would do in the REPL are ephemeral key. A few steps in getting a lien should be ephemeral key? (to get/redeem the SFT). I think there are several multistep things that don’t require approval for governance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wallet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants