interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

GitHub aien-dev/aien-sovereign-core-mv#266 (code only)

closed derived d862184b5a69a942 #266

Imported from GitHub aien-dev/aien-sovereign-core-mv#266 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base bdc1aa1c6002d66e20e03800488b669a534b8f8c · Head 89ff1941f1422d91c4e3e7893f81cb0d22391eba

Fetch it

A git bundle of the pull request's head, 3346 bytes.

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/d862184b5a69a942.bundle -o d862184b5a69a942.bundle
git fetch d862184b5a69a942.bundle refs/pull/266/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
266
89ff1941f1422d91c4e3e7893f81cb0d22391eba
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":266,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/266","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:35Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index a196cd3c..7839395a 100644
--- a/.crumb
+++ b/.crumb
@@ -77,14 +77,14 @@
         }
       ],
       "children_root": "sha256:4ff1a56b7c8ac606ad5709f2ba1141f16055c34f5f242ac491233dca20d5153e",
-      "compiled_at": "2026-10-07T03:37:34Z",
+      "compiled_at": "2026-10-07T03:51:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:9c94e6a0360e0904f07fd35e6dd1ae960c62f62b9d5043e6242d7cc08e3dca86",
+      "digest": "sha256:950da750f791d269aa8ab366556f3652cf49b9a06b1e74011dfc3d6d1962729a",
       "evidence_files": 155,
       "evidence_root": "sha256:ff6dddfecfcc02cea55f46acaccc7eaecd27557209e98c3d5616ec02bdde31db",
       "files": 1119,
-      "generated_at_commit": "a914490eb8ae8f9582ec31b498497eb4483ac400",
-      "source_tree": "sha256:116073775100d240cef5d339050b961d09e8538c2f141d89bf888ead349fdf69"
+      "generated_at_commit": "0b14ebab343e7cd911a8db1eded99d7a4718339e",
+      "source_tree": "sha256:8ff157daf713d6d9839d9d0c9720872d479e368575bdb78fe2143ffc14bb49ab"
     }
   },
   "history": [],
diff --git a/crates/aien-drive/src/http.rs b/crates/aien-drive/src/http.rs
index 6c1f92df..170e9773 100644
--- a/crates/aien-drive/src/http.rs
+++ b/crates/aien-drive/src/http.rs
@@ -1,9 +1,11 @@
-//! Minimal plain-HTTP client over `std::net` (loopback endpoints only).
+//! Minimal plain-HTTP client over `std::net`, loopback endpoints only: every
+//! address the host resolves to must be loopback, and the connection goes to
+//! those resolved addresses (no second lookup between the check and connect).
 //! Sends HTTP/1.0 with `Connection: close` and decodes chunked bodies if the
 //! server uses them anyway.
 
 use std::io::{BufRead, BufReader, Read, Write};
-use std::net::TcpStream;
+use std::net::{SocketAddr, TcpStream, ToSocketAddrs};
 use std::time::Duration;
 
 pub struct Response {
@@ -19,7 +21,9 @@ fn split_url(url: &str) -> Result<(String, String), String> {
         Some(i) => (&rest[..i], &rest[i..]),
         None => (rest, "/"),
     };
-    let host = if host.contains(':') {
+    let host = if host.starts_with('[') && host.ends_with(']') {
+        format!("{host}:80")
+    } else if host.contains(':') {
         host.to_string()
     } else {
         format!("{host}:80")
@@ -27,6 +31,21 @@ fn split_url(url: &str) -> Result<(String, String), String> {
     Ok((host, path.to_string()))
 }
 
+/// Resolve `host:port` and refuse it unless every address is loopback.
+fn loopback_addrs(host: &str) -> Result<Vec<SocketAddr>, String> {
+    let addrs: Vec<SocketAddr> = host
+        .to_socket_addrs()
+        .map_err(|e| format!("resolve {host}: {e}"))?
+        .collect();
+    if addrs.is_empty() {
+        return Err(format!("resolve {host}: no addresses"));
+    }
+    if let Some(a) = addrs.iter().find(|a| !a.ip().is_loopback()) {
+        return Err(format!("refused: {host} resolves to non-loopback {a}"));
+    }
+    Ok(addrs)
+}
+
 struct Chunked<R: BufRead> {
     inner: R,
     left: usize,
@@ -63,7 +82,8 @@ impl<R: BufRead> Read for Chunked<R> {
 /// POST a JSON body. `timeout` bounds each socket read and write.
 pub fn post_json(url: &str, body: &str, timeout: Duration) -> Result<Response, String> {
     let (host, path) = split_url(url)?;
-    let mut s = TcpStream::connect(&host).map_err(|e| format!("connect {host}: {e}"))?;
+    let addrs = loopback_addrs(&host)?;
+    let mut s = TcpStream::connect(&addrs[..]).map_err(|e| format!("connect {host}: {e}"))?;
     s.set_read_timeout(Some(timeout))
         .map_err(|e| e.to_string())?;
     s.set_write_timeout(Some(timeout))
@@ -106,3 +126,33 @@ pub fn post_json(url: &str, body: &str, timeout: Duration) -> Result<Response, S
     };
     Ok(Response { status, body })
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn loopback_hosts_are_accepted() {
+        for h in ["127.0.0.1:18080", "127.8.9.10:1", "[::1]:1", "localhost:1"] {
+            let a = loopback_addrs(h).unwrap_or_else(|e| panic!("{h}: {e}"));
+            assert!(a.iter().all(|a| a.ip().is_loopback()), "{h}");
+        }
+        assert_eq!(split_url("http://[::1]/x").unwrap().0, "[::1]:80");
+    }
+
+    #[test]
+    fn non_loopback_hosts_are_refused_before_connecting() {
+        for url in [
+            "http://10.0.0.1:18080/v1",
+            "http://192.168.1.192/v1",
+            "http://0.0.0.0:18080/v1",
+            "http://[2001:db8::1]:80/v1",
+            "http://203.0.113.7/v1",
+        ] {
+            let err = post_json(url, "{}", Duration::from_millis(50))
+                .err()
+                .unwrap_or_else(|| panic!("{url} was not refused"));
+            assert!(err.starts_with("refused: "), "{url}: {err}");
+        }
+    }
+}