Skip to content

Add queryParser prototype-pollution and operator-injection tests in src/tests/queryParser.injection.test.ts #735

Description

@1nonlypiece

📌 Description

src/middleware/queryParser.ts and src/services/queryParser.ts translate
request query strings into filters. There is no dedicated test proving they
reject __proto__/constructor keys and unsafe operator injection. A gap here
could allow prototype pollution or filter-bypass.

This issue adds focused injection and prototype-pollution tests for the query
parser.

Goal: prove the query parser rejects prototype-pollution keys and unsafe
operators while accepting valid filters.

🎯 Requirements and Context

  • Must assert __proto__, constructor, and prototype keys are rejected.
  • Must assert unsupported operators and unknown fields are rejected.
  • Must assert valid filters still parse correctly.
  • Must run with bun test.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b test/queryparser-injection

2. Implement changes

  • Add src/tests/queryParser.injection.test.ts.

3. Test and commit

  • Run with bun test.
  • Cover edge cases: pollution keys, unknown field, bad operator, valid filter.

Example commit message

test: queryParser prototype-pollution and injection guards

✅ Guidelines

  • Minimum 95% test coverage on the new/changed lines.
  • Clear, reviewer-friendly documentation.
  • No regressions on existing query parsing.
  • Timeframe: 96 hours.

🏷️ Labels

type-testing · type-security · area-backend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the Disciplr contributor Discord to coordinate, ask questions, and get
    unblocked fast: https://discord.gg/xvNAvMJf
  • Please introduce yourself in the channel before you start so we can avoid
    duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful
    reviews — reach out any time you're blocked.

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaignMAYBE REWARDEDEligible for GrantFox rewardOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programarea-backendBackend / API worktype-securitySecurity review / hardeningtype-testingTests and test coverage

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions