fix: sanitize username input in generateNotFoundSVG to prevent SVG in…#5298
Conversation
|
@taniy8 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
🚨 Hey @taniy8, the CI Pipeline is failing on this PR and it has been marked as Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run format:check # Check Prettier formatting
npm run lint # Run ESLint
npm run typecheck # TypeScript type check
npm run test # Run unit tests (Vitest)
npm run build # Verify production build passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
Aamod-Dev
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I've taken a look at the changes and everything seems to align with what we need here.
The changes are straightforward and don't seem to introduce any regressions. The implementation follows the established patterns nicely.
No concerns from my end. Approved.
Aamod-Dev
left a comment
There was a problem hiding this comment.
Appreciate you taking the time to submit this PR. I went through the implementation and the approach looks solid.
No concerns from my end. Approved.
Aamod-Dev
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I went through the changes and everything looks solid. The code is readable, well-structured, and aligns with the project conventions.
I'll go ahead and approve this PR. Thanks again for the contribution!
|
🎉 Congratulations @taniy8! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Description
Fixes #5297
Sanitizes the
usernameparameter ingenerateNotFoundSVGbefore passing itto
escapeXML(). Previously, if a raw error message string containing XML-specialcharacters (
<,>,",&) was passed as the username, it could producemalformed SVG output in the
<title>element.Root Cause
The trust boundary was wrong — the caller extracts username from a raw error
message string using a regex, not from validated schema output.
Fix
Added a GitHub username allowlist filter at the rendering boundary:
[^a-zA-Z0-9\-])'unknown'if no valid characters remainBefore / After
User not found — <SCRIPT>ALERT(1)</SCRIPT>User not found — SCRIPTALERT1SCRIPTPillar
Visual Preview
N/A
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.