Skip to content

Guard all (still public) endpoints with authentication checks#23

Merged
TKlerx merged 5 commits into
mainfrom
feature/auth-checks
Jun 29, 2026
Merged

Guard all (still public) endpoints with authentication checks#23
TKlerx merged 5 commits into
mainfrom
feature/auth-checks

Conversation

@0xC0FEBABE

Copy link
Copy Markdown
Collaborator

Summary

Security audit that enforces authentication on all API endpoints that were previously accessible without a session.

  • menus.ts — Added requireAuthenticatedActor to all 9 mutation/read handlers (create, update, delete menu/items, import, preview). GET /api/menus was public before; now requires auth too.
  • foodSelections.ts — Auth guard added to 3 GET endpoints (active selection, history, fallback candidates).
  • polls.ts — Auth guard added to 2 GET endpoints (active poll, poll by ID).
  • shoppingList.ts — Auth guard added to 1 GET endpoint.
  • Tests updated across 4 test files: menu tests got a seeded user + agent() helper to send auth cookies; food-selection, poll, and meal-recommendation tests updated their createMenu/createMenuItem helpers and relevant GETs to include approvedAuthHeaders().
  • prisma-generate-safe.mjs — Now clears stale generated client dirs before regenerating (fixes sqlite/postgres client pollution).
  • .faim/ — Formal invariant memory bootstrapped; auth_on_mutations invariant passes with 0 violations.

What stays public

Auth-bootstrap endpoints only: /api/auth/config, /api/auth/local/login, /api/auth/logout, /api/auth/entra/*, and the static SPA.

@0xC0FEBABE
0xC0FEBABE requested a review from TKlerx June 29, 2026 04:57
@0xC0FEBABE 0xC0FEBABE self-assigned this Jun 29, 2026
@TKlerx
TKlerx merged commit d99c451 into main Jun 29, 2026
1 check passed
@TKlerx
TKlerx deleted the feature/auth-checks branch June 29, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants