fix(files): preserve principals when serving generated documents - #6654
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview v1 API keys build typed Principals ( Downloads and mounts (single-file stream, ZIP bulk, Copilot Compiled doc publication: dependency-bound artifacts get a published JSON pointer in copilot storage; Reviewed by Cursor Bugbot for commit 6c64353. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR fixes Principal propagation when serving and downloading generated workspace documents.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the prior v1 Principal-propagation and absolute-import findings are fixed, and the broader delegated workspace scope was explicitly accepted as intentional.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/files/serve/[...path]/route.ts | Workspace paths now authenticate a Principal and use the canonical authorized read boundary before resolving generated-document bytes. |
| apps/sim/app/api/v1/auth.ts | V1 authentication now constructs canonical personal and workspace API-key Principals and rejects incomplete key identities. |
| apps/sim/app/api/v1/middleware.ts | Rate-limit context now preserves the authenticated Principal for downstream application operations. |
| apps/sim/app/api/v1/files/[fileId]/route.ts | V1 downloads now delegate to the shared Principal-aware workspace-file download use case. |
| apps/sim/lib/copilot/tools/server/files/doc-compile.ts | Document compilation preserves authorization for dependency reads and uses the required absolute import for the compiled-artifact store. |
| apps/sim/lib/copilot/tools/server/files/doc-compiled-store.ts | Compiled artifacts can be published through an authorized pointer for later public-share serving. |
| apps/sim/lib/workspace-files/application/download-workspace-file.ts | The shared download flow carries the Principal through generated-document rendering and semantic auditing. |
| apps/sim/lib/workspace-files/application/read-workspace-file-content-by-key.ts | Storage keys are resolved through canonical workspace-file metadata and authorization before content is returned. |
Sequence Diagram
sequenceDiagram
participant Client
participant Route as File Route
participant Auth as Principal Authentication
participant Files as Workspace File Use Case
participant Compiler as Document Compiler
participant Dependency as Referenced File Reader
Client->>Route: Download generated document
Route->>Auth: Authenticate request
Auth-->>Route: Session, API-key, or delegated Principal
Route->>Files: Read canonical file with Principal
Files-->>Route: Authorized source bytes
Route->>Compiler: Resolve servable bytes with Principal
Compiler->>Dependency: Read referenced files with same Principal
Dependency-->>Compiler: Authorized dependency bytes
Compiler-->>Route: Compiled artifact
Route-->>Client: Generated document
Reviews (2): Last reviewed commit: "fix(files): address principal serve revi..." | Re-trigger Greptile
2deac27 to
6c64353
Compare
|
@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 6c64353. Configure here.
Summary
Validation