Repository navigation
security(audit): server-derived machine-traffic class in audit entries - #1194
Merged
Merged
Conversation
Two enterprise-config defects from #1189/#1190, both about a configured proxy silently not being the proxy. #1189 — explicit embedding.mode="proxy" with an unusable endpoint (startup): the empty-endpoint and EmbeddingProxy::new failure paths in make_embedder warned and returned Embedder::lexical(); the node came up "healthy" and every embedding request then wrote lexical feature-hash vectors into the index while /v1/embedding/identity reported backend:lexical for a config that said proxy. The reporter's htp:// typo produced exactly this. Fail closed in three places that must agree: - xerj-server boot: explicit proxy validates endpoint presence and proxy construction, mirroring the onnx-experimental boot contract (engine's proxy_config now pub for reuse, no duplicated mapping). - make_embedder: explicit proxy errors; auto (endpoint set, mode not pinned) keeps the documented warn+lexical fallback. - embedding_execution_identity: explicit proxy errors instead of degrading to lexical; auto keeps the fallback. This is what the autoindex resume guard and /v1/embedding/identity consume. Live verification (rc.85 binary + this fix): --embed-mode proxy, no endpoint -> exit 1 "requires embedding.default_endpoint ... remove mode=proxy (use auto)" --embed-mode proxy, htp:// typo -> exit 1 "failed to initialize: embedding endpoint must use http or https" --embed-mode auto -> boots, serves, identity lexical xerj autoindex also now names the live backend in its run output (pr.note at the identity pin), so a degraded backend is visible where the indexing work happens. #1190 — embedding.batch_size ("Maximum documents per embedding API call (default: 64)") had no reader: one _bulk of 20 docs left the proxy as a single 20-input request; an autoindex run was observed sending a 192-input request. Providers cap the request input array (OpenAI 2048, self-hosted gateways often far lower). EmbeddingProxyConfig gains batch_size (serde default 64); embed_batch_with_model splits texts into chunks of at most batch_size and runs them concurrently through try_join_all — one semaphore permit per chunk, so the semaphore now limits in-flight HTTP requests (its purpose) rather than logical batches; per-chunk retry/backoff unchanged; vectors reassembled in input order. Test: batch_size_splits_requests_and_preserves_order (mock endpoint, 10 texts / batch 4 -> requests of 4/4/2 inputs, output order preserved across chunk boundaries). Engine tests rewritten for the new contract: explicit proxy with "", "not a url", "file://..." errors at identity and embedder; auto/""/unknown mode with a broken endpoint still resolves lexical. Full xerj-engine --lib green except the known co-tenant flush flake (passes on rerun, untouched here); xerj-autoindex --lib 1254 passed; release build clean. Reference-code mandate: skipped — this is this repository's own config validation and a request-chunking loop over our own proxy client; no peer-engine subsystem is involved. Files: - crates/xerj-ai/src/embed.rs batch_size field + chunked dispatch - crates/xerj-engine/src/index.rs make_embedder + identity fail-closed, proxy_config pub, tests - crates/xerj-server/src/main.rs boot validation for explicit proxy - crates/xerj-autoindex/src/lib.rs run output names live backend - crates/xerj-common/src/config.rs mode docs state the contract
…xpect is denied)
#1109) Problem: audit search entries recorded WHO issued a query (subject) but not WHO IT SERVED. The only machine/user separation available was the client-side heuristic in `xerj gain` (#1105): parse `size=0` out of the note string, match resource == "autoindex-catalog". That is re-derivation of a classification the server already knew at append time, breakable by any note-format change, and spoofable by anything that can write audit-shaped entries (a client-set marker was proposed as `X-Xerj-Internal` during #1107 and rejected as spoofable; that decision stands and this is the replacement). Fix: every AuditEntry now carries `actor: "user"|"machine"`, derived at append time by the SERVER alone, from the request's own semantics: machine iff size == 0 (a counting probe: asks for no hits back) or the target is the autoindex catalog (a maintenance index no person searches) `search_actor_class(size, index)` in es_compat.rs is the single derivation, deliberately a function of nothing a client can set. The search handler calls the new `audit.append_as(actor, ...)`; every other call site keeps `append()`, whose default is "user" — the writes and security ops are all request-driven user traffic. Tamper-evidence: actor is in compute_hash's input, so flipping an entry user->machine (the dodge that would remove unfavourable traffic from the gain hit-rate denominator) breaks the chain like any other edit. Mixed-version logs: serde `default = "default_actor"` loads fieldless pre-#1109 entries as "user" — which is what they all were — and the hash recomputes over that deserialized default, so a log spanning the upgrade still verifies (pinned by test: hand-strip the field from one line of a persisted log, reopen, verify ok, keep appending). Consumer: `xerj gain` (xerj-autoindex/gain.rs) prefers the field when present and keeps the note/resource derivation ONLY as the legacy fallback for entries written by older binaries — an upgraded install whose ring still holds pre-#1109 entries must not report a hit-rate dip that is really version skew. The probe/sweep counters keep their split inside machine traffic for the existing honesty line. The catalog index name moved to xerj-common::AUTOINDEX_CATALOG_INDEX (single source of truth) because the classifier (xerj-api) and the name's owner (xerj-autoindex::catalog) do not share a dependency edge; both now read the constant. Tests: 735/1256/337 lib tests green in xerj-engine/xerj-autoindex/ xerj-api; new pins — actor flip breaks the chain; mixed-version log verifies; actor field authoritative over note heuristics; catalog-named DATA index ("autoindex-catalog-copy") stays user; clippy clean.
Merged
neoneye
pushed a commit
to agent-memory-atlas-archive/xerj-org--xerj
that referenced
this pull request
Oct 10, 2026
Fifth daily release cut. The window was dominated by the xerj-org#1109 security audit fixes and the config/telemetry honesty items, plus the first code contribution from a third external contributor. Window (v1.0.0-rc.85..main, PRs all cited in the CHANGELOG): - Security: xerj-org#1109 closed by PR xerj-org#1194 (audit remediation, Security section added to the notes) - Fixed: xerj-org#1158 (build-time half, PR xerj-org#1185, stays open on the issue), xerj-org#1189 + xerj-org#1190 (PR xerj-org#1193), xerj-org#1186 (PR xerj-org#1188), xerj-org#1146 (PR xerj-org#1177) and xerj-org#1092 (PR xerj-org#1184) - both Vincenzo Lombardo, xerj-org#1146 his first merged fix; _doc arrival order (xerj-org#1127, Saurav Kumar, his first code contribution) - Field reports: xerj-org#1178 (Vinz2168), xerj-org#1187 (thomas-villani) - Metrics chore 15b62f5 cited as a Community line (direct commit, [ski 7F0A p ci], rc.85 precedent) Roll mechanics: - engine/Cargo.toml workspace version 1.0.0-rc.86; Cargo.lock regenerated (version-only diff verified: 0 non-version lines) - CHANGELOG: fresh [Unreleased], rc.86 section, new Community section - ROADMAP: Last-reviewed pass for the cut (docs_capability_lists gate requires it), rc.86 paragraph in Next release, Open defects shortlist rolled to the eleven live trackers - landing footers: V1.0.0-RC.85 -> V1.0.0-RC.86 (91), lowercase variant (1); zero rc.85 patterns remain - release-notes-gate.sh run locally before this commit: PASS on freshness, issue-state (11 open-defect checks, 6 Fixed checks incl. the xerj-org#1158 stays-open marker) and coverage (9 window PRs) In flight past the cut: phase-B bulk coalescing for xerj-org#1147 (PR xerj-org#1195, sticky-failure fix + 8-in-flight wire concurrency, rustsec 10.1s->9.7s / pysec 17.4s->16.9s vs rc.85 on the loopback A/B), merges into the rc.87 window.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1109.
Problem
The audit log's search entries record WHO issued a query (
subject) but not WHO IT SERVED. The only machine/user separation available was the client-side heuristicxerj gainshipped with #1105 — parsesize=0out of the note string, matchresource == "autoindex-catalog"— which is re-derivation of a classification the server already knew at append time, breakable by any note-format change, and satisfiable by anything that can write audit-shaped entries. (A client-set marker was proposed asX-Xerj-Internalduring #1107 and rejected as spoofable; that decision stands — this is the replacement.)Fix
Every
AuditEntrynow carriesactor: "user"|"machine", derived at append time by the SERVER alone, from the request's own semantics:size == 0— a counting probe: it asks for no hits back (autoindex verification reads back group counts this way; gain: hit-rate and latency are polluted by autoindex internal count-poll searches (179 size-0 "searches" logged as user queries) #1105 measured 179 of them in one onboarding window).autoindex-catalog— a maintenance index no person searches.search_actor_class(size, index)ines_compat.rsis the single derivation, deliberately a function of nothing a client can set. The search handler calls the newaudit.append_as(actor, ...); every other call site keepsappend()(default"user") — writes and security ops are request-driven user traffic.Tamper-evidence: the actor class is in
compute_hash's input, so flipping an entry user→machine — the dodge that would remove unfavourable traffic from the gain hit-rate denominator — breaks the chain like any other edit.Mixed-version logs: serde
defaultloads fieldless pre-#1109 entries as"user"(which is what they all were), and the hash recomputes over that deserialized default, so a log spanning the upgrade still verifies.Consumer:
xerj gainprefers the field when present and keeps the note/resource derivation only as the documented legacy fallback for entries written by older binaries — an upgraded install whose ring still holds pre-#1109 entries must not report a hit-rate dip that is really version skew.The catalog index name moved to
xerj_common::AUTOINDEX_CATALOG_INDEX(single source of truth): the classifier (xerj-api) and the name's owner (xerj-autoindex) do not share a dependency edge, so both read the constant from common.Tests
actorfield authoritative over note heuristics (machine with unparseable note still excluded; user withsize=0stays user — one classifier, the server's)autoindex-catalog-copy(a catalog-named DATA index) stays userReference-code mandate: skipped, stated — this is audit-log record shape and its own consumer inside this repository; no peer-engine subsystem applies.