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.

docs: the first-run admin key is not printed (#1710)

xerj-orgf9dcf626a11e
diff --git a/engine/crates/xerj-common/tests/admin_key_not_printed.rs b/engine/crates/xerj-common/tests/admin_key_not_printed.rs
new file mode 100644
index 000000000..feea061fe
--- /dev/null
+++ b/engine/crates/xerj-common/tests/admin_key_not_printed.rs
@@ -0,0 +1,46 @@
+//! The first-run banner names `<data_dir>/admin.key` and does not print the
+//! key (see `first_run_admin_key_notice`). These pages used to say the
+//! opposite, so an agent waited for a secret that never appears.
+
+use std::path::PathBuf;
+
+fn repo(rel: &str) -> String {
+ let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+ .join("../../..")
+ .join(rel);
+ std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("read {}: {e}", path.display()))
+}
+
+#[test]
+fn first_run_docs_do_not_say_the_key_is_printed() {
+ let security = repo("landing/docs/security.html");
+ assert!(
+ security.contains("does not print the key"),
+ "security.html must say the banner does not print the key"
+ );
+ assert!(
+ !security.contains("printed in a startup banner"),
+ "security.html still says the key is printed"
+ );
+
+ let quickstart = repo("landing/docs/quickstart.html");
+ assert!(quickstart.contains("does not print the key"));
+ assert!(
+ !quickstart.contains("prints it, and writes it"),
+ "quickstart.html still says the key is printed"
+ );
+
+ let install = repo("landing/docs/install.html");
+ assert!(install.contains("without printing the key"));
+ assert!(
+ !install.contains("prints an auto-generated admin API key"),
+ "install.html still says the key is printed"
+ );
+
+ let full = repo("landing/llms-full.txt");
+ assert!(full.contains("does not print it, and writes it to `<data_dir>/admin.key`"));
+ assert!(
+ !full.contains("prints it, and writes it to `<data_dir>/admin.key`"),
+ "llms-full.txt still says the key is printed"
+ );
+}
diff --git a/landing/docs/install.html b/landing/docs/install.html
index 2f775401e..98c237694 100644
--- a/landing/docs/install.html
+++ b/landing/docs/install.html
@@ -291,7 +291,7 @@ data_dir = "/var/lib/xerj"
[auth]
enabled = true</pre>
- <p>With <code class="inline">auth.enabled = true</code>, the first start prints an auto-generated admin API key and writes it to <code class="inline">&lt;data_dir&gt;/admin.key</code> — every native-API request (including health) must send it, and so must the CLI clients that talk to this node (see <a href="#first-index">Index your first folder</a> below). For TLS, either set <code class="inline">[tls] enabled = true</code> with a PEM <code class="inline">cert_path</code> and <code class="inline">key_path</code> (in-process rustls on ports 8080/9200; see <a href="/docs/security">Auth &amp; TLS</a>), or terminate TLS at a reverse proxy (nginx/caddy) in front of those ports. The gRPC port 8081 stays plaintext h2c either way.</p>
+ <p>With <code class="inline">auth.enabled = true</code>, the first start writes an auto-generated admin API key to <code class="inline">&lt;data_dir&gt;/admin.key</code> and the banner names that file without printing the key — every native-API request (including health) must send it, and so must the CLI clients that talk to this node (see <a href="#first-index">Index your first folder</a> below). For TLS, either set <code class="inline">[tls] enabled = true</code> with a PEM <code class="inline">cert_path</code> and <code class="inline">key_path</code> (in-process rustls on ports 8080/9200; see <a href="/docs/security">Auth &amp; TLS</a>), or terminate TLS at a reverse proxy (nginx/caddy) in front of those ports. The gRPC port 8081 stays plaintext h2c either way.</p>
<h2>Run as a systemd unit</h2>
<p>Create the service user first — <code class="inline">StateDirectory</code> then gives it <code class="inline">/var/lib/xerj</code> automatically:</p>
diff --git a/landing/docs/quickstart.html b/landing/docs/quickstart.html
index a525bcb54..30323b583 100644
--- a/landing/docs/quickstart.html
+++ b/landing/docs/quickstart.html
@@ -233,7 +233,7 @@
<p>XERJ is a single static binary and needs no config file to start. Run it in dev mode — <code class="inline">--insecure</code> turns off TLS <strong>and</strong> API-key auth, which is what lets the bare <code class="inline">curl</code>s in the rest of this page work:</p>
<pre class="code">$ xerj --insecure --data-dir ./data</pre>
<p>That flag is a trust boundary, not a convenience: with auth off, every caller that can reach the port is a superuser who can read and delete every index — including every <code class="inline">/_memory</code> namespace. It is meant for one user on a dev machine, and it is safe there because a fresh node binds <code class="inline">127.0.0.1</code> only; a cleartext bind on any other interface refuses to start unless you set <code class="inline">server.allow_insecure_network_bind</code>. Anything shared or exposed wants the auth-on start below, plus TLS — see <a href="/docs/security">Auth &amp; TLS</a>.</p>
- <p>Auth is <strong>on by default</strong>. Any node started <em>without</em> <code class="inline">--insecure</code> — including one started from a config file, and including the config in the <a href="/docs/install">install guide</a> — mints an admin key on first boot, prints it, and writes it to <code class="inline">&lt;data_dir&gt;/admin.key</code>. Every client then has to send it, the CLI included:</p>
+ <p>Auth is <strong>on by default</strong>. Any node started <em>without</em> <code class="inline">--insecure</code> — including one started from a config file, and including the config in the <a href="/docs/install">install guide</a> — mints an admin key on first boot and writes it to <code class="inline">&lt;data_dir&gt;/admin.key</code>. The startup banner names that file and does not print the key. Every client then has to send it, the CLI included:</p>
<pre class="code">$ xerj --config xerj.toml # see /docs/config for the keys
$ export XERJ_API_KEY="$(cat ./data/admin.key)" # data_dir defaults to ./data
$ curl -s -H "Authorization: ApiKey $XERJ_API_KEY" http://localhost:8080/v1/health
diff --git a/landing/docs/security.html b/landing/docs/security.html
index c822b592f..5ab561243 100644
--- a/landing/docs/security.html
+++ b/landing/docs/security.html
@@ -226,7 +226,7 @@
<h2 id="api-key">API-key auth</h2>
<p>Every request is required to carry <code class="inline">Authorization: ApiKey &lt;key&gt;</code> when <code class="inline">[auth] enabled = true</code> — which is the default, so a node started without <code class="inline">--insecure</code> demands a key whether or not you wrote a config. <code class="inline">Bearer &lt;key&gt;</code> and <code class="inline">Basic base64(user:&lt;key&gt;)</code> are accepted too, but <code class="inline">ApiKey</code> is the scheme the engine documents and the one every XERJ client sends.</p>
- <p>An admin key is auto-generated on first run if <code class="inline">admin_api_key</code> is blank — a 64-character hex string, printed in a startup banner and written to <code class="inline">&lt;data_dir&gt;/admin.key</code> with mode <code class="inline">0600</code>. It is <strong>not</strong> stored next to the config, and it is reused on restart rather than regenerated.</p>
+ <p>An admin key is auto-generated on first run if <code class="inline">admin_api_key</code> is blank — a 64-character hex string, written to <code class="inline">&lt;data_dir&gt;/admin.key</code> with mode <code class="inline">0600</code>. The startup banner names that file and does not print the key. It is <strong>not</strong> stored next to the config, and it is reused on restart rather than regenerated.</p>
<pre class="code">$ cat /var/lib/xerj/admin.key
4f2c9e17b83a0d5641fe72c8b90a3d5e17c46b8f92a0e35d7148bc6a03f9e2d1
diff --git a/landing/llms-full.txt b/landing/llms-full.txt
index 704e849bf..925cae5a9 100644
--- a/landing/llms-full.txt
+++ b/landing/llms-full.txt
@@ -117,7 +117,7 @@ Handshake:
Auth:
- A node started with `--insecure` requires no auth (that flag disables TLS AND auth).
- Otherwise auth is ON by default: the node generates an admin API key on first run,
- prints it, and writes it to `<data_dir>/admin.key` (0600, reused on later starts).
+ does not print it, and writes it to `<data_dir>/admin.key` (0600, reused on later starts).
Send it as `Authorization: ApiKey <key>`. See https://xerj.org/docs/security
- The `autoindex` CLI takes `--api-key <K>` or env `XERJ_API_KEY`.
diff --git a/landing/sitemap.xml b/landing/sitemap.xml
index a443f8126..84225e203 100644
--- a/landing/sitemap.xml
+++ b/landing/sitemap.xml
@@ -634,7 +634,7 @@
</url>
<url>
<loc>https://xerj.org/docs/security</loc>
- <lastmod>2026-10-16</lastmod>
+ <lastmod>2026-10-17</lastmod>
</url>
<url>
<loc>https://xerj.org/docs/storage</loc>