Skip to content

accounts: tighten macaroon permissions to reflect allowed calls #504

@guggero

Description

@guggero

Currently, when creating an account, the permissions assigned to the macaroon that is created for the account are:

                "info:read",
                "invoices:read",
                "invoices:write",
                "offchain:read",
                "offchain:write",
                "onchain:read",
                "peers:read"

But this is a superset of the calls that are actually allowed to be made with an account restricted macaroon, which leads to incorrect permissions being reported when using the wasmClientHasPerms call in LNC.

The actual list of calls that should be allowed is (see https://github.com/lightninglabs/lightning-terminal/blob/master/accounts/checkers.go#L111):

/lnrpc.Lightning/AddInvoice
/lnrpc.Lightning/ListInvoices
/lnrpc.Lightning/LookupInvoice
/lnrpc.Lightning/SendPayment
/lnrpc.Lightning/SendPaymentSync
/routerrpc.Router/SendPaymentV2
/lnrpc.Lightning/SendToRoute
/lnrpc.Lightning/SendToRouteSync
/routerrpc.Router/SendToRouteV2
/lnrpc.Lightning/DecodePayReq
/lnrpc.Lightning/ListPayments
/routerrpc.Router/TrackPaymentV2
/lnrpc.Lightning/PendingChannels
/lnrpc.Lightning/ListChannels
/lnrpc.Lightning/ClosedChannels
/lnrpc.Lightning/ChannelBalance
/lnrpc.Lightning/WalletBalance
/lnrpc.Lightning/GetTransactions
/lnrpc.Lightning/ListPeers
/lnrpc.Lightning/GetInfo
/lnrpc.Lightning/GetNodeInfo

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions