@bananapus/permission-ids-v6 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADMINISTRATION.md +4 -4
- package/ARCHITECTURE.md +9 -9
- package/AUDIT_INSTRUCTIONS.md +7 -4
- package/README.md +16 -16
- package/RISKS.md +19 -19
- package/SKILLS.md +4 -4
- package/USER_JOURNEYS.md +13 -14
- package/package.json +1 -1
package/ADMINISTRATION.md
CHANGED
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
|
|
12
12
|
## Purpose
|
|
13
13
|
|
|
14
|
-
`nana-permission-ids-v6` has no runtime admin surface. Its control significance is source
|
|
14
|
+
`nana-permission-ids-v6` has no runtime admin surface. Its control significance is at the source level: it defines the shared permission namespace used by the rest of the ecosystem.
|
|
15
15
|
|
|
16
16
|
## Control Model
|
|
17
17
|
|
|
18
18
|
- No owner
|
|
19
19
|
- No runtime governance
|
|
20
20
|
- No mutable onchain state
|
|
21
|
-
- Source-
|
|
21
|
+
- Source-level coordination only
|
|
22
22
|
|
|
23
23
|
## Roles
|
|
24
24
|
|
|
25
25
|
| Role | How Assigned | Scope | Notes |
|
|
26
26
|
| --- | --- | --- | --- |
|
|
27
|
-
| Maintainer | Source-code author | Ecosystem-wide | Can add or reorder constants only by editing and
|
|
27
|
+
| Maintainer | Source-code author | Ecosystem-wide | Can add or reorder constants only by editing code and updating dependent deployments |
|
|
28
28
|
|
|
29
29
|
## Privileged Surfaces
|
|
30
30
|
|
|
@@ -45,7 +45,7 @@ There are no privileged runtime functions. The only meaningful changes are sourc
|
|
|
45
45
|
|
|
46
46
|
- Do not infer semantic compatibility from matching names if numeric IDs changed.
|
|
47
47
|
- Treat `src/JBPermissionIds.sol` as append-only unless a breaking ecosystem-wide migration is intentional.
|
|
48
|
-
- If docs and code disagree on a permission number, trust the code and update the docs before further
|
|
48
|
+
- If docs and code disagree on a permission number, trust the code and update the docs before further review.
|
|
49
49
|
|
|
50
50
|
## Recovery
|
|
51
51
|
|
package/ARCHITECTURE.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
`nana-permission-ids-v6` is the shared permission namespace for the V6 ecosystem. It
|
|
5
|
+
`nana-permission-ids-v6` is the shared permission namespace for the V6 ecosystem. It makes sure every repo agrees on what each permission bit means when interacting with `JBPermissions`.
|
|
6
6
|
|
|
7
7
|
## System Overview
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This repo intentionally contains almost no logic. Other repos import `JBPermissionIds` and compare permission bits against these constants.
|
|
10
10
|
|
|
11
11
|
## Core Invariants
|
|
12
12
|
|
|
13
|
-
- Existing IDs must
|
|
13
|
+
- Existing IDs must stay stable once deployed contracts or integrations use them.
|
|
14
14
|
- New IDs should be appended intentionally, not reused or repurposed.
|
|
15
|
-
- Numeric stability matters more than naming convenience
|
|
15
|
+
- Numeric stability matters more than naming convenience.
|
|
16
16
|
- `ROOT` must stay aligned with `JBPermissions` expectations in `nana-core-v6`.
|
|
17
17
|
|
|
18
18
|
## Modules
|
|
@@ -24,7 +24,7 @@ The repo intentionally contains almost no logic. Its value is stable coordinatio
|
|
|
24
24
|
## Trust Boundaries
|
|
25
25
|
|
|
26
26
|
- This repo has no runtime authority by itself.
|
|
27
|
-
- It is
|
|
27
|
+
- It is tightly coupled to `nana-core-v6` and every repo that performs permission checks.
|
|
28
28
|
|
|
29
29
|
## Critical Flows
|
|
30
30
|
|
|
@@ -37,15 +37,15 @@ No accounting lives here.
|
|
|
37
37
|
## Security Model
|
|
38
38
|
|
|
39
39
|
- The code is trivial, but the coordination burden is not.
|
|
40
|
-
- A
|
|
41
|
-
-
|
|
42
|
-
- There is
|
|
40
|
+
- A rename or reorder here can silently break permissions across the ecosystem.
|
|
41
|
+
- The real blast radius comes from deployed contracts that already use these values.
|
|
42
|
+
- There is very little meaningful local runtime test surface in this repo.
|
|
43
43
|
|
|
44
44
|
## Safe Change Guide
|
|
45
45
|
|
|
46
46
|
- Treat any ID change as a cross-repo protocol change.
|
|
47
47
|
- When adding a permission, update downstream repos and docs in the same change set.
|
|
48
|
-
- Do not add aliases that
|
|
48
|
+
- Do not add aliases that hide the one-to-one mapping between bit position and meaning.
|
|
49
49
|
|
|
50
50
|
## Source Map
|
|
51
51
|
|
package/AUDIT_INSTRUCTIONS.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# Audit Instructions
|
|
2
2
|
|
|
3
|
-
This repo is only permission ID constants, but
|
|
3
|
+
This repo is only permission ID constants, but those constants are security-critical because many repos key access control off them.
|
|
4
4
|
|
|
5
5
|
## Audit Objective
|
|
6
6
|
|
|
7
7
|
Find issues that:
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
- assign duplicate IDs to different permissions
|
|
9
10
|
- mismatch IDs that downstream repos assume are canonical
|
|
10
11
|
- create ordering or collision hazards for future permission additions
|
|
11
12
|
|
|
12
13
|
## Scope
|
|
13
14
|
|
|
14
15
|
In scope:
|
|
16
|
+
|
|
15
17
|
- `src/JBPermissionIds.sol`
|
|
16
18
|
|
|
17
19
|
## Start Here
|
|
@@ -22,6 +24,7 @@ In scope:
|
|
|
22
24
|
## Security Model
|
|
23
25
|
|
|
24
26
|
This repo defines canonical numeric IDs that other repos treat as part of their permission model.
|
|
27
|
+
|
|
25
28
|
- the file is small, but stale renumbering or collisions can silently widen or break access control elsewhere
|
|
26
29
|
- correctness depends on cross-repo alignment, not local logic alone
|
|
27
30
|
|
|
@@ -37,8 +40,8 @@ This repo defines canonical numeric IDs that other repos treat as part of their
|
|
|
37
40
|
1. Each permission semantic has one stable numeric ID.
|
|
38
41
|
2. No two distinct permissions share an ID.
|
|
39
42
|
3. IDs match the expectations of all dependent repos in this workspace.
|
|
40
|
-
4. ID 23 (`SIGN_FOR_ERC20`)
|
|
41
|
-
5. IDs 36-40
|
|
43
|
+
4. ID `23` (`SIGN_FOR_ERC20`) matches the value used by `nana-core-v6` for ERC-1271 signature delegation.
|
|
44
|
+
5. IDs `36-40` used by `revnet-core-v6` match the values used in `REVHiddenTokens` and `REVLoans`.
|
|
42
45
|
|
|
43
46
|
## Attack Surfaces
|
|
44
47
|
|
package/README.md
CHANGED
|
@@ -11,13 +11,13 @@ Audit instructions: [AUDIT_INSTRUCTIONS.md](./AUDIT_INSTRUCTIONS.md)
|
|
|
11
11
|
|
|
12
12
|
## Overview
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
This library is intentionally simple: one Solidity file, no storage, no deployment, and no runtime logic. Its value is consistency.
|
|
15
15
|
|
|
16
|
-
`JBPermissions` stores operator permissions as packed bits. This package names
|
|
16
|
+
`JBPermissions` stores operator permissions as packed bits. This package names those bit positions so integrations do not drift across repos.
|
|
17
17
|
|
|
18
18
|
Use this repo as the single source of truth for permission numbers. Do not redefine permission IDs locally in downstream repos.
|
|
19
19
|
|
|
20
|
-
If the question is "who can do this action?" you
|
|
20
|
+
If the question is "who can do this action?" you still need `JBPermissions` in `nana-core-v6`. This repo only tells you what the numbers mean.
|
|
21
21
|
|
|
22
22
|
## Current Permission Ranges
|
|
23
23
|
|
|
@@ -28,19 +28,19 @@ If the question is "who can do this action?" you will still need `JBPermissions`
|
|
|
28
28
|
| `24-27` | 721 hook permissions |
|
|
29
29
|
| `28-30` | buyback hook and registry permissions |
|
|
30
30
|
| `31` | router terminal registry permission |
|
|
31
|
-
| `32-35` | sucker and omnichain
|
|
32
|
-
| `36-40` | revnet-core permissions
|
|
31
|
+
| `32-35` | sucker and omnichain deployment permissions |
|
|
32
|
+
| `36-40` | revnet-core permissions |
|
|
33
33
|
|
|
34
34
|
The exact constants live in `src/JBPermissionIds.sol`.
|
|
35
35
|
|
|
36
|
-
Two IDs deserve
|
|
36
|
+
Two IDs deserve extra attention:
|
|
37
37
|
|
|
38
38
|
- `SET_BUYBACK_HOOK` covers both setting and permanently locking the configured buyback hook
|
|
39
39
|
- `SET_ROUTER_TERMINAL` covers both setting and permanently locking the configured router terminal
|
|
40
40
|
|
|
41
41
|
## Mental Model
|
|
42
42
|
|
|
43
|
-
This repo is a
|
|
43
|
+
This repo is a naming registry, not a behavior repo. Its job is to make every other package use the same permission names for the same bit positions.
|
|
44
44
|
|
|
45
45
|
## Read This File First
|
|
46
46
|
|
|
@@ -48,15 +48,15 @@ This repo is a coordination artifact, not a behavior repo. Its value is that eve
|
|
|
48
48
|
|
|
49
49
|
## Integration Traps
|
|
50
50
|
|
|
51
|
-
- changing an existing numeric constant is
|
|
52
|
-
- adding a new permission ID without coordinating downstream repos creates semantic drift even if
|
|
53
|
-
- wildcard project permissions
|
|
51
|
+
- changing an existing numeric constant is an ecosystem breaking change
|
|
52
|
+
- adding a new permission ID without coordinating downstream repos creates semantic drift even if code still compiles
|
|
53
|
+
- wildcard project permissions are still dangerous even when the numeric IDs are correct
|
|
54
54
|
|
|
55
55
|
## Where Meaning Lives
|
|
56
56
|
|
|
57
|
-
- numeric permission labels
|
|
58
|
-
- runtime permission checks
|
|
59
|
-
- repo-specific uses of those IDs
|
|
57
|
+
- numeric permission labels: `JBPermissionIds.sol`
|
|
58
|
+
- runtime permission checks: `nana-core-v6/src/JBPermissions.sol`
|
|
59
|
+
- repo-specific uses of those IDs: the downstream repo that imports them
|
|
60
60
|
|
|
61
61
|
## For AI Agents
|
|
62
62
|
|
|
@@ -86,6 +86,6 @@ src/
|
|
|
86
86
|
## Risks And Notes
|
|
87
87
|
|
|
88
88
|
- `ROOT` is intentionally powerful and should be granted sparingly
|
|
89
|
-
- wildcard project scope is convenient but easy to misuse
|
|
90
|
-
- some IDs
|
|
91
|
-
- any change to this file has ecosystem-wide consequences because other repos assume the values
|
|
89
|
+
- wildcard project scope is convenient but easy to misuse
|
|
90
|
+
- some IDs bundle configuration and irreversible locking authority, so their blast radius is larger than the short name suggests
|
|
91
|
+
- any change to this file has ecosystem-wide consequences because other repos assume the values stay stable
|
package/RISKS.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
# Permission IDs Risk Register
|
|
2
2
|
|
|
3
|
-
This file
|
|
3
|
+
This file covers the coordination risks in `JBPermissionIds`. The contract surface is tiny, but drift here can corrupt access control across the V6 ecosystem.
|
|
4
4
|
|
|
5
|
-
## How
|
|
5
|
+
## How To Use This File
|
|
6
6
|
|
|
7
|
-
- Read `Priority risks` first
|
|
7
|
+
- Read `Priority risks` first. The main danger is cross-repo disagreement, not a local code bug.
|
|
8
8
|
- Treat every ID change as an ecosystem migration event.
|
|
9
|
-
- Use `Invariants to
|
|
9
|
+
- Use `Invariants to verify` to keep append-only discipline explicit.
|
|
10
10
|
|
|
11
|
-
## Priority
|
|
11
|
+
## Priority Risks
|
|
12
12
|
|
|
13
13
|
| Priority | Risk | Why it matters | Primary controls |
|
|
14
14
|
|----------|------|----------------|------------------|
|
|
15
|
-
| P0 | Semantic drift across repos | If two packages assign different meanings to the same
|
|
16
|
-
| P1 | Reusing or reordering existing IDs | Renumbering breaks
|
|
17
|
-
| P1 | Over-trusting high-impact IDs | Some IDs directly control funds,
|
|
15
|
+
| P0 | Semantic drift across repos | If two packages assign different meanings to the same ID, permission checks can silently authorize the wrong actions. | Single source of truth, append-only changes, and synchronized downstream updates. |
|
|
16
|
+
| P1 | Reusing or reordering existing IDs | Renumbering breaks deployed contracts and off-chain tooling without any on-chain migration safety. | Never repurpose an assigned ID. Append only. |
|
|
17
|
+
| P1 | Over-trusting high-impact IDs | Some IDs directly control funds, routing, locking, or loan state. Misgrants are dangerous. | Explicit operator review and narrow-scoped grants. |
|
|
18
18
|
|
|
19
19
|
## 1. Known Risks
|
|
20
20
|
|
|
21
21
|
- **No runtime enforcement here.** This library only defines constants. Safety depends on every consuming repo checking the intended ID.
|
|
22
|
-
- **`ROOT` is
|
|
23
|
-
- **Wildcard grants
|
|
24
|
-
- **Hook and router lock powers are bundled.** `SET_BUYBACK_HOOK` (
|
|
25
|
-
- **
|
|
22
|
+
- **`ROOT` is broad authority.** `ROOT` (ID `1`) grants all permissions, including permissions added in the future.
|
|
23
|
+
- **Wildcard grants increase blast radius.** Any permission granted with `projectId = 0` applies to all projects owned by that account.
|
|
24
|
+
- **Hook and router lock powers are bundled.** `SET_BUYBACK_HOOK` (`30`) and `SET_ROUTER_TERMINAL` (`31`) both cover setting and locking.
|
|
25
|
+
- **Third-party extensions do not have an on-chain namespace.** IDs `41-255` are only socially coordinated, so external packages can collide without coordination.
|
|
26
26
|
|
|
27
27
|
## 2. High-Impact IDs
|
|
28
28
|
|
|
@@ -32,19 +32,19 @@ This file focuses on the coordination risks in `JBPermissionIds`. The contract s
|
|
|
32
32
|
|
|
33
33
|
## 3. Integration Risks
|
|
34
34
|
|
|
35
|
-
- **Docs can lag deployed assumptions.** Off-chain tooling, UIs, and
|
|
36
|
-
- **Cross-package imports must
|
|
37
|
-
- **Future IDs
|
|
35
|
+
- **Docs can lag deployed assumptions.** Off-chain tooling, UIs, and audits often rely on human-readable permission names.
|
|
36
|
+
- **Cross-package imports must stay canonical.** Downstream repos should import this library instead of redefining numeric literals locally.
|
|
37
|
+
- **Future IDs expand current `ROOT` power.** Any new permission automatically becomes available to existing `ROOT` operators.
|
|
38
38
|
|
|
39
|
-
## 4. Invariants
|
|
39
|
+
## 4. Invariants To Verify
|
|
40
40
|
|
|
41
41
|
- Assigned IDs are append-only and never repurposed.
|
|
42
|
-
- `0`
|
|
43
|
-
- Every documented ID in this repo matches the numeric checks in downstream
|
|
42
|
+
- `0` stays unused as a permission ID.
|
|
43
|
+
- Every documented ID in this repo matches the numeric checks in downstream contracts.
|
|
44
44
|
- New IDs added after `40` do not collide with existing ecosystem assignments.
|
|
45
45
|
|
|
46
46
|
## 5. Accepted Behaviors
|
|
47
47
|
|
|
48
48
|
### 5.1 This repo is coordination infrastructure, not an enforcement layer
|
|
49
49
|
|
|
50
|
-
`JBPermissionIds` intentionally has no access control, storage, or runtime checks. The
|
|
50
|
+
`JBPermissionIds` intentionally has no access control, storage, or runtime checks. The repo matters because every other package can import the same constants and mean the same thing.
|
package/SKILLS.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## Use This File For
|
|
4
4
|
|
|
5
|
-
- Use this file when you need the canonical numeric meaning of a Juicebox V6 permission constant
|
|
6
|
-
- Start here
|
|
5
|
+
- Use this file when you need the canonical numeric meaning of a Juicebox V6 permission constant.
|
|
6
|
+
- Start here when reviewing changes that could affect permission numbering across the ecosystem.
|
|
7
7
|
|
|
8
8
|
## Read This Next
|
|
9
9
|
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
|
|
21
21
|
## Purpose
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
This repo is the single source of truth for Juicebox V6 permission ID constants. It has no runtime behavior. Its value is ecosystem-wide coordination.
|
|
24
24
|
|
|
25
25
|
## Reference Files
|
|
26
26
|
|
|
27
|
-
- Open [`references/runtime.md`](./references/runtime.md) when you need the stability expectations and why changes here
|
|
27
|
+
- Open [`references/runtime.md`](./references/runtime.md) when you need the stability expectations and why changes here affect the whole ecosystem.
|
|
28
28
|
|
|
29
29
|
## Working Rules
|
|
30
30
|
|
package/USER_JOURNEYS.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Repo Purpose
|
|
4
4
|
|
|
5
|
-
This repo is the shared permission vocabulary for the V6 ecosystem.
|
|
6
|
-
It does not store permissions or enforce them at runtime. It defines the constants downstream repos should import so
|
|
7
|
-
permissioned behavior stays legible and consistent.
|
|
5
|
+
This repo is the shared permission vocabulary for the V6 ecosystem. It does not store permissions or enforce them at runtime. It defines the constants that downstream repos should import so permissioned behavior stays clear and consistent.
|
|
8
6
|
|
|
9
7
|
## Primary Actors
|
|
10
8
|
|
|
@@ -15,7 +13,7 @@ permissioned behavior stays legible and consistent.
|
|
|
15
13
|
## Key Surfaces
|
|
16
14
|
|
|
17
15
|
- `JBPermissionIds`: library of canonical permission constants used across V6 repos
|
|
18
|
-
- grouped constants for core, 721, router, buyback, sucker,
|
|
16
|
+
- grouped constants for core, 721, router, buyback, sucker, revnet, and related actions
|
|
19
17
|
- reserved ranges documented in `README.md`, including `ROOT = 1`, ecosystem-managed IDs through `40`, and socially coordinated extension space above that
|
|
20
18
|
|
|
21
19
|
## Journey 1: Map A Product Action To The Right Permission
|
|
@@ -37,15 +35,15 @@ permissioned behavior stays legible and consistent.
|
|
|
37
35
|
**Failure Modes**
|
|
38
36
|
- the repo hardcodes a number locally and drifts from the shared vocabulary
|
|
39
37
|
- a repo picks the wrong existing constant because the action sounds similar but is not actually equivalent
|
|
40
|
-
- a team grants `ROOT` or wildcard
|
|
41
|
-
- docs and tests describe a permission by nickname
|
|
38
|
+
- a team grants `ROOT` or wildcard permissions without appreciating the blast radius
|
|
39
|
+
- docs and tests describe a permission by nickname instead of the imported constant
|
|
42
40
|
|
|
43
41
|
**Postconditions**
|
|
44
42
|
- the downstream action is guarded by the shared permission vocabulary instead of a local numeric convention
|
|
45
43
|
|
|
46
44
|
## Journey 2: Review An Existing Operator Setup
|
|
47
45
|
|
|
48
|
-
**Actor:** auditor, operator, or
|
|
46
|
+
**Actor:** auditor, operator, or integrator.
|
|
49
47
|
|
|
50
48
|
**Intent:** decode opaque permission bits into named actions.
|
|
51
49
|
|
|
@@ -56,13 +54,13 @@ permissioned behavior stays legible and consistent.
|
|
|
56
54
|
**Main Flow**
|
|
57
55
|
1. Start with the permission bits granted on the project.
|
|
58
56
|
2. Map each bit to its named constant here.
|
|
59
|
-
3. Confirm the downstream repo still uses that constant consistently
|
|
60
|
-
4. Check whether any granted IDs are
|
|
57
|
+
3. Confirm the downstream repo still uses that constant consistently in authorization checks and docs.
|
|
58
|
+
4. Check whether any granted IDs are really funds-moving, routing, locking, or loan-management powers rather than low-risk admin toggles.
|
|
61
59
|
|
|
62
60
|
**Failure Modes**
|
|
63
61
|
- downstream code reuses a permission ID for a different meaning
|
|
64
|
-
- reviewers decode the bit correctly but underestimate what the downstream repo lets that permission do
|
|
65
|
-
- reviewers
|
|
62
|
+
- reviewers decode the bit correctly but underestimate what the downstream repo lets that permission do
|
|
63
|
+
- reviewers rely on this repo alone and skip the guarded code
|
|
66
64
|
|
|
67
65
|
**Postconditions**
|
|
68
66
|
- the reviewer has a named permission map and knows which downstream repos still need inspection
|
|
@@ -71,7 +69,7 @@ permissioned behavior stays legible and consistent.
|
|
|
71
69
|
|
|
72
70
|
**Actor:** maintainer extending the permission vocabulary.
|
|
73
71
|
|
|
74
|
-
**Intent:** add
|
|
72
|
+
**Intent:** add a new permission constant that the rest of the ecosystem can reuse.
|
|
75
73
|
|
|
76
74
|
**Preconditions**
|
|
77
75
|
- no existing constant already matches the new action
|
|
@@ -95,10 +93,11 @@ permissioned behavior stays legible and consistent.
|
|
|
95
93
|
|
|
96
94
|
## Trust Boundaries
|
|
97
95
|
|
|
98
|
-
- this repo is trusted only as shared vocabulary
|
|
96
|
+
- this repo is trusted only as shared vocabulary
|
|
97
|
+
- actual storage and enforcement live elsewhere
|
|
99
98
|
- downstream repos can still misuse a constant even when they import the right one
|
|
100
99
|
|
|
101
100
|
## Hand-Offs
|
|
102
101
|
|
|
103
102
|
- Use [nana-core-v6](../nana-core-v6/USER_JOURNEYS.md) for the runtime permission registry that stores and checks these IDs.
|
|
104
|
-
- Use the relevant downstream repo when the question is about what a permissioned action
|
|
103
|
+
- Use the relevant downstream repo when the question is about what a permissioned action does after authorization succeeds.
|