mirror of
https://github.com/vernu/textbee.git
synced 2026-09-03 03:29:58 +03:00
fix(api): validate deviceId before ObjectId conversion
This commit is contained in:
@@ -217,6 +217,13 @@ export class WebhookService {
|
||||
}
|
||||
|
||||
if (deviceId) {
|
||||
if (!mongoose.Types.ObjectId.isValid(deviceId)) {
|
||||
throw new HttpException(
|
||||
'Invalid deviceId',
|
||||
HttpStatus.BAD_REQUEST,
|
||||
)
|
||||
}
|
||||
|
||||
commonPipeline.push({
|
||||
$match: {
|
||||
'deviceData._id': new mongoose.Types.ObjectId(deviceId),
|
||||
|
||||
Reference in New Issue
Block a user