Sponsored Content
Skip to content

fix: Make assorted RPC fixes - #6529

Merged
bthomee merged 35 commits into
XRPLF:developfrom
mvadari:assorted-rpc-fixes
Apr 29, 2026
Merged

fix: Make assorted RPC fixes#6529
bthomee merged 35 commits into
XRPLF:developfrom
mvadari:assorted-rpc-fixes

Conversation

@mvadari

@mvadari mvadari commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

  • account_channels: The destination_account field now returns an error if the value is not a string.
  • subscribe: The taker field in the books array now returns an error if the value is not a string.
  • account_info: The urlgravatar field now uses HTTPS instead of HTTP.
  • ledger: The full, accounts, transactions, expand, binary, owner_funds, and queue fields now return an error if the value is not a boolean.
  • ledger_data: The binary field now returns an error if the value is not a boolean.
  • submit: The fail_hard field now returns an error if the value is not a boolean.
  • subscribe: The taker field in the books array now returns actMalformed instead of badIssuer if the value is not a valid account.
  • noripple_check: Changed bitwise & to logical && in several places where booleans were being combined
  • Role.cpp — Fixed a bug in forwardedFor() where the fallback position returned when no comma/semicolon delimiter was found was computed incorrectly as it->value().size() - forStr.size() (relative to the start of the whole header) instead of remaining (relative to where found points, after "for="). This could cause truncated or over-read IP addresses from the Forwarded header.
  • Removed some dead code in the transaction signing code

Context of Change

AI code review

Fixes #6759
Fixes #6762

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

API Impact

Basically only validation changes, the API Changelog has been updated.

Test Plan

Everything added has tests.

@mvadari
mvadari requested review from Copilot and godexsoft March 11, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens RPC request validation and corrects a few RPC-related behavioral issues, aligning error handling with intended semantics and improving security (e.g., HTTPS gravatar URL).

Changes:

  • Add stricter type validation for several RPC request fields (string/bool) and return appropriate errors.
  • Fix incorrect logic/behavior in a few RPC handlers (e.g., subscribe taker error code, Role forwarded parsing, NoRippleCheck boolean operators).
  • Add/extend unit tests to cover the new validation and bug fixes, and update the API changelog.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/xrpld/rpc/handlers/Subscribe.cpp Validate books[].taker is a string; return actMalformed for malformed account values.
src/xrpld/rpc/handlers/Submit.cpp Validate fail_hard is boolean and propagate structured validation errors via Expected.
src/xrpld/rpc/handlers/NoRippleCheck.cpp Fix boolean logic by replacing bitwise & with logical &&.
src/xrpld/rpc/handlers/LedgerHandler.cpp Enforce boolean typing for multiple ledger options and adjust ledger lookup gating.
src/xrpld/rpc/handlers/LedgerData.cpp Enforce binary is boolean (with field-specific error).
src/xrpld/rpc/handlers/GetAggregatePrice.cpp Avoid repeated ledger lookup by moving it out of the per-item loop.
src/xrpld/rpc/handlers/AccountInfo.cpp Switch gravatar URL from HTTP to HTTPS.
src/xrpld/rpc/handlers/AccountChannels.cpp Validate destination_account is a string before parsing.
src/xrpld/rpc/detail/TransactionSign.cpp Remove redundant sle null-check in verify path (already validated earlier).
src/xrpld/rpc/detail/Role.cpp Fix remaining-length calculation when parsing Forwarded to prevent buffer over-read.
src/test/rpc/Subscribe_test.cpp Add coverage for invalid books[].taker types/values and expected errors.
src/test/rpc/Submit_test.cpp New tests covering fail_hard type validation for both submit paths.
src/test/rpc/Roles_test.cpp Add targeted cases for the Forwarded parsing fix; improve testcase labeling.
src/test/rpc/LedgerRPC_test.cpp Add coverage ensuring non-boolean ledger option fields return invalid params.
src/test/rpc/LedgerData_test.cpp Add coverage ensuring non-boolean binary returns the expected field error.
src/test/app/PayChan_test.cpp Add coverage ensuring non-string destination_account is rejected in account_channels.
API-CHANGELOG.md Document the validation/error behavior changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.1%. Comparing base (46b997b) to head (1bfd3ef).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/rpc/handlers/account/AccountInfo.cpp 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6529     +/-   ##
=========================================
- Coverage     82.1%   82.1%   -0.0%     
=========================================
  Files         1010    1010             
  Lines        75961   75995     +34     
  Branches      7392    7382     -10     
