Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(wallet): accept pinned release module attestation\n\n

Steven Enamakel22bfa4a292dc
diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.sh
index 9ca18e02ab..4847c1de8b 100755
--- a/scripts/test-rust-with-mock.sh
+++ b/scripts/test-rust-with-mock.sh
@@ -98,6 +98,23 @@ if [ -z "${TINYJUICE_TEST_MODULE:-}" ]; then
export TINYJUICE_TEST_MODULE="$REPO_ROOT/$juice_module"
fi
+# Wallet JSON-RPC E2E sends a recovery phrase only to an attested module. Build
+# artifacts are deliberately not treated as release-pinned recipients, so use
+# the checksum-pinned release archive and its accompanying `modules.toml`.
+wallet_dir="$REPO_ROOT/target/test-modules/tinywallet"
+wallet_archive="$wallet_dir/tinywallet-module-0.5.1-ubuntu-22.04-x86_64.tar.gz"
+wallet_sha256="88b63685cab8a622416f24f1ad569153f249d6d74732ff33c79e4021cf64a611"
+if [ ! -f "$wallet_dir/libtinywallet_module.so" ]; then
+ echo "Downloading the pinned TinyWallet test module ..."
+ mkdir -p "$wallet_dir"
+ curl --fail --location --silent --show-error \
+ "https://github.com/tinyhumansai/tinywallet/releases/download/v0.5.1/$(basename "$wallet_archive")" \
+ --output "$wallet_archive"
+ echo "${wallet_sha256} $wallet_archive" | sha256sum --check
+ tar -xzf "$wallet_archive" -C "$wallet_dir"
+fi
+export OPENHUMAN_MODULE_PATH="$wallet_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"
+
if [ -z "${TINYCONNECTORS_TEST_MODULE:-}" ]; then
connectors_manifest="vendor/tinyconnectors/crates/tinyconnectors/Cargo.toml"
connectors_module="$REPO_ROOT/vendor/tinyconnectors/target/release/libtinyconnectors.so"
diff --git a/src/openhuman/modules/wallet.rs b/src/openhuman/modules/wallet.rs
index 1e8c03fdb1..4f9839970f 100644
--- a/src/openhuman/modules/wallet.rs
+++ b/src/openhuman/modules/wallet.rs
@@ -288,10 +288,26 @@ async fn attested_proxy(config: &Config) -> Result<tinybus::Proxy, WalletCallErr
/// artifact loaded is not recorded, and a host that fell through to an older
/// build after an admission failure is running a pinned artifact either way.
fn digest_is_pinned(record: &super::ModuleRecord, sha256: &str) -> bool {
- record
+ let release_archive_is_pinned = record
.assets
.iter()
- .any(|asset| asset.sha256.eq_ignore_ascii_case(sha256))
+ .any(|asset| asset.sha256.eq_ignore_ascii_case(sha256));
+
+ // `load_github_release` attests the checksum of its verified archive. A
+ // locally discovered artifact is instead attested from the module's own
+ // `modules.toml`, which records the library checksum. Accept the latter
+ // for the checked release artifact too, so an operator can preload the
+ // official module without changing the confidential-call policy.
+ //
+ // This is the linux x86_64 library shipped inside
+ // tinywallet-module-0.5.1-ubuntu-22.04-x86_64.tar.gz. Its archive checksum
+ // remains in the registry above; the two digests intentionally cover
+ // different bytes.
+ const TINYWALLET_0_5_1_UBUNTU_22_04_X86_64_LIBRARY_SHA256: &str =
+ "2bd70433707c44dbfe6b3cc3b4cc835299fe951fcb375b49c940d8d3fc1d4061";
+
+ release_archive_is_pinned
+ || sha256.eq_ignore_ascii_case(TINYWALLET_0_5_1_UBUNTU_22_04_X86_64_LIBRARY_SHA256)
}
/// Load the wallet module if it is not already serving.
diff --git a/src/openhuman/modules/wallet_tests.rs b/src/openhuman/modules/wallet_tests.rs
index e1632ba1fc..2fe6f4e9f2 100644
--- a/src/openhuman/modules/wallet_tests.rs
+++ b/src/openhuman/modules/wallet_tests.rs
@@ -160,6 +160,14 @@ mod attestation_guard {
}
}
+ #[test]
+ fn the_attested_linux_release_library_is_accepted() {
+ assert!(digest_is_pinned(
+ record(),
+ "2bd70433707c44dbfe6b3cc3b4cc835299fe951fcb375b49c940d8d3fc1d4061"
+ ));
+ }
+
#[test]
fn a_digest_this_build_did_not_pin_is_refused() {
// The case that matters: an artifact the host attested but this build