feat(security): add CSRF protection for all state-changing API routes
Build & Push Docker Image / build (push) Successful in 2m16s
Build & Push Docker Image / build (push) Successful in 2m16s
- Synchronizer token stored in session; GET /auth/csrf to obtain it - csrfProtection middleware requires X-CSRF-Token on non-safe methods - customFetch injects the header via setCsrfTokenGetter - toolrate boot loads token; reload after local login (session regenerate) - OpenAPI GET /auth/csrf + CsrfToken schema, orval regenerated
This commit is contained in:
@@ -570,6 +570,19 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/AuthMode"
|
||||
|
||||
/auth/csrf:
|
||||
get:
|
||||
operationId: getCsrfToken
|
||||
tags: [auth]
|
||||
summary: Get a CSRF token for state-changing requests
|
||||
responses:
|
||||
"200":
|
||||
description: CSRF token
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CsrfToken"
|
||||
|
||||
/auth/login:
|
||||
post:
|
||||
operationId: localLogin
|
||||
@@ -942,6 +955,13 @@ components:
|
||||
type: string
|
||||
enum: [oidc, local]
|
||||
|
||||
CsrfToken:
|
||||
type: object
|
||||
required: [token]
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
|
||||
LocalLoginInput:
|
||||
type: object
|
||||
required: [username, password]
|
||||
|
||||
Reference in New Issue
Block a user