Skip to content

Commit 896fc91

Browse files
sparrowDomclaude
andcommitted
Honor USE_DEFENDER_SIGNER env var to route this run via Defender
Talos' per-action "Use Defender Relayer signer" checkbox sets this env var on the dispatch spawn when an operator opts in. Add a branch in getSigner() before the KMS check that honors it: if the env vars are missing throw a structured error (so it surfaces cleanly in talos run_logs instead of as a Defender SDK 401), otherwise call the existing getDefenderSigner(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7095dc5 commit 896fc91

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/js/utils/signers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,25 @@ export async function getSigner(address?: string): Promise<Signer> {
141141
return maybeWrap(wallet);
142142
}
143143

144+
// Per-action override set by talos dispatch when the operator checked
145+
// the "Use Defender Relayer signer" box on this action. Skip KMS and
146+
// route through Defender for this run only. Throw a structured error
147+
// if the env vars aren't actually present so the failure surfaces
148+
// cleanly in run_logs instead of as an SDK 401.
149+
if (process.env.USE_DEFENDER_SIGNER === "1") {
150+
if (
151+
!process.env.DEFENDER_RELAYER_KEY ||
152+
!process.env.DEFENDER_RELAYER_SECRET
153+
) {
154+
throw new Error(
155+
"USE_DEFENDER_SIGNER=1 was requested but DEFENDER_RELAYER_KEY / " +
156+
"DEFENDER_RELAYER_SECRET are not configured on this runner. " +
157+
"Either uncheck the Defender option on this action or configure the env vars.",
158+
);
159+
}
160+
return maybeWrap(await getDefenderSigner());
161+
}
162+
144163
if (hasAwsKmsCredentials()) {
145164
return maybeWrap(await getKmsSigner());
146165
}

0 commit comments

Comments
 (0)