Repository navigation
v2.4.0
v2.4.0 (2026-11-24) — Production Security, Durability & Correctness Hardening
Security & Trust Boundaries
- P2P Ed25519 challenge-response authentication: Restored real challenge-response handshake using fresh 32-byte
OsRngnonces with 30s TTL, domain separation bound to both client and serverPeerIds,authorized_keysenforcement, and automatic session cleanup onConnectionClosed. - Strict ID & path validation: Added
validate_object_id(64 lowercase hex chars) at everyStorebackend,PartialTransfer, and P2P handler; addedsafe_repo_joinpreventing absolute paths,..,.shard/.git, and symlink escapes acrosscheckout,export,pull, and/api/v1/add; addedvalidate_branch_nameblocking../traversal while supporting hierarchical branch names likefeature/foo. - HuggingFace push key protection:
shard hf pushnow stages only safe public repository artifacts (includingobjects.dbfor Sled/SQLite repos) into an isolated temp directory with a mandatory pre-flight assertion refusingsecret.key,repo.key,keys/archive/,wal.log,partial/, and.shard.lock; passes tokens viaHF_TOKENenv var instead of CLI flags. - Hardened HTTP API (
shard serve): RemovedCorsLayer::permissive(); added constant-time bearer token auth (SHARD_API_TOKENor ephemeralOsRngtoken); confined/api/v1/addinside the repository; fixed/api/v1/committo return realcommit_idand/api/v1/statusto load.shard/index; offloaded blocking operations viatokio::task::spawn_blocking. - Signature trust & key hardening:
verifyandpull/syncrequire valid signatures (with--allow-unsignedopt-in), verifykey_id == blake3(public_key), and anchor trust to local keychain +authorized_keys; all secret keys written atomically with0o600permissions;repo.keywrapped with Argon2id + AES-256-GCM when passphrase is set;key rotatesupports encrypted keys; secret buffers zeroized withzeroize; AEAD AAD binds chunk hashes; removed panickingRepoCipher::key_bytes();SHARD_PASSPHRASEenv var supported across all commands. - Dependency upgrades: Upgraded
libp2pto0.57(and transitivehickory,rustls-webpki,ring,bytes,rand,time), eliminating active security/soundness advisories and pruning.cargo/audit.toml.
Core Storage, Durability, Memory & Correctness
- Atomic writes & crash-safe WAL: Added
atomic_write(write -> sync_all -> rename -> dir fsync) acrossFlatStore,Index, refs,HEAD,tags.json, andconfig.json. WAL now backs upHEAD, active branch ref (refs/heads/<branch>), andindexwith per-record CRC32 checksums,sync_all(), and graceful recovery from truncated trailing records. - Real cross-process locking: Replaced polling
OpQueuewith OS-level advisory locking (fs2on<repo_root>/.shard.lock) combined with in-processRwLockacross all operations. - Eliminated OOM paths: Replaced 1 GiB
zstd::bulk::decompressand unboundedzlibdecompression with bounded streaming decompression (64 MiB default cap); streamedcheckout,export, andpullchunk-by-chunk viaBufWriter; streamedpushobject-by-object fromStore; added key-onlyStorageBackend::iter_keys()for Sled/SQLite GC. - Self-describing
SHRDv1 chunk envelopes: Fixedpushrejection andpullresume corruption forzstd/zlib/--privaterepos and prevented silent corruption when compression/privacy flags change. - 3-way LCA merge: Rewrote
merge()with DAG Lowest Common Ancestor computation, fullFileManifestpreservation (compression, size, content_type, merkle_root), and explicit conflict detection. - Fail-closed GC: Deduplicated
prune->gc::gc(); added recursive branch scanning for slashed branches,KeyRotationandpartial/reachability marking, iterative DAG traversal, RAII panic-safe guard, and fail-closed abort on any mark-phase error. - Backend & chunker fixes: Removed buggy
objects.idxfromFlatStore; enabled SQLite WAL +synchronous=NORMAL+busy_timeout=5000on every pooled connection; reused openStoreinimport/share/syncto fix Sled double-open crashes; replaced broken rolling hash with true shift-invariant FastCDC (64-bit Gear hash + dual normalized masks). - Commit snapshot semantics &
import(): Commits now carry forward unmodified manifests from parent commits;import()preserves source directory hierarchy.
Modularity, Bindings, CLI & Repo Hygiene
- Decomposed 3,566-LOC
core/src/lib.rsinto focused submodules (repo,auth,backup,p2p_sync,hf,chunk_codec,fs_util,error). - Fixed
SHARD_*env var key mapping (preserving underscores) and wiredvalidate_config()(withzlibinstead ofgzip). - Rewrote
python/shard-pyto invokeshard-coredirectly with GIL release (py.allow_threads). - Routed CLI diagnostics strictly to
stderrwhile keeping clean data/JSON onstdout; fixedkey verify --jsonnon-zero exit code on failure. - Un-ignored and stabilized
test_three_node_pullandtest_sync_auto_pull; added comprehensive security, P2P auth, merge, GC, and HTTP API tests. - Hardened
Dockerfile(non-root user),docker-compose.yml, andscripts/install.sh(mktemp -d+trap+ macOSshasum); cleaned root clutter.
What's Changed
- release: v2.3.0 — auth enforcement, share robustness, status --porcelain by @sandy-sachin7 in #1
New Contributors
- @sandy-sachin7 made their first contribution in #1
Full Changelog: v2.3.0...v2.4.0