Skip to content

armgit / xerj

Public Imported from GitHub
0

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.

release: cut v1.0.0-rc.7

xerj-orgd1e73bc1aa78
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b34fe1bb3..3a6130e90 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,76 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [1.0.0-rc.7] - 2026-07-30
+
+Seventh release candidate: the **second brain and security-hardening
+release**. Headline for users: point one binary at a folder with
+`xerj brain <folder>` and get a bi-temporal, evidence-carrying link graph
+over your own documents, with a console view — THE MAP — that stays
+readable at any corpus size. Alongside it, six network-reachable security
+findings from a whitebox self-audit are fixed.
+
+### Added
+
+- **`xerj brain <folder>`** — one command turns a folder into a queryable
+ knowledge graph. Structural detectors (wiki-links, markdown links,
+ hrefs, folder adjacency, reading order) record, for every link, the
+ exact sentence that created it and the byte offset it came from.
+ Measured: 10 notes → 25 links in 0.1s; a 943 MB repo copy → 7,571 files,
+ 2,128,360 notes, 20,930 links in 322.7s.
+- **Graph HTTP API** — `POST`/`DELETE /_graph/{brain}/link`,
+ `GET /_graph/{brain}/ego`, `GET /_graph/{brain}/overview`. Bi-temporal:
+ links are retired, never deleted, and any past moment is replayable via
+ `as_of`. Traversal is capped at 2 hops per call by design — XERJ is a
+ search engine with a graph-shaped index, not a graph database.
+- **THE MAP** (console) — a Canvas knowledge-graph view whose default
+ "helicopter" altitude is bounded by construction: any corpus collapses
+ to at most a dozen named groups plus one catch-all. Measured 19,299
+ links / 1,550 documents → 13 groups in 44 ms; a synthetic 50,000-link
+ budget → 13 groups / 60 bundles in 122 ms, byte-identical across runs;
+ 60 fps pan/zoom/expand. Small corpora skip clustering and draw real
+ notes, so the view is adaptive rather than one-size.
+- **Cross-file-type links** — new `pathcite@1` and `cratecite@1`
+ detectors relate documents to the code and files they cite, so a PDF or
+ a design note can be shown next to the crate it references, with the
+ citing text as evidence.
+- **Agent surface** — four MCP tools (`xerj_brain_ego`, `xerj_brain_link`,
+ `xerj_brain_unlink`, `xerj_brain_overview`) under
+ `contract: xerj-second-brain/1`.
+- `limits.snapshot_repo_allowlist` — an Elasticsearch `path.repo`
+ equivalent bounding where snapshot repositories may live.
+
+### Fixed
+
+- **Security (unauthenticated):** `POST /_sql` with a deeply nested
+ `WHERE` clause overflowed the stack and aborted the whole process. The
+ WHERE parser now bounds recursion depth (`MAX_SQL_DEPTH`), as the
+ query_string parser already did.
+- **Security:** search-template parameters were spliced into the query
+ JSON unescaped and re-parsed, so a parameter could inject query
+ structure and drop the template's own filter. Parameters are now
+ JSON-escaped and can no longer emit structural tokens.
+- **Security:** a snapshot repository's `settings.location` was an
+ unvalidated absolute path, so snapshots could read and write index data
+ outside `data_dir`. Locations are now bounded by `data_dir` or the new
+ allowlist.
+- **Security:** the console's session `last_seen` refresh blind-wrote a
+ stale copy of the session, which could resurrect a session revoked
+ moments earlier. The refresh now re-reads and skips revoked sessions.
+- Console: the Second Brain dashboard is no longer always present — it
+ appears once at least one brain exists, so a user who has never run
+ `xerj brain` is not shown an empty dashboard.
+- Console: several second-brain counts reported the engine's 10,000-hit
+ floor as an exact total on multi-million-note brains; totals are now
+ exact, and floors are shown as `≥`.
+
+### Notes
+
+- The second brain's link detection is **structural and lexical** — there
+ is no LLM and no semantic model in the loop, and the node-store embedder
+ remains a lexical feature hash. Scale beyond the measured corpus above
+ is not claimed.
+
## [1.0.0-rc.6] - 2026-07-28
Sixth release candidate: the **semantic-analytics and bounded-memory
diff --git a/engine/Cargo.lock b/engine/Cargo.lock
index 1ecdf9aee..0c59c2e74 100644
--- a/engine/Cargo.lock
+++ b/engine/Cargo.lock
@@ -6203,7 +6203,7 @@ dependencies = [
[[package]]
name = "xerj-ai"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"candle-core",
@@ -6224,7 +6224,7 @@ dependencies = [
[[package]]
name = "xerj-api"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"async-trait",
@@ -6254,7 +6254,7 @@ dependencies = [
[[package]]
name = "xerj-autoindex"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"chrono",
@@ -6281,7 +6281,7 @@ dependencies = [
[[package]]
name = "xerj-cluster"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"async-trait",
@@ -6303,7 +6303,7 @@ dependencies = [
[[package]]
name = "xerj-common"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"byteorder",
@@ -6321,7 +6321,7 @@ dependencies = [
[[package]]
name = "xerj-compress"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"byteorder",
"bytes",
@@ -6334,7 +6334,7 @@ dependencies = [
[[package]]
name = "xerj-console-api"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"arc-swap",
@@ -6370,7 +6370,7 @@ dependencies = [
[[package]]
name = "xerj-engine"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"arc-swap",
@@ -6409,7 +6409,7 @@ dependencies = [
[[package]]
name = "xerj-fts"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"bitpacking",
@@ -6435,7 +6435,7 @@ dependencies = [
[[package]]
name = "xerj-logs"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"byteorder",
@@ -6453,7 +6453,7 @@ dependencies = [
[[package]]
name = "xerj-mcp"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"reqwest",
@@ -6463,7 +6463,7 @@ dependencies = [
[[package]]
name = "xerj-query"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"base64 0.22.1",
@@ -6478,7 +6478,7 @@ dependencies = [
[[package]]
name = "xerj-server"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"axum",
@@ -6524,7 +6524,7 @@ dependencies = [
[[package]]
name = "xerj-storage"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"arc-swap",
@@ -6554,7 +6554,7 @@ dependencies = [
[[package]]
name = "xerj-vector"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"byteorder",
@@ -6572,7 +6572,7 @@ dependencies = [
[[package]]
name = "xerj-wasm"
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
dependencies = [
"anyhow",
"bytes",
diff --git a/engine/Cargo.toml b/engine/Cargo.toml
index 78c1687e1..a9d54729a 100644
--- a/engine/Cargo.toml
+++ b/engine/Cargo.toml
@@ -21,7 +21,7 @@ members = [
]
[workspace.package]
-version = "1.0.0-rc.6"
+version = "1.0.0-rc.7"
edition = "2021"
license = "Apache-2.0"
authors = ["xerj Contributors"]
diff --git a/engine/crates/xerj-engine/src/engine.rs b/engine/crates/xerj-engine/src/engine.rs
index 6dcaf9d97..76cd7084b 100644
--- a/engine/crates/xerj-engine/src/engine.rs
+++ b/engine/crates/xerj-engine/src/engine.rs
@@ -1942,53 +1942,6 @@ fn validate_snapshot_path(
}
}
-#[cfg(test)]
-mod snapshot_path_security_tests {
- use super::validate_snapshot_path;
-
- #[test]
- fn f_path_02_repo_location_outside_data_dir_is_rejected_by_default() {
- let data = tempfile::TempDir::new().unwrap();
- // A repo location pointing outside data_dir (the F-PATH-02 exploit shape)
- // with an empty allowlist must be refused.
- let outside = tempfile::TempDir::new().unwrap();
- let repo = outside.path().to_str().unwrap();
- let snap = std::path::Path::new(repo).join("s1");
- let err = validate_snapshot_path(repo, "s1", &snap, data.path(), &[])
- .expect_err("external repo location must be rejected");
- assert!(err.to_string().contains("outside data_dir"), "{err}");
- }
-
- #[test]
- fn location_inside_data_dir_is_allowed() {
- let data = tempfile::TempDir::new().unwrap();
- let repo_dir = data.path().join("backups");
- std::fs::create_dir_all(&repo_dir).unwrap();
- let repo = repo_dir.to_str().unwrap();
- let snap = repo_dir.join("s1");
- validate_snapshot_path(repo, "s1", &snap, data.path(), &[])
- .expect("a repo under data_dir must be allowed");
- }
-
- #[test]
- fn explicit_allowlist_permits_an_external_root() {
- let data = tempfile::TempDir::new().unwrap();
- let ext = tempfile::TempDir::new().unwrap();
- let repo = ext.path().to_str().unwrap().to_string();
- let snap = std::path::Path::new(&repo).join("s1");
- validate_snapshot_path(&repo, "s1", &snap, data.path(), &[repo.clone()])
- .expect("an allowlisted external root must be permitted");
- }
-
- #[test]
- fn traversal_name_still_rejected_even_inside_an_allowed_base() {
- let data = tempfile::TempDir::new().unwrap();
- let snap = data.path().join("..");
- let repo = data.path().to_str().unwrap();
- assert!(validate_snapshot_path(repo, "..", &snap, data.path(), &[]).is_err());
- }
-}
-
/// Recursively copy all files from `src` to `dst`, recording relative paths in `files`.
fn copy_dir_recursive(
src: &std::path::Path,
@@ -2054,3 +2007,50 @@ fn es_type_to_field_type(es_type: &str) -> xerj_common::types::FieldType {
_ => FieldType::Object,
}
}
+
+#[cfg(test)]
+mod snapshot_path_security_tests {
+ use super::validate_snapshot_path;
+
+ #[test]
+ fn f_path_02_repo_location_outside_data_dir_is_rejected_by_default() {
+ let data = tempfile::TempDir::new().unwrap();
+ // A repo location pointing outside data_dir (the F-PATH-02 exploit shape)
+ // with an empty allowlist must be refused.
+ let outside = tempfile::TempDir::new().unwrap();
+ let repo = outside.path().to_str().unwrap();
+ let snap = std::path::Path::new(repo).join("s1");
+ let err = validate_snapshot_path(repo, "s1", &snap, data.path(), &[])
+ .expect_err("external repo location must be rejected");
+ assert!(err.to_string().contains("outside data_dir"), "{err}");
+ }
+
+ #[test]
+ fn location_inside_data_dir_is_allowed() {
+ let data = tempfile::TempDir::new().unwrap();
+ let repo_dir = data.path().join("backups");
+ std::fs::create_dir_all(&repo_dir).unwrap();
+ let repo = repo_dir.to_str().unwrap();
+ let snap = repo_dir.join("s1");
+ validate_snapshot_path(repo, "s1", &snap, data.path(), &[])
+ .expect("a repo under data_dir must be allowed");
+ }
+
+ #[test]
+ fn explicit_allowlist_permits_an_external_root() {
+ let data = tempfile::TempDir::new().unwrap();
+ let ext = tempfile::TempDir::new().unwrap();
+ let repo = ext.path().to_str().unwrap().to_string();
+ let snap = std::path::Path::new(&repo).join("s1");
+ validate_snapshot_path(&repo, "s1", &snap, data.path(), std::slice::from_ref(&repo))
+ .expect("an allowlisted external root must be permitted");
+ }
+
+ #[test]
+ fn traversal_name_still_rejected_even_inside_an_allowed_base() {
+ let data = tempfile::TempDir::new().unwrap();
+ let snap = data.path().join("..");
+ let repo = data.path().to_str().unwrap();
+ assert!(validate_snapshot_path(repo, "..", &snap, data.path(), &[]).is_err());
+ }
+}