Skip to content

bug(registry): reinstate does not verify the profile was actually revoked before reinstating it #606

Description

@K1NGD4VID

Summary

reinstate (lib.rs:467-489) unconditionally sets verified=true/revoked=false and emits address_reinstated for any registered profile, regardless of whether that profile was ever revoked:

pub fn reinstate(env: Env, address: Address) -> bool {
    ... admin auth ...
    let mut profile: Profile = ...
    profile.set_verified(true);
    profile.set_revoked(false);
    env.storage().persistent().set(&key, &profile);
    ...
    events::address_reinstated(&env, &address);
    ...
    true
}

There is no check equivalent to the one in revoke (which no-ops when !profile.verified()). Calling reinstate on a never-verified (Pending) profile silently performs the same state change as verify_profile(address, true), but emits the semantically wrong address_reinstated event instead of profile_verified, misleading any off-chain indexer that treats address_reinstated as "this address was previously revoked, now un-revoked."

Current Behavior

reinstate can be used as an undocumented alternate path to verify a Pending profile, emitting a misleading event. No test exercises this path — all existing reinstate tests first go through register -> verify -> revoke -> reinstate.

Expected Behavior

Either restrict reinstate to only operate on profiles where profile.revoked() is true (panicking or no-op-ing otherwise, similar to revoke's idempotency guard), or explicitly document that reinstate is a general-purpose "set verified" alias for verify_profile(address, true).

Acceptance Criteria

  • Decide and implement the intended semantics for reinstate on a non-revoked profile
  • Add a test covering reinstate called on a Pending (never-revoked) profile

Tech Stack

Rust, Soroban SDK, contracts/registry/src/lib.rs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions