Skip to content

fix(media): bind local media roots to the active session - #144347

Merged
vincentkoc merged 8 commits into
openclaw:mainfrom
eleqtrizit:1036
Sep 17, 2026
Merged

vincentkoc merged 8 commits into
openclaw:mainfrom
eleqtrizit:1036

Conversation

@eleqtrizit

@eleqtrizit eleqtrizit commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A sandboxed session could make the Gateway read files outside its sandbox — sibling sandboxes and the shared host workspace — through the media pipelines, even with workspaceAccess: "none" (the default). #143521 made base media roots session-scoped, but three construction paths still re-granted the shared parents downstream. This PR closes those paths, completing #143521 without touching #138856's display layer.

What was wrong

The sandbox media-read contract had three gaps — each re-introducing a parent that #143521 had removed:

  1. Source-parent expansion re-promoted shared parents (src/media/local-roots.ts) — naming a file re-authorized its directory, so naming <state>/sandboxes/<other>/secret.txt re-added the sibling sandbox and the shared sandboxes parent to the allowlist.
  2. The attachment pipeline never received the session filter (src/media-understanding/, src/plugin-sdk/) — attachment-cache roots still defaulted to the shared sandbox parent, and the cache merged sessionless default roots back over session-scoped ones, restoring them at construction.
  3. Reply media staging ignored the sandbox access mode (src/auto-reply/reply/reply-media-paths.ts) — host-workspace absolute paths were staged regardless of workspaceAccess, so none didn't mean "not mounted".

Net effect: model-steered media paths in a sandboxed session could read sibling session sandboxes and host-workspace files through both the outbound reply and inbound attachment pipelines.

Why this design

  • Fail closed before bytes move: rejected paths stop at the boundary check — no staging, no byte consumption; media surfaces through the existing per-file "Delivery failed" path, not silent drops.
  • Session-scoped roots are authoritative end-to-end: the filtered root set computed once is what the cache reads; no downstream merge re-adds what upstream removed.
  • workspaceAccess is the contract: none (default) → host-workspace paths fail closed through the sandbox boundary; ro/rw → the workspace is mounted and staging keeps working.
  • No config surface, no migration: no defaults flip; legitimate grants (own sandbox, explicitly mounted workspaces, managed media, external-attachment parent expansion) are preserved and test-covered.

Why this does not conflict with #143521 or #138856

These PRs govern different layers of the same principle — media access follows the session's actual workspace context:

PR Layer it governs Relation to this PR
#143521 Gateway pipeline: base media roots become session-scoped Completed. #143521 removed shared parents at base construction; this PR closes the three downstream paths that re-added them (expansion, cache merge, staging). Its contract tests pass unchanged on this branch.
#138856 Control UI display: previews honor the session's filesystem-protection mode Untouched. This diff contains no ui/ and no src/gateway/ files; the preview-serving path (assistant-media-policy, control-ui, http-image-response) is not modified, and its test suites pass on this branch.

