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. # Set default behaviour, in case users don't have core.autocrlf set.
#* text=auto #* text=auto
# These annoying files
rippled.1 binary
LICENSE binary
# Visual Studio # Visual Studio
*.sln text eol=crlf *.sln text eol=crlf
*.vcproj text eol=crlf *.vcproj text eol=crlf

114
.gitignore vendored
View File

@@ -1,69 +1,43 @@
# .gitignore # .gitignore
bin/boostbook_catalog.xml # Macintosh Desktop Services Store files.
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.
.DS_Store .DS_Store
# Ignore backup/temps # Build, intermediate, and temporary artifacts.
*~ *~
# Ignore object files.
*.o *.o
.nih_c *.pdb
tags *.swp
TAGS /.clangd
GTAGS Debug/
GRTAGS Release/
GPATH /.build/
bin/rippled /build/
Debug/*.* /db/
Release/*.* /out.txt
/Testing/
/tmp/
CMakeSettings.json
CMakeUserPresets.json
# Ignore coverage files. # Coverage files.
*.gcno *.gcno
*.gcda *.gcda
*.gcov *.gcov
# Levelization checking # Profiling data.
gmon.out
# Levelization data.
.github/scripts/levelization/results/* .github/scripts/levelization/results/*
!.github/scripts/levelization/results/loops.txt !.github/scripts/levelization/results/loops.txt
!.github/scripts/levelization/results/ordering.txt !.github/scripts/levelization/results/ordering.txt
# Ignore tmp directory. # Customized configs.
tmp /rippled.cfg
/validators.txt
# Ignore database directory. # XCode IDE.
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/
*.pbxuser *.pbxuser
!default.pbxuser !default.pbxuser
*.mode1v3 *.mode1v3
@@ -76,38 +50,16 @@ xcuserdata
profile profile
*.moved-aside *.moved-aside
DerivedData DerivedData
.idea/
*.hmap *.hmap
# Intel Parallel Studio 2013 XE # JetBrains IDE.
My Amplifier XE Results - RippleD /.idea/
# Compiler intermediate output # Microsoft Visual Studio IDE.
/out.txt /.vs/
/.vscode/
# Build Log # AI tools.
rippled-build.log /.augment
/.claude
# Profiling data /CLAUDE.md
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*/

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

View File

@@ -332,15 +332,31 @@ private:
if (jvParams.size() >= 5) if (jvParams.size() >= 5)
{ {
int iLimit = jvParams[5u].asInt(); try
{
int iLimit = jvParams[4u].asInt();
if (iLimit > 0) if (iLimit > 0)
jvRequest[jss::limit] = iLimit; jvRequest[jss::limit] = iLimit;
}
catch (std::exception const&)
{
return RPC::invalid_field_error(jss::limit);
}
} }
if (jvParams.size() >= 6 && jvParams[5u].asInt()) if (jvParams.size() >= 6)
{ {
jvRequest[jss::proof] = true; 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) if (jvParams.size() == 7)

View File

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