=========================================
+ Hits         62330   62356     +26     
- Misses       13631   13639      +8     
Files with missing lines Coverage Δ
src/xrpld/rpc/detail/Role.cpp 91.8% <100.0%> (ø)
src/xrpld/rpc/detail/TransactionSign.cpp 90.1% <ø> (+0.1%) ⬆️
src/xrpld/rpc/handlers/account/AccountChannels.cpp 81.8% <100.0%> (+0.4%) ⬆️
src/xrpld/rpc/handlers/account/NoRippleCheck.cpp 100.0% <100.0%> (ø)
src/xrpld/rpc/handlers/ledger/Ledger.cpp 47.8% <100.0%> (+7.0%) ⬆️
src/xrpld/rpc/handlers/ledger/LedgerData.cpp 58.1% <100.0%> (+1.9%) ⬆️
...xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp 99.4% <ø> (ø)
src/xrpld/rpc/handlers/subscribe/Subscribe.cpp 91.9% <100.0%> (+2.0%) ⬆️
src/xrpld/rpc/handlers/transaction/Submit.cpp 84.1% <100.0%> (+1.5%) ⬆️
src/xrpld/rpc/handlers/account/AccountInfo.cpp 85.4% <0.0%> (ø)

... and 9 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@godexsoft godexsoft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Leaving some nits 👍

Comment thread src/test/app/PayChan_test.cpp Outdated
Comment thread src/test/rpc/Submit_test.cpp Outdated
Comment thread src/test/rpc/Submit_test.cpp Outdated
Comment thread src/test/rpc/Subscribe_test.cpp Outdated
Comment thread src/xrpld/rpc/detail/Role.cpp Outdated
Comment thread src/xrpld/rpc/handlers/NoRippleCheck.cpp
@mvadari mvadari added the AI Triage Bugs and fixes that have been triaged via AI initiatives label Mar 24, 2026
@github-actions

Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

@mvadari
mvadari requested a review from godexsoft April 8, 2026 21:03
Copilot AI review requested due to automatic review settings April 27, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread API-CHANGELOG.md
Comment thread src/xrpld/rpc/handlers/account/AccountInfo.cpp Outdated
Comment thread API-CHANGELOG.md
Copilot AI review requested due to automatic review settings April 27, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/xrpld/rpc/handlers/transaction/Submit.cpp Outdated
Comment thread src/xrpld/rpc/handlers/ledger/Ledger.cpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 15:06
@mvadari mvadari added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Apr 29, 2026
@bthomee bthomee changed the title fix: Assorted RPC fixes fix: Make assorted RPC fixes Apr 29, 2026
Comment thread src/xrpld/rpc/handlers/subscribe/Subscribe.cpp
@bthomee
bthomee added this pull request to the merge queue Apr 29, 2026
Merged via the queue into XRPLF:develop with commit 7be98d9 Apr 29, 2026
3 checks passed
@mvadari
mvadari deleted the assorted-rpc-fixes branch April 30, 2026 15:17
marek-foss-neti pushed a commit to marek-foss-neti/rippled that referenced this pull request May 5, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Added to API Changelog API changes have been documented in API-CHANGELOG.md AI Triage Bugs and fixes that have been triaged via AI initiatives API Change Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AccountInfo: gravatar URL uses HTTP instead of HTTPS AccountChannels: missing type validation on destination_account parameter

5 participants