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.

fix(deps): zip 9 for RUSTSEC-2026-0367/0368/0369 (cargo-audit red on every PR) (#1869)

xerj-org0e9a4fd56daf
diff --git a/engine/.cargo/audit.toml b/engine/.cargo/audit.toml
new file mode 100644
index 000000000..ab426ffc6
--- /dev/null
+++ b/engine/.cargo/audit.toml
@@ -0,0 +1,31 @@
+# cargo-audit configuration (read by `cargo audit` run from engine/, as CI does).
+#
+# Policy: every RUSTSEC *vulnerability* fails CI unless it is listed here with
+# a justification that says why it cannot reach us AND what removes the entry.
+# Keep this list as short as possible; delete an entry as soon as it is fixable.
+
+[advisories]
+ignore = [
+ # zip < 9.0.0 — RUSTSEC-2026-0367 (SUID/SGID bits preserved on extract),
+ # RUSTSEC-2026-0368 (extract creates symlinks pointing outside the dest dir),
+ # RUSTSEC-2026-0369 (extract applies Unix permissions through symlinks).
+ #
+ # Every zip we depend on directly or through autoindex (calamine 0.37,
+ # office_oxide 0.1.15, xerj-autoindex itself) is on the fixed zip 9.x line.
+ # The only remaining vulnerable copy is zip 7.2.0, pulled in by
+ # candle-core 0.9.2 (optional `neural` / `decide-local` features of
+ # xerj-ai). No candle-core release depends on zip >= 9 (latest 0.11.0 still
+ # requires zip ^8.6), so it cannot be upgraded yet.
+ #
+ # Not reachable: all three advisories are in `ZipArchive::extract` /
+ # `ZipStreamReader::extract` (writing archive entries to disk). candle-core
+ # only opens .npz/.pth files with `ZipArchive::new` and reads named entries
+ # into memory (src/npy.rs, src/pickle.rs); it never calls `extract`. XERJ
+ # itself only loads `model.safetensors` through candle (xerj-ai
+ # neural.rs), so even those zip readers are not on any code path we use.
+ #
+ # Remove these three entries when candle-core ships with zip >= 9.0.0.
+ "RUSTSEC-2026-0367",
+ "RUSTSEC-2026-0368",
+ "RUSTSEC-2026-0369",
+]
diff --git a/engine/Cargo.lock b/engine/Cargo.lock
index 4359b5a3c..cea4bc70c 100644
--- a/engine/Cargo.lock
+++ b/engine/Cargo.lock
@@ -956,9 +956,9 @@ dependencies = [
[[package]]
name = "calamine"
-version = "0.36.1"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fa68281b1a76b54a62156474adb06bb380a67e07dd60656e3217152b42183f3"
+checksum = "c9ca341b94bc4b29e08970b1a03914fad2dfe177e2ecb67fcd6de9046004aafb"
dependencies = [
"atoi_simd",
"byteorder",
@@ -967,9 +967,9 @@ dependencies = [
"encoding_rs",
"fast-float2",
"log",
- "quick-xml",
+ "quick-xml 0.42.0",
"serde",
- "zip 8.6.0",
+ "zip 9.0.5",
]
[[package]]
@@ -3169,9 +3169,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "libc"
-version = "0.2.185"
+version = "0.2.191"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
[[package]]
name = "libm"
@@ -3532,6 +3532,18 @@ dependencies = [
"libc",
]
+[[package]]
+name = "nix"
+version = "0.31.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
+dependencies = [
+ "bitflags 2.11.1",
+ "cfg-if",
+ "cfg_aliases",
+ "libc",
+]
+
[[package]]
name = "nom"
version = "7.1.3"
@@ -3694,20 +3706,20 @@ dependencies = [
[[package]]
name = "office_oxide"
-version = "0.1.8"
+version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "317c254cebe5b87c74a0fbd84e889d51ec0c4db885fa5aca98700ad85fd9ec5f"
+checksum = "7993e747e60a6b06c8c0b7060f0bd7f7e8e03921f18a4b42b23738ff276a4715"
dependencies = [
"atoi_simd",
"encoding_rs",
"fast-float2",
- "libc",
+ "flate2",
"log",
- "quick-xml",
+ "quick-xml 0.42.0",
"serde",
"serde_json",
"thiserror 2.0.18",
- "zip 8.6.0",
+ "zip 9.0.5",
]
[[package]]
@@ -3909,7 +3921,7 @@ dependencies = [
"nom 8.0.0",
"office_oxide",
"phf 0.14.0",
- "quick-xml",
+ "quick-xml 0.41.0",
"regex",
"serde",
"serde_json",
@@ -4174,7 +4186,7 @@ dependencies = [
"findshlibs",
"libc",
"log",
- "nix",
+ "nix 0.26.4",
"once_cell",
"prost 0.12.6",
"prost-build 0.12.6",
@@ -4451,6 +4463,15 @@ name = "quick-xml"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "quick-xml"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b"
dependencies = [
"encoding_rs",
"memchr",
@@ -7386,7 +7407,7 @@ dependencies = [
"memchr",
"notify",
"pdf_oxide",
- "quick-xml",
+ "quick-xml 0.41.0",
"rayon",
"regex",
"reqwest",
@@ -7440,7 +7461,7 @@ dependencies = [
"walkdir",
"xerj-common",
"xxhash-rust",
- "zip 8.6.0",
+ "zip 9.0.5",
]
[[package]]
@@ -7965,14 +7986,15 @@ dependencies = [
[[package]]
name = "zip"
-version = "8.6.0"
+version = "9.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
+checksum = "6e04976da629d3b04204ba8105b396a193af8ad2583b2c79bfb3ab8af580a11e"
dependencies = [
"crc32fast",
"flate2",
"indexmap 2.14.0",
"memchr",
+ "nix 0.31.3",
"typed-path",
"zopfli",
]
diff --git a/engine/crates/xerj-autoindex/Cargo.toml b/engine/crates/xerj-autoindex/Cargo.toml
index cc2efb0cb..706572acf 100644
--- a/engine/crates/xerj-autoindex/Cargo.toml
+++ b/engine/crates/xerj-autoindex/Cargo.toml
@@ -132,16 +132,17 @@ flate2 = "1" # gzip streaming (rust backend)
pdf_oxide = { version = "=0.3.75", default-features = false, features = ["legacy-crypto"] }
csv = "1" # streaming CSV with sniffed dialect
quick-xml = "0.41" # XML pull parser + DOCX internals
-zip = { version = "8", default-features = false, features = ["deflate"] } # DOCX container
+zip = { version = "9", default-features = false, features = ["deflate"] } # DOCX container
# --- Legacy Microsoft Office binary formats (OLE2 / Compound File Binary) ---
# calamine reads the legacy BIFF `.xls` worksheet stream (it ships its own CFB
-# reader internally); pinned to 0.36.1, which depends on `zip ^8.6` and
-# `quick-xml ^0.41` so it shares this crate's `zip 8` and `quick-xml 0.41`
-# majors without retaining `quick-xml 0.31.0` (RUSTSEC-2026-0194 / 0195).
+# reader internally); pinned to 0.37.0, which depends on `zip ^9` (the
+# zip 8.x line carries RUSTSEC-2026-0367/0368/0369, fixed in 9.0.0) so it
+# shares this crate's `zip 9` major, and never retains `quick-xml 0.31.0`
+# (RUSTSEC-2026-0194 / 0195); it brings `quick-xml 0.42` alongside our 0.41.
# Licence: MIT. Its transitive adds are codepage (MIT, for the legacy 8-bit
# cell codepage) and log (MIT/Apache-2.0); byteorder and encoding_rs are
# already here.
-calamine = { version = "=0.36.1", features = ["dates"] }
+calamine = { version = "=0.37.0", features = ["dates"] }
# `cfb` reads the OLE2/Compound File Binary container directly: used by the
# content sniffer to route a `.doc`/`.xls`/other OLE2 file by its stream names,
# and by the `.doc` extractor to pull the WordDocument + Table streams and the
diff --git a/engine/crates/xerj-autoindex/src/extract/pptx.rs b/engine/crates/xerj-autoindex/src/extract/pptx.rs
index b542bba60..fc099cb42 100644
--- a/engine/crates/xerj-autoindex/src/extract/pptx.rs
+++ b/engine/crates/xerj-autoindex/src/extract/pptx.rs
@@ -187,6 +187,8 @@ fn slide_order<R: Read + Seek>(z: &mut zip::ZipArchive<R>, budget: &mut Budget)
let mut numbered: Vec<(u32, String)> = z
.file_names()
.filter_map(|n| {
+ // zip 9: entry names are fallible (non-UTF-8 names); skip those.
+ let n = n.ok()?;
let num = n.strip_prefix("ppt/slides/slide")?.strip_suffix(".xml")?;
Some((num.parse().ok()?, n.to_string()))
})
diff --git a/engine/crates/xerj-autoindex/src/extract/xlsx.rs b/engine/crates/xerj-autoindex/src/extract/xlsx.rs
index a57905b65..2b522ac16 100644
--- a/engine/crates/xerj-autoindex/src/extract/xlsx.rs
+++ b/engine/crates/xerj-autoindex/src/extract/xlsx.rs
@@ -223,6 +223,8 @@ fn sheet_parts<R: Read + Seek>(
let mut numbered: Vec<(u32, String)> = z
.file_names()
.filter_map(|n| {
+ // zip 9: entry names are fallible (non-UTF-8 names); skip those.
+ let n = n.ok()?;
let num = n
.strip_prefix("xl/worksheets/sheet")?
.strip_suffix(".xml")?;
diff --git a/engine/crates/xerj-autoindex/src/harvest/source.rs b/engine/crates/xerj-autoindex/src/harvest/source.rs
index bba2d46a7..d5bdaee74 100644
--- a/engine/crates/xerj-autoindex/src/harvest/source.rs
+++ b/engine/crates/xerj-autoindex/src/harvest/source.rs
@@ -195,7 +195,11 @@ pub fn extract_zip(zip: &Path, dest: &Path) -> Result<usize> {
skipped += 1;
continue;
}
- let raw = entry.name().to_string();
+ // zip 9: an entry name that cannot be decoded is skipped like an unsafe one.
+ let Ok(raw) = entry.name().map(|n| n.to_string()) else {
+ skipped += 1;
+ continue;
+ };
let Some(safe) = sanitize_entry_path(&raw) else {
skipped += 1;
continue;
diff --git a/engine/crates/xerj-autoindex/src/sniff.rs b/engine/crates/xerj-autoindex/src/sniff.rs
index 6fafa396d..9a2ffcd5a 100644
--- a/engine/crates/xerj-autoindex/src/sniff.rs
+++ b/engine/crates/xerj-autoindex/src/sniff.rs
@@ -1245,7 +1245,7 @@ fn zip_container_kind<R: Read + std::io::Seek>(z: &mut zip::ZipArchive<R>) -> &'
}
}
// numpy.savez: a zip of `.npy` members.
- if !z.is_empty() && z.file_names().all(|n| n.ends_with(".npy")) {
+ if !z.is_empty() && z.file_names().all(|n| n.is_ok_and(|n| n.ends_with(".npy"))) {
return "npz";
}
let mut mime = Vec::with_capacity(64);