Skip to content

feat(auth): add roles, RequireRole and CSRF protection - #22

Merged
pitercoding merged 2 commits into
mainfrom
feat/roles-and-csrf
Nov 24, 2026
Merged

pitercoding merged 2 commits into
mainfrom
feat/roles-and-csrf

Conversation

@pitercoding

Copy link
Copy Markdown
Owner

Adds authorization and CSRF protection (not wired into main yet):

  • tenant.Role (owner > admin > member) with AtLeast, which fails closed
    for unknown roles; auth.Account now carries a typed role
  • RequireRole middleware: 401 without a session, 403 for a role that is too low
  • CSRF protection based on http.CrossOriginProtection, with trusted
    origins validated at startup and Problem Details responses

A test keeps the Go roles in sync with the database CHECK constraint.

@pitercoding
pitercoding merged commit e0f27da into main Nov 24, 2026
4 checks passed
@pitercoding
pitercoding deleted the feat/roles-and-csrf branch November 24, 2026 15:12
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.

1 participant