fix: Whitelist app config fields sent to the client#3394
Conversation
|
🚀 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. 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. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Closes #1517
Problem
/parse-dashboard-config.json(Parse-Dashboard/app.js) sends a shallow copy of each app object to the browser:Many users reuse their Parse Server config as the dashboard app config, so
apps[]often carries server-only fields. This has two consequences:filesAdapterinstance holds circular references (e.g. a Mongo topology), sores.jsonthrowsTypeError: Converting circular structure to JSONand the whole dashboard fails to load with a "Server Error".readOnlyMasterKey,databaseURI) is shipped to the browser even though the client never reads them.Fix
Send only a whitelist of the per-app fields the client actually consumes. The whitelist is the union of what
src/lib/ParseApp.jsdestructures, the rawinfoPanelread directly inBrowser.react.js, and the documented app options in the README. The projection is applied at send time (after the existing read-onlymasterKeyresolution, which still needsreadOnlyMasterKey/masterKeyTtl), so those server-only fields are used for shaping but never sent.This fixes the circular-JSON crash and stops leaking server-only fields.
readOnlyMasterKeyandmasterKeyTtlare now stripped from the payload (intentional tightening; the client never read them).Note: the whitelist includes both
apiKeyandfileKeybecause the README documents the option asfileKeywhileParseApp.jsdestructuresapiKey. That naming mismatch is pre-existing and left as-is here.Verification
Added
src/lib/tests/dashboardConfig.test.js(red→green against the realapp.jsserver): with a circularfilesAdapterin the config, it asserts the endpoint responds200, includes the whitelisted client fields, and omitsfilesAdapter/databaseURI/readOnlyMasterKey/masterKeyTtl.Runtime, same app config with a circular
filesAdapter:Before:
GET /parse-dashboard-config.jsonreturns500(Converting circular structure to JSON), and the dashboard fails to load:After: the endpoint returns
200with only whitelisted fields, and the dashboard loads:(The "Server not reachable" note in the after image is only because no Parse Server backend was running for this QA; it is unrelated to the config fix, which is what loaded the app.)