Skip to content

fix: Cloud Code beforeFind trigger context is not isolated from prototype pollution#10570

Merged
mtrezza merged 1 commit into
parse-community:alphafrom
mtrezza:fix/beforefind-context-prototype-isolation
Jul 11, 2026
Merged

fix: Cloud Code beforeFind trigger context is not isolated from prototype pollution#10570
mtrezza merged 1 commit into
parse-community:alphafrom
mtrezza:fix/beforefind-context-prototype-isolation

Conversation

@mtrezza

@mtrezza mtrezza commented Jul 11, 2026

Copy link
Copy Markdown
Member

Issue

The beforeFind trigger context is not isolated from Object.prototype, unlike every other Cloud Code trigger. getRequestObject builds the trigger context with a null prototype (Object.assign(Object.create(null), context)), but the symmetric getRequestQueryObject used by beforeFind still assigned context: context || {}, so its request.context inherited Object.prototype.

Tasks

  • Add tests

@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Query trigger contexts are now created with null prototypes to prevent prototype pollution, and mutations made during beforeFind are propagated to the shared context used by afterFind. Regression tests cover isolation, pollution resistance, and mutation propagation.

Changes

Query trigger context isolation

Layer / File(s) Summary
Null-prototype context construction
src/triggers.js, spec/vulnerabilities.spec.js
Query trigger contexts use null-prototype objects, with tests verifying no inherited or polluted properties are exposed.
Mutation propagation between triggers
src/triggers.js, spec/vulnerabilities.spec.js
Mutations made in beforeFind are copied into the afterFind context while both contexts retain null prototypes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: Moumouls


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ❌ Error The PR description is missing the required Issue, Approach, and Tasks sections. Add the template sections with an issue reference, a brief approach summary, and completed task checkboxes relevant to this PR.
Security Check ⚠️ Warning Object.assign(context, requestObject.context) can turn a user-supplied __proto__ key into prototype pollution on the shared context object. Merge back only safe own keys or keep the shared context null-prototype too; never Object.assign untrusted keys into a plain object.
Engage In Review Feedback ❓ Inconclusive Repo shows only code/test changes in one commit; no review-thread or comment history is available to verify engagement with feedback. Provide the PR review thread or GitHub comments so I can confirm whether feedback was discussed before being resolved.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the required prefix and clearly describes the main fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.68%. Comparing base (cb9b542) to head (c599875).
⚠️ Report is 1 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10570   +/-   ##
=======================================
  Coverage   92.67%   92.68%           
=======================================
  Files         193      193           
  Lines       17007    17009    +2     
  Branches      248      248           
=======================================
+ Hits        15762    15764    +2     
  Misses       1224     1224           
  Partials       21       21           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza merged commit bea001e into parse-community:alpha Jul 11, 2026
24 checks passed
parseplatformorg pushed a commit that referenced this pull request Jul 11, 2026
# [9.10.0-alpha.7](9.10.0-alpha.6...9.10.0-alpha.7) (2026-07-11)

### Bug Fixes

* Cloud Code beforeFind trigger context is not isolated from prototype pollution ([#10570](#10570)) ([bea001e](bea001e))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 9.10.0-alpha.7

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jul 11, 2026
@mtrezza mtrezza deleted the fix/beforefind-context-prototype-isolation branch July 11, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants