Compare commits

...

8 Commits

Author SHA1 Message Date
Bart
149df6a36d Tweaks 2025-11-20 11:27:53 -05:00
Bart
ddda26d76a Ignore .claude and Testing 2025-11-20 09:52:14 -05:00
Bart
b93d4a122a Merge branch 'develop' into bthomee/git 2025-11-20 09:49:37 -05:00
Mayukha Vadari
a3d4be4eaf fix: Set correct index for limit in book_offers CLI (#6043)
This change fixes an indexing typo in the `book_offers` CLI processing, and does not affect the HTTPS/WS RPC processing.
2025-11-20 06:37:28 -05:00
Olek
6ff495fd9b Fix: Perform array size check (#6030)
The `ledger_entry` and `deposit_preauth` requests require an array of credentials. However, the array size is not checked before is gets processing. This fix adds checks and return errors in case array size is too big.
2025-11-19 16:58:18 +00:00
Bart
15997b6683 Add AI tool file to .gitignore 2025-11-05 15:01:54 +00:00
Bart
f909d954ee Merge branch 'develop' into bthomee/git 2025-11-05 15:00:57 +00:00
Bart
e6d3238fb1 Clean up .gitignore and .gitattributes 2025-11-05 08:04:56 +00:00
7 changed files with 93 additions and 115 deletions

4
.gitattributes vendored
View File

@@ -1,10 +1,6 @@
# Set default behaviour, in case users don't have core.autocrlf set.
#* text=auto
# These annoying files
rippled.1 binary
LICENSE binary
# Visual Studio
*.sln text eol=crlf
*.vcproj text eol=crlf

114
.gitignore vendored
View File

@@ -1,69 +1,43 @@
# .gitignore
bin/boostbook_catalog.xml
bin/config.log
bin/project-cache.jam
# Ignore vim swap files.
*.swp
# Ignore SCons support files.
.sconsign.dblite
# Ignore python compiled files.
*.pyc
# Ignore Macintosh Desktop Services Store files.
# Macintosh Desktop Services Store files.
.DS_Store
# Ignore backup/temps
# Build, intermediate, and temporary artifacts.
*~
# Ignore object files.
*.o
.nih_c
tags
TAGS
GTAGS
GRTAGS
GPATH
bin/rippled
Debug/*.*
Release/*.*
*.pdb
*.swp
/.clangd
Debug/
Release/
/.build/
/build/
/db/
/out.txt
/Testing/
/tmp/
CMakeSettings.json
CMakeUserPresets.json
# Ignore coverage files.
# Coverage files.
*.gcno
*.gcda
*.gcov
# Levelization checking
# Profiling data.
gmon.out
# Levelization data.
.github/scripts/levelization/results/*
!.github/scripts/levelization/results/loops.txt
!.github/scripts/levelization/results/ordering.txt
# Ignore tmp directory.
tmp
# Customized configs.
/rippled.cfg
/validators.txt
# Ignore database directory.
db/
db/*.db
db/*.db-*
# Ignore debug logs
debug_log.txt
# Ignore customized configs
rippled.cfg
validators.txt
# Doxygen generated documentation output
HtmlDocumentation
docs/html_doc
# Xcode user-specific project settings
# Xcode
.DS_Store
/build/
# XCode IDE.
*.pbxuser
!default.pbxuser
*.mode1v3
@@ -76,38 +50,16 @@ xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
# Intel Parallel Studio 2013 XE
My Amplifier XE Results - RippleD
# JetBrains IDE.
/.idea/
# Compiler intermediate output
/out.txt
# Microsoft Visual Studio IDE.
/.vs/
/.vscode/
# Build Log
rippled-build.log
# Profiling data
gmon.out
Builds/VisualStudio2015/*.db
Builds/VisualStudio2015/*.user
Builds/VisualStudio2015/*.opendb
Builds/VisualStudio2015/*.sdf
# MSVC
*.pdb
.vs/
CMakeSettings.json
compile_commands.json
.clangd
packages
pkg_out
pkg
CMakeUserPresets.json
bld.rippled/
.vscode
# Suggested in-tree build directory
/.build*/
# AI tools.
/.augment
/.claude
/CLAUDE.md

3
docs/.gitignore vendored
View File

@@ -1,3 +0,0 @@
html
temp
out.txt

View File

@@ -1103,7 +1103,7 @@ class LedgerEntry_test : public beast::unit_test::suite
checkErrorValue(
jrr[jss::result],
"malformedAuthorizedCredentials",
"Invalid field 'authorized_credentials', not array.");
"Invalid field 'authorized_credentials', array empty.");
}
{
@@ -1144,7 +1144,7 @@ class LedgerEntry_test : public beast::unit_test::suite
checkErrorValue(
jrr[jss::result],
"malformedAuthorizedCredentials",
"Invalid field 'authorized_credentials', not array.");
"Invalid field 'authorized_credentials', array too long.");
}
}

