fix: Incomplete JSON key escaping in PostgreSQL Increment on nested Object fields#10261
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. |
✅ 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. |
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds JSON-string escaping for nested-object Increment keys in the Postgres storage adapter and updates PostgreSQL tests to assert that crafted sub-keys cannot create or modify unintended JSONB keys or bypass ACL/CLP protections. Changes
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)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Adapters/Storage/Postgres/PostgresStorageAdapter.js`:
- Line 212: The escapeJsonString function currently only escapes backslashes and
quotes, leaving control characters like newline, carriage return and tabs
unescaped which can break the CONCAT-built JSON literal; update escapeJsonString
to also replace control characters (at minimum \n, \r, \t — and ideally \b and
\f) with their escaped sequences (e.g. \\n, \\r, \\t, \\b, \\f) using global
replacements so the produced string is a valid JSON string when inserted into
CONCAT('{"...":', ...)::jsonb; keep the existing backslash and quote escaping
and ensure the replacements run on the same input value in escapeJsonString.
🪄 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: 48172d9e-852e-47fa-9e29-e5f14b0645ac
📒 Files selected for processing (3)
spec/PostgresStorageAdapter.spec.jsspec/vulnerabilities.spec.jssrc/Adapters/Storage/Postgres/PostgresStorageAdapter.js
…special characters
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10261 +/- ##
==========================================
+ Coverage 84.38% 92.55% +8.16%
==========================================
Files 192 192
Lines 16431 16433 +2
Branches 226 226
==========================================
+ Hits 13866 15210 +1344
+ Misses 2545 1203 -1342
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# [9.6.0-alpha.46](9.6.0-alpha.45...9.6.0-alpha.46) (2026-03-20) ### Bug Fixes * Incomplete JSON key escaping in PostgreSQL Increment on nested Object fields ([#10261](#10261)) ([a692873](a692873))
|
🎉 This change has been released in version 9.6.0-alpha.46 |
Issue
Incomplete JSON key escaping in PostgreSQL Increment on nested Object fields (GHSA-33gq-87fg-pf98)