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

branch main Branches Tags History

aien-sovereign-core-mv / tools / aien-test / tests / security_boundaries.rs

84 lines · 2714 bytes Raw Blame History
1//! Offline security regression shared with the origin/main baseline.
2use aien_test::{plan, verify, worker::StateDir};
3use std::{fs, path::Path, process::Command};
4
5fn git(root: &Path, args: &[&str]) {
6 let out = Command::new("git")
7 .current_dir(root)
8 .args([
9 "-c",
10 "user.name=Security Test",
11 "-c",
12 "user.email=security@example.invalid",
13 ])
14 .args(args)
15 .output()
16 .unwrap();
17 assert!(
18 out.status.success(),
19 "{}",
20 String::from_utf8_lossy(&out.stderr)
21 );
22}
23
24#[test]
25fn candidate_checker_cannot_execute_without_valid_evidence() {
26 let temp = std::env::temp_dir().join(format!("sc-sec-1-{}", std::process::id()));
27 fs::create_dir(&temp).unwrap();
28 let root = temp.join("aien-architecture");
29 fs::create_dir_all(root.join("tools/crumb")).unwrap();
30 let built = temp.join("build-executed");
31 let ran = temp.join("checker-executed");
32 fs::write(
33 root.join("tools/crumb/crumb.c"),
34 "int main(void){return 0;}\n",
35 )
36 .unwrap();
37 fs::write(
38 root.join("tools/crumb/Makefile"),
39 format!(
40 "crumb:\n\ttouch {}\n\tprintf '#!/bin/sh\\ntouch {}\\n' > crumb\n\tchmod +x crumb\n",
41 built.display(),
42 ran.display()
43 ),
44 )
45 .unwrap();
46 git(&root, &["init", "-q"]);
47 git(&root, &["add", "."]);
48 git(&root, &["commit", "-q", "-m", "candidate"]);
49 let head = plan::resolve(&root, "HEAD").unwrap();
50 let report = verify::run(
51 &root,
52 &verify::Ask {
53 state: StateDir::new(&temp.join("state")),
54 commit: head.clone(),
55 base: head.clone(),
56 repository: Some("github.com/test/aien-architecture".into()),
57 release: false,
58 operator: false,
59 hardware_identity: String::new(),
60 crumb: Some("crumb".into()),
61 keys_override: None,
62 },
63 );
64 let executed = built.exists() || ran.exists();
65 // Negative control: the candidate payload really does execute if promoted explicitly.
66 let tool = verify::crumb_tool_for(&root, &head, "crumb", &temp.join("control"));
67 let verify::CrumbTool::Pinned { path, .. } = tool else {
68 panic!("control unavailable")
69 };
70 assert_eq!(
71 verify::crumb_status(&root, &head, path.to_str()).0,
72 "CURRENT"
73 );
74 assert!(
75 built.exists() && ran.exists(),
76 "inert negative-control payload"
77 );
78 fs::remove_dir_all(temp).unwrap();
79 assert!(!report.ready);
80 assert!(
81 !executed,
82 "candidate Makefile/checker executed as trusted worker despite invalid evidence"
83 );
84}