Skip to content

[Snyk] Security upgrade mongoose from 5.13.15 to 6.13.6#93

Open
cdobru wants to merge 1 commit intomainfrom
snyk-fix-482c2586a6e452c06fc6f55932d5518b
Open

[Snyk] Security upgrade mongoose from 5.13.15 to 6.13.6#93
cdobru wants to merge 1 commit intomainfrom
snyk-fix-482c2586a6e452c06fc6f55932d5518b

Conversation

@cdobru
Copy link
Owner

@cdobru cdobru commented Mar 25, 2026

snyk-top-banner

Snyk has created this PR to fix 1 vulnerabilities in the npm dependencies of this project.

Snyk changed the following file(s):

  • package.json
  • package-lock.json

Vulnerabilities that will be fixed with an upgrade:

Issue Score
high severity Improper Neutralization of Special Elements in Data Query Logic
SNYK-JS-MONGOOSE-8623536
  495  

Breaking Change Risk

Merge Risk: High

Notice: This assessment is enhanced by AI.


Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • Max score is 1000. Note that the real score may have changed since the PR was raised.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.

For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic


Learn how to fix vulnerabilities with free interactive lessons:

🦉 Improper Neutralization of Special Elements in Data Query Logic

@cdobru
Copy link
Owner Author

cdobru commented Mar 25, 2026

Merge Risk: High

The upgrade from Mongoose v5 to v6 is a major version change with numerous breaking changes that require code modifications and careful review.

Key Breaking Changes:

  • strictQuery Behavior: By default, strictQuery is now true (in Mongoose 6, it was called strict). This means Mongoose will filter out any query conditions for fields that are not defined in your schema. This is a significant change from Mongoose 5 and can lead to unexpected query results. To restore the previous behavior, you must globally set mongoose.set('strictQuery', false);. [1]
  • Connection Options Removed: The useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex options are no longer supported and must be removed from your mongoose.connect() call. Mongoose 6 uses a newer MongoDB driver where these are the default behavior. [2]
  • Model.exists() Return Value: This method no longer returns a boolean. It now returns either the lean document if found, or null if not. Code checking for a true/false result will break. [1]
  • Array Modifications: A positive change is that you no longer need to call doc.markModified() after updating an array element directly (e.g., doc.myArray[0] = 'new'). Mongoose 6 uses Proxies to automatically detect these changes. [2]
  • Removed Methods: The execPopulate() method has been removed. [1]

Recommendation: This upgrade requires significant testing and code review. Pay close attention to query behavior due to the strictQuery change. Review all uses of Model.exists() and remove the deprecated connection options. It is highly recommended to consult the official migration guide before proceeding.

Source: Mongoose 5.x to 6.x Migration Guide [1, 5]

Notice 🤖: This content was augmented using artificial intelligence. AI-generated content may contain errors and should be reviewed for accuracy before use.

@cdobru
Copy link
Owner Author

cdobru commented Mar 25, 2026

Snyk checks have failed. 4 issues have been found so far.

Status Scan Engine Critical High Medium Low Total (4)
Open Source Security 0 0 4 0 4 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cdobru
Copy link
Owner Author

cdobru commented Mar 25, 2026

Snyk checks have failed. 4 issues have been found so far.

Status Scan Engine Critical High Medium Low Total (4)
Open Source Security 0 0 4 0 4 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@bojtetami
Copy link

bojtetami commented Mar 25, 2026

Snyk checks have failed. 4 issues have been found so far.

Status Scan Engine Critical High Medium Low Total (4)
Open Source Security 0 0 4 0 4 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants