Skip to content

feat(security): add admin-managed asset allowlist and document threat model (Fixes #790) - #895

Open
yunyue-taste-it wants to merge 1 commit into
MergeFi:mainfrom
yunyue-taste-it:fix/issue-790-asset-allowlist
Open

yunyue-taste-it wants to merge 1 commit into
MergeFi:mainfrom
yunyue-taste-it:fix/issue-790-asset-allowlist

Conversation

@yunyue-taste-it

Copy link
Copy Markdown

Summary

Resolves #790 by implementing an admin-managed asset allowlist across contracts/escrow, contracts/maintenance-pool, and contracts/milestones, and documenting the defense-in-depth threat model for asset validation in README.md.

Related Issues

Fixes #790

Key Changes

  1. Admin-Managed Allowlist:
    • Added TokenAllowlistConfigured and TokenAllowed(Address) storage keys.
    • Added set_token_allowed(env, token, allowed) entrypoint requiring admin authentication, which publishes TokenAllowlistUpdated.
    • Added is_token_allowed(env, token) -> bool view function. Operates in permissive/open mode when unconfigured for backward compatibility.
    • Enforced token validation during escrow::fund, maintenance-pool::deposit, and milestones::create_milestone, returning Error::TokenNotAllowed if the asset is not authorized.
  2. Dedicated Error Code:
    • Added TokenNotAllowed variant to Error in contracts/escrow, contracts/maintenance-pool, and contracts/milestones.
  3. Documentation:
    • Added ### Asset allowlists and worthless-token threat model to README.md under "Why three contracts instead of one", detailing the dual-layer off-chain backend oracle gating (mergefi-backend USDC_TOKEN_CONTRACT_ID / XLM_TOKEN_CONTRACT_ID and mergefi-frontend asset coercion) and on-chain allowlist protection.
  4. Unit Tests:
    • Added tests covering open permissive mode, admin authentication, allowlist updates/revocations, and rejection with Error::TokenNotAllowed when allowlist is active across the contracts.

Test Plan

  • cargo test -p mergefi-escrow: 102/102 passed
  • cargo test -p mergefi-maintenance-pool: 64/64 passed
  • cargo clippy --workspace --all-targets --locked: 0 errors
  • cargo fmt --all --check: clean

Payout EVM Address: 0x53A47C81DdaCEDFba1048842D5D5f011a80e386D

@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

@yunyue-taste-it is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

1 participant