Skip to content

fix(desktop): keep an unactivated enterprise install off the network until a workspace address is submitted - #4809

Merged
yomgui merged 3 commits into
devfrom
astra/e1-preactivation-egress
Sep 10, 2026
Merged

yomgui merged 3 commits into
devfrom
astra/e1-preactivation-egress

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Problem

An unactivated enterprise build made non-loopback requests before the person entered a workspace address, i.e. to hosts nobody in the organization chose:

  • app.openworklabs.com/api/runtime-config — resolveDenBootstrapConfigWithRuntimeApi guarded only on isDesktopRuntime(), so initializeDenBootstrapConfig probed the hosted default on every fresh boot.
  • PostHog (us.i.posthog.com) — AppRoot called initAnalytics() / captureAnalyticsEvent("app_opened") above EnterpriseActivationGate; isAnalyticsEnabled() had no activation check.
  • Cloud inventory prefetch — also above the gate (a no-op without a token today, gated anyway).
  • Found while writing the spec: github.com — ArchitectureMismatchGate → openwork:system:architecture → resolveArchitectureInfo() fetched the public release manifest on every boot, even when the installed build already matched the machine.
  • Found by the spec on Linux CI: redirector.gvt1.com — Chromium's spellchecker downloads its Hunspell dictionary from Google as soon as a text field mounts (Windows/Linux only; macOS uses the native spellchecker).

