Safely extract and restore project snapshots created by projectclone — secure, atomic, integrity-checked restore engine.
Project description
🛠️ projectrestore — Secure, Atomic, Verified Project Restore
projectrestore is the companion tool to
projectclone.
It safely restores project backups created via projectclone — with strict safety guarantees, atomic replacement, rollback, checksum verification, PID locking, and tar-bomb protection.
Mission: Restore project environments safely, predictably, and without trust assumptions — even across systems.
✅ Key Features
| Capability | Description |
|---|---|
| 🔐 Atomic restore | Extracts to temp dir → atomic swap → rollback if failed |
| 🛡️ Zero-trust archive validation | Rejects suspicious tar entries (symlink, device, traversal) |
| 📦 Tarbomb protection | Max-files & max-bytes enforcement |
| 🧾 SHA-256 integrity check | Optional digest validation before restore |
| 🚫 Privilege-safe | Strip setuid/setgid, block device nodes |
| 🔄 Dry-run validation | Verify archives without touching disk |
| 🔒 PID locking | Prevent concurrent restores |
| 🧯 Crash-safe | Best-effort rollback & cleanup |
| 📁 Cross-platform | Works on Linux, Termux/Android, VPS, containers |
| ⚡ No dependencies | Pure Python — clean install, small footprint |
🧩 Installation
pip install projectrestore
Or editable dev install:
git clone https://github.com/dhruv13x/projectrestore
cd projectrestore
pip install -e .
---
🚀 Quick Start
Restore the latest backup made by projectclone:
projectrestore
Restore to a specific directory:
projectrestore --backup-dir ~/project_backups --extract-dir ./restored_project
Dry-run (validate only):
projectrestore --dry-run
Verify SHA-256 before restore:
projectrestore --checksum checksums.txt
Limit archive extraction:
projectrestore --max-files 50000 --max-bytes 2G
Debug logs:
projectrestore --debug
---
🔍 How It Works (Safety Model)
1. Validate backup archive structure & metadata
2. Create PID lock → single-instance safety
3. Extract to isolated temporary directory
4. Apply strict checks:
No absolute paths
No ../ traversal
No symlinks / hardlinks
No device nodes / FIFO
No setuid/setgid preserved
5. Optionally verify SHA-256
6. Atomic swap:
Move old dir → backup
Move new dir → destination
7. Cleanup old state (or rollback on error)
---
⚠️ Design Philosophy
> Separation of responsibilities
projectclone = capture
projectrestore = apply safely
This tool intentionally does not share codebase or execution surface with projectclone to ensure:
Security isolation
Clear trust boundary
Maintenance clarity
Lower blast radius
Independent versioning & release trains
---
🧪 Exit Codes
Code Meaning
0 Success
1 Error
2 Interrupted / signal
3 Another instance running (PID lock)
---
📂 Compatibility
System Supported
Linux ✅
WSL ✅
Termux / Android ✅
Docker ✅
macOS ⚠️ tar behavior varies — full support in v1.0
---
🤝 Ecosystem
Tool Purpose
projectclone Create stateful reproducible project snapshots
projectrestore Securely apply snapshots with verification & rollback
These tools form a reproducible project state suite.
---
📦 Future Roadmap
Interactive restore preview (file diff, size, changeset)
Restore-to-new-path mode
Encrypted backup support
Signature verification (public key)
macOS hardened extractor extension
---
✅ Requirements
Python 3.8+
Tar archives built by projectclone
---
📜 License
MIT — free, open, audit-friendly, production-safe.
---
👨💻 Author
Dhruv — dhruv13x@gmail.com
Designed for reproducibility, disaster-recovery, and zero-trust restore paths.
---
> ⭐️ If this project saves your work or your sanity, consider starring the repo!
Issues & PRs welcome — security mindset first.
---
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file projectrestore-0.1.0.tar.gz.
File metadata
- Download URL: projectrestore-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e42676e62a9921931fd6a1180e993cd2ab63adf5f6a8d3bc431c561992a0a10
|
|
| MD5 |
e73790edefdfefcb71e3cb68d021b35a
|
|
| BLAKE2b-256 |
e5c8a1f8872c9215c2a229f67235cc7f72fc4b7eab9f82048e66d53ea8a46dd1
|
Provenance
The following attestation bundles were made for projectrestore-0.1.0.tar.gz:
Publisher:
publish.yml on dhruv13x/projectrestore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
projectrestore-0.1.0.tar.gz -
Subject digest:
9e42676e62a9921931fd6a1180e993cd2ab63adf5f6a8d3bc431c561992a0a10 - Sigstore transparency entry: 669662053
- Sigstore integration time:
-
Permalink:
dhruv13x/projectrestore@94efc09a968211d3fb668823a6ac00bede9d9bc7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94efc09a968211d3fb668823a6ac00bede9d9bc7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file projectrestore-0.1.0-py3-none-any.whl.
File metadata
- Download URL: projectrestore-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6447be682b346a7b9274fd3b4f7130dc4d41bcae893244ab6ee062ab053e4999
|
|
| MD5 |
385056388f4f36f2a040dc021bc0fe01
|
|
| BLAKE2b-256 |
bea23f6ea25d61e13d503b571c398150dae7b0d10fa5dbe245d747ff758084da
|
Provenance
The following attestation bundles were made for projectrestore-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on dhruv13x/projectrestore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
projectrestore-0.1.0-py3-none-any.whl -
Subject digest:
6447be682b346a7b9274fd3b4f7130dc4d41bcae893244ab6ee062ab053e4999 - Sigstore transparency entry: 669662059
- Sigstore integration time:
-
Permalink:
dhruv13x/projectrestore@94efc09a968211d3fb668823a6ac00bede9d9bc7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94efc09a968211d3fb668823a6ac00bede9d9bc7 -
Trigger Event:
push
-
Statement type: