Skip to main content

Security — Auth, RBAC, Input Validation

non-critical   Property: ChurchWiseAI   Category: Security Tier: anonymous Persona: anonymous Touchpoint: /admin/[token] and /api/*

Preconditions

  • Test with invalid tokens, injected inputs, and cross-church IDs

Steps

#ActionExpected Result
1Access /admin/[invalid-token]401 or redirect to login — not a 500 or data leak
2Access /admin/[token-from-different-church]Blocked — only own church data accessible
3POST to /api/admin/kb-proxy with SQL injection in bodyInput sanitized — no SQL executed, 400 returned
4Submit XSS payload in chatbot messagePayload escaped — not executed in browser
5Access /api/admin/* without auth header401 returned — no data exposed
6Try to read another church's voice_prayer_requestsRLS blocks it — only own church rows returned
7Attempt brute-force on magic link endpointRate limiting kicks in after N attempts

Known Failure Modes

  • Token from church A grants access to church B data — RLS bug
  • SQL injection succeeds — parameterized queries missing
  • XSS executes in chatbot — output not escaped
  • API returns 200 with data when unauthenticated

References

Notes

All admin routes use token-based auth (magic link token in URL). Supabase RLS enforces row-level isolation per church_id. See architecture/protection-audit.md for full security audit.