lnrpc+rpcserver: add QoL flag for permission check
To make it even more obvious that by default the permissions to check aren't taken from the full method provided, we add a new flag that does that on request.
This commit is contained in:
5 files changed
+680
-543
No files matched your search
+562
-541
File diff suppressed because it is too large.
Load diff
+11
-1
@@ -5119,7 +5119,8 @@ message CheckMacPermRequest {
|
||||
// If the list of permissions given is empty, then the macaroon is
|
||||
// considered valid only based on issuance authority and caveat validity.
|
||||
// An empty list of permissions is therefore equivalent to saying "skip
|
||||
// checking permissions".
|
||||
// checking permissions" (unless check_default_perms_from_full_method is
|
||||
// specified).
|
||||
repeated MacaroonPermission permissions = 2;
|
||||
|
||||
// The RPC method to check the macaroon against. This is only used if there
|
||||
@@ -5129,6 +5130,15 @@ message CheckMacPermRequest {
|
||||
// first, extract the permissions for the method, and then pass them in the
|
||||
// `permissions` field above.
|
||||
string fullMethod = 3;
|
||||
|
||||
// If this field is set to true, then the permissions list above MUST be
|
||||
// empty. The default permissions for the provided fullMethod will be used
|
||||
// to check the macaroon. This is equivalent to looking up the permissions
|
||||
// for a method in the `ListPermissions` RPC and then calling this RPC with
|
||||
// the permission list returned from that call. Without this flag, the list
|
||||
// of permissions must be non-empty for the check to actually perform a
|
||||
// permission check.
|
||||
bool check_default_perms_from_full_method = 4;
|
||||
}
|
||||
|
||||
message CheckMacPermResponse {
|
||||
|
||||
@@ -4676,11 +4676,15 @@
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/lnrpcMacaroonPermission"
|
||||
},
|
||||
"description": "The list of permissions the macaroon should be checked against. Only if\nthe macaroon contains all of these permissions, it is considered valid.\nIf the list of permissions given is empty, then the macaroon is\nconsidered valid only based on issuance authority and caveat validity.\nAn empty list of permissions is therefore equivalent to saying \"skip\nchecking permissions\"."
|
||||
"description": "The list of permissions the macaroon should be checked against. Only if\nthe macaroon contains all of these permissions, it is considered valid.\nIf the list of permissions given is empty, then the macaroon is\nconsidered valid only based on issuance authority and caveat validity.\nAn empty list of permissions is therefore equivalent to saying \"skip\nchecking permissions\" (unless check_default_perms_from_full_method is\nspecified)."
|
||||
},
|
||||
"fullMethod": {
|
||||
"type": "string",
|
||||
"description": "The RPC method to check the macaroon against. This is only used if there\nare custom `uri:\u003crpcpackage\u003e.\u003cServiceName\u003e/\u003cMethodName\u003e` permissions in\nthe permission list above. To check a macaroon against the list of\npermissions of a certain RPC method, query the `ListPermissions` RPC\nfirst, extract the permissions for the method, and then pass them in the\n`permissions` field above."
|
||||
},
|
||||
"check_default_perms_from_full_method": {
|
||||
"type": "boolean",
|
||||
"description": "If this field is set to true, then the permissions list above MUST be\nempty. The default permissions for the provided fullMethod will be used\nto check the macaroon. This is equivalent to looking up the permissions\nfor a method in the `ListPermissions` RPC and then calling this RPC with\nthe permission list returned from that call. Without this flag, the list\nof permissions must be non-empty for the check to actually perform a\npermission check."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user