-
Notifications
You must be signed in to change notification settings - Fork 79
Changes needed for Vellum Assistant on Mac Mini #9335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -370,13 +370,12 @@ const DESIRED_FIREWALL_RULES: FirewallRuleSpec[] = [ | |
| }, | ||
| ]; | ||
|
|
||
| async function resolveInstallScriptPath(): Promise<string | null> { | ||
| const sourcePath = join(import.meta.dir, "..", "adapters", "install.sh"); | ||
| if (existsSync(sourcePath)) { | ||
| return sourcePath; | ||
| } | ||
| console.warn("\u26a0\ufe0f Install script not found at", sourcePath, "(expected in compiled binary)"); | ||
| return null; | ||
| import INSTALL_SCRIPT_CONTENT from "../adapters/install.sh" with { type: "text" }; | ||
|
|
||
| function resolveInstallScriptPath(): string { | ||
| const tmpPath = join(tmpdir(), `vellum-install-${process.pid}.sh`); | ||
| writeFileSync(tmpPath, INSTALL_SCRIPT_CONTENT, { mode: 0o755 }); | ||
| return tmpPath; | ||
| } | ||
|
|
||
| async function pollInstance( | ||
|
|
@@ -459,11 +458,7 @@ async function recoverFromCurlFailure( | |
| sshUser: string, | ||
| account?: string, | ||
| ): Promise<void> { | ||
| const installScriptPath = await resolveInstallScriptPath(); | ||
| if (!installScriptPath) { | ||
| console.warn("\u26a0\ufe0f Skipping install script upload (not available in compiled binary)"); | ||
| return; | ||
| } | ||
| const installScriptPath = resolveInstallScriptPath(); | ||
|
|
||
| const scpArgs = [ | ||
| "compute", | ||
|
|
@@ -488,6 +483,7 @@ async function recoverFromCurlFailure( | |
| if (account) sshArgs.push(`--account=${account}`); | ||
| console.log("\ud83d\udd27 Running install script on instance..."); | ||
| await exec("gcloud", sshArgs); | ||
| try { unlinkSync(installScriptPath); } catch {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Temp file leaked when The new Root CausePreviously, The await exec("gcloud", scpArgs); // can throw
await exec("gcloud", sshArgs); // can throw
try { unlinkSync(installScriptPath); } catch {} // skipped if above throwsImpact: A temp file is left behind in Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
|
|
||
| export async function hatchGcp( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolveInstallScriptPath()now writes a temporary file and can throw (for example when/tmpis full or not writable), but it is called before entering thetry/finallycleanup block. In that failure path,startupScriptPathis never deleted, leaving a startup script in/tmpthat includes sensitive values likeANTHROPIC_API_KEYandRUNTIME_PROXY_BEARER_TOKEN; moving temp install-script creation inside the guarded block (or adding an outerfinally) avoids this leak.Useful? React with 👍 / 👎.