Implement safe public LSL delivery (#129)
Some checks failed
CI / rust-skia (Rust only) (push) Successful in 2m45s
CI / required (push) Failing after 1m0s

This commit is contained in:
2026-08-18 10:38:12 +02:00
parent 6370b3e416
commit a749111657
59 changed files with 3235 additions and 2144 deletions

View File

@@ -2,9 +2,10 @@ use std::collections::BTreeSet;
use std::fs;
use std::path::{Path, PathBuf};
const ALLOWED_DEPENDENCIES: [&str; 12] = [
const ALLOWED_DEPENDENCIES: [&str; 13] = [
"crossterm",
"libremetaverse",
"metacrate-lsl-tools",
"libremetaverse-types",
"reqwest",
"rustls",
@@ -50,7 +51,7 @@ fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
let mut files = Vec::with_capacity(20);
collect_rust_files(&source, &mut files);
assert!(
files.len() <= 28,
files.len() <= 30,
"source-file count needs a reviewed bound update"
);
for path in files {
@@ -81,6 +82,44 @@ fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
}
}
#[test]
fn compatibility_crates_never_depend_on_or_reexport_metacrate_crates() {
let workspace = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.and_then(Path::parent)
.expect("workspace")
.to_path_buf();
for entry in fs::read_dir(workspace.join("crates")).expect("crates") {
let path = entry.expect("crate entry").path();
let Some(name) = path.file_name().and_then(|value| value.to_str()) else {
continue;
};
if !name.starts_with("libremetaverse") || !path.is_dir() {
continue;
}
let manifest = fs::read_to_string(path.join("Cargo.toml")).expect("compat manifest");
assert!(
!manifest.lines().any(|line| {
let line = line.trim_start();
line.starts_with("metacrate-") || line.contains("../metacrate-")
}),
"{name} must not depend on metacrate crates"
);
let lib = path.join("src/lib.rs");
if lib.exists() {
let source = fs::read_to_string(lib).expect("compat lib.rs");
assert!(
!source.lines().any(|line| {
let line = line.trim_start();
(line.starts_with("pub use") || line.starts_with("pub mod"))
&& line.contains("metacrate")
}),
"{name} must not reexport metacrate crates"
);
}
}
}
#[test]
fn world_backend_requires_the_opaque_policy_authorization() {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));