View File

@@ -1584,8 +1584,6 @@ static RPCCallTestData const rpcCallTestArray[] = {
"EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
"junk", // Note: indexing bug in parseBookOffers() requires junk
// param.
"200",
},
RPCCallTestData::no_exception,
@@ -1597,7 +1595,6 @@ static RPCCallTestData const rpcCallTestArray[] = {
"issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
"limit" : 200,
"proof" : true,
"taker_gets" : {
"currency" : "EUR",
"issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
@@ -1617,8 +1614,8 @@ static RPCCallTestData const rpcCallTestArray[] = {
"EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
"junk", // Note: indexing bug in parseBookOffers() requires junk param.
"200",
"0",
"MyMarker"},
RPCCallTestData::no_exception,
R"({
@@ -1630,7 +1627,6 @@ static RPCCallTestData const rpcCallTestArray[] = {
"ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
"limit" : 200,
"marker" : "MyMarker",
"proof" : true,
"taker_gets" : {
"currency" : "EUR",
"issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
@@ -1665,8 +1661,8 @@ static RPCCallTestData const rpcCallTestArray[] = {
"EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
"junk", // Note: indexing bug in parseBookOffers() requires junk param.
"200",
"0",
"MyMarker",
"extra"},
RPCCallTestData::no_exception,
@@ -1770,12 +1766,19 @@ static RPCCallTestData const rpcCallTestArray[] = {
"EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
"ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
"junk", // Note: indexing bug in parseBookOffers() requires junk
// param.
"not_a_number",
},
RPCCallTestData::bad_cast,
R"()"},
RPCCallTestData::no_exception,
R"({
"method" : "book_offers",
"params" : [
{
"error" : "invalidParams",
"error_code" : 31,
"error_message" : "Invalid field 'limit'."
}
]
})"},
// can_delete
// ------------------------------------------------------------------

View File

@@ -332,16 +332,32 @@ private:
if (jvParams.size() >= 5)
{
int iLimit = jvParams[5u].asInt();
try
{
int iLimit = jvParams[4u].asInt();
if (iLimit > 0)
jvRequest[jss::limit] = iLimit;
}
if (jvParams.size() >= 6 && jvParams[5u].asInt())
catch (std::exception const&)
{
return RPC::invalid_field_error(jss::limit);
}
}
if (jvParams.size() >= 6)
{
try
{
int bProof = jvParams[5u].asInt();
if (bProof)
jvRequest[jss::proof] = true;
}
catch (std::exception const&)
{
return RPC::invalid_field_error(jss::proof);
}
}
if (jvParams.size() == 7)
jvRequest[jss::marker] = jvParams[6u];

View File

@@ -16,8 +16,6 @@
#include <xrpl/protocol/STXChainBridge.h>
#include <xrpl/protocol/jss.h>
#include <functional>
namespace ripple {
static Expected<uint256, Json::Value>
@@ -178,18 +176,41 @@ static Expected<STArray, Json::Value>
parseAuthorizeCredentials(Json::Value const& jv)
{
if (!jv.isArray())
{
return LedgerEntryHelpers::invalidFieldError(
"malformedAuthorizedCredentials",
jss::authorized_credentials,
"array");
STArray arr(sfAuthorizeCredentials, jv.size());
}
std::uint32_t const n = jv.size();
if (n > maxCredentialsArraySize)
{
return Unexpected(LedgerEntryHelpers::malformedError(
"malformedAuthorizedCredentials",
"Invalid field '" + std::string(jss::authorized_credentials) +
"', array too long."));
}
if (n == 0)
{
return Unexpected(LedgerEntryHelpers::malformedError(
"malformedAuthorizedCredentials",
"Invalid field '" + std::string(jss::authorized_credentials) +
"', array empty."));
}
STArray arr(sfAuthorizeCredentials, n);
for (auto const& jo : jv)
{
if (!jo.isObject())
{
return LedgerEntryHelpers::invalidFieldError(
"malformedAuthorizedCredentials",
jss::authorized_credentials,
"array");
}
if (auto const value = LedgerEntryHelpers::hasRequired(
jo,
{jss::issuer, jss::credential_type},
@@ -260,13 +281,6 @@ parseDepositPreauth(Json::Value const& dp, Json::StaticString const fieldName)
auto const arr = parseAuthorizeCredentials(ac);
if (!arr.has_value())
return Unexpected(arr.error());
if (arr->empty() || (arr->size() > maxCredentialsArraySize))
{
return LedgerEntryHelpers::invalidFieldError(
"malformedAuthorizedCredentials",
jss::authorized_credentials,
"array");
}
auto const& sorted = credentials::makeSorted(arr.value());
if (sorted.empty())