Skip to content

security: fix broken access control in question endpoints#51

Open
joydip7 wants to merge 1 commit into
Canopus-Labs:mainfrom
joydip7:fix/broken-access-control
Open

security: fix broken access control in question endpoints#51
joydip7 wants to merge 1 commit into
Canopus-Labs:mainfrom
joydip7:fix/broken-access-control

Conversation

@joydip7
Copy link
Copy Markdown

@joydip7 joydip7 commented Jun 1, 2026

Summary

This pull request fixes a broken access control (IDOR) vulnerability in the question controller. Specifically, in togglePinQuestion and updateQuestionNote, any authenticated user could modify pins or notes for questions belonging to other users if they knew the question ID.

Changes

  • Added checks in togglePinQuestion and updateQuestionNote to load the question's session and verify that the session user ID matches the authenticated user ID (req.user.id).
  • If they do not match, a 403 Forbidden response with Unauthorized access is returned.
  • Added an automated verification script at backend/scripts/verify_vulnerability.js to reproduce and confirm the fix.

Documentation about the fix->
questionAuth fix.pdf

@joydip7 joydip7 force-pushed the fix/broken-access-control branch from 1fbf54c to d23d5d9 Compare June 1, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant