Skip to content

fix(server): fence browser policy checks during identity enrollment - #4328

Merged
reachjalil merged 1 commit into
devfrom
feature/browser-url-allowlist-policy
Sep 17, 2026
Merged

reachjalil merged 1 commit into
devfrom
feature/browser-url-allowlist-policy

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

Current scope

This PR is reconstructed on current dev to finish browser-policy review findings. It no longer introduces allowedBrowserHosts: approved-site enforcement already landed through #4564 and later work as execution.browserOrigins.

The historical wildcard/subdomain expansion, union-of-host grants, renderer-pushed policy cache, and empty-means-unrestricted behavior are deliberately not restored. Current exact HTTP(S) origins, intersecting restrictions, empty-list denial, and server-owned enforcement remain authoritative.

Fix

An evaluation that began without a managed identity could await an empty persisted-policy read, then return unrestricted after a managed identity had arrived. Extend the existing generation fence across that read so stale evaluations reject with policy_identity_changed.

  • Add a deterministic enrollment-race regression, an unchanged-identity unmanaged control, and retained-managed-policy denial.
  • Add a focused matcher regression for file:// denial alongside approved HTTPS allowance.
  • Document the current approved-website UI, exact-origin matching, intersecting restrictions, empty-list denial, engine-refresh timing, and upload/form/network limitations.

Genuinely unmanaged local browsing remains allowed. This does not redefine the enrollment boundary, restore retired engine hooks, replace already-open pages, or redesign the new-tab experience. #4836's merged shortcuts remain intact.

Review reconciliation

  • LZ8-9QN: the old startup policy push is replaced on dev. This change closes the remaining identity-installation race in the canonical evaluator.
  • LR2-YZ3: current native interception uses <all_urls> and does not exempt file:; the canonical matcher only accepts approved HTTP(S) origins. The new matcher regression verifies denial, but is not native file-navigation proof.
  • HDD-QBP: the old rollout finding concerns a superseded field and was already resolved. Current deployment order is not asserted by this source change.

Verification

Verdict: Incomplete — native enrollment/file-request evidence and the CI-pinned runtime check remain outstanding.

Current head: 03820db8a7519878206131f3e8d96d3f5b340d5a, based on dev@23143497940c871bda4a9aaebb82bd86c3f95530.

Passed from apps/server:

  • bun --conditions=development test src/managed-desktop-policy.test.ts — exit 0; 10 service tests passed, 52 assertions, plus the passing isolation-wrapper test. The same new regression failed before the production fix (9 pass / 1 fail inside the wrapper).
  • bun test --conditions=development --preload ../../../browser-policy-test-deps.mjs ./src/managed-policy-rules.test.ts — exit 0; 1 passed, 2 assertions. The temporary preload aliases the real installed Zod 4.3.6 dependency without replacing its implementation. Omit the preload in a normally installed workspace.
  • git diff --check origin/dev...HEAD — exit 0.

No successful test was skipped. Local Bun was 1.3.4, not CI's pinned 1.3.14; that runtime check is deferred. Initial dependency setup for the matcher test failed to resolve Zod and was corrected before the passing run.

Not run: native Electron/Den journey, package builds, or whole-package typechecks. The runtime owner remains evals/specs/desktop-policy-restricted-mode.e2e.test.ts; its first-enrollment and native file-request assertions are still missing. A page-context fetch(file://...) would not distinguish policy denial from Chromium restrictions, so it is not used as substitute proof. Historical allowlist evidence on the old head is not evidence for this reconstruction.

@vercel

vercel Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 10, 2026 7:48pm UTC
openwork-den Ready Ready Preview Sep 10, 2026 7:48pm UTC
openwork-diagnostics Ready Ready Preview Sep 10, 2026 7:48pm UTC
openwork-landing Ready Ready Preview, v0 Sep 10, 2026 7:48pm UTC

@reachjalil

reachjalil commented Sep 2, 2026 •

Copy link
Copy Markdown
Member Author

Passed · 12/12 tests · 18/18 assertions · 8 images

Commit 03820db8a7519878206131f3e8d96d3f5b340d5a · selected evidence

Open review report

@reachjalil

Copy link
Copy Markdown
Member Author

The browser.open_url abort fix carried in this PR is now its own ready PR, #4331, with its own spec and exact-head evidence. Once #4331 lands, this branch will rebase and drop the duplicated hunk; the allowlist changes are otherwise independent.

@mintlify

mintlify Bot commented Sep 2, 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, 7:48 PM

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

@reachjalil

Copy link
Copy Markdown
Member Author

Rebased onto dev at b315c76d5. #4331 has landed, so this branch no longer carries the browser.open_url abort fix; browser-panel.mjs now differs from dev only by the allowlist guard. Focused checks at 87a08a45f: browser-url-policy.test.mjs 6/6, den-desktop-config.test.ts 13/13, @openwork/types and @openwork/app typecheck clean. The browser-url-allowlist-policy journey needs a fresh exact-head run before this leaves draft.

@benjaminshafii

Copy link
Copy Markdown
Member

@OmarMcAdam Please review browser URL allowlist enforcement across navigation paths and desktop policy synchronization. Current Linux/macOS unit checks fail; resolve those and verify the policy journey before merging.

Holding for your review under the current merge instructions.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9df70df
Status: ✅  Deploy successful!
Preview URL: https://7605a389.openwork.pages.dev
Branch Preview URL: https://feature-browser-url-allowlis.openwork.pages.dev

View logs

@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 5, 2026 19:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 5, 2026 19:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 5, 2026 19:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 5, 2026 19:55 Inactive
@reachjalil reachjalil changed the title feat(policies): browser URL allowlist desktop policy enforced by the built-in browser fix(server): fence browser policy checks during identity enrollment Sep 10, 2026
@reachjalil
reachjalil force-pushed the feature/browser-url-allowlist-policy branch from 9df70df to 03820db Compare September 10, 2026 19:46
@github-actions

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 (19907 ms), confidentiality-review (27079 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 1
  • Distinct heads in retained window: 1
  • Current unresolved Warden threads: 0 of 3 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 3 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 1/20 run attempts retained; truncated: false
  • Transition snapshot: 3/3 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 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 (03820db8a7519878206131f3e8d96d3f5b340d5a). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

This branch was successfully deployed

5 active deployments
staging - packages/docs — 03820db8 Deployed Sep 10, 2026 by mintlify[bot]
Preview – openwork-landing — 03820db8 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — 03820db8 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-app — 03820db8 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — 03820db8 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.

2 participants