Skip to content

Add an auth guard to migrate before any future migration logic is implemented #266

@mikewheeleer

Description

@mikewheeleer

Description

migrate has no require_auth and is safe today only because it panic!s on every path. The rustdoc warns that adding migration logic without an auth guard would make it callable by any account. Pre-emptively add an admin require_auth (and a guard test) so a future implementer cannot ship a state-mutating migration without authentication.

Requirements and context

  • Scoped to the LiquiFact escrow Soroban contract.
  • Add Self::get_escrow(env.clone()).admin.require_auth() at the top of migrate, keeping the existing version assertions and terminal panic!.
  • Add a test asserting migrate requires admin auth even though it still panics, locking in the guard before logic exists.
  • Invariant: any future migration path is admin-gated by construction; version checks remain.
  • Reference ADR-007 and docs/OPERATOR_RUNBOOK.md.
  • Must be secure, tested, and documented.

Suggested execution

  • Fork the repo and create a branch:
    • git checkout -b security/migrate-auth-guard
  • Implement changes:
    • escrow/src/lib.rs
    • Tests: escrow/src/tests/init.rs
    • Docs: docs/OPERATOR_RUNBOOK.md
    • Include rustdoc/NatSpec-style doc comments on public functions
    • Validate security assumptions (auth, overflow, storage TTL, double-spend)

Test and commit

  • Run tests: cargo test
  • Cover edge cases (zero amounts, overflow, unauthorized callers, double-spend, state-machine misuse)
  • Include test output and security notes in the PR

Example commit message

fix(escrow): require admin auth in migrate entrypoint

Guidelines

  • Minimum 95% test coverage on new/changed code
  • Clear documentation
  • Timeframe: 96 hours from assignment

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions