refactor: enforce Copilot table application boundary - #6453
refactor: enforce Copilot table application boundary#6453TheodoreSpeaks wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
81faf24 to
d0493ad
Compare
|
@cursor review |
PR SummaryHigh Risk Overview Automatic tool-output and CSV/JSON table persistence no longer read the table in the adapter and replace rows separately; they call Internal first-party table routes for workflow groups, imports, and exports are rewritten from hand-rolled v2 import/export presenters are centralized in Table delegation rejects empty table IDs in Reviewed by Cursor Bugbot for commit d7df662. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR moves Copilot and HTTP Table operations behind fixed application commands that own canonical loading, authorization, mutation, audit, and shared effects.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/copilot/application/table-commands.ts | Introduces fixed Copilot adapters that dispatch each operation to one application command and bind single-table principals to the target table. |
| apps/sim/lib/copilot/auth/table-delegation.ts | Rejects blank table scopes and constructs delegated Table principals with the requested resource scope. |
| apps/sim/lib/table/application/authorization.ts | Enforces exact delegated table-scope matching whenever the canonical authorization context contains a table ID. |
| apps/sim/lib/table/application/copilot-table-lifecycle.ts | Implements workspace-scoped lifecycle commands, including per-table canonical workspace checks for best-effort deletion. |
| apps/sim/lib/table/application/rows.ts | Moves projected-row replacement into an authorized, schema-validated, locked application command. |
| apps/sim/lib/table/application/imports.ts | Centralizes durable import authorization and credential-bound upload control in fixed application use cases. |
| apps/sim/lib/table/application/exports.ts | Centralizes export creation, access, cancellation, and download authorization in application use cases. |
| apps/sim/lib/table/application/groups.ts | Moves workflow-group and enrichment mutations behind canonical Table authorization and application-owned effects. |
| apps/sim/lib/copilot/tools/server/table/user-table.ts | Routes Table tools through fixed application use cases with table-scoped principals for single-table operations. |
| apps/sim/app/api/table/[tableId]/groups/route.ts | Reduces group routes to session-authenticated boundary mapping, application dispatch, error policy, and presentation. |
Sequence Diagram
sequenceDiagram
participant Model as Copilot model
participant Adapter as Fixed Table adapter
participant Command as Table application command
participant Auth as Authorization policy
participant Store as Canonical Table storage
Model->>Adapter: Tool call with tableId
Adapter->>Adapter: Construct delegated principal scoped to tableId
Adapter->>Command: Execute one code-defined command
Command->>Store: Load canonical table and workspace
Command->>Auth: Authorize principal against canonical context
Auth-->>Command: Scope and permission decision
Command->>Store: Locked mutation or query
Command-->>Adapter: Domain result
Adapter-->>Model: Presented tool result
Reviews (7): Last reviewed commit: "fix(tables): reject enrichment output mu..." | Re-trigger Greptile
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2856cd5. Configure here.
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 54e16a0. Configure here.
54e16a0 to
ecae9b8
Compare
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d7df662. Configure here.
Summary
serviceId: copilot) from the merged foundation. Fixed adapters construct that Principal, map boundary input, call exactly one code-defined application command/query, and present the result; there is no generic Table multi-operation executor.Application operation manifest
Migrated
Table Copilot operations
Workflow operation
list_workflow_outputscalls one exact authorized Workflow resolver using the shared Copilot Principal. Workflow-output resolution used by group mutations is owned inside the top-level authorized Table command and is not a nested Workflow use case.HTTP Table transfer/group operations
Deferred
Non-goals
list_enrichmentsis a pure code-defined catalog presentation with no durable resource load or mutation; it is intentionally not forced through the Table operation registry.Import and internal-auth policy
Durable import resources are workspace-owned: reading an import requires workspace read access, and cancelling an import requires workspace write access. This intentionally allows a currently authorized workspace member or workspace API key to control the durable job independent of the original uploader.
Upload control remains credential-bound. Upload parts, completion, and upload cancellation require the exact creating principal/API-key credential plus the upload token; finalization reasserts that binding. Delegated principals remain rejected from HTTP upload creation, parts, and completion. Copilot workspace-file imports enter delegated-only Table application commands instead of entering or bypassing the HTTP upload lifecycle.
The ordinary first-party transfer and workflow-group routes are session-only. A caller audit found only browser React Query callers and no workflow executor or trusted server caller sending Bearer auth to these contracts. Executor Bearer support is therefore not applicable here: this PR adds neither
createInternalSessionOrExecutorAuthnor a dead delegation-token abstraction, and it never derives executor authority from a route workspace, uploader, owner, or billing actor. Any future executor caller must use scoped headers generated from canonical workflow execution context.Foundation
This branch is rebased on
d69224595cand consumes the merged delegated identity, consolidated Copilot adapter, and route-boundary foundations from #6462, #6450, and #6451. No duplicate fallback Principal or workspace executor is included.Validation
@sim/authtype-check passedbun run check:api-validation:strictpassedgit diff --checkpassedbun.lockcontains unrelated local tool-version drift and is intentionally excluded.