flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Scripts] Add safety safeguards to db-restore.sh

Open blurbeast opened this issue 2 weeks ago â€ĸ 3 comments

Overview & Background

scripts/db-restore.sh performs a destructive database restore with no safety rails: the "empty database" precondition (lines 6, 33) is never verified, the restore is not transactional, and there is no confirmation or dry-run mode. Restoring over a non-empty DB fails mid-dump, leaving partial state. For a payment-streaming service, a partial restore can corrupt financial records.


Technical Specification & Architecture

  1. Verify the target database is actually empty before restoring (or require an explicit --force with confirmation).
  2. Add a dry-run flag and a pre-restore snapshot step.
  3. Wrap the restore so failure leaves a known state (or clearly signals manual recovery).

Target Files

  • scripts/db-restore.sh
  • docs/DISASTER_RECOVERY.md

Acceptance Criteria

  • [ ] Non-empty target DBs are refused without --force.
  • [ ] A dry-run mode reports what would happen.
  • [ ] Failure mid-restore leaves documented, recoverable state.
  • [ ] Disaster recovery docs match the script's actual behavior.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@pheelztech has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

i would love to work on this issue

â„šī¸ Repo Maintainers: To accept this application, review their application or assign @pheelztech to this issue.

pheelztech avatar Nov 20 '26 12:11 pheelztech

Congratulations, @pheelztech! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍đŸ’ģ @pheelztech: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 20 '26 12:11 drips-wave[bot]

This issue has been completed by @pheelztech as part of the Stellar Wave Program's 11th Wave đŸĨŗ

😎 @pheelztech: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍đŸ’ģ Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 20 '26 16:11 drips-wave[bot]