fix(audit): sécurité + perf + DB — 40 problèmes adressés
SÉCURITÉ (CRITIQUE): - link-preview: auth() obligatoire + filtre IP privées (SSRF fix) - metrics: !metricsToken → 401 au lieu d'etre ouvert si token absent - contextual-ai-chat: DOMPurify.sanitize() sur dangerouslySetInnerHTML (XSS fix) PERFORMANCE: - graph/route.ts: take:500 + orderBy updatedAt desc (pas de full table scan) - syncAllEmbeddings: batch parallèle Promise.allSettled × 5 (pas séquentiel) - 80 console.log supprimés du code production BASE DE DONNÉES: - Note: index contentUpdatedAt + isPublic ajoutés au schema - DocumentChunk: commentaire index vectoriel HNSW (à exécuter manuellement)
This commit is contained in:
@@ -237,6 +237,8 @@ model Note {
|
||||
@@index([reminder])
|
||||
@@index([userId])
|
||||
@@index([userId, notebookId])
|
||||
@@index([contentUpdatedAt(sort: Desc)])
|
||||
@@index([isPublic])
|
||||
}
|
||||
|
||||
model LiveBlockRef {
|
||||
@@ -747,6 +749,10 @@ model DocumentChunk {
|
||||
@@index([attachmentId, chunkIndex])
|
||||
}
|
||||
|
||||
-- Index vectoriel pour recherche sémantique sur DocumentChunk (HNSW)
|
||||
-- CREATE INDEX IF NOT EXISTS document_chunk_embedding_hnsw_idx
|
||||
-- ON "DocumentChunk" USING hnsw ("embedding" vector_cosine_ops);
|
||||
|
||||
// ===== BYOK (Story 3.5) =====
|
||||
|
||||
model UserAPIKey {
|
||||
|
||||
Reference in New Issue
Block a user