mirror of
https://github.com/marcoallegretti/karapace.git
synced 2026-03-26 21:43:09 +00:00
- Pin cargo-cyclonedx@0.5.5 in scripts/generate-sbom.sh (matches CI) - Remove hardcoded /home/lateuf paths from .cargo/config.toml - Remove stale 'quick' command reference from CHANGELOG 0.1.0
9.3 KiB
9.3 KiB
Changelog
All notable changes to Karapace will be documented in this file.
The format is based on Keep a Changelog.
[Unreleased] — 2.0 Hardening
Breaking Changes
- Store format v2 —
STORE_FORMAT_VERSIONbumped to 2. Newstaging/andwal/directories. Version 1 stores require rebuild. - CLI pruned to 23 commands — removed legacy commands:
init,preset,list-presets,export-app,unexport-app,quick,validate,verify-lock,export,list-images,remove-image,remote-list,tui. - Content-addressed layers —
LayerStore::put()now returns the blake3 content hash used as filename. Callers must use the returned hash for references. Engine::gc()requires&StoreLock— compile-time enforcement that callers hold the store lock before garbage collection.- MetadataStore checksum —
EnvMetadatanow includes an optionalchecksumfield (blake3). Written on everyput(), verified on everyget(). Backward-compatible viaserde(default).
Added — 2.0 Hardening (M1–M8)
- M1: WAL Crash Safety — Fixed race windows in
build()andrestore()(rollback registered before side-effects). Added WAL protection todestroy(),commit()(layer manifest rollback), andgc()(WAL marker). 8 new WAL crash-safety tests. - M2: Integrity Hardening —
LayerStore::get()verifies blake3 hash on every read.MetadataStoreembeds and verifies blake3 checksum.verify_store_integrity()expanded to check objects, layers, and metadata. 4 new integrity tests. - M3: GC Safety —
Engine::gc()now requires&StoreLockparameter (type-enforced). Snapshot layers whose parent is a live base layer are preserved during GC. - M4: Remote Protocol —
X-Karapace-Protocol: 1header sent on all HTTP backend requests (PUT, GET, HEAD).PROTOCOL_VERSIONconstant exported fromkarapace-remote. 4 new header/auth verification tests via header-capturing mock server. - M5: unwrap() Audit — 0
unwrap()in productionsrc/code. 4Mutex::lock().unwrap()calls inMockBackendreplaced with properRuntimeErrorpropagation. - M6: Failure Mode Testing — 11 new tests: WAL write failure on read-only dir, build failure when WAL dir is read-only (disk-full simulation), stop() SIGTERM with real process (ESRCH path), stop() with non-existent PID, permission denied on object read, read-only metadata dir, concurrent GC lock contention, layer corruption detection, metadata corruption detection, destroy nonexistent env, invalid manifest.
- M7: Coverage Expansion —
verify_store_integrity()now checks objects + layers + metadata (was objects-only).IntegrityReportexpanded withlayers_checked/passedandmetadata_checked/passedfields. New tests: freeze/archive state transitions, rename environment, verify-store after fresh build, rebuild preserves new and cleans old, HTTP list_blobs, large (1MB) blob roundtrip. - Total: 417 tests (24 ignored, require privileged operations). Clippy
-D warningsclean.cargo fmtclean. Release build OK.
Added — 1.0 Preparation
- Real tar layers —
pack_layer()/unpack_layer()in karapace-store: deterministic tar creation (sorted entries, zero timestamps, owner 0:0) for regular files, directories, and symlinks. Content-addressed via blake3. - Snapshot system —
Engine::commit()captures overlay upper as a tar snapshot;Engine::restore()atomically unpacks a snapshot via staging directory swap;Engine::list_snapshots()lists snapshots for an environment. - CLI:
snapshotsandrestore— new commands for snapshot management. - Write-ahead log (WAL) —
store/wal/{op_id}.jsontracks in-flight operations with rollback steps.Engine::new()auto-recovers on startup. Integrated intobuild(),commit(),restore(). - Newtype wrappers threaded through all structs —
EnvId,ShortId,ObjectHash,LayerHashnow used inEnvMetadataacross all 8 crates. Transparent serde for backward compatibility. - Engine::push/pull — transfer logic moved from
karapace-remotetoEnginemethods.karapace-remoteis now pure I/O. - CoreError::Remote — new error variant for remote operation failures.
- CLI stability contract —
docs/cli-stability.mddefines stable command signatures for 1.x. - Remote protocol spec —
docs/protocol-v1.md(v1-draft) documents blob store routes, push/pull protocol, registry format. - Layer limitations doc —
docs/layer-limitations-v1.mddocuments Phase 1 limits (no xattrs, device nodes, hardlinks).
Changed
- CLI monolith decomposition — split
main.rsinto ~30 command modules undercommands/, thin dispatcher inmain.rs. - Error type cleanup — added
StoreError::InvalidNameandStoreError::NameConflictvariants; removedIo(Error::other)hacks. - D-Bus serialization cleanup — replaced hand-rolled JSON with typed
serderesponse structs. - Engine store caching —
MetadataStore,ObjectStore, andLayerStorecached as fields onEngine. - Remote integrity verification —
pull_envverifies blake3 hash of each downloaded object and layer. - Store spec updated —
docs/store-spec.mdreflects v2 format with WAL, staging, tar_hash, name field. - README updated — reflects 23 commands, snapshot workflow, remote push/pull examples.
[0.1.0] — 2026-02-20
Added
- Deterministic environment engine — content-addressed, hash-based environment identity from resolved lock files.
- Manifest v1 — declarative TOML manifest with strict schema validation, deterministic normalization, and canonical serialization.
- Lock file v2 — resolved packages with pinned versions, base image content digest (not tag), dual verification (integrity + manifest intent).
- Content-addressable store — blake3 hashing, atomic writes (NamedTempFile + persist), integrity verification on read, reference counting, garbage collection with signal cancellation.
- CLI commands —
build,rebuild,enter,exec,destroy,stop,freeze,archive,list,inspect,diff,snapshots,commit,restore,gc,verify-store,push,pull,rename,completions,man-pages,doctor,migrate. - Example manifests —
examples/minimal.toml,examples/dev.toml,examples/gui-dev.toml,examples/ubuntu-dev.toml,examples/rust-dev.tomlfor common use cases. - Multi-distro image support — openSUSE Tumbleweed/Leap, Ubuntu (20.04–24.10), Debian (Bookworm/Trixie/Sid), Fedora (40–42), Arch Linux, custom URLs.
- Runtime backends — user namespace (
unshare+fuse-overlayfs+chroot), OCI (crun/runc/youki), mock (for testing). - Host integration — Wayland, X11, PipeWire, PulseAudio, D-Bus session bus, GPU (
/dev/dri), audio (/dev/snd), SSH agent, fonts, themes, cursor themes, GTK/icon themes. - Desktop app export — export GUI applications from environments as
.desktopfiles on the host. - Overlay drift control — diff, freeze, commit, export writable layer changes.
- D-Bus desktop integration — socket-activated
org.karapace.Manager1service (feature-gated, opt-in). - Security model — mount whitelist, device policy, environment variable allow/deny lists, resource limits, no privilege escalation.
- Structured logging —
log+env_loggerwithKARAPACE_LOGenv var and--verbose/-vCLI flag. - Concurrency safety —
StoreLockfile locking on all mutating CLI and D-Bus operations, GC protects active/archived environments. - Automated tests — unit tests, integration tests, crash injection tests, concurrent build safety, GC safety, reproducibility.
- Shell completions —
karapace completions bash|zsh|fish|elvish|powershellfor tab completion. - Man page generation —
karapace man-pages <dir>generates man pages for all commands. - Prerequisite detection — early check for
unshare,fuse-overlayfs,curlwith distro-aware install instructions. - CI pipeline — GitHub Actions workflow: format, clippy, test, release build with artifact upload.
Security
- Shell injection prevention via POSIX single-quote escaping (
shell_quote) on all sandbox script interpolation. - Environment variable key validation (
[a-zA-Z0-9_]only). - Image download integrity — blake3 digest stored on download,
verify_image()detects corruption. - Destroy guard — cannot destroy a running environment (must stop first).
- Atomic rebuild — new environment built before old one is destroyed (no data loss on failure).
- PID cast safety —
i32::try_from()instead ofas i32forlibc::kill(). - Zero
unwrap()in production code — all error paths handled gracefully. - Input validation in
quickcommand — image and package names validated against TOML injection. Cargo.lockcommitted for reproducible builds.
Documentation
- Manifest v0.1 specification (
docs/manifest-spec.md) - Lock file v2 specification (
docs/lock-spec.md) - Store format specification (
docs/store-spec.md) - Hash contract (
docs/hash-contract.md) - Security model with threat model and attack surface (
docs/security-model.md) - Public API reference (
docs/api-reference.md) - Versioning policy (
docs/versioning-policy.md) CONTRIBUTING.md— development workflow, architecture principles, code standards.LICENSE— European Union Public Licence v1.2 (EUPL-1.2).