GET /webhooks/notifications?deviceId=<anything invalid> returns a 500.
In findWebhookNotificationsForUser the deviceId filter is cast without a validity check (webhook.service.ts, ~line 219):
if (deviceId) {
commonPipeline.push({
$match: {
'deviceData._id': new mongoose.Types.ObjectId(deviceId),
},
})
}
new ObjectId('abc') throws a BSONError, which bubbles up as an internal server error.
The sibling webhookSubscriptionId param in the same function already does it right (~line 98):
if (!mongoose.Types.ObjectId.isValid(webhookSubscriptionId)) {
throw new HttpException('Invalid webhookSubscriptionId', HttpStatus.BAD_REQUEST)
}
Same check for deviceId, same 400 response.
GET /webhooks/notifications?deviceId=<anything invalid>returns a 500.In
findWebhookNotificationsForUserthe deviceId filter is cast without a validity check (webhook.service.ts, ~line 219):new ObjectId('abc')throws a BSONError, which bubbles up as an internal server error.The sibling
webhookSubscriptionIdparam in the same function already does it right (~line 98):Same check for
deviceId, same 400 response.