From 384ab9f61627604744f0fddf317d14b65c9c3a04 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 14 Sep 2020 10:55:19 +0200 Subject: [PATCH] lncli: print all permission actions Due to a misunderstanding about how the entities/actions are encoded inside the macaroon, only the first action was printed per entity. Even though we add them as separate pairs in the macaroon service (for example "offchain:read" and "offchain:write"), they are grouped in the serialized macaroon ("offchain:read,write"). --- cmd/lncli/cmd_macaroon.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/lncli/cmd_macaroon.go b/cmd/lncli/cmd_macaroon.go index 683b2ba6..4ea7dbfd 100644 --- a/cmd/lncli/cmd_macaroon.go +++ b/cmd/lncli/cmd_macaroon.go @@ -399,8 +399,12 @@ func printMacaroon(ctx *cli.Context) error { content.Caveats = append(content.Caveats, string(caveat.Id)) } for _, op := range decodedID.Ops { - permission := fmt.Sprintf("%s:%s", op.Entity, op.Actions[0]) - content.Permissions = append(content.Permissions, permission) + for _, action := range op.Actions { + permission := fmt.Sprintf("%s:%s", op.Entity, action) + content.Permissions = append( + content.Permissions, permission, + ) + } } printJSON(content)