Backup and Recovery Procedure
Implements: Business Continuity Policy Section 4 (Backup and Recovery) Owner: Security Lead Last Updated: 21 May 2026 Next Review: 21 November 2026
Backup Architecture
| Component | Backup Method | Frequency | Retention | Location |
|---|---|---|---|---|
| KV namespaces (all Workers) | provii-backup cron → R2 | Daily | 30 days | Cloudflare R2 |
| Source code | Git (GitHub) | Every push | Indefinite | GitHub (+ local clones) |
| Cloudflare config | wrangler.toml in Git | Every change | Indefinite | Git |
| Secrets/keys | Manual record in secure storage | On rotation | Current + 1 previous | Encrypted storage |
Automated Backup (provii-backup)
The provii-backup is a Cloudflare Worker running on a cron schedule that:
- Lists all keys in each configured KV namespace
- Exports key-value pairs as JSON
- Uploads the export to Cloudflare R2 with a timestamped filename
- Logs success/failure to the worker’s log output
Verifying Backups
# Check recent backup files in R2
wrangler r2 object list provii-backups --remote
# Verify a specific backup is readable
wrangler r2 object get provii-backups/kv-backup-YYYY-MM-DD.json --remote --file /tmp/backup-check.json
Run this verification monthly or after any infrastructure changes.
Recovery Procedures
Scenario 1: Corrupted KV Data
- Identify which namespace and keys are affected
- Download the most recent clean backup from R2:
wrangler r2 object get provii-backups/kv-backup-YYYY-MM-DD.json --remote --file /tmp/restore.json - Parse the JSON and write the affected keys back:
wrangler kv key put KEY VALUE --namespace-id=XXX --remote - Verify the restored data via API calls
Scenario 2: Signing Key Loss
- Signing keys are stored in Cloudflare Workers Secrets
- If secrets are lost, redeploy with
wrangler secret put SIGNING_KEY - Generate new keys if the previous key material is unrecoverable
- If issuer signing keys are rotated, all existing credentials become invalid. Users must re-issue.
- Update JWKS endpoint with new public key
Scenario 3: Full Service Reconstruction
If Cloudflare account access is lost:
- All source code is in GitHub. clone all 15 repositories
- Create a new Cloudflare account
- Run
wrangler deployfor each Worker using checked-inwrangler.toml - Restore secrets (from secure offline storage)
- Restore KV data from R2 backups (if R2 is accessible) or accept data loss
- Update DNS records to point to new Cloudflare account
- Estimated RTO: 4 hours
RPO and RTO
| Metric | Target | Justification |
|---|---|---|
| RPO | 24 hours | Daily KV backups mean up to 24 hours of data loss under normal conditions |
| RTO | 4 hours | Redeployment from Git + secret restoration |
Testing
Backup recovery is tested annually:
- Download a backup from R2
- Restore selected keys to a sandbox KV namespace
- Verify data integrity
- Document results in the management review