guardian / guardian/dotcom-rendering

Validate The Body Of The Blocks Endpoint

Open
#10,168 0 comments 0 reactions 0 assignees View on GitHub
Team Candidate: WebX
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.