fix(security): validate and sanitize github usernames in API routes#866
Conversation
|
@harshitanagpal05 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
There was a problem hiding this comment.
Thanks for your first PR on DevTrack! 🎉
A maintainer will review it within 48 hours. While you wait:
- Make sure CI is passing (type-check + lint)
- Double-check the PR description is filled out and the issue is linked
- Feel free to ask questions in Discussions if you need help
If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project grow and attract more contributors!
|
Changes needed before merge: compare/route.ts — cache still uses // All fetch() calls in compare/route.ts
{ headers: { Authorization: `Bearer ${session.accessToken}` }, cache: "no-store" }The |
|
hey! @Priyanshu-byte-coder, I’ve implemented the requested fix in the compare API route and pushed it to the PR branch. All GitHub fetch calls in route.ts now use cache: "no-store" instead of next: { revalidate: 3600 }. |
Summary
Fixes [Security] GitHub API URL path traversal and search query injection via unsanitized username parameter #857.
Changes
src/lib/validate-github-username.tssrc/app/api/metrics/compare/route.tssrc/app/api/metrics/contributions/route.tssrc/app/api/badge/commits/route.tssrc/app/api/badge/streak-shield/route.tsencodeURIComponent()for GitHub path segments where username is interpolatedURL/URLSearchParamsfor query construction to prevent injectiontest/validate-github-username.test.jsSecurity impact
Validation
closes [Security] GitHub API URL path traversal and search query injection via unsanitized username parameter #857