guardian / guardian/dotcom-rendering
Validate The Body Of The Blocks Endpoint
- Dominant language
- TypeScript
- Stars
- 274
- Forks
- 34
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 121
Description
For most requests from frontend to DCR we validate the body of the request against a schema to make sure it has the correct shape. For example, for article requests:
https://github.com/guardian/dotcom-rendering/blob/89015504a3457c41d5acda25c754d1e95f9a5366/dotcom-rendering/src/lib/article.ts#L36
The exception is blocks requests, which we type cast instead:
https://github.com/guardian/dotcom-rendering/blob/89015504a3457c41d5acda25c754d1e95f9a5366/dotcom-rendering/src/server/handler.article.web.ts#L69-L70
We should add validation for these requests too.
@DanielCliftonGuardian began this work with #7856, which adds validation specifically for the `blocks` field in the body of these requests.
Contributor guide
Assessment
This issue has not been assessed yet.