Fix (smallest)

  • apps/app/src/app/lib/den.ts — boot-time paths (initializeDenBootstrapConfig ×3, refreshDenBootstrapConfigFromShell) go through resolveBootBootstrapConfig, which skips the runtime-config probe while enterpriseActivationRequired(). setDenBootstrapConfig (the submitted address) and an activated bootstrap still resolve it.
  • apps/app/src/app/lib/enterprise-activation.ts — new outboundEgressAllowed(distribution, bootstrap, { desktopConfigLoading }): always true for installs that never require activation; for activation-required installs true only once activated and the desktop config has resolved once (same readiness DesktopUpdaterProvider waits for).
  • apps/app/src/react-app/shell/app-root.tsx — analytics init/capture and the Cloud inventory prefetch wait for useOutboundEgressAllowed().
  • apps/desktop/electron/main.mjs — resolveArchitectureInfo only fetches the release manifest when appArch !== systemArch; a matching install never shows the download so the fetched URL was unused.
  • apps/desktop/electron/main.mjs — holdSpellcheckerUntilActivation() runs synchronously with the first session.defaultSession access (Electron's Session constructor calls SpellcheckService::InitializeDictionaries right there; the download itself waits on a file-thread hop) and clears the dictionary list while activation is required; releaseSpellcheckerAfterActivation() restores the held languages on both existing activation transitions (connect link, bootstrap write from the handoff exchange). Electron re-defaults an empty persisted list at the next boot, so quitting before activation cannot leave the spellchecker off. macOS uses the native spellchecker; the calls are no-ops there.
  • packages/docs/start-here/outbound-network-access.mdx — new "Before enterprise activation" note.

Den policy switch: there is no analytics/telemetry switch in desktopPolicyDefinitions / desktopConfigSchema today, so none is honoured; the local analyticsEnabled preference still applies after activation. Waiting for the desktop config to resolve once means a future policy would be read before the first event.

Public/cloud flavors: outboundEgressAllowed returns true immediately when activation is not required, so their boot is unchanged (unit-tested).

Proof

Spec evals/specs/packaged-preactivation-egress.e2e.test.ts + evals/worlds/packaged-preactivation-egress.ts: boots the packaged enterprise binary on a fresh profile behind a refusing logging forward proxy (ELECTRON_EXTRA_LAUNCH_ARGS=--proxy-server=…, which Chromium's stack, net.fetch in main and electron-updater all honour; loopback is implicitly bypassed).

  1. Negative half: activation gate on screen → 25 s quiet window → zero non-loopback requests. Then a workspace address is submitted (pasted sign-in link naming https://den.example.test) → the only host contacted is den.example.test; the gate stays up (proxy refuses the exchange) and analytics stay silent.
  2. Positive control: same binary with an activation stamp for that Den → the witness sees the runtime-config probe to den.example.test and the PostHog flush, proving the proxy observes renderer + main traffic and that analytics resume after activation.

Red on origin/dev (unfixed binary, macOS): ["CONNECT app.openworklabs.com:443","CONNECT github.com:443"] during the quiet window; the first CI run on Linux additionally surfaced CONNECT redirector.gvt1.com:443 (spellchecker), fixed in the follow-up commits (the first attempt with setSpellCheckerEnabled(false) ran too late; see commit messages). Green on this branch. Added to packaged-smoke.mjs (enterprise flavor) and the journey catalog so CI's packaged smoke gate runs it on Linux.

Unit tests apps/app/tests/preactivation-egress.test.ts (8 tests; 3 red on dev): boot skips runtime-config for unactivated enterprise, resolves it for activated / public / submitted address; outboundEgressAllowed matrix; AppRoot wiring.

Lane: local (packaged specs are placement: local — the packaged enterprise binary is only produced by packaged-smoke; not a Daytona lane). Test-evidence sections are published in the sticky comment below.

Related: ASTRA-1 follow-up E1.

…until a workspace address is submitted

Before activation an enterprise install knows no organization server, yet the
renderer already probed app.openworklabs.com/api/runtime-config during
bootstrap, queued the app_opened analytics event for PostHog and prefetched
Cloud inventory from AppRoot above the activation gate, and the architecture
gate made the main process fetch the public GitHub release manifest on every
boot even when the installed build matched the machine.

- den.ts: boot-time bootstrap resolution skips the runtime-config probe while
  activation is required; setDenBootstrapConfig (the submitted address) and an
  activated bootstrap still resolve it.
- app-root.tsx: analytics init/capture and the Cloud inventory prefetch wait
  until outboundEgressAllowed(): activation complete and the desktop config
  resolved once, mirroring the updater gate. Installs that never require
  activation are unchanged. There is no Den analytics/telemetry policy switch
  today; the local analyticsEnabled preference still applies afterwards.
- main.mjs: resolveArchitectureInfo only fetches the release manifest when the
  app and machine architectures differ.

Spec packaged-preactivation-egress.e2e.test.ts boots the packaged enterprise
binary behind a refusing logging proxy (--proxy-server) and asserts zero
non-loopback requests until a workspace address is submitted, then only that
host; the activated control proves the witness sees runtime-config and
analytics once activated. packaged-smoke runs it for the enterprise flavor.
@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Sep 10, 2026 4:35pm UTC
openwork-den Skipped Skipped Sep 10, 2026 4:35pm UTC
openwork-diagnostics Skipped Skipped Sep 10, 2026 4:35pm UTC
openwork-landing Skipped Skipped Sep 10, 2026 4:35pm UTC

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (60995 ms), confidentiality-review (93067 ms), spec-provenance-review (53620 ms), desktop-den-sync-review (79621 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 3
  • Distinct heads in retained window: 3
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 3/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 10, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (c9ab2937e2d900843bb7b6ea651bf1f43c2eeecd). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

On Windows and Linux Chromium's spellchecker fetches its Hunspell dictionary
from redirector.gvt1.com as soon as a text field mounts, which the packaged
smoke gate's Linux run of packaged-preactivation-egress caught on the fresh
enterprise install. Disable the spellchecker while activation is required
and re-enable it on both activation transitions (connect link and the
bootstrap write from the handoff exchange).
diff-warden[bot]
diff-warden Bot previously approved these changes Sep 10, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (4f378924372d9feaefc69e46177a39292a3d3936). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

…sion access

setSpellCheckerEnabled(false) ran two awaits after session.defaultSession was
first touched, and Electron's Session constructor already calls
SpellcheckService::InitializeDictionaries there, so the Hunspell download had
left before the flag flipped (the Linux packaged smoke run still saw
redirector.gvt1.com). Clear the dictionary list synchronously with that first
access instead — the download waits on a file-thread hop — and restore the
held languages on both activation transitions. Electron re-defaults an empty
persisted list on the next boot, so quitting before activation cannot leave
the spellchecker off.
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 10, 2026 16:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 10, 2026 16:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 10, 2026 16:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 10, 2026 16:35 Inactive
@mintlify

mintlify Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
differentai 🟢 Ready View Preview Sep 10, 2026, 4:39 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (9f426edea01f73d76713c8f39c516a3724af8cd7). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Test evidence — an unactivated enterprise install makes no request outside loopback until a workspace address is submitted — ✅ passed

SHA 9f426ed · engine v1

✅ 0/2 screenshots passed · 2 assertions · 2 expectations passed · 0 failed · 0 pending

[probe] eventually(packaged distribution flavor) · eventually(enterprise activation gate mounted in #root)
[user] see(text=Link this app to your organization)
[probe] eventually(non-loopback requests before a workspace address is submitted)
[user] see(text=Link this app to your organization) · screenshot · type(testId=organization-server-input, "openwork://den-auth?grant=eval-grant-refused-by-witness&denBaseUrl=https%3A%2F%2Fden.example.test") · testId=organization-server-continue · click(testId=organization-server-continue) · see(text=Connect this app to https://den.example.test?) · testId=organization-server-confirm · click(testId=organization-server-confirm)
[probe] eventually(a request to the submitted workspace address den.example.test)
[user] see(text=Link this app to your organization) · screenshot
verdict passed · 6 user observations (see ×4, screenshot ×2) · 4 probes · steps 0/0

ℹ️ ASSERTION — 1. An unactivated enterprise install makes no non-loopback request within 25s of showing "Link this app to your organization"

proxy log: []

  • ✅ PASS An unactivated enterprise install makes no non-loopback request within 25s of showing "Link this app to your organization" — proxy log: []

ℹ️ ASSERTION — 2. After a workspace address is submitted, the install contacts only den.example.test

proxy log: ["CONNECT den.example.test:443","CONNECT den.example.test:443"]

  • ✅ PASS After a workspace address is submitted, the install contacts only den.example.test — proxy log: ["CONNECT den.example.test:443","CONNECT den.example.test:443"]

⚪ UNVALIDATED — 3. an unactivated enterprise install makes no request outside loopback until a workspace address is submitted artifact 1

  • ⚪ UNVALIDATED — no visual expectations recorded.

an unactivated enterprise install makes no request outside loopback until a workspace address is submitted artifact 1

⚪ UNVALIDATED — 4. an unactivated enterprise install makes no request outside loopback until a workspace address is submitted artifact 3

  • ⚪ UNVALIDATED — no visual expectations recorded.

an unactivated enterprise install makes no request outside loopback until a workspace address is submitted artifact 3


Test run created 2026-09-10T16:40:18.312Z · Source: evals/results/test-runs/2026-09-10T16-40-18-311Z-an-unactivated-enterprise-install-makes-no-request-outside-loopback-until-a-work/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4809 --test-run 2026-09-10T16-40-18-311Z-an-unactivated-enterprise-install-makes-no-request-outside-loopback-until-a-work

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Positive control for the sticky test-evidence comment above (same PR head 9f426ed, same witness, macOS local lane). Published as a plain comment because the publisher keeps one test run per sticky comment. The Linux proof for the spellchecker fix is the desktop-egress-gate-enterprise phase of the packaged-smoke job in openwork-tests-build (exit 0, 2 passed / 0 failed / 0 skipped).

Test evidence — an activated enterprise install still resolves its Den and reports analytics — ✅ passed

SHA 9f426ed · engine v1

✅ 0/1 screenshots passed · 1 assertion · 1 expectations passed · 0 failed · 0 pending

Dry run: screenshots were not attached.

[probe] eventually(packaged distribution flavor) · eventually(Den runtime-config probe and analytics flush after activation)
[user] notSee(text=Link this app to your organization) · screenshot
verdict passed · 2 user observations (notSee ×1, screenshot ×1) · 2 probes · steps 0/0

ℹ️ ASSERTION — 1. An activated enterprise install contacts its Den (den.example.test) and flushes analytics (us.i.posthog.com) without any user action

proxy log: ["CONNECT den.example.test:443","CONNECT github.com:443","CONNECT us.i.posthog.com:443"]

  • ✅ PASS An activated enterprise install contacts its Den (den.example.test) and flushes analytics (us.i.posthog.com) without any user action — proxy log: ["CONNECT den.example.test:443","CONNECT github.com:443","CONNECT us.i.posthog.com:443"]

⚪ UNVALIDATED — 2. an activated enterprise install still resolves its Den and reports analytics artifact 1

  • ⚪ UNVALIDATED — no visual expectations recorded.

Test run created 2026-09-10T16:40:46.771Z · Source: evals/results/test-runs/2026-09-10T16-40-46-771Z-an-activated-enterprise-install-still-resolves-its-den-and-reports-analytics/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4809 --test-run 2026-09-10T16-40-46-771Z-an-activated-enterprise-install-still-resolves-its-den-and-reports-analytics

This branch was successfully deployed

1 active and 4 inactive deployments
staging - packages/docs — 9f426ede Deployed Sep 10, 2026 by mintlify[bot]
Preview – openwork-den — 9f426ede Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-app — 9f426ede Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — 9f426ede Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-landing — 9f426ede Deployed Sep 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant