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.

8.0 KB
Raw Blame

title: "Batch lookup CVE and GHSA IDs offline in one query" h1: "Batch lookup CVE IDs and GHSA IDs offline, without GitHub API rate limits" description: "Load a signed advisory pack and look up CVE, GHSA and RUSTSEC IDs offline with source citations. The recorded six-ID run answered four and abstained on two." slug: "batch-lookup-cve-ghsa-ids-offline" cluster: "Answers for coding agents" question: "How do I batch lookup CVE and GHSA IDs offline without hitting GitHub API rate limits?" intent: "how-to" published: "2026-10-19" updated: "2026-10-31" author: "XERJ documentation team" reviewer: "XERJ engineering team" schema_type: "TechArticle" structured_data: [faq] og_image: "og/answers-batch-lookup-cve-ghsa-ids-offline.png" og_image_alt: "Cover: six advisory IDs flow into one query over the signed rust-vulns pack of 2,033 advisories; four resolve to RUSTSEC or GHSA records, two abstain; 15 ms" queries:

  • "batch lookup CVE and GHSA IDs offline"
  • "batch lookup CVE IDs and GHSA IDs without GitHub API rate limits" commands:
  • cmd: "xerj --insecure --data-dir ./xerj-data" note: "Start a single-user node on localhost:9200 in its own terminal."
  • cmd: "xerj corpus add rust-vulns --from rust-vulns-pack.zip --verify-sig rust-vulns.pub" note: "Install the advisory pack after checking its signature."
  • cmd: "xerj corpus index rust-vulns" note: "Index the RustSec and OSV records into xc-rust-vulns-* indices."
  • cmd: "bash batch.sh" note: "Resolve every ID in ids.txt with one _search; print the record and source, or abstain." evidence:
  • claim: "Six IDs: four resolved, two abstained" source: "benchmarks/agent-intents-2026-10-19/05-batch-output.txt"
  • claim: "The batch script" source: "benchmarks/agent-intents-2026-10-19/05-batch.sh"
  • claim: "xerj code ranked the lz4 advisory first for CVE-2021-25900" source: "benchmarks/agent-intents-2026-10-19/05-xerj-code-exact-id.txt"
  • claim: "Pack load about 1.3 s, index 9,769 ms, batch 15 ms" source: "benchmarks/agent-intents-2026-10-19/README.md"
  • claim: "Batch queries are open as issue #1801" source: "https://github.com/xerj-org/xerj/issues/1801" links_out:
  • "full-text-search-over-jsonl-files-cli"
  • "retrieval-that-says-not-found-with-file-line-citations"
  • "/blog/one-vulnerability-three-names"
  • "/blog/the-exploit-hub"
  • "/compare/xerj-vs-elasticsearch-local"
  • "/case-studies/wordpress-security-audit" faq:
  • q: "How do I batch lookup CVE IDs without the GitHub API?" a: "Download the signed rust-vulns pack once, load it with xerj corpus add and xerj corpus index, then send all IDs in one terms query on id and aliases. Nothing calls the GitHub API after the download."
  • q: "How do I avoid GitHub API rate limits when looking up advisories?" a: "Query a local copy. The pack is a 1,598,960-byte release asset; after that every lookup is a request to your own node on localhost."
  • q: "Can I search vulnerability advisories offline?" a: "Yes, for the advisories in the pack: 2,033 records from RustSec (1,288) and OSV crates.io (745), built 2026-10-19. It covers Rust crates only."
  • q: "How do I cite the source for a CVE's affected versions?" a: "Each record carries source_url and origin, for example crates/smallvec/RUSTSEC-2021-0003.md in rustsec/advisory-db. Print them next to the fixed versions, as the script on this page does."
  • q: "What happens to an ID that is not in the pack?" a: "The script prints NOT FOUND in this pack: abstain. CVE-2024-24576, a Rust standard library CVE, was not in this crate-advisory pack and abstained."
  • q: "Is there a built-in batch command?" a: "Not yet. Many IDs per call with a per-item answer or abstain is issue #1801, open. Today the batch is one _search plus jq."
  • q: "Can I use xerj code with a CVE ID instead?" a: "Not reliably. xerj code rust-vulns \"CVE-2021-25900\" ranked an lz4 advisory first in our run. Exact ID matching in xerj code is issue #1788; use the terms query."

TL;DR — To batch lookup CVE and GHSA IDs offline without GitHub API rate limits, load the signed rust-vulns advisory pack into xerj and resolve every ID in one terms query. Each answer names the source file; unknown IDs abstain. On 2026-10-19, 6 IDs took 15 ms: 4 resolved, 2 abstained. Coverage is Rust crates only.

