Skip to content

feat(tasks): upload agent-created artifacts#3754

Merged
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/upload-cloud-task-artifacts
Jul 23, 2026
Merged

feat(tasks): upload agent-created artifacts#3754
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/upload-cloud-task-artifacts

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Files created by cloud agents only live in the temporary sandbox, so users cannot download non-code deliverables after a run ends.

Why: Cloud tasks need a durable, adapter-independent way to deliver reports, images, archives, and other generated files.

Changes

  • Add a shared Claude/Codex tool that uploads selected workspace files through the existing task artifact storage flow
  • Restrict uploads to workspace files and document cloud artifact paths and limits

Generated-By: PostHog Code
Task-Id: 69a64521-9a7f-4886-937e-3cf1e05ef563
@trunk-io

trunk-io Bot commented Jul 23, 2026

Copy link
Copy Markdown

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 271b5a1.

@tatoalo tatoalo self-assigned this Jul 23, 2026
@tatoalo
tatoalo requested a review from a team July 23, 2026 12:01
@tatoalo
tatoalo marked this pull request as ready for review July 23, 2026 12:01
@trunk-io
trunk-io Bot merged commit 88375a2 into main Jul 23, 2026
35 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/upload-cloud-task-artifacts branch July 23, 2026 12:03
}
form.append(
"file",
new Blob([await readFile(artifactPath)], { type: contentType }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High: Symlink race bypasses workspace containment

The containment check and stat operate before this readFile, so an agent can run a background rename/symlink loop that makes realpath validate an in-workspace file and then redirects this reopen to a file such as /tmp/agent-env. That lets the agent register sandbox credentials or other out-of-workspace data as a downloadable artifact. Open the file once, verify the opened descriptor's canonical target is within workspace, and use that same descriptor for stat and reading rather than reopening the pathname.

@veria-ai

veria-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

PR overview

This pull request adds support for uploading artifacts created by agents through the local tools adapter.

One security issue remains open in the artifact upload path: a symlink race can bypass workspace containment and expose files outside the workspace as downloadable artifacts. No issues have yet been addressed, and the remaining flaw could disclose sandbox credentials or other sensitive data accessible to the agent process.

Open issues (1)

Fixed/addressed: 0 · PR risk: 8/10

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(tasks): upload agent-created artifa..." | Re-trigger Greptile

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