Concretely: what a browser may display (#138856) and what a sandboxed pipeline may read (#143521 + this PR) are separate checks with separate owners. Narrowing the latter does not reopen the former — a project-worktree session keeps its own workspace roots in both layers. The two PRs do share src/media/local-roots.ts; our branch is based on a revision that already includes #138856, and the changes compose (additive filtering helpers vs. display policy).

Evidence (final effects on this head)

Exercised through the real production owners — unmocked sandbox resolution, real sink chain, real staging — via throwaway state dirs (private reproduction retained in the advisory):

Path named workspaceAccess Outcome Bytes moved?
own sandbox file none STAGED / READ OK yes (allowed)
sibling sandbox file none DROPPED before staging none
unmounted host-workspace file none DROPPED before staging none
host-workspace file rw (mounted) STAGED OK yes (unchanged behavior)
relative host-workspace path rw STAGED OK yes (unchanged behavior)

Outbound reader (resolveOutboundAttachmentFromUrl) and attachment-cache getBuffer observations match: allowed reads succeed; sibling/unmounted/outside-roots reads are rejected before consumption.

SDK / caller upgrade contract

  • getAgentScopedMediaLocalRoots / …ForSources (plugin-sdk) keep their existing contract: trusted session context keeps that session's access; callers that omit session context now fail closed for sandbox files rather than silently keeping shared-parent grants.
  • Covered by plugin-sdk/media-local-roots.test.ts, including the expansion branch with trusted context (own nested sandbox file readable; sibling blocked).

Boundary decisions requested from security owners

Three explicit asks so this PR can merge with clear ownership (posted as a comment for @openclaw/openclaw-secops):

  1. Accept the bounded repair: this PR does not claim complete inbound host-workspace isolation — ordinary inbound processing retains the pre-existing caller-workspace grant (production callers pass the host agent workspace to media understanding). Excluded from claims, documented for owner ownership.
  2. Accept the session-context upgrade contract for third-party SDK callers (fail-closed transition above).
  3. Confirm the explicit-root compatibility posture: explicit-root normalizer callers are treated as unmounted (fail-closed).

Testing

  • New: sibling-sandbox and shared-workspace expansion confinement, session-safe attachment defaults, cache-construction authority (final getBuffer reads), workspaceAccess-gated staging (none blocks / rw stages), SDK expansion-branch contract.
  • Unchanged-green: local roots, read capability, reply media paths, media-understanding attachments, chat-send attachments, gateway media policy, UI attachment availability — including the fix(media): prevent sibling sandbox attachment reads #143521 and fix(ui): honor session filesystem permissions for image previews #138856 suites, run on this branch (212-test composition run).
  • No public issue is linked; the report arrived through the private advisory process.

Sandboxed sessions could read sibling sandbox and shared host workspace
files through local media authorization: the read allowlist still trusted
the shared sandboxes/workspace parents, source-parent expansion re-granted
any directory the caller named, and the attachment/understanding pipeline
never received the session filter.

- confine base and expansion-added media roots so shared isolation parents
  (and the shared workspace for sandboxed sessions) never re-enter the
  allowlist; own sandbox and explicitly granted workspaces stay readable
- use session-safe default roots for attachment/understanding caches
- gate host-workspace media staging on the sandbox workspaceAccess mode:
  with the default "none" the session's media workspace is its sandbox,
  and host-workspace paths fail closed via the sandbox boundary; ro/rw
  keep staging since the workspace is mounted
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 17, 2026, 3:14 AM ET / 07:14 UTC (Revision 11).

ClawSweeper review

What this changes

The PR confines attachment reads to session-appropriate folders, preserves those restrictions through attachment caches, and checks workspace access before staging local reply files.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful security repair absent from fetched main and the latest release. No blocking introduced defect was found; the previous cache finding is resolved, and exact-head security review accepts the bounded repair and compatibility tradeoff.

Priority: P0
Reviewed head: 7b0b2893e49e24572aa16429c2f2c04420ca19da

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with useful final-effect evidence, resolved prior findings, and an explicitly accepted compatibility tradeoff.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured production-owner observations exercise unmocked sandbox resolution, outbound staging, and cache reads in isolated state: authorized files succeed and sibling or unmounted-workspace files are rejected before consumption; exact-head security reviews corroborate the repaired boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured production-owner observations exercise unmocked sandbox resolution, outbound staging, and cache reads in isolated state: authorized files succeed and sibling or unmounted-workspace files are rejected before consumption; exact-head security reviews corroborate the repaired boundary.
Evidence reviewed 10 items Current main still needs the repair: Fetched main still returns unrestricted source-parent expansion after the filesystem-policy checks; it does not contain the branch’s shared-root confinement filter.
Latest release retains the expansion path: The supplied latest release, v2026.9.4, also contains unconditional source-parent expansion after policy checks. The requested confinement is therefore not established as shipped.
Introduced authorization repair: The verified base-to-head delta filters canonical source parents and preserves trusted active-session roots. The new SDK regression exercises successful own-sandbox reads and rejected sibling reads through the public loader.
Findings None None.
Security None None.

How this fits together

OpenClaw’s media pipeline turns attachment paths into bytes for agent input or outbound delivery. Session workspace roots and caller-held read capabilities determine which local files that pipeline may consume.

flowchart TD
  A[Attachment or reply path] --> C[Media access policy]
  B[Session workspace and read capability] --> C
  C --> D{Path authorized?}
  D -->|Yes| E[Checked file read]
  E --> F[Agent input or staged attachment]
  D -->|No| G[Recorded attachment failure]
Loading

Before merge

  • Resolve merge risk (P1) - Third-party SDK callers relying on implicit sandbox source-parent expansion will lose attachment access until they supply trusted active-session context; exact-head security review accepts this compatibility tradeoff.
  • Resolve merge risk (P1) - The repair does not establish complete inbound host-workspace isolation: ordinary inbound processing retains its existing caller-workspace grant, as explicitly scoped in the PR.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +129, Tests +255. Total +384 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 152 23 +129
Tests 5 256 1 +255
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 408 24 +384

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/auto-reply/reply/reply-media-paths.ts, unknown-data-model-change: src/auto-reply/reply/reply-media-paths.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Retain the approved session-context requirement (recommended)
    Accept the documented loss of implicit sandbox access for legacy SDK callers while preserving attachment access through trusted session context.

Technical review

Best possible solution:

Retain the approved shared media-policy repair, preserving explicit session grants and keeping the documented inbound limitation outside its security claims.

Do we have a high-confidence way to reproduce the issue?

Yes, source inspection establishes the source-parent reauthorization path on fetched main, and the PR records corresponding production-owner observations. This read-only review did not execute a reproduction or tests.

Is this the best way to solve the issue?

Yes, the patch repairs the existing authorization owner and cache consumers without adding a competing policy or configuration surface; its compatibility and scope decisions have exact-head security acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5f17f893af58.

Labels

Label changes:

  • add P0: The repair addresses a source-supported sandbox boundary bypass capable of reading another session’s files.
  • remove P1: Current review triage priority is P0, so this older priority label is no longer current.

Label justifications:

  • P0: The repair addresses a source-supported sandbox boundary bypass capable of reading another session’s files.
  • merge-risk: 🚨 compatibility: Existing SDK callers that depend on implicit sandbox grants must pass trusted session context after this intentionally restrictive change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured production-owner observations exercise unmocked sandbox resolution, outbound staging, and cache reads in isolated state: authorized files succeed and sibling or unmounted-workspace files are rejected before consumption; exact-head security reviews corroborate the repaired boundary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured production-owner observations exercise unmocked sandbox resolution, outbound staging, and cache reads in isolated state: authorized files succeed and sibling or unmounted-workspace files are rejected before consumption; exact-head security reviews corroborate the repaired boundary.

Evidence

What I checked:

  • Current main still needs the repair: Fetched main still returns unrestricted source-parent expansion after the filesystem-policy checks; it does not contain the branch’s shared-root confinement filter. (src/media/local-roots.ts:143, 5f17f893af58)
  • Latest release retains the expansion path: The supplied latest release, v2026.9.4, also contains unconditional source-parent expansion after policy checks. The requested confinement is therefore not established as shipped. (src/media/local-roots.ts, 3a9d69db306c)
  • Introduced authorization repair: The verified base-to-head delta filters canonical source parents and preserves trusted active-session roots. The new SDK regression exercises successful own-sandbox reads and rejected sibling reads through the public loader. (src/media/local-roots.ts:214, 7b0b2893e49e)
  • Prior cache finding resolved: Agent-turn attachments, media understanding, and document context now disable downstream default-root merging. The cache checks the opened file’s canonical path before bounded byte consumption. (src/media-understanding/attachments.cache.ts:278, 7b0b2893e49e)
  • Workspace access and SDK contracts: Workspace documentation defines none as withholding the agent workspace. The SDK guide already directs callers to obtain the active sandbox workspace from trusted host context, rather than the requested path. Public docs: docs/plugins/sdk-channel-plugins/status-and-media.md. (docs/plugins/sdk-channel-plugins/status-and-media.md:73, 7b0b2893e49e)
  • Affirmative filesystem dependency boundary: The introduced canonicalization calls resolveLocalPathFromRootsSync through src/infra/fs-safe.ts, which re-exports @openclaw/fs-safe/advanced; package.json pins version 0.13.1. This establishes the relevant dependency contract without involving the Codex harness. (src/media/local-roots.ts:27, 7b0b2893e49e)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • eleqtrizit: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-10T20:32:21.347Z sha e8ed5c9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-10T20:58:00.509Z sha e8ed5c9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-10T21:07:26.483Z sha e8ed5c9 :: blocked before merge. :: none
  • reviewed 2026-09-10T21:16:51.464Z sha e8ed5c9 :: blocked before merge. :: none
  • reviewed 2026-09-11T02:52:01.264Z sha e8ed5c9 :: blocked before merge. :: none
  • reviewed 2026-09-11T03:10:21.959Z sha 8d18a0e :: blocked before merge. :: none
  • reviewed 2026-09-11T03:24:49.507Z sha aaaecd1 :: blocked before merge. :: none
  • reviewed 2026-09-17T05:32:10.663Z sha 779f526 :: blocked before merge. :: none

…andboxed sessions

Thread the caller's session workspace into the session-safe default media
roots so the shared workspace parent is removed whenever the session
workspace lives elsewhere (an active sandbox). Sessionless callers keep
the legacy grant; the caller's own workspace is merged explicitly.
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

…he construction

MediaAttachmentCache merged sessionless default roots back into
caller-provided scoped roots, restoring the shared workspace/sandbox
parents that resolveMediaAttachmentLocalRoots had removed for sandboxed
sessions. Production consumers now pass includeDefaultLocalPathRoots:
false so the scoped root set is authoritative through the final read.

Adds final-read regression coverage through the cache getBuffer path and
SDK expansion-branch coverage for trusted session-context callers.
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@eleqtrizit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
…icit-root assertion

Chat-send display finalization is not a model-read boundary; restoring the
pre-#144347 unconditional source-parent expansion there fixes transcript-
adjacent media display (chat.directive-tags suite) and keeps
appendLocalMediaParentRoots production-used for the dependency check.
Model-facing paths (media understanding, reply staging) keep the session
confinement and workspaceAccess gating.
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Sep 11, 2026
…tion

The assertion-safety ratchet only counts a // SAFETY: comment on the
assertion line or immediately above it.
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Secops-qualified at this head. Stable physical aliases now intersect through fs-safe, normal outbound dispatch carries the canonical workspace policy, and an explicit caller-backed sandbox grant is no longer mislabeled as unmounted.

Merge after exact-head CI completes and the queued ClawSweeper refresh is clear.

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Secops approved at exact head 7b0b289. The current-main merge is conflict-free and preserves the hardened resolved-media boundary: canonicalized roots, caller read policy, sandbox mount proof, and explicit error/reply outcomes.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. and removed P1 High-priority user-facing bug, regression, or broken workflow. labels Sep 17, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Secops closeout: the data-model rank move does not apply. The diff does not change any persisted representation, key, schema, or migration; persistLocalReplyMedia keeps the existing attachment artifact shape and only receives a source root selected by the per-turn filesystem policy. Compatibility and inbound-workspace residual risks remain explicitly accepted. @clawsweeper re-review

@vincentkoc
vincentkoc merged commit fca0489 into openclaw:main Sep 17, 2026
377 of 389 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…4347)

