From a5655b9aa80244285b04584238f5161c9bc148aa Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 19:28:50 +0000 Subject: [PATCH 1/2] Reconcilable host-to-Drive mappings, for hosted vanity subdomains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Tree::DriveMapping` already routes a hostname to a Drive, but the only way in was `/bind-drive`, which needs an agent with write access on the Drive. A control plane that deliberately does not hold user signing keys cannot use it, so hosted vanity subdomains (`acme.atomicserver.eu`) had no way to be installed. This adds the pieces `atomic-saas` needs, and closes a leak found on the way. - `Db::sync_drive_mappings` reconciles the mappings a control plane owns against a desired set: adds, repoints and removes, idempotently, so a managed node can call it on every policy poll and a released name stops resolving with nobody touching the box. Removal is scoped to the hosts a previous run installed, tracked in `Tree::PluginMeta` — treating the input as authoritative for the whole table would have deleted the `localhost` / `127.0.0.1` entries every store gets at setup, and any binding made by hand, on the first run. - `Db::list_drive_mappings` and `Db::managed_alias_hosts` expose the table, which previously had no read path beyond a single-host lookup. - Mapping keys are normalized. Hostnames are case-insensitive, but the `Host` header arrives in whatever case the client sent, so `ACME.example.com` missed the mapping `/bind-drive` had stored lowercased and fell through to the store root. - A host bound to a Drive now serves that Drive or 404s. `map_request_subject` fell through to the store root when the bound Drive was missing — not synced yet, or migrated to another node — which on a multi-tenant node answers one tenant's hostname with another namespace's content. - `--served-domain-suffix` makes a server answer for `*.` without the rest of `--base-domain`. Nodes need the request origin to follow the hostname the visitor used, or served subjects localize to the node's own name and a vanity host hands out links to a different hostname. `--base-domain` does that too, but it also becomes the *store's* base domain, changing how subjects are normalized and migrated — not something to switch on for a box that already holds customer data. This is the conflation `config.rs`'s own note on `ATOMIC_BASE_DOMAIN` flags. Paired with ontola/atomic-saas on the same branch name, which adds the alias registry, the plan gating and the node-side reconcile. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01WJmx2z4BWAr4gNvTvg48D4 --- TESTING_COVERAGE.md | 32 ++++ lib/src/db.rs | 385 +++++++++++++++++++++++++++++++++++++++++- server/src/config.rs | 26 +++ server/src/context.rs | 42 ++++- 4 files changed, 476 insertions(+), 9 deletions(-) diff --git a/TESTING_COVERAGE.md b/TESTING_COVERAGE.md index 12feb5b57c..421b30e14b 100644 --- a/TESTING_COVERAGE.md +++ b/TESTING_COVERAGE.md @@ -567,6 +567,38 @@ Cloud Vault display metadata: `vaultAutoBackup.test.ts` verifies name/emoji enro authenticated read from the real managed node. Plan purchase alone creates no enrollment. Real Stripe-hosted test-card checkout remains a deployment check. +## Host-to-Drive routing and hosted vanity subdomains + +`Tree::DriveMapping` is what makes one server answer for many hostnames. It +backs `/bind-drive` for self-hosters and hosted vanity subdomains for +`atomic-saas`, whose control plane reconciles it through +`Db::sync_drive_mappings`. + +- `db::drive_mapping_tests`: the reconcile a managed node runs on every policy + poll — add, repoint, remove; idempotent on an unchanged list; scoped so a + binding it did not install (including the `localhost` / `127.0.0.1` entries + from `setup_test_env`, and anything bound by hand through `/bind-drive`) is + never removed; keys normalized so a mixed-case `Host` still resolves; empty + hosts and empty drives skipped. +- `db::resolver_tests::a_bound_host_whose_drive_is_missing_does_not_serve_the_store_root`: + the multi-tenant leak. A host bound to a Drive this node does not hold (not + synced yet, or migrated away) must 404 rather than fall through to the store + root, which would answer one tenant's hostname with another namespace's + content. This is the property that lets the control plane authorize a + certificate on reservation instead of only after a node confirms. +- `context::tests::a_served_domain_suffix_accepts_tenants_without_a_base_domain`: + `--served-domain-suffix` makes the request origin follow the hostname the + visitor used, without turning on `--base-domain` and with it the store's + subject normalization. +- Paired `atomic-saas` coverage (registry, plan gating, `/caddy-ask`, the + heartbeat report) is listed in that repo's + `planning/TEST_COVERAGE_AND_CI.md`. + +**Not covered:** no test drives a real HTTP request against a vanity host +end to end — the reconcile and the resolver are tested separately, and joining +them needs the representative two-service environment. The multi-node gateway +routing that a second node would require does not exist yet. + ## Error reporting and feedback - `browser/data-browser/src/helpers/feedback.test.ts`: unavailable reporting, failed delivery, blank input and successful submission. diff --git a/lib/src/db.rs b/lib/src/db.rs index 59dbd722c0..38e8c0b334 100644 --- a/lib/src/db.rs +++ b/lib/src/db.rs @@ -217,6 +217,48 @@ pub struct ReplicationTarget { pub authorized_by: String, } +/// What [`Db::sync_drive_mappings`] changed in the host → Drive mapping table. +#[derive(Debug, Default, Clone, PartialEq, Eq)] +pub struct DriveMappingSync { + /// Hosts that had no mapping before. + pub added: Vec, + /// Hosts that pointed at a different Drive before. + pub updated: Vec, + /// Hosts an earlier reconcile installed and that the desired set no longer + /// names. + pub removed: Vec, +} + +impl DriveMappingSync { + /// Whether anything actually changed, so a caller polling on a timer can + /// log real edits instead of one line per poll. + pub fn is_empty(&self) -> bool { + self.added.is_empty() && self.updated.is_empty() && self.removed.is_empty() + } +} + +/// `Tree::PluginMeta` key holding the hosts whose Drive mapping was installed +/// by [`Db::sync_drive_mappings`]. +/// +/// Removal is scoped to this set rather than to everything in +/// `Tree::DriveMapping`, because that table also holds bindings made by hand +/// through `/bind-drive` plus the `localhost` / `127.0.0.1` entries every store +/// gets at setup. A reconcile that treated its input as authoritative for the +/// whole table would delete those the first time it ran. +const MANAGED_ALIAS_HOSTS_KEY: &[u8] = b"managed_drive_alias_hosts"; + +/// Normalizes a host into a `Tree::DriveMapping` key. +/// +/// Hostnames are case-insensitive (RFC 4343), but the `Host` header comes back +/// in whatever case the client sent, and `/bind-drive` derives its key from a +/// parsed URL (which the `url` crate has already lowercased). Storing and +/// looking up lowercased is what makes `ACME.example.com` resolve the Drive +/// that `acme.example.com` was bound to, instead of silently missing the +/// mapping and falling through to the store root. +fn drive_mapping_key(host: &str) -> String { + host.trim().trim_end_matches('.').to_ascii_lowercase() +} + const REPLICATION_PREFIX: &str = "replication:"; /// `Tree::PluginMeta` key holding the fingerprint of the built-in defaults @@ -1426,8 +1468,16 @@ impl Db { return Ok(subject.clone()); }; + // A host bound to a Drive serves that Drive or nothing. Falling through + // to the store root here is what let a vanity host whose Drive has not + // synced yet — or was migrated to another node — quietly serve the + // node's *own* root Drive under a customer's hostname. On a + // multi-tenant node that is one tenant's domain answering with another + // namespace's content, so it is a 404 instead. if self.get_resource(&drive_did).await.is_err() { - return Ok(subject.clone()); + return Err(AtomicError::not_found(format!( + "Host '{host}' is bound to drive {drive_did}, which this server does not have." + ))); } if subject_string == "/" { @@ -1596,19 +1646,131 @@ impl Db { _ => drive_did.to_string(), }; + let key = drive_mapping_key(host); self.kv - .insert(Tree::DriveMapping, host.as_bytes(), did_str.as_bytes())?; - tracing::info!("Added drive mapping: {} -> {}", host, did_str); + .insert(Tree::DriveMapping, key.as_bytes(), did_str.as_bytes())?; + tracing::info!("Added drive mapping: {} -> {}", key, did_str); Ok(()) } /// Removes the drive mapping for a given host. pub fn remove_drive_mapping(&self, host: &str) -> AtomicResult<()> { - self.kv.remove(Tree::DriveMapping, host.as_bytes())?; - tracing::info!("Removed drive mapping for host: {}", host); + let key = drive_mapping_key(host); + self.kv.remove(Tree::DriveMapping, key.as_bytes())?; + tracing::info!("Removed drive mapping for host: {}", key); Ok(()) } + /// Every host → Drive mapping in this store, sorted by host. + pub fn list_drive_mappings(&self) -> AtomicResult> { + let mut out = Vec::new(); + + for (key, value) in self.kv.scan_prefix(Tree::DriveMapping, b"").flatten() { + let (Ok(host), Ok(did)) = (std::str::from_utf8(&key), std::str::from_utf8(&value)) + else { + continue; + }; + out.push((host.to_string(), did.to_string())); + } + + out.sort(); + Ok(out) + } + + /// The hosts [`Self::sync_drive_mappings`] installed on its last run. + pub fn managed_alias_hosts(&self) -> AtomicResult> { + let Some(bytes) = self.kv.get(Tree::PluginMeta, MANAGED_ALIAS_HOSTS_KEY)? else { + return Ok(Vec::new()); + }; + + serde_json::from_slice(&bytes) + .map_err(|e| format!("Corrupt managed alias host list: {e}").into()) + } + + /// Reconciles the host → Drive mappings this server installs on behalf of a + /// control plane against `desired`, reporting what changed. + /// + /// Idempotent, so a managed node can call it on every policy poll: a host + /// already pointing at the right Drive is left untouched. Hosts a previous + /// run installed that `desired` no longer names are removed, which is what + /// makes a released vanity name stop resolving without anyone touching the + /// box. Ownership is tracked in [`MANAGED_ALIAS_HOSTS_KEY`], so a mapping + /// made by hand through `/bind-drive` is never removed by a reconcile that + /// does not name it. + /// + /// A host the control plane *does* name is taken over even if something + /// else bound it first: the control plane owns the namespace it hands out, + /// and a stale local binding shadowing an issued name is the failure this + /// is meant to correct. + pub fn sync_drive_mappings( + &self, + desired: &[(String, String)], + ) -> AtomicResult { + let mut report = DriveMappingSync::default(); + let mut managed: Vec = Vec::with_capacity(desired.len()); + + for (host, drive_did) in desired { + let key = drive_mapping_key(host); + // An empty host would claim the zero-length key and match no + // request; an empty DID would point a live hostname at nothing. + // Either is a bug upstream, and neither is worth writing. + if key.is_empty() || drive_did.trim().is_empty() { + tracing::warn!("Skipping drive mapping with an empty host or drive: {key:?}"); + continue; + } + + let current = self + .kv + .get(Tree::DriveMapping, key.as_bytes())? + .and_then(|bytes| String::from_utf8(bytes).ok()); + + match current { + Some(current) if current == *drive_did => {} + Some(_) => { + self.kv + .insert(Tree::DriveMapping, key.as_bytes(), drive_did.as_bytes())?; + report.updated.push(key.clone()); + } + None => { + self.kv + .insert(Tree::DriveMapping, key.as_bytes(), drive_did.as_bytes())?; + report.added.push(key.clone()); + } + } + + if !managed.contains(&key) { + managed.push(key); + } + } + + for host in self.managed_alias_hosts()? { + if managed.contains(&host) { + continue; + } + if self.kv.get(Tree::DriveMapping, host.as_bytes())?.is_some() { + self.kv.remove(Tree::DriveMapping, host.as_bytes())?; + report.removed.push(host); + } + } + + managed.sort(); + let bytes = serde_json::to_vec(&managed) + .map_err(|e| format!("Could not encode managed alias hosts: {e}"))?; + self.kv + .insert(Tree::PluginMeta, MANAGED_ALIAS_HOSTS_KEY, &bytes)?; + + if !report.is_empty() { + tracing::info!( + "Drive mappings reconciled: {} added, {} updated, {} removed", + report.added.len(), + report.updated.len(), + report.removed.len() + ); + } + + Ok(report) + } + /// Where a drive is replicated to, and who authorized it. /// /// This is **server-local config, and must stay out of the drive**. A @@ -1675,7 +1837,8 @@ impl Db { /// Returns the full Drive DID for a given host (domain/subdomain). pub async fn get_drive_did(&self, host: &str) -> AtomicResult> { - if let Some(did_bin) = self.kv.get(Tree::DriveMapping, host.as_bytes())? { + let key = drive_mapping_key(host); + if let Some(did_bin) = self.kv.get(Tree::DriveMapping, key.as_bytes())? { let did_str = std::str::from_utf8(&did_bin) .map_err(|e| format!("Failed to parse DID from database: {}", e))?; return Ok(Some(Subject::from_raw(did_str, None))); @@ -3954,6 +4117,216 @@ mod resolver_tests { "did:ad:test-child?drive=".to_string() + drive_did.as_str() ); } + + /// The vanity-subdomain hazard: a host is bound to a Drive this node does + /// not hold (not synced yet, or migrated away). Serving the store root + /// instead would answer a customer's hostname with another namespace's + /// content, so the request must fail. + #[tokio::test] + async fn a_bound_host_whose_drive_is_missing_does_not_serve_the_store_root() { + let store = Db::init_temp("resolver_missing_drive").await.unwrap(); + setup_test_env(&store).await.unwrap(); + let root_drive = store.get_drive_did("localhost").await.unwrap().unwrap(); + + store + .add_drive_mapping( + "acme.example.com", + &Value::AtomicUrl("did:ad:not-on-this-node".into()), + ) + .unwrap(); + + for path in ["/", "/about"] { + let resolved = store + .resolve_request_target( + &Subject::from_raw(path, None), + "acme.example.com", + path, + "https://acme.example.com", + ) + .await; + + let Err(err) = resolved else { + panic!("{path} on a bound host with a missing drive must not resolve"); + }; + assert!( + !format!("{err}").contains(root_drive.as_str()), + "must not leak the root drive: {err}" + ); + } + + // The node's own hostname is unaffected: it has no mapping, so it + // keeps serving its root as before. + assert!(store + .resolve_request_target( + &Subject::from_raw("/", None), + "node1.example.com", + "/", + "https://node1.example.com", + ) + .await + .is_ok()); + } +} + +#[cfg(test)] +mod drive_mapping_tests { + use super::*; + use crate::{test_utils::setup_test_env, Value}; + + fn desired(pairs: &[(&str, &str)]) -> Vec<(String, String)> { + pairs + .iter() + .map(|(h, d)| (h.to_string(), d.to_string())) + .collect() + } + + /// The reconcile a managed node runs on every policy poll: new names are + /// installed, a repointed name follows its Drive, and a released name + /// stops resolving. All three without an operator touching the box. + #[tokio::test] + async fn reconcile_adds_updates_and_removes() { + let store = Db::init_temp("drive_mapping_reconcile").await.unwrap(); + + let report = store + .sync_drive_mappings(&desired(&[ + ("acme.example.com", "did:ad:acme"), + ("blog.example.com", "did:ad:blog"), + ])) + .unwrap(); + assert_eq!(report.added, vec!["acme.example.com", "blog.example.com"]); + assert!(report.updated.is_empty()); + assert!(report.removed.is_empty()); + + // `acme` is repointed at another Drive (a migration), `blog` is + // released, and `docs` is new. + let report = store + .sync_drive_mappings(&desired(&[ + ("acme.example.com", "did:ad:acme-moved"), + ("docs.example.com", "did:ad:docs"), + ])) + .unwrap(); + assert_eq!(report.added, vec!["docs.example.com"]); + assert_eq!(report.updated, vec!["acme.example.com"]); + assert_eq!(report.removed, vec!["blog.example.com"]); + + assert_eq!( + store + .get_drive_did("acme.example.com") + .await + .unwrap() + .unwrap() + .as_str(), + "did:ad:acme-moved" + ); + assert!(store + .get_drive_did("blog.example.com") + .await + .unwrap() + .is_none()); + } + + /// Polled on a timer, so an unchanged policy must be a no-op rather than a + /// write per tick. + #[tokio::test] + async fn reconcile_is_idempotent() { + let store = Db::init_temp("drive_mapping_idempotent").await.unwrap(); + let want = desired(&[("acme.example.com", "did:ad:acme")]); + + assert_eq!( + store.sync_drive_mappings(&want).unwrap().added, + vec!["acme.example.com"] + ); + for _ in 0..3 { + assert!(store.sync_drive_mappings(&want).unwrap().is_empty()); + } + } + + /// The reconcile owns only what it installed. `setup_test_env` binds + /// `localhost` and `127.0.0.1`, and an operator may have bound a host by + /// hand through `/bind-drive`; treating the control plane's list as + /// authoritative for the whole table would delete all of those on the + /// first poll. + #[tokio::test] + async fn reconcile_leaves_bindings_it_did_not_install_alone() { + let store = Db::init_temp("drive_mapping_scope").await.unwrap(); + setup_test_env(&store).await.unwrap(); + let local_drive = store.get_drive_did("localhost").await.unwrap().unwrap(); + + store + .add_drive_mapping( + "hand-bound.example.com", + &Value::AtomicUrl("did:ad:hand-bound".into()), + ) + .unwrap(); + + let report = store + .sync_drive_mappings(&desired(&[("acme.example.com", "did:ad:acme")])) + .unwrap(); + assert!(report.removed.is_empty()); + + // Both survive a reconcile that names neither. + assert_eq!( + store.get_drive_did("localhost").await.unwrap().unwrap(), + local_drive + ); + assert!(store + .get_drive_did("hand-bound.example.com") + .await + .unwrap() + .is_some()); + } + + /// Hostnames are case-insensitive, but the `Host` header is echoed in + /// whatever case the client sent. Without normalization a request for + /// `ACME.example.com` misses the mapping and falls through to the store + /// root. + #[tokio::test] + async fn mapping_keys_are_case_insensitive() { + let store = Db::init_temp("drive_mapping_case").await.unwrap(); + + store + .sync_drive_mappings(&desired(&[("ACME.Example.COM", "did:ad:acme")])) + .unwrap(); + + for spelling in ["acme.example.com", "ACME.EXAMPLE.COM", "Acme.Example.Com"] { + assert_eq!( + store + .get_drive_did(spelling) + .await + .unwrap() + .unwrap_or_else(|| panic!("{spelling} should resolve")) + .as_str(), + "did:ad:acme", + ); + } + + assert_eq!( + store.list_drive_mappings().unwrap(), + vec![("acme.example.com".to_string(), "did:ad:acme".to_string())] + ); + } + + /// A host with no Drive, or a Drive with no host, is a bug upstream. Both + /// are skipped rather than written: the empty key would match no request, + /// and an empty Drive would point a live hostname at nothing. + #[tokio::test] + async fn reconcile_skips_empty_hosts_and_drives() { + let store = Db::init_temp("drive_mapping_empty").await.unwrap(); + + let report = store + .sync_drive_mappings(&desired(&[ + ("", "did:ad:nohost"), + ("nodrive.example.com", " "), + ("good.example.com", "did:ad:good"), + ])) + .unwrap(); + + assert_eq!(report.added, vec!["good.example.com"]); + assert_eq!( + store.list_drive_mappings().unwrap(), + vec![("good.example.com".to_string(), "did:ad:good".to_string())] + ); + } } #[cfg(test)] diff --git a/server/src/config.rs b/server/src/config.rs index a32f59289f..b2d09e323d 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -138,9 +138,35 @@ pub struct Opts { /// The base domain for multi-tenant hosting. /// If set, the server will allow serving subdomains of this domain (e.g. *.atomicserver.eu). + /// + /// Note that this does two things at once: it accepts subdomain `Host` + /// headers *and* it becomes the store's base domain, which is what + /// `Subject::from_raw` normalizes absolute URLs against. If you only need + /// the former — answering for names a control plane routes to you, without + /// changing how subjects are stored — use `--served-domain-suffix`. #[clap(long, env = "ATOMIC_BASE_DOMAIN")] pub base_domain: Option, + /// An extra domain whose subdomains this server answers for, e.g. + /// `atomicserver.eu` so that `acme.atomicserver.eu` is treated as one of + /// this server's own names. + /// + /// Deliberately separate from `--base-domain`. Only the set of `Host` + /// headers the server trusts is affected: the request origin (what signed + /// auth proofs bind to, and what served subjects are localized to) follows + /// the hostname the request actually arrived on, instead of falling back to + /// the configured origin and handing a visitor links to a different + /// hostname than the one they typed. The store's own base domain is + /// untouched, so nothing about how subjects are normalized or migrated + /// changes — which is what makes this safe to switch on for a node that + /// already holds data. + /// + /// This is what a managed node is given for hosted vanity subdomains; the + /// mapping from such a hostname to a Drive is separate, and lives in + /// `Tree::DriveMapping`. + #[clap(long, env = "ATOMIC_SERVED_DOMAIN_SUFFIX")] + pub served_domain_suffix: Option, + /// Serve one Drive as this server's front page. /// /// Set this to a Drive's subject (e.g. `internal:/` for the Drive at the diff --git a/server/src/context.rs b/server/src/context.rs index c784f563fd..bb3d4a3071 100644 --- a/server/src/context.rs +++ b/server/src/context.rs @@ -72,9 +72,15 @@ fn host_is_served_here(host: &str, opts: &crate::config::Opts) -> bool { { return true; } - if let Some(base) = opts.base_domain.as_deref() { - let base = base.trim().trim_start_matches('.').to_ascii_lowercase(); - if !base.is_empty() && (hostname == base || hostname.ends_with(&format!(".{base}"))) { + for suffix in [ + opts.base_domain.as_deref(), + opts.served_domain_suffix.as_deref(), + ] + .into_iter() + .flatten() + { + let suffix = suffix.trim().trim_start_matches('.').to_ascii_lowercase(); + if !suffix.is_empty() && (hostname == suffix || hostname.ends_with(&format!(".{suffix}"))) { return true; } } @@ -121,6 +127,36 @@ mod tests { crate::config::Opts::parse_from(args) } + fn opts_with_served_suffix(domain: &str, suffix: &str) -> crate::config::Opts { + crate::config::Opts::parse_from([ + "atomic-server", + "--domain", + domain, + "--served-domain-suffix", + suffix, + ]) + } + + /// A managed node serving hosted vanity subdomains gets the suffix without + /// `--base-domain`, so the request origin follows the hostname the visitor + /// used while the store's subject normalization stays as it was. + #[test] + fn a_served_domain_suffix_accepts_tenants_without_a_base_domain() { + let o = opts_with_served_suffix("node1.atomicserver.eu", "atomicserver.eu"); + assert!(o.base_domain.is_none()); + + assert!(host_is_served_here("acme.atomicserver.eu", &o)); + assert!(host_is_served_here("ACME.AtomicServer.eu:443", &o)); + // The node's own name and the apex are both names it answers for. + assert!(host_is_served_here("node1.atomicserver.eu", &o)); + assert!(host_is_served_here("atomicserver.eu", &o)); + + // The same near-misses the base-domain path rejects. + assert!(!host_is_served_here("notatomicserver.eu", &o)); + assert!(!host_is_served_here("atomicserver.eu.evil.example", &o)); + assert!(!host_is_served_here("evil.example", &o)); + } + #[test] fn configured_domain_and_tenants_are_served_here() { let o = opts("atomicdata.dev", Some("atomicserver.eu")); From f00feb280d2217728d9344fe1d97ccb5439601ca Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 19:29:54 +0000 Subject: [PATCH 2/2] Add changelog entries for the Drive-mapping API and --served-domain-suffix Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01WJmx2z4BWAr4gNvTvg48D4 --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19d96cea17..fccbf6060f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,25 @@ See [STATUS.md](server/STATUS.md) to learn more about which features will remain ## UNRELEASED +- `atomic_lib`: host-to-Drive mappings are reconcilable, so a control plane can + install hosted vanity subdomains without an agent that can sign on the + Drive's behalf. `Db::sync_drive_mappings` adds, repoints and removes a + desired set idempotently and scopes removal to the hosts it installed + itself (so `/bind-drive` bindings and the `localhost` entries from setup + survive); `Db::list_drive_mappings` and `Db::managed_alias_hosts` read the + table, which had no read path beyond a single-host lookup. Mapping keys are + now normalized, so a mixed-case `Host` header resolves the Drive it was + bound to instead of falling through to the store root. +- A host bound to a Drive now serves that Drive or answers 404. It used to + fall through to the store root when the bound Drive was missing — not synced + yet, or moved to another node — which on a multi-tenant server answers one + tenant's hostname with another namespace's content. +- New `--served-domain-suffix` / `ATOMIC_SERVED_DOMAIN_SUFFIX`: answer for + `*.` so the request origin follows the hostname the visitor used, + without `--base-domain`'s other effect of also becoming the store's base + domain (which changes how subjects are normalized and migrated, and is not + something to switch on for a server that already holds data). + - The outbox drains over a live Iroh link too (`sync::peer::LivePeerCommitTransport`): a device with no hub in reach delivers its queued writes to a paired peer as signed `COMMIT` frames, which the peer validates and applies like a hub