RocketChat / RocketChat/Rocket.Chat
Missing Ajv Schema Validation on users REST API endpoints
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
The legacy users REST API endpoints currently lack explicit schema validation. Inputs are weakly typed or imperatively checked inside the handlers, which can lead to runtime regressions.
The following endpoints need to be formally typed and migrated using ajv via @rocket.chat/rest-typings:
users.getAvatarusers.deleteOwnAccountusers.resetAvatarusers.forgotPassword
Proposed Solution
- Add TypeBox/Ajv JSON schemas to
packages/rest-typings. - Export the typing boundaries.
- Attach the
validateParamsoption onto theAPI.v1.addRouteconfig block for these endpoints.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/rest-typings and inspect the existing TypeBox/Ajv schema patterns and exported typing boundaries. Then locate the API.v1.addRoute config blocks for users.getAvatar, users.deleteOwnAccount, users.resetAvatar, and users.forgotPassword, and compare how validateParams is attached elsewhere. Done means each listed endpoint has a schema in rest-typings and uses its exported boundary for validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100