From e03289d738d97e2f9ebb21452b74b459b8ca91e1 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:05:22 +0200 Subject: [PATCH] fix(dpp): add input validation --- .../rs-dpp/src/identity/identity_public_key/random.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/rs-dpp/src/identity/identity_public_key/random.rs b/packages/rs-dpp/src/identity/identity_public_key/random.rs index 3fddbd5751..4fed36eb0f 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/random.rs @@ -583,6 +583,14 @@ impl IdentityPublicKey { "at least 2 keys must be created".to_string(), )); } + + if key_count > 16 { + return Err(ProtocolError::PublicKeyGenerationError(format!( + "too many keys requested: {}, max is 16", + key_count + ))); + } + //create a master and a high level key let mut main_keys = if key_count == 2 { vec![