Skip to content

1.0.2 — spec registry per-user + restart wires through it#191

Merged
click0 merged 1 commit into
mainfrom
claude/release-1.0.2
May 12, 2026
Merged

1.0.2 — spec registry per-user + restart wires through it#191
click0 merged 1 commit into
mainfrom
claude/release-1.0.2

Conversation

@click0
Copy link
Copy Markdown
Owner

@click0 click0 commented May 12, 2026

Summary

Two coupled multi-tenant fixes that the audit flagged as a single latent bug pair:

  1. lib/spec_registry.cppeffectivePath() lazy-resolve mirroring 0.9.27 (NetworkLease) and 1.0.1 (NetworkLease6). When the privops socket is detected, the registry file moves to /var/run/crate/<uid>/spec-registry.txt. Alice and bob no longer share the same {jail-name → .crate path} store.

  2. lib/lifecycle.cpprestartCrate() now queries SpecRegistry::lookup() before falling back to the legacy /var/run/crate/<name>.crate filesystem walk. The fallback is preserved for pre-0.8.21 jails and single-tenant homelabs that drop .crate files manually under /var/run/crate/.

These two fixes are inseparable: per-user registry without per-user lookup is half-useless; per-user lookup without per-user storage is incoherent.

Why this matters

Before this release, two operators on the same host running crate restart web raced to find each other's .crate path through the shared /var/run/crate/spec-registry.txt. Whoever pushed last won — cross-tenant restarts either picked up the wrong spec (silent data corruption) or hit the legacy filesystem walk and grabbed a stale leftover.

Behaviour change

Mode Registry path Restart fallback
Legacy (no crated) /var/run/crate/spec-registry.txt unchanged
Rootless (crated + privops) /var/run/crate/<uid>/spec-registry.txt per-user registry + legacy fs walk

Wire / API compatibility

SpecRegistry::registryPath() now returns the resolved per-user path (matching what NetworkLease::leasePath() has done since 0.9.27). All public function signatures unchanged. Bearer tokens, libnv schemas, control sockets, HTTPS API, Prometheus metrics — all untouched.

1.x backlog (unchanged from 1.0.1)

  • lib/pfctl_ops.cpp pf lock per-user
  • lib/stack.cpp DNS dirs per-user
  • lib/vm_run.cpp VM + cloud-init paths per-user
  • lib/run_net.cpp:446 direct ifconfig -vnetSetIfaceUp privops verb
  • Query-side privops verbs (inspect/doctor/migrate)

Test plan

  • FreeBSD CI lite green
  • Linux CI green
  • Manual: alice crate run -f web.crate; check ls /var/run/crate/$(id -u alice)/spec-registry.txt exists
  • Manual: bob crate restart web finds bob's web, not alice's
  • Manual: legacy single-tenant deployment (no crated) — crate restart still uses /var/run/crate/spec-registry.txt

Generated by Claude Code

Two coupled multi-tenant fixes:

1. lib/spec_registry.cpp gains the same effectivePath() lazy-
   resolve pattern as network_lease.cpp (0.9.27). When the
   privops socket is detected, the registry file moves to
   /var/run/crate/<uid>/spec-registry.txt — alice and bob
   no longer share the same {jail-name -> .crate path} store.

2. lib/lifecycle.cpp restartCrate now queries the spec
   registry before falling back to the legacy /var/run/crate/
   filesystem walk. The fallback is preserved for pre-0.8.21
   jails and single-tenant homelabs.

Wire/format/signatures unchanged. Suite stays at 1303.
@click0 click0 merged commit 2f4887c into main May 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants