Skip to content

Commit 069e180

Browse files
committed
docs(cips): Further WIP edits to RBAC
1 parent d85ff26 commit 069e180

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed

.config/dictionaries/project.dic

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ bluefireteam
1010
BROTLI
1111
cardano
1212
Catalyst
13+
cbor
1314
CEST
1415
cfbundle
1516
chromedriver
@@ -89,6 +90,7 @@ slotno
8990
sqlfluff
9091
Stefano
9192
stevenj
93+
Subkey
9294
subosito
9395
tacho
9496
thiserror
@@ -106,4 +108,4 @@ xcodeproj
106108
xctest
107109
xctestrun
108110
xcworkspace
109-
yoroi
111+
yoroi

docs/src/catalyst-standards/draft-cips/role-registration/cip-xxxx.md

+28-32
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,20 @@ License: CC-BY-4.0 / Apache 2.0
1616
# Role Based Access Control Registration
1717

1818
## Abstract
19-
<!-- A short (\~200 word) description of the proposed solution and the technical issue being addressed. -->
19+
2020
dApps such as Project Catalyst need robust, secure and extensible means for users to register under various roles
2121
and for the dApp to be able to validate actions against those roles.
2222
While these Role based registrations are required for future functionality of Project Catalyst, they are also
2323
intended to be generally useful to any dApp with User roles.
2424

2525
## Motivation: why is this CIP necessary?
26-
<!-- A clear explanation that introduces the reason for a proposal, its use cases and stakeholders.
27-
If the CIP changes an established design then it must outline design issues that motivate a rework.
28-
For complex proposals, authors must write a Cardano Problem Statement (CPS) as defined in CIP-9999
29-
and link to it as the `Motivation`. -->
3026

3127
CIP-36 contains a limited form of role registration limited to voters and dreps.
3228

3329
However, Project Catalyst has a large (and growing) number of roles identified in the system, all of
3430
which can benefit from on-chain registration.
3531

36-
A non-exhaustive list of the roles Project Catalyst needs to identify on-chain are:
32+
A non-exhaustive example list of the roles Project Catalyst needs to identify securely are:
3733

3834
1. Proposers.
3935
2. Co-Proposers.
@@ -46,7 +42,7 @@ A non-exhaustive list of the roles Project Catalyst needs to identify on-chain a
4642

4743
Individual dApps may have their own unique list of roles they wish users to register for.
4844
Roles are such that an individual user may hold multiple roles, one of the purposes of this
49-
CIP is to allow the user to unambiguously assert they are acting in the capacity of a selected role.
45+
CIP is to allow the user to unambiguously assert they are acting in the capacity of a selected role.
5046

5147
CIP-36 offers a "purpose" field, but offers no way to manage it, and offers no way to allow it to be used unambiguously.
5248
The "purpose" field therefore is insufficient for the needs of identifying roles.
@@ -63,12 +59,6 @@ Registering for various roles and having role specific keys is generally useful
6359
motivated to solve problems with Project Catalyst, it is also intended to be generally applicable to other dApps.
6460

6561
## Specification
66-
<!-- The technical specification should describe the proposed improvement in sufficient technical detail.
67-
In particular, it should provide enough information that an implementation can be performed solely on the basis
68-
of the design in the CIP.
69-
This is necessary to facilitate multiple, interoperable implementations.
70-
This must include how the CIP should be versioned.
71-
If a proposal defines structure of on-chain data it must include a CDDL schema in it's specification.-->
7262

7363
Role registration is achieved by using two metadata records attached to the same transaction.
7464

@@ -136,7 +126,8 @@ Informally, all Registrations follow the same generalized Format (Non-Normative)
136126
// Role
137127
5: 0,
138128
// dApp ID (UUID or ULID)
139-
6: h'',
129+
6: #6.37 h'a3c12b1c98af4ee8b54278e77906c0fc'; or // UUID
130+
#6.32770 h'018d1d2acaf04486be189dbc5ae35e51', // ULID
140131
// Expires - Optional
141132
7: 0,
142133
// dApp Defined Metadata - Optional
@@ -157,7 +148,7 @@ the requirements of the identified dApp.
157148
Subkey 1 is either:
158149

