Skip to content

Commit

Permalink
Add an intro. to sanitization and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pwizla committed Apr 30, 2024
1 parent 619d012 commit 84e2e16
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docusaurus/docs/dev-docs/backend-customization/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ When a new [content-type](/dev-docs/backend-customization/models#content-types)

### Sanitization and Validation in controllers

Sanitization means that the object is “cleaned” and returned.

Validation means an assertion is made that the data is already clean and throws an error if something is found that shouldn't be there.

In Strapi:

- validation is applied on query parameters,
- and only sanitization is applied to input data (create and update body data).

:::warning
It's strongly recommended you sanitize (v4.8.0+) and/or validate (v4.13.0+) your incoming request query utilizing the new `sanitizeQuery` and `validateQuery` functions to prevent the leaking of private data.
:::
Expand Down

0 comments on commit 84e2e16

Please sign in to comment.