feat: Private notes enforcement (is_public filtering + API key auth) #178
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-api#178
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 F6 (Private Notes Enforcement)Repo
forgejo_admin/pal-e-docsUser Story
As a pal-e-docs user
I want private notes to be hidden from anonymous requests
So that journal entries and private thoughts are not exposed to unauthenticated visitors
Context
is_publicfield exists on every note (default True) but is never filtered in any endpoint. list_notes(), search_notes(), and semantic_search() all return private notes to anyone. This is a security gap — the "I have a private thought" pattern (journal notes under Private project) depends on privacy enforcement. The fix: add a simple API key header (X-PaleDocs-Token) that pal-e-app passes from server-side fetches. If present and valid → show all notes. If absent → hide is_public=false notes.File Targets
Files to modify:
src/pal_e_docs/routes/notes.py— add is_public filtering to list_notes (line 346), _build_filter_clauses (line 157), _keyword_search (line 193), _semantic_search_notes (line 293); add auth dependency to check X-PaleDocs-Token headersrc/pal_e_docs/schemas.py— addis_public: boolto NoteSearchResult (line 174) and SemanticSearchResult (line 186)src/pal_e_docs/config.py— add PAL_E_DOCS_API_KEY setting (optional, defaults to None = no enforcement)Files NOT to touch:
src/pal_e_docs/routes/boards.py— board privacy is out of scopealembic/— no migration needed, is_public column already existsAcceptance Criteria
Test Expectations
cd ~/pal-e-docs && .venv/bin/pytest tests/ -vConstraints
Checklist
Related
pal-e-docs— project this affects