fix(FN-4702): scope pre-approved override to install gate
Fusion-Task-Id: FN-4702 Fusion-Task-Lineage: 378b46bc-2e71-43bf-9ff7-85e7aed8bf85
This commit is contained in:
committed by
gsxdsm
parent
412e59e1f9
commit
ac264bf64b
@@ -195,25 +195,18 @@ export async function executeApprovedWorktrunkInstall(opts: {
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function installWorktrunk(opts: {
|
||||
settings: WorktrunkSettings;
|
||||
async function applyInstallGate(opts: {
|
||||
auditor?: RunAuditor;
|
||||
runContext?: EngineRunContext;
|
||||
gateOverride?: "pre-approved";
|
||||
}): Promise<{ binaryPath: string; source: "installed-release" | "installed-cargo" }> {
|
||||
}): Promise<{ satisfied: boolean }> {
|
||||
if (opts.gateOverride === "pre-approved") {
|
||||
await emitBinaryAudit(opts.auditor, "binary:install-requested", {
|
||||
reason: "pre-approved",
|
||||
taskId: opts.runContext?.taskId,
|
||||
runId: opts.runContext?.runId,
|
||||
});
|
||||
await emitBinaryAudit(opts.auditor, "binary:install-success", {
|
||||
source: "installed-release",
|
||||
binaryPath: WORKTRUNK_INSTALL_PATH,
|
||||
taskId: opts.runContext?.taskId,
|
||||
runId: opts.runContext?.runId,
|
||||
});
|
||||
return { binaryPath: WORKTRUNK_INSTALL_PATH, source: "installed-release" };
|
||||
return { satisfied: true };
|
||||
}
|
||||
|
||||
await emitBinaryAudit(opts.auditor, "binary:install-denied", {
|
||||
@@ -224,6 +217,22 @@ export async function installWorktrunk(opts: {
|
||||
throw new WorktrunkInstallFailedError(AUTO_INSTALL_DISABLED_MESSAGE, { stage: "auto-install-disabled" });
|
||||
}
|
||||
|
||||
export async function installWorktrunk(opts: {
|
||||
settings: WorktrunkSettings;
|
||||
auditor?: RunAuditor;
|
||||
runContext?: EngineRunContext;
|
||||
gateOverride?: "pre-approved";
|
||||
}): Promise<{ binaryPath: string; source: "installed-release" | "installed-cargo" }> {
|
||||
await applyInstallGate(opts);
|
||||
await emitBinaryAudit(opts.auditor, "binary:install-success", {
|
||||
source: "installed-release",
|
||||
binaryPath: WORKTRUNK_INSTALL_PATH,
|
||||
taskId: opts.runContext?.taskId,
|
||||
runId: opts.runContext?.runId,
|
||||
});
|
||||
return { binaryPath: WORKTRUNK_INSTALL_PATH, source: "installed-release" };
|
||||
}
|
||||
|
||||
export function clearWorktrunkResolveCache(): void {
|
||||
resolveCache.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user