Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

security: model validated wiki paths for CodeQL

AkitaOnRailsd9d874aa885a
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.yml
new file mode 100644
index 00000000..ebefcf04
--- /dev/null
+++ b/.github/codeql/extensions/ai-memory-models/models/path-barriers.model.yml
@@ -0,0 +1,14 @@
+# Every wiki filesystem path crosses `tree_path`, which rejects absolute,
+# parent, root and prefix components and inspects the in-root directory chain
+# for symbolic links or Windows reparse points before returning the path.
+# Treat only the validated success value as safe for filesystem operations;
+# request-derived values that reach any other path construction remain tainted.
+#
+# The CLI test `codeql_model_targets_exist` fails if the modeled function is
+# renamed or moved.
+extensions:
+ - addsTo:
+ pack: codeql/rust-all
+ extensible: barrierModel
+ data:
+ - ["ai_memory_wiki::confinement::tree_path", "ReturnValue.Field[core::result::Result::Ok(0)]", "path-injection", "manual"]
diff --git a/crates/ai-memory-cli/tests/suite/repo_layout.rs b/crates/ai-memory-cli/tests/suite/repo_layout.rs
index 7934b16e..a0ef4d93 100644
--- a/crates/ai-memory-cli/tests/suite/repo_layout.rs
+++ b/crates/ai-memory-cli/tests/suite/repo_layout.rs
@@ -119,6 +119,7 @@ fn codeql_model_targets_exist() {
"ai_memory_client",
repo_root.join("companions/ai-memory-client/src"),
),
+ ("ai_memory_wiki", crates_dir().join("ai-memory-wiki/src")),
];
let models_dir = repo_root.join(".github/codeql/extensions/ai-memory-models/models");
let mut targets = 0;