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 POST /_security/profile/_activate (fixes Kibana login 500)
Vincenzo Lombardo45924f0ba4eb
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rsindex 0360d4511..b131dca98 100644--- a/engine/crates/xerj-api/src/es_compat.rs+++ b/engine/crates/xerj-api/src/es_compat.rs@@ -21630,6 +21630,51 @@ pub async fn security_authenticate(State(_state): State<AppState>) -> impl IntoR.into_response()}+// ─────────────────────────────────────────────────────────────────────────────+// POST /_security/profile/_activate — activate/create a user profile+// ─────────────────────────────────────────────────────────────────────────────+// The route didn't exist at all (no handler, not registered in router.rs), so+// every call hit axum's default "no route matched" response: a bodyless 404.+// Kibana calls this right after a successful login to get a profile UID for+// the authenticated user; its client expects an ES-shaped JSON body back+// (success or error) and throws on the empty 404, which Kibana's own server+// then surfaces to the browser as a 500 ("Failed to activate user profile: "+// — the empty reason is Kibana failing to parse a reason out of nothing).+// xerj was never actually returning 500 itself; the fix is simply to+// implement the endpoint.+//+// Same single-owner identity model as `security_authenticate` — xerj has no+// multi-user store, so every grant (password or access_token) activates the+// same built-in superuser profile. The uid is a fixed constant rather than+// content-derived from the submitted credentials, so repeated logins (and+// Kibana state keyed on this uid, e.g. space favorites) stay stable.+pub async fn security_activate_user_profile(+ State(_state): State<AppState>,+ body: Option<Json<Value>>,+) -> impl IntoResponse {+ let _ = body;+ let now_ms = Utc::now().timestamp_millis().max(0);+ Json(json!({+ "uid": "u_xerj-superuser-0000000000000000000000000000000000000_0",+ "enabled": true,+ "last_synchronized": now_ms,+ "user": {+ "username": "xerj",+ "roles": ["superuser"],+ "realm_name": "native",+ "full_name": "Xerj Administrator",+ "email": null+ },+ "labels": {},+ "data": {},+ "_doc": {+ "_primary_term": 1,+ "_seq_no": 0+ }+ }))+ .into_response()+}+// ─────────────────────────────────────────────────────────────────────────────// POST /_security/api_key — create API key (stub: returns admin key)// ─────────────────────────────────────────────────────────────────────────────diff --git a/engine/crates/xerj-api/src/router.rs b/engine/crates/xerj-api/src/router.rsindex 645d142d0..3eabc9910 100644--- a/engine/crates/xerj-api/src/router.rs+++ b/engine/crates/xerj-api/src/router.rs@@ -539,6 +539,10 @@ pub fn build_es_compat_router(state: AppState) -> Router {"/_security/_authenticate",get(es_compat::security_authenticate),)+ .route(+ "/_security/profile/_activate",+ post(es_compat::security_activate_user_profile),+ ).route("/_security/api_key",post(es_compat::security_create_api_key),