lightninglabs / lightninglabs/lnc-web
Expose session's macaroon and/or full permission list
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
In an effort to save people's feet from their own guns, we like to make sure they give us minimally permissible credentials to do what they want us to do.
The only API `lnc-web` exposes for permissions are `hasPerms` and `isReadOnly`. If we wanted to make sure a session only allows us to send offchain payments for instance, we'd need to make sure `hasPerms` returns false for every other possible permission the session could have.
Something like a `listPermissions`, or `macaroon` function even, would allow us to more efficiently/effectively do this check.
For reference, our lnd auto-withdrawals using the old fashioned non-TURNed configuration validate the macaroon by decoding it clientside and making sure the ops are strictly limited to either:
the ideal:
```js
const INVOICABLE_MACAROON_OPS = [
{
entity: 'invoices',
actions: [
'read',
'write'
]
}
]
```
the prebaked invoice macaroon:
```js
const INVOICE_MACAROON_OPS = [
{
entity: 'address',
actions: [
'read',
'write'
]
},
{
entity: 'invoices',
actions: [
'read',
'write'
]
},
{
entity: 'onchain',
actions: [
'read'
]
}
]
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing hasPerms and isReadOnly APIs in lnc-web and review how sessions represent macaroons and permissions. Decide whether exposing a listPermissions or macaroon API best supports checking exact permission sets, then verify it can distinguish the example invoice-only operations from broader credentials.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, authorization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100