From 3a554e21c7f8ec1f9df028b31686c1b2d0973551 Mon Sep 17 00:00:00 2001 From: Gonza Montiel Date: Tue, 10 Feb 2026 00:05:40 -0300 Subject: [PATCH] fix: avoid passing private key by command line --- test/cli/handlers/contracts/upgrade.ts | 14 +++++--------- test/scripts/fund-validators.ts | 12 +++++++++--- test/scripts/update-validator-set.ts | 9 +++++++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/test/cli/handlers/contracts/upgrade.ts b/test/cli/handlers/contracts/upgrade.ts index d64ec0d7..9ef098e1 100644 --- a/test/cli/handlers/contracts/upgrade.ts +++ b/test/cli/handlers/contracts/upgrade.ts @@ -206,9 +206,9 @@ const deployServiceManagerImplementation = async ( const actualDeployments = await parseDeploymentsFile(chain); - // Use environment variables to avoid command injection - // Note: Private key is passed via environment variable as required by forge - // This is a known limitation of the forge toolchain + // Use environment variables to avoid command injection and process list exposure + // Note: Private key is passed via PRIVATE_KEY environment variable (not command-line) + // to prevent it from appearing in system process lists (security best practice) const env = { ...process.env, PRIVATE_KEY: privateKey, @@ -226,8 +226,6 @@ const deployServiceManagerImplementation = async ( "deployServiceManagerImpl()", "--rpc-url", rpcUrl, - "--private-key", - privateKey, "--broadcast", "--non-interactive" ]; @@ -296,8 +294,8 @@ const updateServiceManagerProxyWithVersion = async ( ) => { logger.info(`🔄 Updating ServiceManager proxy and setting version to ${version}...`); - // Note: Private key is passed via environment variable as required by forge - // This is a known limitation of the forge toolchain + // Note: Private key is passed via PRIVATE_KEY environment variable (not command-line) + // to prevent it from appearing in system process lists (security best practice) const proxyAdmin = (deployments as any).ProxyAdmin ?? process.env.PROXY_ADMIN; if (!proxyAdmin) { throw new Error( @@ -322,8 +320,6 @@ const updateServiceManagerProxyWithVersion = async ( "updateServiceManagerProxyWithVersion()", "--rpc-url", rpcUrl, - "--private-key", - privateKey, "--broadcast", "--non-interactive" ]; diff --git a/test/scripts/fund-validators.ts b/test/scripts/fund-validators.ts index f7ffefd6..c44e4e51 100644 --- a/test/scripts/fund-validators.ts +++ b/test/scripts/fund-validators.ts @@ -160,10 +160,13 @@ export const fundValidators = async (options: FundValidatorsOptions): Promise