Skip to content

Commit

Permalink
docs(readBody): mention CSRF risk in jsdocs (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
OhB00 authored Oct 3, 2024
1 parent 011e2cf commit c586052
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ export function readRawBody<E extends Encoding = "utf8">(

/**
* Reads request body and tries to safely parse using [destr](https://github.com/unjs/destr).
*
*
* Be aware that this utility is not restricted to `application/json` and will parse `application/x-www-form-urlencoded` content types.
* Because of this, authenticated `GET`/`POST` handlers may be at risk of a [CSRF](https://owasp.org/www-community/attacks/csrf) attack, and must check the `content-type` header manually.
*
* @example
* export default defineEventHandler(async (event) => {
* const body = await readBody(event);
Expand Down

0 comments on commit c586052

Please sign in to comment.