feat(grid-agent): enforce central action policy (#120)
This commit is contained in:
@@ -2,12 +2,13 @@ use std::collections::BTreeSet;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
const ALLOWED_DEPENDENCIES: [&str; 7] = [
|
||||
const ALLOWED_DEPENDENCIES: [&str; 8] = [
|
||||
"libremetaverse",
|
||||
"libremetaverse-types",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"tokio",
|
||||
"url",
|
||||
];
|
||||
@@ -45,7 +46,7 @@ fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
|
||||
let mut files = Vec::with_capacity(8);
|
||||
collect_rust_files(&source, &mut files);
|
||||
assert!(
|
||||
files.len() <= 8,
|
||||
files.len() <= 10,
|
||||
"source-file count needs a reviewed bound update"
|
||||
);
|
||||
for path in files {
|
||||
@@ -76,6 +77,15 @@ fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn world_backend_requires_the_opaque_policy_authorization() {
|
||||
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let backend = fs::read_to_string(root.join("src/backend.rs")).expect("backend source");
|
||||
assert!(backend.contains("action: AuthorizedAction"));
|
||||
assert!(!backend.contains("call: ProposedToolCall"));
|
||||
assert!(!backend.contains("decision: PolicyDecision"));
|
||||
}
|
||||
|
||||
fn collect_rust_files(directory: &Path, output: &mut Vec<PathBuf>) {
|
||||
for entry in fs::read_dir(directory).expect("read source directory") {
|
||||
let path = entry.expect("source entry").path();
|
||||
|
||||
Reference in New Issue
Block a user