Skip to content

[BUG]: updateProfile Bypasses User Schema Validation and Permits Verification-State Updates #269

@VarshithReddy2006

Description

@VarshithReddy2006

While reviewing the user profile update workflow, I identified a validation and authorization issue in updateProfile() that allows modification of verification-related fields and bypasses the user schema validation layer.

The controller copies the incoming request body, removes only password, email, and _id, sanitizes the remaining payload, and directly updates the user document using $set.

However, the endpoint does not validate updates against the configured user schema and does not restrict verification-state fields that are used elsewhere in the authentication flow.

Verification fields such as:

  • emailVerified
  • isVerified
  • isverified

are actively used by the authentication and account-linking logic, but they are not removed or protected inside updateProfile().

As a result, authenticated users can submit updates containing verification-related fields, and those values are passed directly to the database update operation.

This creates an inconsistency where security-sensitive account state can be modified through a generic profile update endpoint instead of the dedicated verification workflow.

Additionally, because the endpoint does not use the same validation path as other data-update operations, user-configured schema constraints are not consistently enforced during profile updates.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions