Files
hedgedoc/commons
Erik Michelson 66d052d611 feat(security): add CSRF protection to private API endpoints
This adds a new endpoint /api/private/csrf/token which serves a CSRF-token that
is stored in the user's session. Following requests with POST, PUT, PATCH or DELETE
request methods, need to provide this token in the CSRF-Token header. Since this
is not possible to do via HTML forms or other cross-site effects, this prevents
cross-site attacks. The frontend loads the CSRF token on app initialization and
stores it in the redux. It keeps using the token for up to one hour and then
updates the stored token from the API endpoint again.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-04 21:36:52 +01:00
..
2022-12-11 23:09:10 +01:00
2022-12-11 23:09:10 +01:00