File tree Expand file tree Collapse file tree 4 files changed +18
-2
lines changed
Expand file tree Collapse file tree 4 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,9 @@ jwt_auth_fail_timeout_seconds = 300
201201# Path to the CA certificate that signed the Dirk server certificate
202202# OPTIONAL
203203# ca_cert_path = "/path/to/ca.crt"
204+ # Limits the maximum size of a decoded gRPC response
205+ # OPTIONAL. Default: 4MB
206+ # max_response_size_bytes = 4194304
204207
205208# Add one entry like this for each Dirk host
206209# [[signer.dirk.hosts]]
Original file line number Diff line number Diff line change @@ -113,6 +113,9 @@ pub enum SignerType {
113113 /// How to store proxy key delegations
114114 /// ERC2335 is not supported with Dirk signer
115115 store : Option < ProxyStore > ,
116+ /// Limits the maximum size of a decoded gRPC response.
117+ /// Default is 4MB (from tonic bindings)
118+ max_response_size_bytes : Option < usize > ,
116119 } ,
117120}
118121
@@ -122,6 +125,7 @@ pub struct DirkConfig {
122125 pub client_cert : Identity ,
123126 pub secrets_path : PathBuf ,
124127 pub cert_auth : Option < Certificate > ,
128+ pub max_response_size_bytes : Option < usize > ,
125129}
126130
127131#[ derive( Debug , Clone ) ]
@@ -188,7 +192,7 @@ impl StartSignerConfig {
188192 secrets_path,
189193 ca_cert_path,
190194 store,
191- ..
195+ max_response_size_bytes ,
192196 } => {
193197 let cert_path = load_env_var ( DIRK_CERT_ENV ) . map ( PathBuf :: from) . unwrap_or ( cert_path) ;
194198 let key_path = load_env_var ( DIRK_KEY_ENV ) . map ( PathBuf :: from) . unwrap_or ( key_path) ;
@@ -222,6 +226,7 @@ impl StartSignerConfig {
222226 }
223227 None => None ,
224228 } ,
229+ max_response_size_bytes,
225230 } ) ,
226231 } )
227232 }
Original file line number Diff line number Diff line change @@ -101,7 +101,14 @@ impl DirkManager {
101101 }
102102 } ;
103103
104- let accounts_response = match ListerClient :: new ( channel. clone ( ) )
104+ let mut lister_client = ListerClient :: new ( channel. clone ( ) ) ;
105+ if let Some ( max_decoding_size) = config. max_response_size_bytes {
106+ // ListAccounts seems the only method that can return large responses,
107+ // so we only set the max decoding size for it.
108+ lister_client = lister_client. max_decoding_message_size ( max_decoding_size) ;
109+ }
110+
111+ let accounts_response = match lister_client
105112 . list_accounts ( ListAccountsRequest { paths : host. wallets . clone ( ) } )
106113 . await
107114 {
Original file line number Diff line number Diff line change @@ -329,6 +329,7 @@ key_path = "/path/to/client.key"
329329secrets_path = " /path/to/secrets"
330330# Optional parameters
331331ca_cert_path = " /path/to/ca.crt"
332+ max_response_size_bytes = " 4194304"
332333
333334# Add one entry like this for each host
334335[[signer .dirk .hosts ]]
You can’t perform that action at this time.
0 commit comments