Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(codeql): realize wiki confinement barriers
AkitaOnRails961a847bb767
diff --git a/.github/codeql/extensions/ai-memory-models/models/path-barriers.model.yml b/.github/codeql/extensions/ai-memory-models/models/path-barriers.model.ymlindex 41273b1c..b6f3a931 100644--- a/.github/codeql/extensions/ai-memory-models/models/path-barriers.model.yml+++ b/.github/codeql/extensions/ai-memory-models/models/path-barriers.model.yml@@ -4,8 +4,11 @@# points before returning the path. Model the entry points as well as the# implementation boundary: CodeQL's interprocedural summary can otherwise# propagate request taint through a wrapper before it reaches `tree_path`.-# Treat only the validated success value as safe for filesystem operations;-# request-derived values that reach any other path construction remain tainted.+# CodeQL's Rust model resolver realizes these source-defined `Result<PathBuf,+# WikiError>` boundaries only at `ReturnValue`; an `Ok(0)` field access path+# currently produces no barrier node. The error variant contains no path value,+# so treating the whole return as the barrier preserves the runtime contract.+# Request-derived values that bypass these functions remain tainted.## The CLI test `codeql_model_targets_exist` fails if the modeled function is# renamed or moved.@@ -14,7 +17,7 @@ extensions:pack: codeql/rust-allextensible: barrierModeldata:- - ["ai_memory_wiki::confinement::project_root", "ReturnValue.Field[core::result::Result::Ok(0)]", "path-injection", "manual"]- - ["ai_memory_wiki::confinement::project_path", "ReturnValue.Field[core::result::Result::Ok(0)]", "path-injection", "manual"]- - ["ai_memory_wiki::confinement::workspace_path", "ReturnValue.Field[core::result::Result::Ok(0)]", "path-injection", "manual"]- - ["ai_memory_wiki::confinement::tree_path", "ReturnValue.Field[core::result::Result::Ok(0)]", "path-injection", "manual"]+ - ["ai_memory_wiki::confinement::project_root", "ReturnValue", "path-injection", "manual"]+ - ["ai_memory_wiki::confinement::project_path", "ReturnValue", "path-injection", "manual"]+ - ["ai_memory_wiki::confinement::workspace_path", "ReturnValue", "path-injection", "manual"]+ - ["ai_memory_wiki::confinement::tree_path", "ReturnValue", "path-injection", "manual"]diff --git a/crates/ai-memory-cli/tests/suite/repo_layout.rs b/crates/ai-memory-cli/tests/suite/repo_layout.rsindex 4e43646f..a6fdb4ef 100644--- a/crates/ai-memory-cli/tests/suite/repo_layout.rs+++ b/crates/ai-memory-cli/tests/suite/repo_layout.rs@@ -168,6 +168,26 @@ fn codeql_model_targets_exist() {);}+/// CodeQL's Rust extractor does not currently materialize an `Ok(0)` field+/// barrier for source-defined `Result<PathBuf, _>` functions. A narrower model+/// silently matches no flow node and reopens every confinement false positive.+#[test]+fn codeql_path_barriers_model_the_realized_return_node() {+ let model = fs::read_to_string(+ crates_dir()+ .parent()+ .expect("crates/ lives in the repository root")+ .join(".github/codeql/extensions/ai-memory-models/models/path-barriers.model.yml"),+ )+ .expect("read path barrier model");++ assert!(model.contains("\"ReturnValue\", \"path-injection\""));+ assert!(+ !model.contains("ReturnValue.Field[core::result::Result::Ok(0)]"),+ "Rust Result field barriers are not realized for these source functions"+ );+}+/// Advanced CodeQL setup does not reliably auto-load repository-local model/// packs. Keep the explicit Rust analysis path wired to the checked-in pack.#[test]