Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4

This commit is contained in:
Ed Hennis
2025-09-25 13:27:17 -04:00
committed by GitHub
8 changed files with 50 additions and 21 deletions

View File

@@ -63,7 +63,7 @@ jobs:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
max-parallel: 10
runs-on: ${{ matrix.architecture.runner }}
container: ${{ inputs.os == 'linux' && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }}
container: ${{ inputs.os == 'linux' && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-5dd7158', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }}
steps:
- name: Check strategy matrix
run: |

View File

@@ -40,7 +40,7 @@ jobs:
upload:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158
steps:
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

View File

@@ -7,8 +7,9 @@ on:
workflow_dispatch:
jobs:
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
run-hooks:
uses: XRPLF/actions/.github/workflows/pre-commit.yml@af1b0f0d764cda2e5435f5ac97b240d4bd4d95d3
with:
runs_on: ubuntu-latest
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit" }'
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-d1496b8" }'

View File

@@ -27,7 +27,7 @@ env:
jobs:
publish:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/ci/tools-rippled-documentation
container: ghcr.io/xrplf/ci/tools-rippled-documentation:sha-d1496b8
permissions:
contents: write
steps:

View File

@@ -56,7 +56,7 @@ jobs:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
max-parallel: 10
runs-on: ${{ matrix.architecture.runner }}
container: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }}
container: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-5dd7158', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }}
steps:
- name: Cleanup workspace

View File

@@ -768,6 +768,24 @@ private:
expectUntrusted(lists.at(7));
expectTrusted(lists.at(2));
// try empty or mangled manifest
checkResult(
trustedKeys->applyLists(
"", version, {{blob7, sig7, {}}, {blob6, sig6, {}}}, siteUri),
publisherPublic,
ListDisposition::invalid,
ListDisposition::invalid);
checkResult(
trustedKeys->applyLists(
base64_encode("not a manifest"),
version,
{{blob7, sig7, {}}, {blob6, sig6, {}}},
siteUri),
publisherPublic,
ListDisposition::invalid,
ListDisposition::invalid);
// do not use list from untrusted publisher
auto const untrustedManifest = base64_encode(makeManifestString(
randomMasterKey(),

View File

@@ -877,7 +877,7 @@ private:
verify(
lock_guard const&,
Json::Value& list,
std::string const& manifest,
Manifest manifest,
std::string const& blob,
std::string const& signature);

View File

@@ -1149,21 +1149,33 @@ ValidatorList::applyList(
Json::Value list;
auto const& manifest = localManifest ? *localManifest : globalManifest;
auto [result, pubKeyOpt] = verify(lock, list, manifest, blob, signature);
auto m = deserializeManifest(base64_decode(manifest));
if (!m)
{
JLOG(j_.warn()) << "UNL manifest cannot be deserialized";
return PublisherListStats{ListDisposition::invalid};
}
auto [result, pubKeyOpt] =
verify(lock, list, std::move(*m), blob, signature);
if (!pubKeyOpt)
{
JLOG(j_.info()) << "ValidatorList::applyList unable to retrieve the "
"master public key from the verify function\n";
JLOG(j_.warn())
<< "UNL manifest is signed with an unrecognized master public key";
return PublisherListStats{result};
}
if (!publicKeyType(*pubKeyOpt))
{
JLOG(j_.info()) << "ValidatorList::applyList Invalid Public Key type"
" retrieved from the verify function\n ";
{ // LCOV_EXCL_START
// This is an impossible situation because we will never load an
// invalid public key type (see checks in `ValidatorList::load`) however
// we can only arrive here if the key used by the manifest matched one of
// the loaded keys
UNREACHABLE(
"ripple::ValidatorList::applyList : invalid public key type");
return PublisherListStats{result};
}
} // LCOV_EXCL_STOP
PublicKey pubKey = *pubKeyOpt;
if (result > ListDisposition::pending)
@@ -1356,19 +1368,17 @@ std::pair<ListDisposition, std::optional<PublicKey>>
ValidatorList::verify(
ValidatorList::lock_guard const& lock,
Json::Value& list,
std::string const& manifest,
Manifest manifest,
std::string const& blob,
std::string const& signature)
{
auto m = deserializeManifest(base64_decode(manifest));
if (!m || !publisherLists_.count(m->masterKey))
if (!publisherLists_.count(manifest.masterKey))
return {ListDisposition::untrusted, {}};
PublicKey masterPubKey = m->masterKey;
auto const revoked = m->revoked();
PublicKey masterPubKey = manifest.masterKey;
auto const revoked = manifest.revoked();
auto const result = publisherManifests_.applyManifest(std::move(*m));
auto const result = publisherManifests_.applyManifest(std::move(manifest));
if (revoked && result == ManifestDisposition::accepted)
{
@@ -1796,7 +1806,7 @@ ValidatorList::getAvailable(
if (!keyBlob || !publicKeyType(makeSlice(*keyBlob)))
{
JLOG(j_.info()) << "Invalid requested validator list publisher key: "
JLOG(j_.warn()) << "Invalid requested validator list publisher key: "
<< pubKey;
return {};
}