1.0.2 — spec registry per-user + restart wires through it#191
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two coupled multi-tenant fixes that the audit flagged as a single latent bug pair:
lib/spec_registry.cpp—effectivePath()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.lib/lifecycle.cpp—restartCrate()now queriesSpecRegistry::lookup()before falling back to the legacy/var/run/crate/<name>.cratefilesystem walk. The fallback is preserved for pre-0.8.21 jails and single-tenant homelabs that drop.cratefiles 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 webraced to find each other's.cratepath 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
crated)/var/run/crate/spec-registry.txt/var/run/crate/<uid>/spec-registry.txtWire / API compatibility
SpecRegistry::registryPath()now returns the resolved per-user path (matching whatNetworkLease::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.cpppf lock per-userlib/stack.cppDNS dirs per-userlib/vm_run.cppVM + cloud-init paths per-userlib/run_net.cpp:446directifconfig -vnet→SetIfaceUpprivops verbTest plan
crate run -f web.crate; checkls /var/run/crate/$(id -u alice)/spec-registry.txtexistscrate restart webfinds bob's web, not alice'scrated) —crate restartstill uses/var/run/crate/spec-registry.txtGenerated by Claude Code