fix(security): add JWT auth + visibility check to pages API
- GET /pages/:slug now requires JWT + checks custom_menu_items visibility - GET /pages (list) is admin-only - GET /pages/:slug/images/* uses visibility check without JWT (browser img tags cannot carry auth headers), blocks admin-only page images - Frontend fetch adds Authorization header from authStore.token - settingService nil guard changed to fail-closed (deny access) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -202,7 +202,9 @@ async function fetchAndRenderMarkdown(slug: string) {
|
||||
tocItems.value = []
|
||||
activeHeadingId.value = ''
|
||||
try {
|
||||
const resp = await fetch(`/api/v1/pages/${encodeURIComponent(slug)}`)
|
||||
const resp = await fetch(`/api/v1/pages/${encodeURIComponent(slug)}`, {
|
||||
headers: authStore.token ? { Authorization: `Bearer ${authStore.token}` } : {},
|
||||
})
|
||||
if (!resp.ok) {
|
||||
renderedHtml.value = '<p class="text-red-500">Page not found</p>'
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user