Skip to content

Commit

Permalink
Merge pull request #14975 from Automattic/vkarpov15/sanitizefilter-co…
Browse files Browse the repository at this point in the history
…nnectionoptions

types(connection): add missing sanitizeFilter option
  • Loading branch information
vkarpov15 authored Oct 23, 2024
2 parents 925327f + 57b38f8 commit 6c55767
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/connection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ declare module 'mongoose' {
autoIndex?: boolean;
/** Set to `false` to disable Mongoose automatically calling `createCollection()` on every model created on this connection. */
autoCreate?: boolean;
/**
* Sanitizes query filters against [query selector injection attacks](
* https://thecodebarbarian.com/2014/09/04/defending-against-query-selector-injection-attacks.html
* ) by wrapping any nested objects that have a property whose name starts with $ in a $eq.
*/
sanitizeFilter?: boolean;
}

class Connection extends events.EventEmitter implements SessionStarter {
Expand Down

0 comments on commit 6c55767

Please sign in to comment.