Surfaced by a role-based review; verified against current code (docs/security.md already flags the weakness).
Problem: server/searchToken.ts:26 generates the token with Math.random().toString(36).substring(2) — a non-cryptographic PRNG yielding ~11 low-entropy chars. This token is the CSRF/auth gate for the SearXNG proxy and /inference.
Fix: Use crypto.randomBytes(32).toString("hex") (or crypto.randomUUID()) — a drop-in change.
Files: server/searchToken.ts
Surfaced by a role-based review; verified against current code (
docs/security.mdalready flags the weakness).Problem:
server/searchToken.ts:26generates the token withMath.random().toString(36).substring(2)— a non-cryptographic PRNG yielding ~11 low-entropy chars. This token is the CSRF/auth gate for the SearXNG proxy and/inference.Fix: Use
crypto.randomBytes(32).toString("hex")(orcrypto.randomUUID()) — a drop-in change.Files:
server/searchToken.ts