From 68646147d3e95c68b4a90c9e37d888ef00e9d35d Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 23 Oct 2024 13:49:01 -0700 Subject: [PATCH] fix: validate scriptArgs endowment --- packages/builders/scripts/inter-protocol/updatePriceFeeds.js | 3 ++- packages/deploy-script-support/src/externalTypes.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builders/scripts/inter-protocol/updatePriceFeeds.js b/packages/builders/scripts/inter-protocol/updatePriceFeeds.js index c71e25ce3fd..866a4865882 100644 --- a/packages/builders/scripts/inter-protocol/updatePriceFeeds.js +++ b/packages/builders/scripts/inter-protocol/updatePriceFeeds.js @@ -69,7 +69,8 @@ const Usage = `agoric run updatePriceFeed.js ${keys(configurations).join(' | ')} /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */ export default async (homeP, endowments) => { const { scriptArgs } = endowments; - const config = configurations[scriptArgs?.[0]]; + assert(scriptArgs, 'expected script args endowment'); + const config = configurations[scriptArgs[0]]; if (!config) { console.error(Usage); process.exit(1); diff --git a/packages/deploy-script-support/src/externalTypes.js b/packages/deploy-script-support/src/externalTypes.js index 91b7a9e89d1..cc75a1ff876 100644 --- a/packages/deploy-script-support/src/externalTypes.js +++ b/packages/deploy-script-support/src/externalTypes.js @@ -60,6 +60,7 @@ export {}; * now: () => number, * pathResolve: (...path: string[]) => string, * publishBundle: PublishBundleRef, + * scriptArgs?: string[], * }} DeployScriptEndownments */