@bananapus/permission-ids-v6 0.0.23 → 0.0.25
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/AUDIT_INSTRUCTIONS.md +5 -3
- package/CHANGELOG.md +5 -7
- package/RISKS.md +2 -2
- package/STYLE_GUIDE.md +2 -47
- package/package.json +1 -1
- package/references/runtime.md +2 -2
- package/src/JBPermissionIds.sol +11 -7
- package/slither-ci.config.json +0 -10
package/AUDIT_INSTRUCTIONS.md
CHANGED
|
@@ -4,7 +4,9 @@ This repo is only permission ID constants, but those constants are security-crit
|
|
|
4
4
|
|
|
5
5
|
## Audit Objective
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
There is a billion dollars of well-meaning projects' money in the Juicebox Money Engine, growing exponentially. Your job is to hack it before anyone else. Whoever hacks it first saves/steals the money, and you are obsessed with being this winner, while also being a steward of the protocol and wanting it to keep growing safely.
|
|
8
|
+
|
|
9
|
+
Suggestions of where to look:
|
|
8
10
|
|
|
9
11
|
- assign duplicate IDs to different permissions
|
|
10
12
|
- mismatch IDs that downstream repos assume are canonical
|
|
@@ -33,7 +35,7 @@ This repo defines canonical numeric IDs that other repos treat as part of their
|
|
|
33
35
|
| Dependency | Assumption | What breaks if wrong |
|
|
34
36
|
|------------|------------|----------------------|
|
|
35
37
|
| `nana-core-v6` | ERC-20 signature delegation still uses the documented ID | Signature authority checks mismatch |
|
|
36
|
-
| `revnet-core-v6` | Loan
|
|
38
|
+
| `revnet-core-v6` | Loan permissions still use the documented IDs | Delegated actions widen, fail, or misroute |
|
|
37
39
|
|
|
38
40
|
## Critical Invariants
|
|
39
41
|
|
|
@@ -41,7 +43,7 @@ This repo defines canonical numeric IDs that other repos treat as part of their
|
|
|
41
43
|
2. No two distinct permissions share an ID.
|
|
42
44
|
3. IDs match the expectations of all dependent repos in this workspace.
|
|
43
45
|
4. ID `23` (`SIGN_FOR_ERC20`) matches the value used by `nana-core-v6` for ERC-1271 signature delegation.
|
|
44
|
-
5. IDs
|
|
46
|
+
5. IDs used by `revnet-core-v6` match the values used in `REVLoans`.
|
|
45
47
|
|
|
46
48
|
## Attack Surfaces
|
|
47
49
|
|
package/CHANGELOG.md
CHANGED
|
@@ -19,15 +19,13 @@ This file describes the verified change from `nana-permission-ids-v5` to the cur
|
|
|
19
19
|
|
|
20
20
|
- `SIGN_FOR_ERC20` (23) — sign messages on behalf of a project's ERC-20 token via ERC-1271. Used for Etherscan contract verification and other off-chain signature validation.
|
|
21
21
|
|
|
22
|
-
## v6 additions: revnet-core delegation
|
|
22
|
+
## v6 additions: revnet-core delegation
|
|
23
23
|
|
|
24
|
-
- `
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
27
|
-
- `REPAY_LOAN` (39) — repay a loan on behalf of a loan NFT owner via `REVLoans.repayLoan`. Checked against the loan NFT owner.
|
|
28
|
-
- `REVEAL_TOKENS` (40) — reveal hidden tokens on behalf of a holder via `REVHiddenTokens.revealTokensOf`. Checked against the token holder.
|
|
24
|
+
- `OPEN_LOAN` — open a loan on behalf of a token holder via `REVLoans.borrowFrom`. Checked against the token holder.
|
|
25
|
+
- `REALLOCATE_LOAN` — reallocate loan collateral on behalf of a loan NFT owner via `REVLoans.reallocateCollateralFromLoan`. Checked against the loan NFT owner.
|
|
26
|
+
- `REPAY_LOAN` — repay a loan on behalf of a loan NFT owner via `REVLoans.repayLoan`. Checked against the loan NFT owner.
|
|
29
27
|
|
|
30
|
-
These are consumed by `revnet-core-v6` and checked via
|
|
28
|
+
These are consumed by `revnet-core-v6` and checked via inline `PERMISSIONS.hasPermission` calls (for `REVLoans`).
|
|
31
29
|
|
|
32
30
|
## Verified deltas
|
|
33
31
|
|
package/RISKS.md
CHANGED
|
@@ -28,11 +28,11 @@ This file covers the coordination risks in `JBPermissionIds`. The contract surfa
|
|
|
28
28
|
|
|
29
29
|
- **Fund-moving IDs.** `CASH_OUT_TOKENS` (`4`), `SEND_PAYOUTS` (`5`), `MIGRATE_TERMINAL` (`6`), `SET_TERMINALS` (`15`), `USE_ALLOWANCE` (`18`), and `SET_SPLIT_GROUPS` (`19`) can redirect or release value.
|
|
30
30
|
- **Hook-routing IDs.** `SET_BUYBACK_POOL` (`28`), `SET_BUYBACK_HOOK` (`30`), and `SET_ROUTER_TERMINAL` (`31`) materially control execution routes and can lock those routes permanently.
|
|
31
|
-
- **Revnet loan IDs.** `OPEN_LOAN` (`
|
|
31
|
+
- **Revnet loan IDs.** `OPEN_LOAN` (`36`), `REALLOCATE_LOAN` (`37`), and `REPAY_LOAN` (`38`) are operationally powerful because they move collateral and debt state.
|
|
32
32
|
|
|
33
33
|
## 3. Integration Risks
|
|
34
34
|
|
|
35
|
-
- **Docs can lag deployed assumptions.** Off-chain tooling, UIs, and
|
|
35
|
+
- **Docs can lag deployed assumptions.** Off-chain tooling, UIs, and reviews often rely on human-readable permission names.
|
|
36
36
|
- **Cross-package imports must stay canonical.** Downstream repos should import this library instead of redefining numeric literals locally.
|
|
37
37
|
- **Future IDs expand current `ROOT` power.** Any new permission automatically becomes available to existing `ROOT` operators.
|
|
38
38
|
|
package/STYLE_GUIDE.md
CHANGED
|
@@ -451,54 +451,9 @@ jobs:
|
|
|
451
451
|
run: forge fmt --check
|
|
452
452
|
```
|
|
453
453
|
|
|
454
|
-
**
|
|
455
|
-
```yaml
|
|
456
|
-
name: slither
|
|
457
|
-
on:
|
|
458
|
-
pull_request:
|
|
459
|
-
branches:
|
|
460
|
-
- main
|
|
461
|
-
push:
|
|
462
|
-
branches:
|
|
463
|
-
- main
|
|
464
|
-
jobs:
|
|
465
|
-
analyze:
|
|
466
|
-
runs-on: ubuntu-latest
|
|
467
|
-
steps:
|
|
468
|
-
- uses: actions/checkout@v4
|
|
469
|
-
with:
|
|
470
|
-
submodules: recursive
|
|
471
|
-
- uses: actions/setup-node@v4
|
|
472
|
-
with:
|
|
473
|
-
node-version: 25.9.0
|
|
474
|
-
- name: Install npm dependencies
|
|
475
|
-
run: npm install --omit=dev
|
|
476
|
-
- name: Install Foundry
|
|
477
|
-
uses: foundry-rs/foundry-toolchain@v1
|
|
478
|
-
- name: Run slither
|
|
479
|
-
uses: crytic/slither-action@v0.4.1
|
|
480
|
-
with:
|
|
481
|
-
slither-config: slither-ci.config.json
|
|
482
|
-
fail-on: medium
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
**slither-ci.config.json:**
|
|
486
|
-
```json
|
|
487
|
-
{
|
|
488
|
-
"detectors_to_exclude": "timestamp,uninitialized-local,naming-convention,solc-version,shadowing-local",
|
|
489
|
-
"exclude_informational": true,
|
|
490
|
-
"exclude_low": false,
|
|
491
|
-
"exclude_medium": false,
|
|
492
|
-
"exclude_high": false,
|
|
493
|
-
"disable_color": false,
|
|
494
|
-
"filter_paths": "(mocks/|test/|node_modules/|lib/)",
|
|
495
|
-
"legacy_ast": false
|
|
496
|
-
}
|
|
497
|
-
```
|
|
454
|
+
**Static review workflow** (repos with `src/` contracts only):
|
|
498
455
|
|
|
499
|
-
|
|
500
|
-
- Deployer-only repos (no `src/`, only `script/`) skip slither entirely — the action's internal `forge build` skips `test/` and `script/` by default, leaving nothing to compile.
|
|
501
|
-
- Use inline `// slither-disable-next-line <detector>` to suppress known false positives rather than adding to `detectors_to_exclude` in the config. The comment must be on the line immediately before the flagged expression.
|
|
456
|
+
Keep repo-local static review automation current with the package's runtime surface. At minimum, CI should run formatting, linting, and build checks with `--deny notes`. Repos that only contain deployment scripts can rely on the shared formatting and lint jobs unless they add runtime contracts.
|
|
502
457
|
|
|
503
458
|
### package.json
|
|
504
459
|
|
package/package.json
CHANGED
package/references/runtime.md
CHANGED
|
@@ -13,6 +13,6 @@ Use this file when you need to confirm the canonical numeric labels, not when yo
|
|
|
13
13
|
|
|
14
14
|
## Change Checklist
|
|
15
15
|
|
|
16
|
-
- If you edit a constant,
|
|
16
|
+
- If you edit a constant, review every dependent repo that imports it.
|
|
17
17
|
- If you need to know who can exercise a permission, follow the usage into the enforcing repo rather than stopping here.
|
|
18
|
-
- There are no repo-local tests here, so downstream compile and behavior
|
|
18
|
+
- There are no repo-local tests here, so downstream compile and behavior reviews matter more than this package in isolation.
|
package/src/JBPermissionIds.sol
CHANGED
|
@@ -160,25 +160,29 @@ library JBPermissionIds {
|
|
|
160
160
|
|
|
161
161
|
/// @notice Deploy cross-chain sucker bridges for a project, enabling token bridging between chains
|
|
162
162
|
/// (`JBSuckerRegistry.deploySuckersFor`).
|
|
163
|
+
/// @dev When the configuration's `peer` is `address(0)` or `address(this)` (default symmetric-address peering),
|
|
164
|
+
/// `DEPLOY_SUCKERS` is sufficient. Registering a non-symmetric explicit peer also requires `SET_SUCKER_PEER`.
|
|
163
165
|
uint8 internal constant DEPLOY_SUCKERS = 33;
|
|
164
166
|
|
|
167
|
+
/// @notice Register a non-symmetric explicit peer address when deploying a cross-chain sucker
|
|
168
|
+
/// (`JBSuckerRegistry.deploySuckersFor` with `configuration.peer` != 0 and != `address(this)`).
|
|
169
|
+
/// @dev The explicit-peer field bypasses the same-address peering invariant, so any operator that can set it
|
|
170
|
+
/// can authorize mint-from-arbitrary-roots. This permission is intentionally narrower than `DEPLOY_SUCKERS` so
|
|
171
|
+
/// that ops automation with `DEPLOY_SUCKERS` cannot register attacker-controlled peers.
|
|
172
|
+
uint8 internal constant SET_SUCKER_PEER = 34;
|
|
173
|
+
|
|
165
174
|
/// @notice Enable the emergency hatch on a cross-chain sucker, allowing stuck tokens to be recovered
|
|
166
175
|
/// (`JBSucker.enableEmergencyHatchFor`).
|
|
167
|
-
uint8 internal constant SUCKER_SAFETY =
|
|
176
|
+
uint8 internal constant SUCKER_SAFETY = 35;
|
|
168
177
|
|
|
169
178
|
/// @notice Set the deprecation status of a cross-chain sucker, progressing it through its shutdown lifecycle
|
|
170
179
|
/// (`JBSucker.setDeprecation`).
|
|
171
|
-
uint8 internal constant SET_SUCKER_DEPRECATION =
|
|
180
|
+
uint8 internal constant SET_SUCKER_DEPRECATION = 36;
|
|
172
181
|
|
|
173
182
|
/* ── revnet-core-v6
|
|
174
183
|
─────────────────────────────────────────────────
|
|
175
184
|
*/
|
|
176
185
|
|
|
177
|
-
/// @notice Hide tokens on behalf of a holder, removing them from public visibility
|
|
178
|
-
/// (`REVHiddenTokens.hideTokensFor`).
|
|
179
|
-
/// @dev Hidden tokens are still owned by the holder and can be revealed later.
|
|
180
|
-
uint8 internal constant HIDE_TOKENS = 36;
|
|
181
|
-
|
|
182
186
|
/// @notice Open a loan against project tokens as collateral on behalf of a token holder
|
|
183
187
|
/// (`REVLoans.borrowFrom`).
|
|
184
188
|
uint8 internal constant OPEN_LOAN = 37;
|
package/slither-ci.config.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"detectors_to_exclude": "timestamp,uninitialized-local,naming-convention,solc-version,shadowing-local",
|
|
3
|
-
"exclude_informational": true,
|
|
4
|
-
"exclude_low": false,
|
|
5
|
-
"exclude_medium": false,
|
|
6
|
-
"exclude_high": false,
|
|
7
|
-
"disable_color": false,
|
|
8
|
-
"filter_paths": "(mocks/|test/|node_modules/|lib/)",
|
|
9
|
-
"legacy_ast": false
|
|
10
|
-
}
|