About Authorization
Date | Responsible | Changes |
---|---|---|
January 16, 2023 | @Luis Fidelis | Initial version |
February 27, 2023 | @Luis Fidelis | • Update access.signer schema and rename access.bearer.$key to access.bearer.$signer in order to reuse the same schema. • Add sign access action. • Rename meta.signatures[*].schema to meta.signatures[*].method . |
March 7, 2023 | @Filip Herceg | • Added digest as part of signature object. • Refactored signer.schema → signer.format • Added custom.moment to examples |
April 17, 2023 | @Omar Monterrey | Added sign-intent action to enum |
May 25, 2023 | @Luis Fidelis | • Describe circle access constraint for signers. • Add circle to the list of records. • Add assign-signer and unassign-signer to the list of actions. |
June 14, 2023 | @Luis Fidelis | Describe policy referencing to access rules. |
July 19, 2023 | @Luis Fidelis | Add schema , $record and $ledger signer properties. |
August 22, 2023 | @Omar Monterrey | Removed action sign-intent from enum |
February 6, 2024 | @Omar Monterrey | Updated enums for AccessAction and AccessRecord |
There are two ways in which clients can authenticate to the ledger, the first by signing the mutation bodies, and the second by sending a JWT token. See About Authentication for more details about it.
These two forms of authentication allow users to say who they are, but do not guarantee that they have privileges to access the ledger. To ensure that users have the necessary privileges to create, update and read ledger records, access control rules can be defined at three levels: server, ledger and record. The authorization layer checks permissions by following the hierarchy:
An access rule can be either a simple rule or a reference to a policy. See About Security Policies for more details about policies.
Access permission rules follow the following format.
Where
The create
action is not valid when defining access to a specific record - record level rules - since the record already exists. Access rules with create
action are defined on parent records, usually this is ledger or server.
access
is also not valid for records without children, it should be defined either at server or ledger levels. See the section about child records access constraints
Access constraints must be defined respecting the hierarchy of server > ledger > record which means:
- The
server
record rule cannot be set on ledger or record level rules - The
ledger
record rule cannot be set on ledger or record level rules - The property
record
should me omitted or defined with the same value of the record's type when defining access control on record level i.e it's not allowed to define access rules to managesymbol
within awallet
record.
The property record
can be omitted when defining access rules, and in this case it indicates the access rule is intended to be applied to record which defines the access rule.
signer
property is only valid for mutations, since a GET Http request doesn't have a body.
Since a record can hold multiple signatures, these access rules defines that at least one of the signers must fulfill.
Both AccessSigner and AccessBearer are matcher objects. Please don’t confuse them with Referenced Records. Matcher objects are more flexible because the whole object can be matched instead of just handle.
Child record access constraints
Child record access constraints works as filters and describes minimum conditions required for accessing a child record or a record. They can be set on any record that has child records in the ledger. Most common records like that are ledger
and server
records.
Those access constraints are checked before validating the actual action
the user wants to perform, and it follows the hierarchy
Examples:
-
user A
wants toread
asymbol
, so firstly it must fulfill requirements for accessing theserver
and then fulfill requirements to access theledger
. Only after those requirements are satisfied, the ledger will check if theuser A
can perform theread
operation on thesymbol
. -
user B
wants tocreate
aledger
, so it should have permissions to access theserver
first. After that the ledger will check if the user has permissions tocreate
aledger
.
Examples of child record access rules at server level:
Examples of child record access rules at ledger level:
Server level rules
Server level rules are defined via an environment variable named SERVER_ACCESS_RULES
set on ledger API.
Access to any record and action can be defined at server level since it's the root level of access control.
Ledger level rules
Ledger level rules are defined in access
property by creating a ledger instance.
Access to any record can be defined at ledger level, except from server
.
Record level rules
Record level rules are defined in access
property by creating a record.
It can be used to define access to read
and update
the target record.