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
fix(autoindex): a link that left the root through a dotfile gets its own report label
xerj-org1350a641a8cc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ab796e69e..06392dfaa 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,7 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0A followed link is now judged by what it **resolves to**, not by the name itwears. Targets outside the folder are refused and reported under a new`symlink:outside-root` rule; targets inside a hidden directory are skipped- like any dotfile.+ like any dotfile; and one that does both — left the folder AND resolved+ through a dotted component — is reported as `symlink:outside-root+hidden`,+ because it is refused even with the opt-in below and neither of the other two+ labels tells the operator anything they can act on.**This will index less than the previous release for some setups**, and thefirst run after upgrading drops what it previously indexed through such adiff --git a/engine/crates/xerj-autoindex/src/ignore_rules.rs b/engine/crates/xerj-autoindex/src/ignore_rules.rsindex 4e4092c02..ddbd3570a 100644--- a/engine/crates/xerj-autoindex/src/ignore_rules.rs+++ b/engine/crates/xerj-autoindex/src/ignore_rules.rs@@ -129,6 +129,14 @@ pub const ESCAPED_ROOT_RULE: &str = "symlink:outside-root";/// operator expected is named rather than silently missing.pub const UNRESOLVED_LINK_RULE: &str = "symlink:unresolved";+/// A followed link that left the folder AND resolved through a dotted+/// component. Refused whatever `--follow-symlinks-outside-root` says, so it+/// needs its own label: reporting it as [`ESCAPED_ROOT_RULE`] tells an operator+/// who already passed that flag to pass it again, and reporting it as+/// [`HIDDEN_RULE`] sends them looking for a dotfile in a folder that has none.+/// Both were tried; this names the two facts that are actually true.+pub const HIDDEN_OUTSIDE_ROOT_RULE: &str = "symlink:outside-root+hidden";+const MAX_WARNINGS: usize = 20;/// Directory entries the `--dry-run` deep count may examine in total. A/// pathological `node_modules` is not allowed to turn "tell me the plan" into@@ -719,6 +727,21 @@ impl IgnoreStack {}}+ /// A followed link that left the root through a dotted component.+ /// See [`HIDDEN_OUTSIDE_ROOT_RULE`].+ pub fn record_symlink_hidden_escape(&mut self, is_dir: bool) {+ if is_dir {+ self.report.dirs_pruned += 1;+ self.report+ .by_rule+ .entry(HIDDEN_OUTSIDE_ROOT_RULE.to_string())+ .or_default()+ .dirs += 1;+ } else {+ self.record_file(HIDDEN_OUTSIDE_ROOT_RULE);+ }+ }+/// A followed entry that could not be resolved. See [`UNRESOLVED_LINK_RULE`].pub fn record_symlink_unresolved(&mut self, is_dir: bool) {if is_dir {diff --git a/engine/crates/xerj-autoindex/src/walk.rs b/engine/crates/xerj-autoindex/src/walk.rsindex ec82e061e..ffee09dca 100644--- a/engine/crates/xerj-autoindex/src/walk.rs+++ b/engine/crates/xerj-autoindex/src/walk.rs@@ -321,7 +321,7 @@ pub fn walk_reporting_opts(resolved = Some(real);}Err(SymlinkVerdict::HiddenOutsideRoot) => {- stack.record_symlink_escape(is_dir);+ stack.record_symlink_hidden_escape(is_dir);if is_dir {it.skip_current_dir();}diff --git a/engine/crates/xerj-autoindex/tests/follow_symlinks_boundary.rs b/engine/crates/xerj-autoindex/tests/follow_symlinks_boundary.rsindex b576d0a91..67ece42ee 100644--- a/engine/crates/xerj-autoindex/tests/follow_symlinks_boundary.rs+++ b/engine/crates/xerj-autoindex/tests/follow_symlinks_boundary.rs@@ -20,7 +20,9 @@use std::fs;use std::os::unix::fs::symlink;use std::path::Path;-use xerj_autoindex::ignore_rules::{IgnoreOptions, ESCAPED_ROOT_RULE, HIDDEN_RULE};+use xerj_autoindex::ignore_rules::{+ IgnoreOptions, ESCAPED_ROOT_RULE, HIDDEN_OUTSIDE_ROOT_RULE, HIDDEN_RULE,+};use xerj_autoindex::walk::walk_reporting;/// root/@@ -351,16 +353,30 @@ fn out_of_root_entries_carry_the_resolved_path_and_are_reported_as_escapes() {!report.by_rule.contains_key(HIDDEN_RULE),"there is no dotfile in the operator's folder to blame: {report:?}");+ // Two different refusals, two different labels. `shared-lib` left the root+ // and is plain `symlink:outside-root`; `keys.txt` left it THROUGH `.ssh`,+ // which the opt-in cannot waive, so it carries its own label. Reporting the+ // second as an escape tells an operator who already passed the flag to pass+ // it again; reporting it as a dotfile sends them hunting for one they do+ // not have.let escaped = report.by_rule.get(ESCAPED_ROOT_RULE).copied().unwrap_or_default();- // `keys.txt` is a file link and `shared-lib` a directory link, so they land- // in different counters — one each, not two files.+ let hidden_escape = report+ .by_rule+ .get(HIDDEN_OUTSIDE_ROOT_RULE)+ .copied()+ .unwrap_or_default();assert_eq!((escaped.files, escaped.dirs),- (1, 1),- "both links left the root: {report:?}"+ (0, 1),+ "the ordinary out-of-root link is a plain escape: {report:?}"+ );+ assert_eq!(+ (hidden_escape.files, hidden_escape.dirs),+ (1, 0),+ "the one that left through a dotted component is labelled as such: {report:?}");}