fix: Additional RPC validation checks on ammRpcInfo account and amm_account fields. (#7324)

This commit is contained in:
Timothy Banks
2026-06-24 08:23:12 -04:00
committed by GitHub
parent 69d289a388
commit bb7c4d1c9f
4 changed files with 66 additions and 8 deletions

View File

@@ -65,6 +65,26 @@ public:
BEAST_EXPECT(jv[jss::error_message] == "Account malformed.");
});
// Account is not a string
testAMM([&](AMM& ammAlice, Env&) {
auto const jv =
ammAlice.ammRpcInfo(json::Value{42}, std::nullopt, XRP, USD, std::nullopt, true, 3);
BEAST_EXPECT(jv[jss::error_message] == "Account malformed.");
});
// AMM Account is not a string
testAMM([&](AMM& ammAlice, Env&) {
auto const jv = ammAlice.ammRpcInfo(
json::Value{to_string(ammAlice.ammAccount())},
std::nullopt,
XRP,
USD,
json::Value{42},
false,
3);
BEAST_EXPECT(jv[jss::error_message] == "Account malformed.");
});
std::vector<std::tuple<std::optional<Issue>, std::optional<Issue>, TestAccount, bool>> const
invalidParams = {
{xrpIssue(), std::nullopt, TestAccount::None, false},