Commit ad6ba28
authored
fix(validation): add max-length and regex validation to org parameter in streakParamsSchema (JhaSourav07#1664)
## Description
The `org` parameter in `streakParamsSchema` at `lib/validations.ts:186`
had zero validation (`org: z.string().optional()`) -- no min, no max, no
regex. Any arbitrary string of any length was accepted and directly
interpolated into GitHub REST API URL paths. This enabled path-traversal
attacks against the GitHub API, bypassing the strict validation enforced
on the `user` parameter.
Fixes JhaSourav07#1366:
- SSRF: path-traversal sequences in org parameter could reach unintended
GitHub API endpoints
- Injection: unvalidated string length could create enormous URL strings
stressing the server
- Inconsistency: org had no validation while user on the same schema had
strict regex + max(39)
## Pillar
- [ ] Pillar 1 - New Theme Design
- [ ] Pillar 2 - Geometric SVG Improvement
- [ ] Pillar 3 - Timezone Logic Optimization
- [x] Other (Bug fix, refactoring, docs)
## Checklist before requesting a review:
- [x] I have read the CONTRIBUTING.md file.
- [x] I have tested these changes locally.
- [x] I have run npm run format and npm run lint locally and resolved
all errors.
- [x] My commits follow the Conventional Commits format.1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
187 | 193 | | |
188 | 194 | | |
189 | 195 | | |
| |||
0 commit comments