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
Description
migratehas norequire_authand is safe today only because itpanic!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 adminrequire_auth(and a guard test) so a future implementer cannot ship a state-mutating migration without authentication.Requirements and context
escrowSoroban contract.Self::get_escrow(env.clone()).admin.require_auth()at the top ofmigrate, keeping the existing version assertions and terminalpanic!.migraterequires admin auth even though it still panics, locking in the guard before logic exists.docs/OPERATOR_RUNBOOK.md.Suggested execution
git checkout -b security/migrate-auth-guardescrow/src/lib.rsescrow/src/tests/init.rsdocs/OPERATOR_RUNBOOK.mdTest and commit
cargo testExample commit message
Guidelines