Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 39s
CRITICAL: - Add auth + admin check to 10 unprotected API routes (test-*, debug/*, config, models, fix-labels) - Add CRON_SECRET bearer auth to /api/cron/reminders (was fully open) - Add SSRF protection to getOllamaModels (blocks private/internal IPs) HIGH: - Fix getAllLabels() missing userId filter (leaked all users' labels) - Fix /api/labels OR clause leaking other users' labels - Fix IDOR in toggleAgent/getAgentActions (add ownership check) - Fix getEmbeddings() returning [] on error in all 5 providers (corrupted semantic search with NaN cosine similarity) — now throws instead Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { getSystemConfig } from '@/lib/config'
|
|
import { auth } from '@/auth'
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const session = await auth()
|
|
if (!session?.user?.id) {
|
|
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
|
}
|
|
if ((session.user as any).role !== 'ADMIN') {
|
|
return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
|
|
}
|
|
|
|
try {
|
|
const config = await getSystemConfig()
|
|
|
|
return NextResponse.json({
|
|
AI_PROVIDER_TAGS: config.AI_PROVIDER_TAGS || 'not set',
|
|
AI_MODEL_TAGS: config.AI_MODEL_TAGS || 'not set',
|
|
AI_PROVIDER_EMBEDDING: config.AI_PROVIDER_EMBEDDING || 'not set',
|
|
AI_MODEL_EMBEDDING: config.AI_MODEL_EMBEDDING || 'not set',
|
|
AI_PROVIDER_CHAT: config.AI_PROVIDER_CHAT || 'not set',
|
|
AI_MODEL_CHAT: config.AI_MODEL_CHAT || 'not set',
|
|
OPENAI_API_KEY: config.OPENAI_API_KEY ? '***configured***' : '',
|
|
CUSTOM_OPENAI_API_KEY: config.CUSTOM_OPENAI_API_KEY ? '***configured***' : '',
|
|
CUSTOM_OPENAI_BASE_URL: config.CUSTOM_OPENAI_BASE_URL || '',
|
|
OLLAMA_BASE_URL: config.OLLAMA_BASE_URL || 'not set'
|
|
})
|
|
} catch (error: any) {
|
|
return NextResponse.json(
|
|
{
|
|
error: error.message || 'Failed to fetch config'
|
|
},
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
}
|