Instruction file imported from Josh-git-lab/Starlit (
.cursor/rules/authentication-authorization.mdc). Copyright stays with the author.
Authentication & Authorization (Rule B)
Starlit v1 uses:
- custom authentication
- bcrypt password hashing
- secure httpOnly session cookies
- server-side session validation
- fixed application roles (receptionist, manager, owner, platform admin)
Do NOT use
Clerk, Auth0, Descope, Supabase Auth, or any other authentication provider unless explicitly instructed.
Enforcement
- Never rely only on client-side role checks.
- Authorization must be enforced server-side on every protected endpoint.
- UI hiding is not authorization.
- Sensitive operations must verify both:
- authenticated identity
- permission for the requested organization/resource/action
Session cookies
Use HttpOnly, Secure (production), and appropriate SameSite settings. Use separate cookie namespaces for tenant users vs platform admins.