Bug Description
The confusion alert endpoint (src/app/api/confusion/route.ts) allows authenticated students to submit confusion alerts without any rate limiting or deduplication.
Repeated requests can create many duplicate confusion alerts, causing inaccurate teacher dashboard data and unnecessary database load.
Steps to Reproduce
- Join a classroom as a student.
- Send repeated POST requests to
/api/confusion with a valid classroom ID and topic.
- Submit many requests within a short period (for example, 100 requests in 1 second).
- Open the teacher dashboard.
- Observe duplicate confusion alerts being displayed.
- Check the
confusionAlerts table and observe multiple duplicate records.
Expected Behavior
The endpoint should limit repeated confusion alerts from the same user and classroom.
For example:
- Allow one alert per user/classroom within a short time window.
- Deduplicate repeated alerts with the same topic.
Actual Behavior
The endpoint accepts unlimited confusion alert submissions, allowing duplicate records and inaccurate dashboard counts.
Screenshots
N/A
Environment
- OS: Any
- Browser: Any modern browser
- Node.js version: Any supported version
- Screen size: Desktop/Mobile
Console Errors
No console errors.
Additional Context
Adding rate limiting and deduplication would improve dashboard accuracy and reduce unnecessary database writes.
Bug Description
The confusion alert endpoint (
src/app/api/confusion/route.ts) allows authenticated students to submit confusion alerts without any rate limiting or deduplication.Repeated requests can create many duplicate confusion alerts, causing inaccurate teacher dashboard data and unnecessary database load.
Steps to Reproduce
/api/confusionwith a valid classroom ID and topic.confusionAlertstable and observe multiple duplicate records.Expected Behavior
The endpoint should limit repeated confusion alerts from the same user and classroom.
For example:
Actual Behavior
The endpoint accepts unlimited confusion alert submissions, allowing duplicate records and inaccurate dashboard counts.
Screenshots
N/A
Environment
Console Errors
No console errors.
Additional Context
Adding rate limiting and deduplication would improve dashboard accuracy and reduce unnecessary database writes.