Skip to content

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

Rust

ci(codeql): trust wiki path confinement

AkitaOnRailse99556a85381
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..41273b1c
--- /dev/null
+++ b/.github/codeql/extensions/ai-memory-models/models/path-barriers.model.yml
@@ -0,0 +1,20 @@
+# Every wiki filesystem path crosses one of these typed entry points and then
+# `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. 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.
+#
+# 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::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"]
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;