Skip to content

feat(contracts): enforce Publisher and TokenHolder standing at appeal filing (audit I-3) (#688) #1017

Closed

Description

@alpergundogdu

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 namespaceId filing argument. A hash→namespace reverse lookup is unusable because PublisherRegistry allows many namespaces to claim the same hash. Verify both ownerOf(namespaceId) == msg.sender and hasClaimed(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 namespaceId param to openBlacklistAppeal(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 appealFilerTokenThreshold state + setAppealFilerTokenThreshold (GOVERNANCE_ROLE, bounded, event) mirroring setRejectionCooldownWindow/appealBond.
  • New PublisherRegistry binding on ContentBlacklist (see wiring below).

PublisherRegistry.sol

  • Add a public hasClaimed(uint256 namespaceId, bytes32 blake3Hash) view returns (bool) getter exposing _hasClaimed. (ownerOf is already public; getClaimingNamespaces already exists.)
  • Consider extending IPublisherRegistryOwnership (already used by OriginAssignment) with hasClaimed, 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:
    1. 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 needs admin, so reordering is trivial).
    2. Post-deploy setter (setPublisherRegistry, GOVERNANCE_ROLE) matching the existing setContentBlacklist cross-wiring pattern.
  • Update every construction site: script/BaseProtocolDeploy.s.sol, and tests test/ContentBlacklist.t.sol, test/DeployProtocolScript.t.sol, test/OriginAssignment.t.sol, test/InterfaceFreeze.t.sol, test/CapacityBondRegionE2E.t.sol.
  • InterfaceFreeze.t.sol will need its frozen selector set updated for the new openBlacklistAppeal signature + 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.

Activity

  1. added 3 commits that reference this issue on Jun 30, 2026
    38a6f41
    5aa14b4
    c55fa1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions