From 3999a47352338c881edd8e5b151d34b19c110ec8 Mon Sep 17 00:00:00 2001 From: polydez <155382956+polydez@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:13:25 +0500 Subject: [PATCH] feat: add requirement of account id to be public in RPC --- rpc/src/server/api.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rpc/src/server/api.rs b/rpc/src/server/api.rs index cbe7b1606..58cd22729 100644 --- a/rpc/src/server/api.rs +++ b/rpc/src/server/api.rs @@ -149,7 +149,7 @@ impl api_server::Api for RpcApi { debug!(target: COMPONENT, request = ?request.get_ref()); // Validating account using conversion: - let _account_id: AccountId = request + let account_id: AccountId = request .get_ref() .account_id .clone() @@ -157,6 +157,12 @@ impl api_server::Api for RpcApi { .try_into() .map_err(|err| Status::invalid_argument(format!("Invalid account id: {err}")))?; + if !account_id.is_on_chain() { + return Err(Status::invalid_argument( + "Invalid account id: account required to be public", + )); + } + self.store.clone().get_public_account_details(request).await } }