Repository navigation
Closed
Description
Sub-issue of #688. Mechanism C1 — full standing enforcement at filing (audit I-3). Complexity M-L. Prerequisite for C2.
Problem
openBlacklistAppeal only truly verifies Operator standing (region match via CapacityBond/ADR 030). StandingPath.Publisher and StandingPath.TokenHolder are enum-range-checked only — any address can claim them. This is audit finding I-3: appeal standing is forgeable for two of the three paths.
Decisions (resolved)
- Publisher: add a
namespaceIdfiling argument. A hash→namespace reverse lookup is unusable becausePublisherRegistryallows many namespaces to claim the same hash. Verify bothownerOf(namespaceId) == msg.senderandhasClaimed(namespaceId, hash). - TokenHolder: require
token.balanceOf(msg.sender) >= APPEAL_FILER_TOKEN_THRESHOLD, a governable bounded param (GOVERNANCE_ROLE setter, low default, tightening-only with lower-bound = default). Market-sensitive anti-Sybil gate, so it differs from B/D's fixed constants. - Concrete threshold value: TBD — propose a LOW starting default + bounds in the PR for sign-off (deliberately not fixed here; it is an economic parameter).
Solution / scope
ContentBlacklist.sol
- Add
namespaceIdparam toopenBlacklistAppeal(bytes32 hash, bytes32 region, bytes32 evidenceBundleHash, StandingPath standingPath, uint256 namespaceId). Ignored for non-Publisher paths (or required-zero — decide in PR). - Publisher branch:
if (publisherRegistry.ownerOf(namespaceId) != msg.sender || !publisherRegistry.hasClaimed(namespaceId, hash)) revert UnauthorizedStanding(...). - TokenHolder branch:
if (token.balanceOf(msg.sender) < appealFilerTokenThreshold) revert UnauthorizedStanding(...). - Add
appealFilerTokenThresholdstate +setAppealFilerTokenThreshold(GOVERNANCE_ROLE, bounded, event) mirroringsetRejectionCooldownWindow/appealBond. - New
PublisherRegistrybinding on ContentBlacklist (see wiring below).
PublisherRegistry.sol
- Add a public
hasClaimed(uint256 namespaceId, bytes32 blake3Hash) view returns (bool)getter exposing_hasClaimed. (ownerOfis already public;getClaimingNamespacesalready exists.) - Consider extending
IPublisherRegistryOwnership(already used byOriginAssignment) withhasClaimed, or add a new minimal interface for ContentBlacklist to depend on.
Wiring — touches deploy + all construction sites
- ContentBlacklist currently deploys (BaseProtocolDeploy.s.sol:276) before PublisherRegistry (line 283). Two options for the binding:
- Constructor immutable (recommended for a security-critical standing check — can't be left unset/re-pointed): add an
IPublisherRegistry*constructor arg and reorder the deploy so the registry is built first (it only needsadmin, so reordering is trivial). - Post-deploy setter (
setPublisherRegistry, GOVERNANCE_ROLE) matching the existingsetContentBlacklistcross-wiring pattern.
- Constructor immutable (recommended for a security-critical standing check — can't be left unset/re-pointed): add an
- Update every construction site:
script/BaseProtocolDeploy.s.sol, and teststest/ContentBlacklist.t.sol,test/DeployProtocolScript.t.sol,test/OriginAssignment.t.sol,test/InterfaceFreeze.t.sol,test/CapacityBondRegionE2E.t.sol. InterfaceFreeze.t.solwill need its frozen selector set updated for the newopenBlacklistAppealsignature + setter.
Test plan
- Publisher: owner of a namespace that claims the hash succeeds; non-owner reverts; owner of a namespace that does NOT claim the hash reverts; wrong namespaceId reverts.
- TokenHolder: balance >= threshold succeeds; below reverts; threshold setter (bounds, role-gating, event); tightening-only lower bound.
- Operator path unchanged (regression).
ADR reconciliation
Update ADR-031 standing section: all three paths now enforced; document the namespaceId filing arg and the governable token threshold.
Agent-suitable: yes (but the interface-freeze + deploy-wiring churn is broad — careful diff). C2 depends on this.
Reacted by github-actions
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Activity
feat(contracts): enforce Publisher and TokenHolder standing at appeal…
fix(contracts): guard TokenHolder balanceOf against aderyn reentrancy…
fix(contracts): make appealFilerTokenThreshold truly tightening-only (#…
docs(contracts): reconcile ADR 011 + runbook to bond-is-standing; fix…
feat(contracts): enforce Publisher and TokenHolder standing at appeal…