Run it

Download the zip, the public key and the signature from the GitHub release pack-rust-vulns-2026-10-19. Then install the pack with a signature check.

xerj --insecure --data-dir ./xerj-data &
xerj corpus add rust-vulns --from rust-vulns-pack.zip --verify-sig rust-vulns.pub
xerj corpus index rust-vulns

The add step printed signature verified in about 1.3 s. It loaded 1,288 RustSec and 745 OSV advisories. Indexing the 2,033 advisories took 9,769 ms.

Put the IDs in a file:

CVE-2021-25900
GHSA-9q5j-jm53-v7vr
CVE-2026-35355
RUSTSEC-2023-0071
CVE-2024-24576
CVE-2099-00001

batch.sh sends all of them in one request and matches each ID against id or aliases:

ids=$(jq -R . ids.txt | jq -sc .)
curl -s 'localhost:9200/xc-rust-vulns-*/_search' -H 'content-type: application/json' -d "{
  \"size\": 100,
  \"_source\": [\"id\", \"aliases\", \"packages\", \"fixed_versions\", \"origin\", \"source_url\"],
  \"query\": {\"bool\": {\"should\": [{\"terms\": {\"id\": $ids}}, {\"terms\": {\"aliases\": $ids}}]}}
}" | jq -r --argjson ids "$ids" '
  [.hits.hits[]._source] as $h
  | $ids[] as $q
  | ($h | map(select(.id == $q or ((.aliases // []) | index($q)))) | first) as $r
  | if $r then "\($q)  \($r.id)  \(($r.packages // []) | join(","))  fixed \(($r.fixed_versions // []) | join(","))  src \($r.source_url) :: \($r.origin)"
    else "\($q)  NOT FOUND in this pack: abstain" end'

Real output, 15 ms wall time:

CVE-2021-25900  RUSTSEC-2021-0003  smallvec  fixed 0.6.14,1.6.1  src https://github.com/rustsec/advisory-db :: crates/smallvec/RUSTSEC-2021-0003.md
GHSA-9q5j-jm53-v7vr  RUSTSEC-2022-0051  lz4-sys  fixed 1.9.4  src https://github.com/rustsec/advisory-db :: crates/lz4-sys/RUSTSEC-2022-0051.md
CVE-2026-35355  GHSA-239g-2685-54x3  uu_install  fixed 0.6.0  src https://osv-vulnerabilities.storage.googleapis.com/crates.io/all.zip :: GHSA-239g-2685-54x3.json
RUSTSEC-2023-0071  RUSTSEC-2023-0071  rsa  fixed   src https://github.com/rustsec/advisory-db :: crates/rsa/RUSTSEC-2023-0071.md
CVE-2024-24576  NOT FOUND in this pack: abstain
CVE-2099-00001  NOT FOUND in this pack: abstain

RUSTSEC-2023-0071 shows no fixed version because the advisory lists none. A trailing wildcard (xc-rust-vulns-*) is the pattern that worked; see the last section for the two that did not.

Measured on 2026-10-19

Measure Value
Pack rust-vulns, 1,598,960 bytes, 2,033 advisories, built 2026-10-19
Signature check and load about 1.3 s
Index 9,769 ms
Batch of 6 IDs, one request 15 ms wall time
Resolved / abstained 4 / 2
GitHub API calls after download 0

How it compares

Approach Offline Rate limit Many IDs per call Source per answer Coverage
xerj + rust-vulns pack yes none, local yes, one terms query yes, file in advisory-db or OSV Rust crates
GitHub advisory REST API no yes, per token no, one cve_id per request yes GitHub ecosystems
OSV.dev API no service limits yes, querybatch yes many ecosystems
cargo audit after DB fetch none per lockfile, not per ID yes Rust crates
Chat model depends depends yes no, may invent an ID training data

When not to use xerj

  • Your IDs are not Rust crates. The pack holds RustSec and OSV crates.io advisories only; npm, PyPI and Go are not in it.
  • You need advisories published since the build date. The pack was built 2026-10-19 and does not update itself.
  • You want to audit a Cargo.lock. cargo audit does that directly.
  • You need _msearch or a mid-name wildcard. On rc.97, _msearch with xc-rust-vulns-* returned 404 index_not_found, and _search on xc-rust-vulns-*-rustsec returned 0 hits without an error. Use the trailing wildcard as above.