From e7f65b4aace709d564230071e06434300cafeb8f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 15 Feb 2026 16:05:49 +0000 Subject: [PATCH] refactor(infra): dedupe exec allowlist analysis failure --- src/infra/exec-approvals-allowlist.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/infra/exec-approvals-allowlist.ts b/src/infra/exec-approvals-allowlist.ts index cb491937df5..1d7b52018ec 100644 --- a/src/infra/exec-approvals-allowlist.ts +++ b/src/infra/exec-approvals-allowlist.ts @@ -256,6 +256,14 @@ export function evaluateShellAllowlist(params: { autoAllowSkills?: boolean; platform?: string | null; }): ExecAllowlistAnalysis { + const analysisFailure = (): ExecAllowlistAnalysis => ({ + analysisOk: false, + allowlistSatisfied: false, + allowlistMatches: [], + segments: [], + segmentSatisfiedBy: [], + }); + const chainParts = isWindowsPlatform(params.platform) ? null : splitCommandChain(params.command); if (!chainParts) { const analysis = analyzeShellCommand({ @@ -265,13 +273,7 @@ export function evaluateShellAllowlist(params: { platform: params.platform, }); if (!analysis.ok) { - return { - analysisOk: false, - allowlistSatisfied: false, - allowlistMatches: [], - segments: [], - segmentSatisfiedBy: [], - }; + return analysisFailure(); } const evaluation = evaluateExecAllowlist({ analysis, @@ -302,13 +304,7 @@ export function evaluateShellAllowlist(params: { platform: params.platform, }); if (!analysis.ok) { - return { - analysisOk: false, - allowlistSatisfied: false, - allowlistMatches: [], - segments: [], - segmentSatisfiedBy: [], - }; + return analysisFailure(); } segments.push(...analysis.segments);