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

multi: support using a regex when specifying custom perms #450

Merged
merged 2 commits into from
Nov 29, 2022

Conversation

ellemouton
Copy link
Member

With this PR, you can now use the wild card character when specifying custom URIs that permissions should be added for in an LNC session. This allows you to do the following:

litcli s a --label=custom_perm_session  --type=custom --uri=/lnrpc.Lightning/ListChannels --uri="/poolrpc.Trader/*"

The above will create a session that has the perms to only access the ListChannels call of the lnrpc.Lightning but then also has the perms to access any URI that falls under the poolrpc.Trader service.
`
Fixes #439

Copy link
Contributor

@itsrachelfish itsrachelfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, just found one typo.

Going to use this branch while testing my permission changes 👍

cmd/litcli/sessions.go Outdated Show resolved Hide resolved
@lightninglabs-deploy
Copy link

@ellemouton, remember to re-request review from reviewers when ready

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Pretty straightforward implementation, just an idea for making it even more generic.

cmd/litcli/sessions.go Outdated Show resolved Hide resolved
session_rpcserver.go Outdated Show resolved Hide resolved
@ellemouton ellemouton changed the title multi: support using wild-card URIs when specifying custom perms multi: support using a regex when specifying custom perms Nov 23, 2022
@ellemouton ellemouton requested a review from guggero November 28, 2022 06:01
@ellemouton
Copy link
Member Author

@itsrachelfish , this is ready for a final review :)

Copy link
Contributor

@itsrachelfish itsrachelfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK, regex support works, but the examples & tests could be updated to be more clear.

perms/permissions_test.go Outdated Show resolved Hide resolved
With this commit, a user can now specify a regex when specifying custom
permissions for an LNC session. This regex will be used to select
permissions for URIs that match the regex.
@ellemouton ellemouton merged commit ce2cf12 into lightninglabs:master Nov 29, 2022
@ellemouton ellemouton deleted the wildCardURIs branch November 29, 2022 10:44
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

Successfully merging this pull request may close these issues.

Wildcard permissions support
4 participants