bug: SSR sends admin API key for unauthenticated visitors — private content exposed #38
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-docs-app#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-pal-e-docs→ Phase F14 (phase-pal-e-docs-f14-public-readiness)Repo
forgejo_admin/pal-e-appUser Story
As a public visitor browsing pal-e-app without a Keycloak session
I want to only see public notes, projects, and boards
So that private content (journals, personal projects, internal boards) is not visible to me
As Lucas (admin with Keycloak session)
I want to see all content including private notes
So that my admin experience is unchanged
Context
Phase F6 (PR #29) added
X-PaleDocs-TokentoapiFetch()via thePAL_E_DOCS_API_KEYenv var. The bug: this header is sent on EVERY SSR request, even when the visitor has no Keycloak session. The pal-e-docs API correctly filters private content for unauthenticated requests, but the frontend always authenticates as admin.Current flow (broken):
Expected flow:
Evidence: after signing out, the dashboard still shows private note titles ("The Chinese Room..."), private projects ("Private", "Remember"), and private boards ("Private Board", "Remember") with full content.
File Targets
Files the agent should modify:
src/lib/api.ts(or whereverapiFetchis defined) — conditionally includeX-PaleDocs-Tokenonly when user has active Keycloak sessionsrc/routes/+layout.server.ts(or equivalent) — pass session/auth state to child routessrc/routes/+page.server.ts— use session state to determine whether to send auth token in API callssrc/routes/signin/+page.svelte— replace Keycloak redirect with "Contact Lucas for access" page + portfolio linktests/ore2e/— E2E test for anonymous visitor content filteringFiles the agent should reference:
src/hooks.server.ts— existing auth/session handlingAcceptance Criteria
portfolio.tail5b443a.ts.net)Test Expectations
npx playwright testor equivalentConstraints
apiFetchshould check for session, not remove the auth capability/signin?admin=trueChecklist
Related
project-pal-e-docs— project this affectsphase-pal-e-docs-private-notes— Phase F6 (PR #29), the original implementation this fixes