159150
* A Single [Role Specific Public Key](#subkey-1---role-key---single-role-specific-public-key); OR
160-
* A [Optionally Weighted List of Role Specific Public Keys](#grouped-role-registration-format).
151+
* A [Optionally Weighted List of Role Specific Public Keys](#subkey-1---role-key---list-of-role-keys).
161152

162153
#### SubKey 1 - Role Key - Single Role Specific Public Key
163154

@@ -210,39 +201,43 @@ It also provides a mechanism to unambiguously identify the role being asserted w
210201
The Role Specific key derivation path must start with a specific segment:
211202

212203
Path based key derivation is limited to 31 bits, per path component.
213-
The [dApp ID]() is 128 bits.
204+
The [dApp ID] is 128 bits.
214205
It is required that the Role key be, as far as practically possible, unique amongst dApps.
215206
This is to prevent a Role from one dApp being misused by another, either intentionally or inadvertently.
216207

217-
The [dApp ID]() will be reduced to 31 bits by using Blake2B with a 31 bit digest over the [dApp ID]().
218-
While 31 bits is small, and could be subject to a collision attack, the intention here is not to prevent
219-
deliberately contrived collisions but to disambiguate dApps under normal circumstances.
220-
As the [dApp ID]() is not controllable, a malicious dApp could simply use the same dApp ID as another.
221-
Therefore it is not possible to protect against a collision and the [dApp ID]() is not a security mechanism
222-
in any event.
223-
224-
However key derivation is limited to 31 bits, accordingly, the [dApp ID][] will be hashed with Blake2B and a
208+
However key derivation is limited to 31 bits, accordingly, the [dApp ID] will be hashed with Blake2B and a
225209
31 bit digest will be produced.
226210
The aim is to as far as practical cause dApps to have distinct Role keys under normal circumstances.
227211

228-
`m / 7222' / 1815' / account' / chain' / blake2b_31(dApp ID) / role`
212+
`m / 7222' / 1815' / account' / chain' / hash(dApp ID) / role`
229213

230214
* `7222'` : The registration metadata field key from this CIP.
231215
* `1815'` : The year Ada Lovelace was born - Identifies this key as being for Cardano.
232216
* `account'` : The voters account
233217
* `chain'` : The chain on which the voter is registering.
234-
* `blake2b_31(uuid)` : The [dApp ID]()
218+
* `hash(dapp ID)` : The [hashed](#hashdapp-id) [dApp ID]
235219
* `role` : The role being registered for.
236220

237-
Note: It is specifically required that the Role Key NOT CHANGE for registrations made from the same wallet for the same dApp UUID/Purpose.
238-
This is because its possible to make both single and array role registrations, and its critical the key be the same regardless of which is used.
221+
Note: It is specifically required that the Role Key NOT CHANGE for the same dApp UUID/Purpose for any compliant Wallet.
222+
This is because its possible to make both single and array role registrations, and its critical the key be the same in these.
223+
It also critical that the Role keys be freely transferable and recoverable across wallets.
239224
The necessity of this will be expanded on when the witness is discussed below.
240225

241-
If the wallet does not use path based key derivation it is Essential that:
226+
##### hash(dapp ID)
227+
228+
The [dApp ID] will be reduced to 31 bits by using Blake2B with a 32 bit digest over the [dApp ID].
242229

243-
* Role Specific Public Keys do not change from registration to registration for the same [dApp UUID][dApp-UUID]/Purpose.
244-
* Role Specific Public Keys are not the same for different Purposes for a UUID.
245-
* It is acceptable, though undesirable, for different [dApp UUID's][dApp-UUID] to use the same Role Specific Public Keys.
230+
To ensure the hardening bit is not set, the high bit of the resultant hash will be forced to 0.
231+
232+
```text
233+
hash(dapp ID) == blake2b_32(dapp ID) & 0x7FFFFFFF
234+
```
235+
236+
While 31 bits is small, and could be subject to a collision attack, the intention here is not to prevent
237+
deliberately contrived collisions but to disambiguate dApps under normal circumstances.
238+
As the [dApp ID] is not controllable, a malicious dApp could simply use the same dApp ID as another.
239+
Therefore it is not possible to protect against a collision and the [dApp ID] is not a security mechanism
240+
in any event.
246241

247242
#### SubKey 1 - Role Key - List of Role Keys
248243

@@ -540,3 +535,4 @@ Code samples and reference material are licensed under [Apache 2.0]
540535
[Apache 2.0]: https://www.apache.org/licenses/LICENSE-2.0.html
541536
[CBOR]: https://www.rfc-editor.org/rfc/rfc8949.html
542537
[CBOR - Core Deterministic Encoding Requirements]: https://www.rfc-editor.org/rfc/rfc8949.html#section-4.2.1
538+
[CIP0003]: https://cips.cardano.org/cip/CIP-0003

0 commit comments

Comments
 (0)