Skip to content

feat(#3996): gate workspace-escaping generated-media paths behind user confirmation - #4026

Draft
aheritier wants to merge 2 commits into
workspace-media-materializationfrom
workspace-media-escape-confirm
Draft

feat(#3996): gate workspace-escaping generated-media paths behind user confirmation#4026
aheritier wants to merge 2 commits into
workspace-media-materializationfrom
workspace-media-escape-confirm

Conversation

@aheritier

@aheritier aheritier commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

What

Requires user confirmation before generated-media paths escape the workspace, including classification, CLI/runtime flow, session manifests, and TUI schema coverage.

Why

Prevents generated files from silently writing outside the configured workspace.

Validation

task test; workspace-media, runtime escape, CLI, session, and TUI tests.

Test instructions

Run:

task test

Request generated-media output whose destination is outside the configured workspace. Expected: the operation asks for confirmation; approving writes to the requested destination, while denying it performs no outside-workspace write and reports the denial safely.

@aheritier aheritier added area/cli CLI commands, flags, output formatting area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Aug 22, 2026
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 9b6e49d to 8e76a13 Compare August 24, 2026 15:13
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 8e76a13 to 871dd1e Compare August 25, 2026 08:00
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch 2 times, most recently from e76fa5b to 0fe2b64 Compare August 25, 2026 08:32
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 0fe2b64 to d6b3c12 Compare August 25, 2026 20:24
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from d6b3c12 to 9a926c1 Compare August 26, 2026 11:09
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch 2 times, most recently from 426aea6 to 9a926c1 Compare September 1, 2026 16:10
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 9a926c1 to c442c63 Compare September 1, 2026 16:30
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from c442c63 to 161aaa6 Compare September 1, 2026 19:58
aheritier

This comment was marked as resolved.

@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 161aaa6 to 5b26f97 Compare September 6, 2026 16:14
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 5b26f97 to ffb1c83 Compare September 7, 2026 11:19
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from ffb1c83 to b9f0d13 Compare September 7, 2026 11:34
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from b9f0d13 to 5ab1ac5 Compare September 7, 2026 16:13
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 5ab1ac5 to f5cc603 Compare September 7, 2026 16:47
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from f5cc603 to 32b0b74 Compare September 8, 2026 06:17
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 32b0b74 to 94da09d Compare September 8, 2026 07:57
Classify absolute, parent-traversing, and home-relative requested paths
and require an explicit affirmative MediaEscapeDecisionSchema choice via
runtime elicitation before writing externally. Keep the workspace option
first and default; empty or free-form submissions never grant permission.

Expand existing directory targets to a MIME-corrected filename before
confirmation. Publish with the same O_EXCL, collision-suffix, and atomic
mechanics as workspace files, and persist the actual final absolute path
with ArtifactRootExternal in the manifest. An ordinary file collision may
select a suffixed sibling; a directory appearing at the confirmed file
path is rejected instead of selecting a different sibling.

Decline and cancellation redirect toward a sanitized workspace basename
with a safe warning; subsequent writes can still fail. Explicitly
noninteractive runtimes/sessions and the A2A path decline automatically.
Foreground no-sink callers, including ACP, are not covered by that policy
and can wait until context cancellation; this patch does not fix ACP.
The non-JSON CLI declines the form and continues draining events so the
warning, response, and persisted turn are retained. RequestedPath supplies
the internal naming input; provider display names retain generic fallback.
After successful workspace materialization and manifest recording, store
the bytes under the owning session and final artifact identity. Add the
SQLite blob table as migration 029 and place the manifest root-kind
migration at 030. The workspace deliverable remains available at its
requested or collision-adjusted path; the session copy enables portable
resolution without embedding generated base64 in session JSON.

Blob writes are all-or-error without a per-item byte cap. A failed blob
write preserves the workspace file and emits a safe portability warning.
DeleteSession removes both manifest and blob rows. The in-memory store
mirrors add, lookup, defensive copying, overwrite, and cleanup semantics.
@aheritier
aheritier force-pushed the workspace-media-escape-confirm branch from 94da09d to 69f32a6 Compare September 8, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands, flags, output formatting area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/sessions For features/issues/fixes related to session lifecycle (resume, persistence, export) area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant