Flow Debugger: method-entry site scope gates routed site traffic only #55

Closed
opened 2026-11-06 15:24:39 -05:00 by dohertj2 · 3 comments
Owner

Register row 113 (deferred-work register).

A site-scoped Deployer who Live-runs a method belonging to another plant is refused at RouteTarget.ResolveSiteAsync, but the method's central-side effects (Database.*, ExternalSystem, notifications) run regardless. ApiMethods have no site affinity, so there is nothing to scope against.

Revisit trigger (from register): A decision to give ApiMethod a site affinity, or a report of a scoped user reaching another plant's central-side effects.

Current state: Accepted for now; F2's stated property holds as written.
Origin: Flow Debugger arch-review remediation code review 2026-09-06.

Source: docs/plans/2026-07-08-deferred-work-register.md row 113

Register row 113 (deferred-work register). A site-scoped Deployer who Live-runs a method belonging to another plant is refused at `RouteTarget.ResolveSiteAsync`, but the method's central-side effects (`Database.*`, `ExternalSystem`, notifications) run regardless. ApiMethods have no site affinity, so there is nothing to scope against. **Revisit trigger (from register):** A decision to give `ApiMethod` a site affinity, or a report of a scoped user reaching another plant's central-side effects. **Current state:** Accepted for now; F2's stated property holds as written. Origin: Flow Debugger arch-review remediation code review 2026-09-06. Source: `docs/plans/2026-07-08-deferred-work-register.md` row 113
dohertj2 added the type:review-findingpriority:p3migrated labels 2026-11-06 15:24:39 -05:00
Author
Owner

Not fixed — needs a product decision (register row 113 marks it accepted until then). ApiMethods have no site link, so a Live method-entry run's central-side effects (Database.*, ExternalSystem, notifications) have nothing to scope against. Options: (a) give ApiMethod a site affinity (model change), (b) refuse method-entry Live runs for site-scoped users, (c) dry-run/suppress central-side effects in Live mode. Recommend (b) — smallest, fail-closed, and Replay stays available to them.

Not fixed — needs a product decision (register row 113 marks it accepted until then). ApiMethods have no site link, so a Live method-entry run's central-side effects (Database.*, ExternalSystem, notifications) have nothing to scope against. Options: (a) give ApiMethod a site affinity (model change), (b) refuse method-entry Live runs for site-scoped users, (c) dry-run/suppress central-side effects in Live mode. Recommend (b) — smallest, fail-closed, and Replay stays available to them.
Author
Owner

Owner decision 2026-11-09: (b) refuse method-entry Live runs for site-scoped users; Replay stays available to them.

**Owner decision 2026-11-09:** **(b) refuse method-entry Live runs for site-scoped users**; Replay stays available to them.
Author
Owner

Fixed in 63ec45e2 (pushed to main), per owner decision (b).

  • Server: FlowDebugRunner.RunMethodAsync refuses FlowDebugRunMethodCommand for a site-scoped caller (the caller has PermittedSiteIds and is not an Administrator). The refusal happens before the method script runs. It writes a failed InboundRequest audit row under the operator's name, then raises SiteScopeViolationException, which surfaces as ManagementUnauthorized. The message explains why the run was refused and that Replay and script-entry runs are still available. The CLI flow-debug run-method sends the same /management command, so it is refused the same way. Its help text and docs/components/CLI.md now say so.
  • UI: for a scoped Deployer, the Inbound API method entry is disabled and shows the reason in a tooltip and an inline note. The page opens on script entry. A ?methodId= drill-in and a stored method choice are ignored.
  • Unchanged: Replay, and Live script / value-change runs (these already call EnforceSiteScope on the target instance's site). The F2 route-time scope stays as defence in depth.
  • Register row 113 already carries → #55; per the backlog rule it was not edited further. Docs updated: the design doc, Component-ManagementService, Component-CentralUI and CLAUDE.md.

Tests: scoped Deployer refused (Theory, routing both in and out of scope; the script never runs, the router is never called, one failed audit row with actor = operator); unscoped user and Administrator allowed (existing tests); scoped Deployer Replay allowed; scoped in-scope value-change Live run still runs. bUnit tests cover the disabled entry plus note, the drill-in being ignored, and the unscoped control. Mutation: with the gate and the UI flag reverted, 4 new tests fail. Suites: ManagementService 777, CentralUI 1540, CLI 581, all green. Full slnx: 10,900 passed. The only failures are the 185 Playwright tests, which cannot connect to a browser server at ws://localhost:3000; this is environmental, not a regression.

Fixed in `63ec45e2` (pushed to `main`), per owner decision (b). - **Server:** `FlowDebugRunner.RunMethodAsync` refuses `FlowDebugRunMethodCommand` for a site-scoped caller (the caller has `PermittedSiteIds` and is not an Administrator). The refusal happens before the method script runs. It writes a failed `InboundRequest` audit row under the operator's name, then raises `SiteScopeViolationException`, which surfaces as `ManagementUnauthorized`. The message explains why the run was refused and that Replay and script-entry runs are still available. The CLI `flow-debug run-method` sends the same `/management` command, so it is refused the same way. Its help text and `docs/components/CLI.md` now say so. - **UI:** for a scoped Deployer, the *Inbound API method* entry is disabled and shows the reason in a tooltip and an inline note. The page opens on script entry. A `?methodId=` drill-in and a stored method choice are ignored. - **Unchanged:** Replay, and Live script / value-change runs (these already call `EnforceSiteScope` on the target instance's site). The F2 route-time scope stays as defence in depth. - Register row 113 already carries `→ #55`; per the backlog rule it was not edited further. Docs updated: the design doc, Component-ManagementService, Component-CentralUI and CLAUDE.md. **Tests:** scoped Deployer refused (Theory, routing both in and out of scope; the script never runs, the router is never called, one failed audit row with actor = operator); unscoped user and Administrator allowed (existing tests); scoped Deployer Replay allowed; scoped in-scope value-change Live run still runs. bUnit tests cover the disabled entry plus note, the drill-in being ignored, and the unscoped control. **Mutation:** with the gate and the UI flag reverted, 4 new tests fail. Suites: ManagementService 777, CentralUI 1540, CLI 581, all green. Full slnx: 10,900 passed. The only failures are the 185 Playwright tests, which cannot connect to a browser server at `ws://localhost:3000`; this is environmental, not a regression.
Sign in to join this conversation.