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

Error "_id is already taken" when trying to update user.... #145

Open
sagarwal10 opened this issue Aug 1, 2023 · 1 comment
Open

Error "_id is already taken" when trying to update user.... #145

sagarwal10 opened this issue Aug 1, 2023 · 1 comment

Comments

@sagarwal10
Copy link

sagarwal10 commented Aug 1, 2023

I tried the POSTMAN api to update the user's email address via the PUT request but I get the following error
saying the _id already exists:

=====================================
{
"errors": {
"_id": "is already taken"
}
}

I believe the error is being triggered by the uniqueValidator(). I read on stackoverflow that if one uses
findOneAndUpdate() instead then the uniqueValidator is not invoked. However when I tried this I got an
error that one cannot modify the _id of an existing entry in the database (even though the _id is the same
value as before).

Anybody else encounter this error? Please advise.

@secure-code-warrior-for-github

Micro-Learning Topic: Stack overflow (Detected by phrase)

Matched on "stack overflow"

What is this? (2min video)

Also referred to as Stack buffer overflows. This vulnerability occurs when data received by a program is written to a memory location on the stack and the allocated space is not large enough to take the whole input. If proper boundary checks are not implemented, or unsafe functions like sprintf, fgets etc. are used which don't require a destination size limit the stack memory after the target buffer may be written to, allowing an attacker to alter the normal behaviour of the program. Most modern compilers now have a secure switch which may reorder stack variables and generate extra code to protect against this type of vulnerability.

Try a challenge in Secure Code Warrior

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

No branches or pull requests

1 participant