Skip to content

Fix fetch_info clear parameter type validation (#6756)#7606

Open
harshitgupta62 wants to merge 1 commit into
XRPLF:developfrom
harshitgupta62:fix-fetch-info-clear-validation
Open

Fix fetch_info clear parameter type validation (#6756)#7606
harshitgupta62 wants to merge 1 commit into
XRPLF:developfrom
harshitgupta62:fix-fetch-info-clear-validation

Conversation

@harshitgupta62

Copy link
Copy Markdown

Summary

Fixes an issue where the clear parameter in the fetch_info RPC method accepts non-boolean values due to loose type coercion.

Problem

The current implementation uses asBool() directly, which coerces non-boolean JSON values into boolean. This leads to unintended behavior where inputs like:

  • { "clear": "false" }
  • { "clear": [1] }
  • { "clear": {} }

are treated as true, causing clearLedgerFetch() to be triggered unexpectedly.

Solution

Added strict type validation using isBool() before calling asBool(). Now, only an explicit boolean true value will trigger the clearing of ledger fetch state.

Behavior After Fix

  • { "clear": true } → clears fetch state
  • { "clear": false } → does not clear
  • Non-boolean values → ignored (no unintended clearing)

Impact

  • Prevents unintended clearing of ledger fetch state
  • Maintains backward compatibility (no breaking changes)

Related Issue

Closes #6756

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.

fetch_info clear parameter accepts non-boolean types via loose coercion

1 participant