@burdenoff/microfe-vibecontrols 2026.1117.2 → 2026.1123.2

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.
@@ -3,14 +3,15 @@ import { SessionSharePermission as a } from "../generated/wspace-types.js";
3
3
  import { SharedTerminalPanel as ie } from "../components/sessions/SharedTerminalPanel.js";
4
4
  import { CollaboratorsList as ae } from "../components/sessions/CollaboratorsList.js";
5
5
  import { useVibeControls as oe } from "../providers/VibeControlsProvider.js";
6
- import { useCallback as o, useEffect as s, useMemo as se, useRef as c, useState as l } from "react";
7
- import { useI18n as ce } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
8
- import { AlertCircle as u, ArrowLeft as d, Clock as le, Eye as f, Gamepad2 as p, Loader2 as m, Lock as h, LogIn as g, Terminal as _, Users as ue } from "lucide-react";
9
- import { useParams as de } from "react-router";
6
+ import { getSafeTunnelIframeUrl as se } from "../utils/iframeUrl.js";
7
+ import { useCallback as o, useEffect as s, useMemo as ce, useRef as c, useState as l } from "react";
8
+ import { useI18n as le } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { AlertCircle as u, ArrowLeft as d, Clock as ue, Eye as f, Gamepad2 as p, Loader2 as m, Lock as h, LogIn as g, Terminal as _, Users as de } from "lucide-react";
10
+ import { useParams as fe } from "react-router";
10
11
  import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
11
- import { MotionPage as fe } from "@burdenoff/fe-libs/shared/motion";
12
+ import { MotionPage as pe } from "@burdenoff/fe-libs/shared/motion";
12
13
  // src/pages/SharedSessionPage.tsx
13
- function pe({ onSubmit: e, isLoading: t, error: n }) {
14
+ function me({ onSubmit: e, isLoading: t, error: n }) {
14
15
  let [r, i] = l("");
15
16
  return /* @__PURE__ */ b("form", {
16
17
  onSubmit: (t) => {
@@ -54,17 +55,17 @@ function pe({ onSubmit: e, isLoading: t, error: n }) {
54
55
  });
55
56
  }
56
57
  function x() {
57
- let { t: h } = ce(), x = o((e, t) => {
58
+ let { t: h } = le(), x = o((e, t) => {
58
59
  let n = h(e);
59
60
  return n === e ? t : n;
60
- }, [h]), { token: S } = de(), { currentUser: me } = oe(), [C, w] = l(!1), [T, E] = l(null), [D, he] = l(""), [ge, O] = l(null), [k, A] = l(null), [j, M] = l(!1), N = c(!1), P = c(!1), F = me?.id ?? "", { data: _e, loading: ve, error: I, refetch: L } = re({
61
+ }, [h]), { token: S } = fe(), { currentUser: he } = oe(), [C, w] = l(!1), [T, E] = l(null), [D, ge] = l(""), [_e, O] = l(null), [k, A] = l(null), [j, M] = l(!1), N = c(!1), P = c(!1), F = he?.id ?? "", { data: ve, loading: ye, error: I, refetch: L } = re({
61
62
  variables: { token: S || "" },
62
63
  skip: !S
63
- }), R = _e?.validateShareLink, [z, { loading: B }] = r(), [V] = i(), [H, { loading: U }] = te(), [W, { loading: ye }] = ee(), { data: be, refetch: G } = n({
64
+ }), R = ve?.validateShareLink, [z, { loading: B }] = r(), [V] = i(), [H, { loading: U }] = te(), [W, { loading: be }] = ee(), { data: xe, refetch: G } = n({
64
65
  variables: { sessionId: T || "" },
65
66
  skip: !T || !C,
66
67
  pollInterval: 6e4
67
- }), K = be?.sessionCollaborators || [], { data: q } = e({
68
+ }), K = xe?.sessionCollaborators || [], { data: q } = e({
68
69
  variables: { sessionId: T || "" },
69
70
  skip: !T || !C
70
71
  }), { data: J } = t({
@@ -129,7 +130,7 @@ function x() {
129
130
  T,
130
131
  H,
131
132
  G
132
- ]), xe = o(async () => {
133
+ ]), Se = o(async () => {
133
134
  if (T) try {
134
135
  await W({ variables: { sessionId: T } }), G();
135
136
  } catch (e) {
@@ -139,14 +140,14 @@ function x() {
139
140
  T,
140
141
  W,
141
142
  G
142
- ]), Se = o(async () => {
143
+ ]), Ce = o(async () => {
143
144
  if (T) try {
144
145
  await V({ variables: { sessionId: T } }), P.current = !1, M(!0), w(!1), E(null), window.history.back();
145
146
  } catch (e) {
146
147
  console.error("Failed to leave session:", e);
147
148
  }
148
- }, [T, V]), Ce = K.find((e) => e.userId === F), Q = R?.permission || a.View, $ = se(() => R?.ttydUrl || null, [R?.ttydUrl]);
149
- return ve ? /* @__PURE__ */ y("div", {
149
+ }, [T, V]), we = K.find((e) => e.userId === F), Q = R?.permission || a.View, $ = ce(() => se(R?.ttydUrl), [R?.ttydUrl]);
150
+ return ye ? /* @__PURE__ */ y("div", {
150
151
  className: "min-h-screen bg-bg-canvas flex items-center justify-center",
151
152
  children: /* @__PURE__ */ b("div", {
152
153
  className: "text-center",
@@ -217,18 +218,18 @@ function x() {
217
218
  }),
218
219
  R.expiresAt && /* @__PURE__ */ b("div", {
219
220
  className: "flex items-center justify-center gap-2 mb-6 text-xs text-text-secondary",
220
- children: [/* @__PURE__ */ y(le, { className: "size-3.5" }), /* @__PURE__ */ b("span", { children: [
221
+ children: [/* @__PURE__ */ y(ue, { className: "size-3.5" }), /* @__PURE__ */ b("span", { children: [
221
222
  x("sharedSession.expires", "Expires"),
222
223
  " ",
223
224
  new Date(R.expiresAt).toLocaleString()
224
225
  ] })]
225
226
  }),
226
- /* @__PURE__ */ y(pe, {
227
+ /* @__PURE__ */ y(me, {
227
228
  onSubmit: (e) => {
228
- he(e), X(e);
229
+ ge(e), X(e);
229
230
  },
230
231
  isLoading: B,
231
- error: ge
232
+ error: _e
232
233
  })
233
234
  ]
234
235
  })
@@ -314,7 +315,7 @@ function x() {
314
315
  children: x("sharedSession.joining", "Joining session...")
315
316
  })]
316
317
  })
317
- }) : /* @__PURE__ */ b(fe, {
318
+ }) : /* @__PURE__ */ b(pe, {
318
319
  className: "min-h-screen bg-bg-canvas flex flex-col",
319
320
  children: [/* @__PURE__ */ y("header", {
320
321
  className: "bg-bg-surface border-b border-border-default px-4 py-3",
@@ -324,7 +325,7 @@ function x() {
324
325
  className: "flex items-center gap-4",
325
326
  children: [/* @__PURE__ */ y("button", {
326
327
  type: "button",
327
- onClick: Se,
328
+ onClick: Ce,
328
329
  className: "p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors",
329
330
  title: "Leave session",
330
331
  "aria-label": "Leave session",
@@ -353,7 +354,7 @@ function x() {
353
354
  children: Q === a.View ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(f, { className: "size-3.5" }), x("sharedSession.viewOnly", "View Only")] }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(p, { className: "size-3.5" }), x("sharedSession.interactive", "Interactive")] })
354
355
  }), /* @__PURE__ */ b("div", {
355
356
  className: "flex items-center gap-1.5 px-2.5 py-1 bg-bg-sunken rounded-full text-xs text-text-secondary",
356
- children: [/* @__PURE__ */ y(ue, { className: "size-3.5" }), /* @__PURE__ */ y("span", { children: K.length })]
357
+ children: [/* @__PURE__ */ y(de, { className: "size-3.5" }), /* @__PURE__ */ y("span", { children: K.length })]
357
358
  })]
358
359
  })]
359
360
  })
@@ -367,9 +368,9 @@ function x() {
367
368
  currentUserId: F,
368
369
  permission: Q,
369
370
  onRequestControl: Z,
370
- onReleaseControl: xe,
371
+ onReleaseControl: Se,
371
372
  isRequestingControl: U,
372
- isReleasingControl: ye,
373
+ isReleasingControl: be,
373
374
  className: "flex-1",
374
375
  children: /* @__PURE__ */ y("div", {
375
376
  className: "w-full h-full bg-bg-inverse text-text-inverse flex items-center justify-center",
@@ -378,7 +379,8 @@ function x() {
378
379
  title: "Shared Terminal",
379
380
  className: "w-full h-full border-0",
380
381
  allow: "clipboard-read; clipboard-write",
381
- sandbox: "allow-scripts allow-same-origin allow-forms"
382
+ sandbox: "allow-scripts allow-same-origin allow-forms",
383
+ referrerPolicy: "no-referrer"
382
384
  }) : /* @__PURE__ */ b("div", {
383
385
  className: "text-center",
384
386
  children: [
@@ -427,7 +429,7 @@ function x() {
427
429
  children: x("sharedSession.yourRole", "Your role")
428
430
  }), /* @__PURE__ */ y("span", {
429
431
  className: "text-text-primary capitalize",
430
- children: Ce?.role?.toLowerCase() || x("sharedSession.viewer", "Viewer")
432
+ children: we?.role?.toLowerCase() || x("sharedSession.viewer", "Viewer")
431
433
  })]
432
434
  }),
433
435
  /* @__PURE__ */ b("div", {
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Client-side iframe URL validators (defense-in-depth alongside backend validation).
3
+ */
4
+ /**
5
+ * Validate a scorecard metric embed URL before binding it to `<iframe src>`.
6
+ *
7
+ * Allows only valid external `https:` URLs and rejects:
8
+ * - non-`https:` schemes (`javascript:`, `data:`, `blob:`, `http:`, etc.)
9
+ * - relative or malformed URLs
10
+ * - URLs containing embedded credentials
11
+ * - URLs matching the host shell origin, Burdenoff/VibeControls hostnames, or loopback hosts
12
+ */
13
+ export declare function getSafeScorecardIframeUrl(rawUrl: string | null | undefined, currentOrigin?: string): string | null;
14
+ /**
15
+ * Validate an agent tunnel URL (terminal, plugin UI, Ungit, browser editor)
16
+ * before binding it to `<iframe src>` or passing it to `window.open()`.
17
+ *
18
+ * Allows `https:` URLs, plus loopback `http:` URLs in development only.
19
+ * Always rejects non-HTTP(S) schemes (`javascript:`, `data:`, `blob:`, etc.),
20
+ * relative/malformed URLs, embedded credentials, same-origin URLs, and
21
+ * Burdenoff/VibeControls app shell hostnames (BOFF-16057).
22
+ */
23
+ export declare function getSafeTunnelIframeUrl(rawUrl: string | null | undefined, options?: {
24
+ currentOrigin?: string;
25
+ isDev?: boolean;
26
+ }): string | null;
@@ -0,0 +1,63 @@
1
+ // src/utils/iframeUrl.ts
2
+ var e = ["vibecontrols.com", "burdenoff.com"], t = /* @__PURE__ */ new Set([
3
+ "localhost",
4
+ "127.0.0.1",
5
+ "::1",
6
+ "[::1]",
7
+ "0.0.0.0"
8
+ ]);
9
+ function n(e) {
10
+ return e.toLowerCase().replace(/\.+$/, "");
11
+ }
12
+ function r(e) {
13
+ let r = n(e);
14
+ return t.has(r) || r.endsWith(".localhost");
15
+ }
16
+ function i(t) {
17
+ let r = n(t);
18
+ return !r || e.some((e) => r === e || r.endsWith(`.${e}`));
19
+ }
20
+ function a(e) {
21
+ return e === void 0 ? typeof window < "u" && window.location?.origin ? window.location.origin : null : e || null;
22
+ }
23
+ function o(e, t) {
24
+ if (!e) return null;
25
+ let n = e.trim();
26
+ if (!n) return null;
27
+ let o;
28
+ try {
29
+ o = new URL(n);
30
+ } catch {
31
+ return null;
32
+ }
33
+ if (o.protocol !== "https:" || o.username || o.password || !o.hostname || i(o.hostname) || r(o.hostname)) return null;
34
+ let s = a(t);
35
+ return s && o.origin === s ? null : n;
36
+ }
37
+ function s(e) {
38
+ if (!e) return !1;
39
+ try {
40
+ let t = n(new URL(e).hostname);
41
+ return r(t) || t.endsWith(".local.burdenoff.com");
42
+ } catch {
43
+ return !1;
44
+ }
45
+ }
46
+ function c(e) {
47
+ return s(e);
48
+ }
49
+ function l(e, t) {
50
+ if (!e) return null;
51
+ let n = e.trim();
52
+ if (!n) return null;
53
+ let o;
54
+ try {
55
+ o = new URL(n);
56
+ } catch {
57
+ return null;
58
+ }
59
+ if (o.username || o.password || !o.hostname) return null;
60
+ let s = a(t?.currentOrigin), l = t?.isDev ?? c(s), u = o.protocol === "https:", d = o.protocol === "http:" && l && r(o.hostname);
61
+ return !u && !d || s && o.origin === s || i(o.hostname) ? null : n;
62
+ }
63
+ export { o as getSafeScorecardIframeUrl, l as getSafeTunnelIframeUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-vibecontrols",
3
- "version": "2026.1117.2",
3
+ "version": "2026.1123.2",
4
4
  "description": "VibeControls microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [