@bivy/bivy 0.16.12-staging.2 → 0.16.12-staging.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/bivy.mjs CHANGED
@@ -4504,7 +4504,7 @@ async function runUpdate(args = []) {
4504
4504
  await waitForIdleSessions(config, { skip: skipWait });
4505
4505
  // install.sh reads BIVY_CHANNEL from the env; pass the recorded channel so a
4506
4506
  // packaged re-install stays on it (and re-records it) instead of latest.
4507
- const code = await run("bash", ["-c", "curl -fsSL https://bivy.sh/install.sh | bash"], {
4507
+ const code = await run("bash", ["-o", "pipefail", "-c", "curl -fsSL https://bivy.sh/install.sh | bash"], {
4508
4508
  cwd: repoRoot,
4509
4509
  env: { ...process.env, BIVY_HOME: repoRoot, BIVY_CHANNEL: channel },
4510
4510
  });
@@ -4520,9 +4520,18 @@ async function runUpdate(args = []) {
4520
4520
  console.log(c.dim("Pulling latest code…"));
4521
4521
  const branch = runQuiet("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd: repoRoot }).stdout.trim();
4522
4522
  const pull = await run("git", ["pull", "--ff-only", "origin", branch || "main"], { cwd: repoRoot });
4523
- if (pull !== 0) console.log(c.yellow("git pull reported an issue; continuing."));
4523
+ if (pull !== 0) {
4524
+ console.log(c.yellow(`git pull failed (exit ${pull}); update stopped without restarting the service.`));
4525
+ process.exitCode = pull;
4526
+ return;
4527
+ }
4524
4528
  const [updateCmd, updateArgs] = installCommandFor(repoRoot);
4525
- await run(updateCmd, updateArgs, { cwd: repoRoot });
4529
+ const installCode = await run(updateCmd, updateArgs, { cwd: repoRoot });
4530
+ if (installCode !== 0) {
4531
+ console.log(c.yellow(`Dependency installation failed (exit ${installCode}); service not restarted. Resolve the installation error and retry 'bivy update'.`));
4532
+ process.exitCode = installCode;
4533
+ return;
4534
+ }
4526
4535
  await ensureKnownAgents();
4527
4536
  const config = loadConfig();
4528
4537
  await waitForIdleSessions(config, { skip: skipWait });
package/dist/auth.js CHANGED
@@ -230,18 +230,23 @@ export function requestOriginAllowed(req) {
230
230
  if (host && !ok(host))
231
231
  return false;
232
232
  }
233
- const originHeader = req.headers["origin"];
234
- const origin = Array.isArray(originHeader) ? originHeader[0] : originHeader;
235
- if (origin && origin !== "null") {
236
- let originHost = null;
233
+ const origin = req.headers["origin"];
234
+ if (origin !== undefined) {
235
+ // A literal "null" is an opaque browser origin (e.g. a sandboxed iframe),
236
+ // not the absence of Origin from a native client. Fail closed on empty or
237
+ // multiple origins too; trusting the first would discard conflicting input.
238
+ if (typeof origin !== "string" || !origin || origin === "null")
239
+ return false;
237
240
  try {
238
- originHost = new URL(origin).hostname;
241
+ const parsed = new URL(origin);
242
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:")
243
+ return false;
244
+ if (!ok(parsed.hostname))
245
+ return false;
239
246
  }
240
247
  catch {
241
248
  return false;
242
249
  }
243
- if (!ok(originHost))
244
- return false;
245
250
  }
246
251
  return true;
247
252
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.16.12-staging.2",
3
+ "version": "0.16.12-staging.3",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "Run coding agents on machines you own. Open-source, self-hostable agent workspace.",