Security overview
Kona’s security stack ships in two modules:
kona-session— HTTP sessions (array / file / cookie / Redis drivers), flash data, previous URL / old input, and CSRF verification.kona-auth— hashing, guards, theAuthfacade, password resets, gates / policies, API tokens, encryption, CORS, security headers, and rate limiting.
Simple path
Section titled “Simple path”Apps from kona new already register session and auth providers and wire StartSession + CSRF in the web middleware stack.
- Keep
SessionServiceProviderandAuthServiceProvideron the bootstrap provider list. - Keep
StartSessionandVerifyCsrfTokenon the web stack (/api/*is CSRF-excepted by default). - Protect HTML routes with
Authenticate; use bearer tokens orAuthenticateWithTokenfor APIs. - Authorize with
Gate/ policies orAuthorizemiddleware.
Guide map
Section titled “Guide map”| Topic | Guide |
|---|---|
| Sessions, flash, drivers | Session |
| Login, remember me, middleware, hashing, tokens | Authentication |
Gates, policies, Authorize |
Authorization |
| Form tokens | CSRF protection |
APP_KEY, encrypt / decrypt |
Encryption |
| CORS + response headers | CORS & security headers |
| Named limiters + throttle middleware | Rate limiting |
CSRF and session cookies interact with the HTTP middleware pipeline; password form rules use the HTTP validator.