* fix(media): bind local media roots to the active session

Sandboxed sessions could read sibling sandbox and shared host workspace
files through local media authorization: the read allowlist still trusted
the shared sandboxes/workspace parents, source-parent expansion re-granted
any directory the caller named, and the attachment/understanding pipeline
never received the session filter.

- confine base and expansion-added media roots so shared isolation parents
  (and the shared workspace for sandboxed sessions) never re-enter the
  allowlist; own sandbox and explicitly granted workspaces stay readable
- use session-safe default roots for attachment/understanding caches
- gate host-workspace media staging on the sandbox workspaceAccess mode:
  with the default "none" the session's media workspace is its sandbox,
  and host-workspace paths fail closed via the sandbox boundary; ro/rw
  keep staging since the workspace is mounted

* fix(media): drop shared workspace from inbound attachment roots for sandboxed sessions

Thread the caller's session workspace into the session-safe default media
roots so the shared workspace parent is removed whenever the session
workspace lives elsewhere (an active sandbox). Sessionless callers keep
the legacy grant; the caller's own workspace is merged explicitly.

* fix(media): keep session-scoped attachment roots authoritative at cache construction

MediaAttachmentCache merged sessionless default roots back into
caller-provided scoped roots, restoring the shared workspace/sandbox
parents that resolveMediaAttachmentLocalRoots had removed for sandboxed
sessions. Production consumers now pass includeDefaultLocalPathRoots:
false so the scoped root set is authoritative through the final read.

Adds final-read regression coverage through the cache getBuffer path and
SDK expansion-branch coverage for trusted session-context callers.

* fix(media): keep display-layer source-parent expansion; annotate explicit-root assertion

Chat-send display finalization is not a model-read boundary; restoring the
pre-openclaw#144347 unconditional source-parent expansion there fixes transcript-
adjacent media display (chat.directive-tags suite) and keeps
appendLocalMediaParentRoots production-used for the dependency check.
Model-facing paths (media understanding, reply staging) keep the session
confinement and workspaceAccess gating.

* fix(media): place SAFETY annotation on the line adjacent to the assertion

The assertion-safety ratchet only counts a // SAFETY: comment on the
assertion line or immediately above it.

* fix(media): canonicalize session-safe roots

* fix(media): retain explicit sandbox read capability

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants