Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert no. 1: Database query built from user-controlled sources #100

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

saranshsinhaa
Copy link
Member

@saranshsinhaa saranshsinhaa commented Oct 22, 2024

Fixes https://github.com/SRM-IST-KTR/githubsrmv2/security/code-scanning/1

Fixes #99

To fix the problem, we need to ensure that the email value is treated as a literal value and not as a query object. This can be achieved by using MongoDB's $eq operator, which ensures that the value is interpreted as a literal string. Additionally, we should validate that the email is a string before using it in the query.

…led sources

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copy link

vercel bot commented Oct 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
githubsrmv2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 2:52pm

@saranshsinhaa
Copy link
Member Author

@djdiptayan1 @StarlyHere Verify Functionality first then merge

@UtkarshJaiswal1406
Copy link
Contributor

this works. its preventing nosql injection as its supposed to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The UI needs some changes Fixed Bug fixed security-fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix code scanning alert - Database query built from user-controlled sources
2 participants