Skip to content

patch: NoSQL injection vulnerabilities introduced by GraphQL resolvers#581

Merged
petruki merged 1 commit intomasterfrom
staging
Apr 11, 2026
Merged

patch: NoSQL injection vulnerabilities introduced by GraphQL resolvers#581
petruki merged 1 commit intomasterfrom
staging

Conversation

@petruki
Copy link
Copy Markdown
Member

@petruki petruki commented Apr 11, 2026

This pull request refactors several resolver functions in src/aggregator/resolvers.js to improve input validation and ensure proper data types when querying MongoDB. The main changes involve converting string IDs to ObjectId, formatting input fields, and enforcing enum values for certain arguments. These updates help prevent errors and ensure consistency across database queries.

Input validation and transformation improvements:

  • All _id fields in resolver functions are now explicitly converted to Types.ObjectId before being used in MongoDB queries, reducing the risk of type-related errors. [1] [2] [3] [4]
  • The key and name fields are now formatted using the formatInput helper to enforce consistent casing, underscores, and allowed spaces as appropriate for each resolver. [1] [2] [3]

Enum enforcement:

  • The strategy and operation arguments in resolveConfigStrategy are now validated against the StrategiesType and OperationsType enums, ensuring only valid values are used in queries.

Imports update:

  • Added imports for Types, OperationsType, StrategiesType, and formatInput to support the above changes.

@petruki petruki added this to the v1.4.1 milestone Apr 11, 2026
@petruki petruki self-assigned this Apr 11, 2026
@petruki petruki added security Vulnerability detected patch Updating dependencies labels Apr 11, 2026
@sonarqubecloud
Copy link
Copy Markdown

@petruki petruki merged commit 96b3392 into master Apr 11, 2026
5 checks passed
@petruki petruki deleted the staging branch April 11, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Updating dependencies security Vulnerability detected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant