Skip to content

MOD-18588 - create new dedicated config fr checking depth in old rdbs - #1657

Open
TalBarYakar wants to merge 1 commit into
masterfrom
tal.ba/bug/rdb_old_load_depth
Open

TalBarYakar wants to merge 1 commit into
masterfrom
tal.ba/bug/rdb_old_load_depth

Conversation

@TalBarYakar

@TalBarYakar TalBarYakar commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Changes RDB/RESTORE behavior for legacy encver 0 snapshots when the opt-in config is enabled; misconfiguration could reject valid deep legacy dumps, but default remains off.

Overview
Adds an optional module setting json-legacy-rdb-depth-limit (default no, documented in module.conf) so loading legacy encver 0 RedisJSON RDB data can enforce the same 128-level nesting cap as JSON path operations.

When enabled, the legacy loader in backward.rs tracks recursion depth while parsing dict/array nodes and fails with the existing recursion-limit error before deeply nested RESTORE / RDB loads can blow the stack. The flag is registered in module configuration and can be toggled at runtime via CONFIG SET.

Pytest coverage crafts nested legacy array DUMP/RESTORE payloads: depth 128 succeeds with the limit on, depth 129 is rejected without crashing the server.

Reviewed by Cursor Bugbot for commit d469210. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d469210. Configure here.

&& depth >= MAX_DEPTH
&& matches!(node_type, NodeType::Dict | NodeType::Array)
{
return Err(crate::manager::err_recursion_limit_exceeded());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depth-128 restore still fails

Medium Severity

The new check counts depth from 0, so 128 nested containers pass json-legacy-rdb-depth-limit. RESTORE then re-parses through from_str with the serde_json recursion limit still enabled, which already rejects 128 nested containers. The documented and tested depth-128 success path therefore still fails.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d469210. Configure here.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant