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(api): add GET /_security/privilege (application privileges)
Vincenzo Lombardoe99ec414909e
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rsindex 0360d4511..16a0d3936 100644--- a/engine/crates/xerj-api/src/es_compat.rs+++ b/engine/crates/xerj-api/src/es_compat.rs@@ -21700,6 +21700,57 @@ pub async fn security_create_api_key(.into_response()}+// ─────────────────────────────────────────────────────────────────────────────+// GET /_security/privilege+// GET /_security/privilege/{application}+// GET /_security/privilege/{application}/{name}+// ─────────────────────────────────────────────────────────────────────────────+// xerj has no application-privilege store: `xerj_engine::rbac::Privilege` is a+// closed enum of index-scoped operations (read/write/admin index, snapshot,+// security admin, audit), a different concept from ES's user-defined+// per-application privilege objects (`application`/`name`/`actions`/+// `metadata`). Kibana polls this endpoint on startup to check/register its+// own `kibana-.kibana` application privileges; the route didn't exist at all,+// so every poll 404'd and Kibana logged "Error registering Kibana Privileges"+// every ~5s (non-fatal, but noisy). Report the honest state instead of a+// missing route: no application privileges are registered, ES-shaped `{}`+// with 200 — that's what real ES returns for "no privileges match", as+// opposed to "this endpoint doesn't exist".++pub async fn security_get_all_privileges(State(_state): State<AppState>) -> impl IntoResponse {+ Json(json!({})).into_response()+}++pub async fn security_get_application_privileges(+ State(_state): State<AppState>,+ Path(_application): Path<String>,+) -> impl IntoResponse {+ Json(json!({})).into_response()+}++pub async fn security_get_privilege(+ State(_state): State<AppState>,+ Path((application, name)): Path<(String, String)>,+) -> impl IntoResponse {+ // Unlike the list forms above, looking up one specific privilege by name+ // is a resource lookup: ES responds 404 when it doesn't exist, matching+ // the convention used for other named-resource lookups in this file+ // (e.g. `get_task_by_id`).+ (+ StatusCode::NOT_FOUND,+ Json(json!({+ "error": {+ "type": "resource_not_found_exception",+ "reason": format!(+ "application privilege [{name}] not found for application [{application}]"+ ),+ },+ "status": 404+ })),+ )+ .into_response()+}+/// Parse an ES time-value expiration (e.g. `"7d"`, `"1h"`, `"30m"`, `"500ms"`)/// into an ABSOLUTE expiration in epoch milliseconds relative to `now_ms`./// Returns `None` when the spec is absent or unparseable — meaning the keydiff --git a/engine/crates/xerj-api/src/router.rs b/engine/crates/xerj-api/src/router.rsindex 645d142d0..2a11e54d2 100644--- a/engine/crates/xerj-api/src/router.rs+++ b/engine/crates/xerj-api/src/router.rs@@ -543,6 +543,18 @@ pub fn build_es_compat_router(state: AppState) -> Router {"/_security/api_key",post(es_compat::security_create_api_key),)+ .route(+ "/_security/privilege",+ get(es_compat::security_get_all_privileges),+ )+ .route(+ "/_security/privilege/:application",+ get(es_compat::security_get_application_privileges),+ )+ .route(+ "/_security/privilege/:application/:name",+ get(es_compat::security_get_privilege),+ )// ── License ───────────────────────────────────────────────────────────.route("/_license",