Repository navigation
fix(platform): scope automation runs to the projects the viewer can see - #3772
Merged
Merged
Conversation
The app door of /api/app/automations answered every run in the organization to every member: the runs list without a project filter, a run by id, its pending question, cancelling it and answering it, whatever project the run belonged to. A member outside a team-restricted project could read that project's run input, output and trace, stop its runs and answer its questions, while the REST and engine doors already hid them. Runs, questions and binding lists on the app door now follow the project read rule the other doors use: organization runs stay visible to every member, a project run needs read access to its project, and a hidden run answers like a missing one (404, no question, nothing to cancel). A project-scoped listing or start names a hidden project as not found. The rule lives in one module, project-visibility.ts, which the engine door's store now uses too instead of its private copy. Who may cancel a visible run is unchanged (any member who can see it); the run metrics endpoint still counts runs organization-wide by automation name.
…-scope-3772 # Conflicts: # services/platform/tests/manual/readme.md
Admission sent an inferred sole binding through the ownership, archived and binding checks for every caller of beginRunInTx. An event dispatch starts every listening automation inside one savepoint without a per-trigger catch, so one automation sole-bound to an archived project threw PROJECT_ARCHIVED and rolled back the runs and trigger stamps of every other automation listening for the same event; its schedule was also stamped start_refused on every occurrence. Only the app door passes the viewer's readable projects, so the inferred project is now checked only then. Trigger, task and REST callers keep the scope they inferred before, unchecked, as on main.
Binding lists now answer only the projects the viewer can read, which left two holes for someone who cannot read every bound project. The editor seeds its Projects selection from that filtered list and posts the whole set back, and the save replaced every binding. A Developer outside a team therefore silently deleted the bindings to that team's projects, and clearing the only binding they could see turned a confidential automation into an organization one. The app save now passes the author's readable projects: it replaces only that part of the set, keeps every binding outside it, and answers a hidden project that is not already bound like a missing one. An automation bound only to hidden projects was still listed, with no bindings, which every client reads as organization scope: the switcher grouped it with organization automations, the list routed it to the organization URL and a start there failed. The app listing and the engine/MCP list now leave such an automation out. The real-Postgres visibility check covers both, plus a trigger start that keeps its inferred sole binding.
The app start's hidden-project pre-check answered a bare
{ error: 'PROJECT_NOT_FOUND' }, while the same refusal from admission
carries the message the app's toast reads. It now throws the store's
AutomationError through the shared error mapping, so both paths answer
the same body.
REST kept its own copy of the readable-project lookup beside the shared
project visibility helper; it now reads the helper, so every door
filters bindings through one rule.
The platform pages still described the Runs tab as the latest 50 runs and the switcher as every automation in the organization. Runs, questions and bindings now follow project visibility, so the pages say so in EN, DE and FR: organization runs are visible to every member, a project's runs and questions only to people who can open it, Projects offers only readable projects and a save keeps the hidden bindings, and an automation bound only to hidden projects is left out of the list and the switcher.
AUTO-B9 checks that a Developer outside a team keeps that team's bindings when saving an automation's projects, and does not see an automation bound only to the team's project as an organization one. The automation coverage row names the specs that own its backend half.
This was referenced Sep 29, 2026
…roject-scope # Conflicts: # services/platform/tests/manual/readme.md
…roject-scope # Conflicts: # services/platform/tests/manual/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This confidentiality fix makes app automation runs follow project visibility. Previously, every organization member could read a hidden project's run input, output, trace and pending question, cancel its runs and answer its questions, and binding lists disclosed hidden project IDs. This came up in customer feedback.
Organization runs stay readable by every member; project runs need read access to the project. A hidden run answers like a missing one: 404 on read,
{ask: null},{cancelled: false}andHUMAN_ASK_NOT_FOUNDon answer. Scoped lists hide inaccessible projects, and the app, engine/MCP and REST binding lists read one shared visibility helper.Admission and ownership:
projectIdcannot infer a hidden sole binding or start an organization run across hidden bindings. Admission checks the bindings it actually resolves, including a binding committed while the request waits. An app start whose sole binding is an archived project gets the samePROJECT_ARCHIVEDrefusal as a named archived project.start_refused.Partial views of bindings (review round 2):
projectIds: [], which every client reads as organization scope. The app listing and the engine/MCP list now leave it out.{ error, message }body as the store's refusal, so the toast shows a sentence.The latest main is merged in, including OAuth migration 0131. There is no schema change.
Checklist
bun run checkpasses (format, lint, typecheck, all tests). Not run as a whole; CI runs it. The targeted runs are listed under the test plan.bun run lint:sastpasses (Opengrep). Only the commit hook's local Opengrep pass ran, on the staged TypeScript files. The full repository scan is left to CI.docs/{en,de,fr}/:platform/automations/execution-logs.md(which runs and questions a member sees),catalog.md(Projects offers only readable projects, a save keeps hidden bindings, and a hidden-only automation is left out of the list), andeditor.md(the switcher leaves out hidden-only automations).Test plan
Round-2 fixes. Each new regression test failed on the previous head and passes now. The failing tests were checked by stashing the runtime changes and rerunning them.
store.bindings-visibility.test.ts: a save within a partial view deletes only readable bindings, keeps a hidden binding that is already bound without re-inserting it, refuses an unbound hidden project withAUTOMATION_PROJECT_UNKNOWNand writes nothing, and replaces the whole set when no view is given.store.project-archived.test.ts: an app start whose sole binding is archived is refused, and a trigger start keeps its inferred archived binding.routes.project-scope.test.ts: a Developer's binding save carries their readable projects, a hidden-only automation is left out of the listing, and the hidden start refusal carries the message.dispatch-store.project-scope.test.ts: the engine/MCP list leaves out a hidden-only automation and keeps organization automations.Checks run:
bun run --filter @tale/platform test -- backend/domains/automations backend/rest: 61 files, 1282 tests pass.bun run --filter @tale/platform typecheckandbunx oxlint --type-awareon the automations domain and the REST automations router pass.oxfmt --checkis clean.services/docstests pass: 35 files, 171 tests, including the EN/DE/FR docs parity and language checks.bun run lint:manualpasses with 1261 boxes.check-guide.tspasses onsuites/automations.md.Real PostgreSQL:
checkAutomationProjectVisibility(inbackend:integration) now also asserts four more things:These round-2 additions typecheck and lint, but they were not executed: the local Docker daemon did not respond this round. The 59 checks reported for the earlier head ran against fresh PostgreSQL. The new assertions still need one
backend:integrationrun.Not verified: no live browser or two-session UI round (
AUTO-B8,AUTO-B9browser halves), no external vendor execution, no docs screenshot changes. No documented screenshot shows the affected states.Existing policy boundaries and follow-ups
/metricsstill reports organization-wide aggregates per automation name.GET /automationshas done this since before this PR: it lists an automation bound only to hidden projects withprojectIds: []. Changing it changes the versioned REST contract, so it is left as a follow-up.