daniele-liprandi/EvoNEST-backbone

Missing ObjectId validation

Open

#33 opened on Nov 26, 2025

 (0 comments) (0 reactions) (0 assignees)JavaScript (2 forks)auto 404
BackendHighbuggood first issue

Repository metrics

Stars
 (1 star)
PR merge metrics
 (PR metrics pending)

Description

Description

ObjectIds from user input are passed directly to MongoDB operations without validation, causing poor error messages when invalid.

Files affected

  • Multiple API routes

Current code

const result = await users.updateOne(
    { _id: new ObjectId(data.id) },  // No validation
);

Recommended fix

Create a utility function to validate ObjectIds before use.

Contributor guide