The vulnerability, described as a protected fields bypass, allows authenticated users to query for protected fields by nesting the query within a logical operator like $or, $and, or $nor. The security advisory and commit logs point to a fix that implements recursive validation of sub-queries.
The analysis of the provided patch commit 2c11c61 confirms this. The changes are in src/RestQuery.js, specifically within the _UnsafeRestQuery.prototype.denyProtectedFields function. Before the patch, this function iterated over protected fields and checked for their presence only in the top-level restWhere object. The patch replaces this with a recursive function, checkWhere, which traverses the query structure, including arrays within $or, $and, and $nor operators, to ensure no protected fields are being queried at any level. Therefore, _UnsafeRestQuery.denyProtectedFields is the function that contained the vulnerability.