AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
style: cargo fmt after Phase 1 security fixes
Derek Chamorro625781a6d32d
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rsindex 7d7a27f3a..9cd457010 100644--- a/engine/crates/xerj-api/src/es_compat.rs+++ b/engine/crates/xerj-api/src/es_compat.rs@@ -20900,7 +20900,8 @@ fn validate_snapshot_name(name: &str) -> Result<(), xerj_common::XerjError> {"snapshot name must not be empty",));}- if name == "." || name == ".."+ if name == "."+ || name == ".."|| name.contains("..")|| name.contains('/')|| name.contains('\\')diff --git a/engine/crates/xerj-common/src/types.rs b/engine/crates/xerj-common/src/types.rsindex fef51ede2..905552061 100644--- a/engine/crates/xerj-common/src/types.rs+++ b/engine/crates/xerj-common/src/types.rs@@ -548,8 +548,8 @@ mod tests {assert!(IndexName::new("_private").is_err()); // starts with _assert!(IndexName::new("bad name").is_err()); // spaceassert!(IndexName::new("1bad").is_err()); // starts with digit- // Path-traversal vectors (regression: leading-dot carve-out plus '.'- // in the body previously let "."/".."/"a/../b" through).+ // Path-traversal vectors (regression: leading-dot carve-out plus '.'+ // in the body previously let "."/".."/"a/../b" through).assert!(IndexName::new(".").is_err()); // literal dotassert!(IndexName::new("..").is_err()); // literal double-dotassert!(IndexName::new("...").is_err()); // triplediff --git a/engine/crates/xerj-engine/src/engine.rs b/engine/crates/xerj-engine/src/engine.rsindex c3f7ba356..7dd09b212 100644--- a/engine/crates/xerj-engine/src/engine.rs+++ b/engine/crates/xerj-engine/src/engine.rs@@ -1756,11 +1756,11 @@ impl Engine {// regression in the validator that would let `dst_dir` escape the// data_dir.if !dst_dir.starts_with(&self.data_dir) {- return Err(EngineError::Common(xerj_common::XerjError::invalid_mapping(- format!(+ return Err(EngineError::Common(+ xerj_common::XerjError::invalid_mapping(format!("refusing to restore index [{idx_name}] outside data_dir"- ),- )));+ )),+ ));}// Remove existing index data (if any) and close it.@@ -1777,11 +1777,11 @@ impl Engine {// that the lexical check misses).if let Ok(dst_canon) = dst_dir.canonicalize() {if !dst_canon.starts_with(&data_dir_canon) {- return Err(EngineError::Common(xerj_common::XerjError::invalid_mapping(- format!(+ return Err(EngineError::Common(+ xerj_common::XerjError::invalid_mapping(format!("refusing to restore index [{idx_name}] outside data_dir (canonical)"- ),- )));+ )),+ ));}}@@ -1855,9 +1855,11 @@ fn validate_snapshot_path(snap_dir: &std::path::Path,) -> Result<std::path::PathBuf> {if repo_path.is_empty() {- return Err(EngineError::Common(xerj_common::XerjError::invalid_mapping(- "snapshot repository location must not be empty",- )));+ return Err(EngineError::Common(+ xerj_common::XerjError::invalid_mapping(+ "snapshot repository location must not be empty",+ ),+ ));}if name.is_empty()|| name.contains("..")@@ -1880,11 +1882,11 @@ fn validate_snapshot_path(// that it starts with the repo.if let Ok(snap_canon) = snap_dir.canonicalize() {if !snap_canon.starts_with(&repo_canon) {- return Err(EngineError::Common(xerj_common::XerjError::invalid_mapping(- format!(+ return Err(EngineError::Common(+ xerj_common::XerjError::invalid_mapping(format!("snapshot [{name}] resolves outside its repository; refusing"- ),- )));+ )),+ ));}Ok(snap_canon)} else {@@ -1893,11 +1895,11 @@ fn validate_snapshot_path(// exists but the repo dir does not.let snap_lex = snap_dir.to_path_buf();if !snap_lex.starts_with(&repo_canon) {- return Err(EngineError::Common(xerj_common::XerjError::invalid_mapping(- format!(+ return Err(EngineError::Common(+ xerj_common::XerjError::invalid_mapping(format!("snapshot [{name}] resolves outside its repository; refusing"- ),- )));+ )),+ ));}Ok(snap_lex)}