Skip to content

RI-7973 Fix JSON error with keys containing constructor or __proto__#5622

Open
pd-redis wants to merge 3 commits intomainfrom
bugfix/RI-7973/fix-json-constructor-key
Open

RI-7973 Fix JSON error with keys containing constructor or __proto__#5622
pd-redis wants to merge 3 commits intomainfrom
bugfix/RI-7973/fix-json-constructor-key

Conversation

@pd-redis
Copy link
Contributor

@pd-redis pd-redis commented Mar 11, 2026

What

Configure all json-bigint parsers with constructorAction: 'preserve' and protoAction: 'preserve' so that JSON keys named constructor or __proto__ are handled correctly instead of throwing.

The rejson details utils on the frontend already used this pattern — this change applies it consistently to the remaining 4 parsers (1 backend, 3 frontend).

Supersedes closed PR #5413 which only fixed the backend. This PR extends the fix to all frontend parsers as well.

Testing

  1. JSON.SET mykey $ '{"constructor":"example value"}'
  2. Open the key in Browser — should display without error
  3. Run JSON.GET mykey $ in Workbench — output should render correctly
  4. Unit tests added for both backend and frontend parsers

Closes #5412
References: #RI-7973

Made with Cursor


Note

Medium Risk
Touches JSON parsing/serialization in both API and UI; while the change is small, it affects handling of special keys like __proto__, so regressions or unexpected object-shape interactions are possible.

Overview
Fixes JSON rendering/download failures when payloads contain object keys named constructor or __proto__ by configuring all remaining json-bigint parsers with protoAction: 'preserve' and constructorAction: 'preserve' (backend RejsonRlService and multiple UI JSON viewers/formatters).

Adds regression tests in the API rejson-rl service and UI JSONViewer to ensure these payloads parse and round-trip without throwing, and centralizes UI re-serialization to reuse a consistently configured parser.

Written by Cursor Bugbot for commit c23b6f5. This will update automatically on new commits. Configure here.

…ll parsers

References: #RI-7973
Made-with: Cursor
@jit-ci
Copy link

jit-ci bot commented Mar 11, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

…on-rl service and tests

- Adjusted formatting in rejson-rl.service.ts and rejson-rl.service.spec.ts for consistency.
- Ensured proper semicolon usage and indentation for better code clarity.
- No functional changes were made; focus was on code style improvements.
- Reformatted the JSON string in the test case to enhance clarity and maintain consistency with coding standards.
- No functional changes were made; focus was on code style improvements.
@github-actions
Copy link
Contributor

Code Coverage - Backend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 92.65% 14928/16113
🟡 Branches 75.02% 4640/6185
🟢 Functions 86.44% 2333/2699
🟢 Lines 92.45% 14261/15425

Test suite run success

3288 tests passing in 303 suites.

Report generated by 🧪jest coverage report action from c23b6f5

@github-actions
Copy link
Contributor

Code Coverage - Integration Tests

Status Category Percentage Covered / Total
🟢 Statements 80.68% 17156/21264
🟡 Branches 63.51% 7813/12301
🟡 Functions 69.3% 2407/3473
🟢 Lines 80.26% 16128/20093

@github-actions
Copy link
Contributor

Code Coverage - Frontend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 82.38% 23517/28546
🟡 Branches 67.48% 9820/14553
🟡 Functions 77.55% 6451/8319
🟢 Lines 82.82% 23023/27798

Test suite run success

6530 tests passing in 792 suites.

Report generated by 🧪jest coverage report action from c23b6f5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:Object contains forbidden constructor property

1 participant