Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| const handleSubmit = async (event: FormEvent<HTMLFormElement>) => { | ||
| event.preventDefault(); | ||
| await onSubmit({ name, isHuman }); | ||
| // Trim whitespace from sanitized name before submitting |
There was a problem hiding this comment.
Bug: Default name bypasses input sanitization on submit
The sanitizeName function is only applied during onChange events. When defaultName is passed to the component (e.g., from an existing leaderboard entry), it's set directly via useState(defaultName) and setName(defaultName) in the useEffect without sanitization. If a user reopens the modal and clicks "Save" without modifying the input, any unsanitized characters in defaultName will be submitted directly. The sanitization needs to be applied to defaultName when initializing state and in the handleSubmit function.
Note
Harden security and stability with CSP/security headers, input sanitization and tests, centralized logger with retry-backed Supabase calls, plus minor docs and dependency updates.
vercel.json(CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy).src/components/LeaderboardModal.tsx(allow only alphanumeric,_, space,-) and trim on submit; comprehensive tests intest/LeaderboardModal.test.tsx.src/utils/logger.ts; replaceconsole.errorwithloggerinsrc/hooks/useLeaderboard.tsandsrc/services/leaderboard.ts.fetchWithRetryand integrate into Supabase calls viacallSupabaseFunction; fewer retries forstart-session; exportdebounceutility.react/react-domto^18.3.0,viteto^7.2.6,@playwright/testto^1.55.1.Written by Cursor Bugbot for commit dc05d65. This will update automatically on new commits. Configure here.