fix: Validate authData input in dot-notation updates, login provider checks, and challenge endpoint#10221
fix: Validate authData input in dot-notation updates, login provider checks, and challenge endpoint#10221mtrezza wants to merge 2 commits intoparse-community:alphafrom
Conversation
…checks, and challenge endpoint
|
🚀 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
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds stricter authData validation across login, challenge, and database update flows and new vulnerability tests. Auth provider list is filtered to require valid validators/adapters; PUT/PATCH rejects any field beginning with Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Controllers/DatabaseController.js (1)
606-611:⚠️ Potential issue | 🟠 MajorScope
authData.*dot-notation blocking to_Useronly.At Line 606, this blocks
authData.<...>updates for every class, not just_User. That can break legitimate custom-class object fields namedauthData.Suggested fix
- if (fieldName.match(/^authData\./)) { + if (className === '_User' && fieldName.match(/^authData\./)) { throw new Parse.Error( Parse.Error.INVALID_KEY_NAME, `Invalid field name for update: ${fieldName}` ); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Controllers/DatabaseController.js` around lines 606 - 611, The current check unconditionally rejects field names matching /^authData\./, which blocks legitimate fields on non-_User classes; update the logic in the function handling updates (the block that reads `if (fieldName.match(/^authData\./)) { ... }`) to only throw the Parse.Error when the target class is '_User' (e.g., check the request or params className variable equals '_User' before rejecting), leaving `authData.*` allowed for custom classes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@spec/vulnerabilities.spec.js`:
- Around line 3064-3079: The test "rejects challenge request with null provider
value without 500" currently asserts expect(res.status).toBeLessThan(500), which
would also pass for 200; update the assertion to ensure a rejection client error
(e.g., assert res.status is >= 400 and < 500) so it fails on success responses,
and apply the same change to the other similar test around lines 3081-3096;
locate the tests by their titles/it descriptions and replace the weak status
check with a strict client-error range (or explicit not-200) assertion.
In `@src/Auth.js`:
- Around line 526-534: savedUserProviders can include entries whose
validator.adapter is undefined, causing a crash when reading
provider.adapter.policy; update the pipeline that builds savedUserProviders (the
map using config.authDataManager.getValidatorForProvider and the subsequent
.filter(Boolean)) to explicitly exclude validators with no adapter (i.e., only
return { name: provider, adapter: validator.adapter } when validator &&
validator.adapter) or add a second filter that checks entry.adapter is truthy so
that any providers without a defined adapter are removed before policy access.
---
Outside diff comments:
In `@src/Controllers/DatabaseController.js`:
- Around line 606-611: The current check unconditionally rejects field names
matching /^authData\./, which blocks legitimate fields on non-_User classes;
update the logic in the function handling updates (the block that reads `if
(fieldName.match(/^authData\./)) { ... }`) to only throw the Parse.Error when
the target class is '_User' (e.g., check the request or params className
variable equals '_User' before rejecting), leaving `authData.*` allowed for
custom classes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3ea0cfe9-e0bd-4ef8-a65e-7a118690f014
📒 Files selected for processing (4)
spec/vulnerabilities.spec.jssrc/Auth.jssrc/Controllers/DatabaseController.jssrc/Routers/UsersRouter.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10221 +/- ##
==========================================
+ Coverage 92.57% 92.59% +0.01%
==========================================
Files 192 192
Lines 16300 16307 +7
Branches 199 199
==========================================
+ Hits 15090 15099 +9
+ Misses 1193 1191 -2
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Issue
Input validation bugs in authData handling:
Tasks