mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
fix: authorized_credential elements in array not objects bug (#1744)
This commit is contained in:
@@ -285,7 +285,7 @@ CustomValidator CustomValidators::AuthorizeCredentialValidator =
|
||||
if (authCred.empty()) {
|
||||
return Error{Status{
|
||||
ClioError::rpcMALFORMED_AUTHORIZED_CREDENTIALS,
|
||||
fmt::format("Requires at least one element in authorized_credentials array")
|
||||
fmt::format("Requires at least one element in authorized_credentials array.")
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -299,13 +299,19 @@ CustomValidator CustomValidators::AuthorizeCredentialValidator =
|
||||
}
|
||||
|
||||
for (auto const& credObj : value.as_array()) {
|
||||
if (!credObj.is_object()) {
|
||||
return Error{Status{
|
||||
ClioError::rpcMALFORMED_AUTHORIZED_CREDENTIALS,
|
||||
"authorized_credentials elements in array are not objects."
|
||||
}};
|
||||
}
|
||||
auto const& obj = credObj.as_object();
|
||||
|
||||
if (!obj.contains("issuer")) {
|
||||
return Error{
|
||||
Status{ClioError::rpcMALFORMED_AUTHORIZED_CREDENTIALS, "Field 'Issuer' is required but missing."}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// don't want to change issuer error message to be about credentials
|
||||
if (!IssuerValidator.verify(credObj, "issuer"))
|
||||
|
||||
Reference in New Issue
Block a user