diff --git a/app/main.py b/app/main.py index b84b7c5..ede3be7 100644 --- a/app/main.py +++ b/app/main.py @@ -5585,6 +5585,17 @@ async def admin_librechat_keys(request: Request): can seed LibreChat's user-key store and members never see an API-key prompt (chat bills to the member's own LiteLLM team/budget). Auth is the dedicated X-Sync-Token header — NOT the admin token. + + DELIBERATE DESIGN (audit M2, 2026-11-05): one static token returns every + member's decrypted chat key — a total-member-key blast radius. Kept (not + per-member fetch) because the only consumer is the LibreChat sandbox's + in-app key-sync, and scoping the feed per member would require changing + the sandbox's sync identity model; a wrong change there stops key seeding + for every member at once. Recorded in ops-docs + (maintenance/librechat-key-feed.md). Monitoring: every fetch is logged + (count only, never key material) and the daily digest watches the rate — + the sandbox polls ~every 10 min, so anything far above that cadence (or a + 401 burst on this route) is surfaced as an anomaly. """ _verify_sync_token(request) @@ -5593,6 +5604,11 @@ async def admin_librechat_keys(request: Request): "SELECT email, key_token FROM members WHERE active = 1 AND key_token != ''" ).fetchall() conn.close() + logger.warning( + "librechat key feed served: %d member key(s) to %s (ua=%s)", + len(rows), request.client.host if request.client else "?", + (request.headers.get("user-agent") or "?")[:60], + ) return { "members": [ {"email": email, "key": decrypt_key(key_token)}