Skip to content

fix: restrict populated author fields to prevent leaking sensitive data (Issue #265, #271)#303

Closed
basantnema31 wants to merge 1 commit into
hereisSwapnil:mainfrom
basantnema31:fix/exposed-author-data
Closed

fix: restrict populated author fields to prevent leaking sensitive data (Issue #265, #271)#303
basantnema31 wants to merge 1 commit into
hereisSwapnil:mainfrom
basantnema31:fix/exposed-author-data

Conversation

@basantnema31

Copy link
Copy Markdown

Fixes #265, Fixes #271

The Bug:
Whenever a user requested notes, questions, or requests, the backend was populating the author field with the entire User document. This unintentionally exposed highly sensitive user data to the client, including hashed passwords, OTPs, email addresses, and account settings.

The Fix:
Modified the populate("author") calls in note.controller.js, question.controller.js, and request.controller.js to explicitly select only safe fields: .populate("author", "username userPhoto"). This significantly reduces the payload size and completely closes the security vulnerability.

@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown

@basantnema31 is attempting to deploy a commit to the swapnilsingh99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, @basantnema31! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.

We will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check our contributing guidelines

@basantnema31 basantnema31 closed this by deleting the head repository May 27, 2026
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.

BUG: There are several personal things exposed at backend. BUG: The unwanted data in reponses

1 participant