Skip to content

fix(discord): block disallowed local media in guild asset uploads - #140334

Merged
pgondhi987 merged 2 commits into
openclaw:mainfrom
pgondhi987:fix/fix-1016
Sep 7, 2026
Merged

pgondhi987 merged 2 commits into
openclaw:mainfrom
pgondhi987:fix/fix-1016

Conversation

@pgondhi987

@pgondhi987 pgondhi987 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Discord users uploading an emoji, sticker, or scheduled-event cover from a local path could bypass the sender-scoped media access policy.

Why This Change Was Made

The existing sender media policy is now carried through Discord guild actions and applied at each local-media loader. Remote media handling and the existing Discord size and content-type checks remain unchanged.

User Impact

Discord guild asset uploads now reject local files outside the sender's allowed media roots while continuing to accept permitted local files.

Evidence

Behavior proof at 1842ac5fba1b423d01643db2c09dcec39506cc97:

  • Production-adapter path: focused action-dispatch tests verify that emoji upload, sticker upload, and scheduled-event cover creation carry the complete sender-scoped policy to their media loaders.
  • Negative scenario: real-loader tests reject emoji and sticker files outside the sender root with an allowed-directory error; the protected Discord REST sink receives no request.
  • Positive control: files inside the sender root are read and encoded into the expected emoji and sticker request bodies.
  • node scripts/check-changed.mjs — passed, including formatting, focused lint, and TypeScript checks.
  • node scripts/run-vitest.mjs --project extension-discord — passed: 259 files and 3,594 tests.
  • The new regression cases fail against the pre-fix loader path and pass with this change.

Environment: local Linux test harness with temporary real files and mocked Discord REST. No live Discord guild or credentials were used.

The Discord emoji-upload, sticker-upload, and event-create branches dropped
the sender-scoped media access options before dispatching the action, so the
guild runtime loaded the requested host-local path with only a byte limit. A
sender permitted to run those actions could therefore place bytes from a file
outside their allowed media roots into an outbound Discord emoji, sticker, or
event-cover request.

Forward the resolved action options from all three branches, carry
mediaAccess/mediaLocalRoots/mediaReadFile through the guild runtime, and load
upload sources through buildOutboundMediaLoadOptions like every other outbound
Discord media path. Adds regression coverage that a source outside the sender
roots is rejected before any request is issued, with an in-roots control.
@clawsweeper

clawsweeper Bot commented Sep 6, 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 channel: discord Channel integration: discord size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 1:57 PM ET / 17:57 UTC.

ClawSweeper review

What this changes

The Discord plugin forwards sender-specific file access restrictions through emoji, sticker, and scheduled-event cover uploads and adds regression coverage.

Merge readiness

✅ Ready for maintainer review

This remains a useful security repair: fetched main still drops the sender media policy on guild uploads. No blocking defect was found in the introduced patch, and the maintainer-authored PR is protected from cleanup closure.

Priority: P1
Reviewed head: 1842ac5fba1b423d01643db2c09dcec39506cc97

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair using the canonical policy helper, with useful regression coverage and no blocking correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Supplied Linux tests exercise real emoji/sticker file loading with mocked Discord REST and separately verify all three dispatch paths; they are supplemental boundary evidence, not a live Discord run. The authority trace revealed no specific unresolved violation requiring additional final-effect proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Supplied Linux tests exercise real emoji/sticker file loading with mocked Discord REST and separately verify all three dispatch paths; they are supplemental boundary evidence, not a live Discord run. The authority trace revealed no specific unresolved violation requiring additional final-effect proof.
Evidence reviewed 9 items Verified review scope: The supplied complete introduction delta is f7f478d..1842ac5. Its eight Discord files also constitute the verified test-merge delta against its recorded main parent; unrelated endpoint drift was excluded.
Still necessary on fetched main: Fetched main’s emoji and sticker upload helpers pass only byte limits to the loader, and their action adapters omit the available media policy. No merged replacement was established.
Release comparison: The latest supplied release, v2026.9.2, retains the event-cover helper accepting only localRoots rather than the complete media access capability; this PR’s complete policy propagation is not established as shipped.
Findings None None.
Security None None.

How this fits together

Discord guild actions receive media paths and host-provided file access restrictions from OpenClaw’s message dispatcher. The media loader validates and reads permitted files before the plugin encodes them into Discord upload requests.

flowchart TD
  A[Message action and media path] --> B[Sender media policy]
  B --> C[Discord guild action]
  C --> D[Shared media loader]
  D --> E{File access allowed?}
  E -->|No| F[Reject upload]
  E -->|Yes| G[Encode and upload to Discord]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +52, Tests +209. Total +261 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 76 24 +52
Tests 3 211 2 +209
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 287 26 +261

Review metrics

None.

Technical review

Best possible solution:

Use the existing sender-scoped media policy consistently at every guild asset loader while preserving permitted uploads and existing size and content-type limits.

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

Yes, from source: a permitted guild uploader can supply a file within default media roots but outside the sender’s roots because fetched main drops the scoped options. The submitted regression cases target this mechanism; this review did not execute them.

Is this the best way to solve the issue?

Yes. Carrying the existing policy into the established shared loader repairs the dropped boundary without introducing another authorization system.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 813b509ef147.

Labels

Label justifications:

  • P1: Guild uploads can currently bypass sender-specific local-file restrictions, making this a priority security repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Supplied Linux tests exercise real emoji/sticker file loading with mocked Discord REST and separately verify all three dispatch paths; they are supplemental boundary evidence, not a live Discord run. The authority trace revealed no specific unresolved violation requiring additional final-effect proof.

Evidence

What I checked:

  • Verified review scope: The supplied complete introduction delta is f7f478d..1842ac5. Its eight Discord files also constitute the verified test-merge delta against its recorded main parent; unrelated endpoint drift was excluded. (1842ac5fba1b)
  • Still necessary on fetched main: Fetched main’s emoji and sticker upload helpers pass only byte limits to the loader, and their action adapters omit the available media policy. No merged replacement was established. (extensions/discord/src/send.emojis-stickers.ts:23, 813b509ef147)
  • Release comparison: The latest supplied release, v2026.9.2, retains the event-cover helper accepting only localRoots rather than the complete media access capability; this PR’s complete policy propagation is not established as shipped. (extensions/discord/src/send.guild.ts:138, 3928bad9badf)
  • Canonical policy enforcement: The upload helpers reuse buildOutboundMediaLoadOptions, already used by ordinary Discord media sends. It preserves supplied roots and readers and rejects a host reader without an explicit root boundary. The shared loader checks containment before invoking the reader; the normal filesystem reader also revalidates the opened file. (src/media/load-options.ts:77, 1842ac5fba1b)
  • Authority and request ordering: Guild actions retain their existing sender permission checks. The new media options reach both upload helpers and the event-cover loader; event creation occurs only after the cover loader returns. The patch introduces no persisted authority, replay mechanism, or new authorization source. (extensions/discord/src/actions/runtime.guild.ts:324, 1842ac5fba1b)
  • Internal helper compatibility: The event-cover helper is exposed through runtime-api.ts, which the channel SDK documentation identifies as an internal runtime surface, rather than Discord’s public api.ts. Its production caller is migrated in the same patch. Public docs: docs/plugins/sdk-channel-plugins.md. (docs/plugins/sdk-channel-plugins.md:1355, 1842ac5fba1b)

Likely related people:

  • Josh Avant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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 (1 earlier review cycle)
  • reviewed 2026-09-06T17:46:50.205Z sha 1842ac5 :: needs maintainer review before merge. :: none

@pgondhi987

pgondhi987 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Security Review: openclaw/openclaw pull request 140334 linked review

Scope

Separate linked-PR security review of GitHub's resolved exact eight-file Discord guild-asset media-policy diff and directly supporting boundary code.

  • Scan mode: diff
  • Target kind: git_diff
  • Target ID: openclaw-linked-pr-140334-1842ac5f
  • Revision range: f7f478d...1842ac5
  • Snapshot digest: codex-security-snapshot/v1:sha256:c6c20c68f31ec4241402f4807edf1cc0dc5c80fd8c2fe24a8b118f0c878449fc
  • Inventory strategy: diff
  • Included paths: extensions/discord/src/
  • Excluded paths: none
  • Runtime or test status: Focused propagation, denied out-of-root, allowed in-root, and pre-REST assertions passed at the immutable reviewed head.
  • Artifacts reviewed: artifacts/01_context/threat_model.md, artifacts/02_discovery/deep_review_input.jsonl, artifacts/02_discovery/work_ledger.jsonl, artifacts/02_discovery/finding_discovery_report.md
  • Scan context: The immutable merge base, head, changed-file count, and complete path set were resolved from the live pull request. Every resolved path has a full-file receipt at that exact head.

Limitations and exclusions:

  • No live Discord service call was made; the focused tests use mocked REST boundaries.
  • Scheduled-event policy propagation is directly tested, while out-of-root event-cover rejection is established from the shared canonical loader path rather than a dedicated event-cover denial test.

Scan Summary

Field Value
Reportable findings 0
Severity mix none
Confidence mix none
Coverage complete
Validation mode Separate exact-prompt linked review with byte-identical reuse of clean exact-head discovery receipts; no candidates required validation or attack-path phases.

Canonical artifacts: scan-manifest.json, findings.json, and coverage.json. This report is a deterministic projection of those files.

Threat Model

Model-controlled guild action inputs are untrusted. Local media access must remain constrained by the current server-owned sender capability, allowed roots, bounded reads, and content policy before any Discord REST side effect.

Assets

  • Host files and sender-scoped local media access
  • Discord guild assets and administrative REST actions
  • Gateway-held channel and sender authority

Trust Boundaries

  • Model-supplied action parameters to trusted Discord action dispatch
  • Local or remote media source to canonical bounded media loading
  • Validated asset bytes to Discord REST side effects

Attacker Capabilities

  • Supply guild action parameters including asset paths or URLs within an authorized action
  • Attempt to select a host-local path outside the sender's permitted roots
  • Supply oversized, unsupported, or misleading media content

Security Objectives

  • Keep local file reads within current sender-owned authority and allowed roots
  • Apply byte and content constraints before Discord REST calls
  • Prevent model parameters from manufacturing or replacing host media capabilities

Assumptions

  • Channel runtime context and media capability construction are trusted lifecycle-owned inputs
  • Direct internal callers that provide custom media readers are trusted plugin code, not model-controlled data

Findings

No findings

No reportable findings survived the canonical discovery, validation, and reportability gates.

Reviewed Surfaces

Surface Risk Area Outcome Notes
Guild action dispatch Capability injection and parameter confusion No issue found Server-owned media policy is forwarded separately from model-controlled action parameters across emoji, sticker, and event branches. Evidence: artifacts/02_discovery/work_ledger.jsonl
Emoji and sticker uploads Local-file containment, bounded reads, and pre-sink enforcement No issue found Canonical media options enforce roots and byte caps before Discord REST; focused negative and positive tests exercise the boundary. Evidence: artifacts/02_discovery/work_ledger.jsonl
Scheduled-event covers Local-file containment, content policy, MIME validation, and size validation No issue found The media source is untrusted, while policy remains server-owned and the shared canonical loader validates before REST. Evidence: artifacts/02_discovery/work_ledger.jsonl
Shared option types and regression tests Capability exposure and regression coverage No issue found The trusted callback contract is not exposed through tool params; tests preserve policy identity and fail-closed behavior. Evidence: artifacts/02_discovery/work_ledger.jsonl

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Behavior proof for exact head 1842ac5fba1b423d01643db2c09dcec39506cc97:

  • Entry boundary: Discord guild emoji, sticker, and scheduled-event actions receive model-controlled media paths while sender-scoped mediaAccess, mediaLocalRoots, and mediaReadFile are injected from trusted runtime context.
  • Negative path: focused tests place local files outside the allowed sibling root and observe an allowed-directory rejection; the Discord REST mock is not called.
  • Positive path: files inside the allowed root load successfully and produce the expected emoji and sticker REST requests.
  • Propagation: a focused action test identity-checks all three media-policy values through the emoji, sticker, and scheduled-event dispatch branches.
  • Commands: node scripts/check-changed.mjs; node scripts/run-vitest.mjs --project extension-discord; git diff --check — all passed at this head.
  • Scope note: Discord REST is mocked, so this proves the changed local-policy and pre-side-effect boundary without making a live service mutation.

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Verification before merge:

  • Verified head: 1842ac5fba1b423d01643db2c09dcec39506cc97 (clean local worktree and matching open PR head).
  • Root behavior: Discord emoji, sticker, and scheduled-event media now receive the sender-scoped media capability through the canonical bounded loader before any REST side effect.
  • Negative proof: local files outside allowed roots are rejected and the Discord REST mock remains uncalled.
  • Positive proof: in-root emoji and sticker files produce the expected REST requests; all three policy fields propagate unchanged through all guild asset branches.
  • Focused validation: node scripts/check-changed.mjs; node scripts/run-vitest.mjs --project extension-discord (259 files, 3,594 tests); git diff --check — passed.
  • Reviews: ClawSweeper tier A with no blocking findings; both Codex Security reviews returned zero findings and explicit yes assessments for sanity, scope, design, and security completeness.
  • Delivery: first/final-candidate dry-run and exact-head real gate passed; conflict receipt passed.
  • CI snapshot: 91 total; 48 passed, 43 skipped, 0 failed, 0 pending.
  • Proof limitation: Discord REST was mocked; no live service mutation was needed to prove the local authorization and pre-side-effect boundary.
  • User-visible compatibility: integrations that previously depended on reading local files outside the sender's allowed roots now receive an allowed-directory error. This fail-closed behavior is the intended security repair.

Maintainer decision before merge:

  • Required acceptance: Should Discord guild asset uploads unconditionally reject host-local paths outside the current sender’s media roots, even when those paths succeeded before this fix?
  • Recommended option: Approve fail-closed enforcement — Accept the intentional compatibility break and land after the media/security owner confirms the sender-root boundary.
  • Acceptance owner: joshavant must explicitly accept this behavior/tradeoff before merge.
  • Workflow status: all automated review, security, delivery, and CI stages completed; this merge-time decision does not block readiness or final reporting.

@pgondhi987
pgondhi987 merged commit e5e7764 into openclaw:main Sep 7, 2026
20 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…nclaw#140334)

The Discord emoji-upload, sticker-upload, and event-create branches dropped
the sender-scoped media access options before dispatching the action, so the
guild runtime loaded the requested host-local path with only a byte limit. A
sender permitted to run those actions could therefore place bytes from a file
outside their allowed media roots into an outbound Discord emoji, sticker, or
event-cover request.

Forward the resolved action options from all three branches, carry
mediaAccess/mediaLocalRoots/mediaReadFile through the guild runtime, and load
upload sources through buildOutboundMediaLoadOptions like every other outbound
Discord media path. Adds regression coverage that a source outside the sender
roots is rejected before any request is issued, with an in-roots control.
RomneyDa added a commit that referenced this pull request Sep 19, 2026
* feat(meta): add Muse Spark 1.3 models (#136553)

* feat(meta): add Muse Spark 1.3 models

* docs(meta): cite Muse Spark 1.3 recommendation

Co-authored-by: Tharun Tej Tammineni <[email protected]>

---------

Co-authored-by: Dallin Romney <[email protected]>
(cherry picked from commit 194b7f2)

* feat(anthropic): support Fable 5.1 from shared model metadata (#135638)

* feat(anthropic): support Fable 5.1 from shared model metadata

* test(anthropic): keep alias coverage within the file limit

* fix(media): decouple image limits from catalog augmentation

(cherry picked from commit 0a9b08c)

* feat(openai): support GPT Image 2.5 variants (#143068)

* feat(openai): support GPT Image 2.5 variants

* docs(openai): correct GPT Image 2.5 section link

(cherry picked from commit f93881f)

* feat(fal): support GPT Image 2.5 variants (#143069)

* feat(fal): support GPT Image 2.5 variants

* test(agents): restore Windows media fixture isolation

(cherry picked from commit a57c799)

* fix(bedrock): preserve images returned by tools (#149336)

## What Problem This Solves
Tool-returned images make the next request fail with `ValidationException` on affected Bedrock routes. Fixes #149332.

## Why This Change Was Made
The serializer generates image labels from each tool-call ID; input images need no labels. All consecutive tool results come first, followed by image groups in the same tool order. Request state has one writer. `stream.runtime.ts`: +28/−1 for this conversion.

Growth accepted under the owner's standing acceptance (2026-09-15).

## User Impact
Image-reading turns can finish without losing image bytes, tool associations, or error status.

## Evidence
Authenticated `chat.send` → registered `read` on a synthetic PNG: main sent a nested image and failed; candidate sent a sibling image and completed with the scripted “Red square; blue circle.” Our run used a recording HTTP transport.

The [contributor's real two-tool run](#149336 (comment)) confirms image interpretation and association.

## Compatibility
Concrete route identities select the conversion. Opaque aliases keep their layout. The general schema permits nested images for some routes; this repair addresses the affected route’s observed rejection. No config or public interface changes.

## Consumers
All clients use the existing Bedrock serializer.

## Invalidation
Conversion is request-local. Stored transcript rows and original image bytes remain unchanged.

## Tests
`node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-providers.config.ts extensions/amazon-bedrock`: 289 tests across 12 files passed on a fresh merge with main. Types, lint, formatting, file-size and assertion limits, and unused-export checks passed.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 115522a)

* fix: preserve Ultra across model runtime boundaries (#135397)

* fix: preserve Ultra across model runtime boundaries

Keep native Codex Ultra as a runtime mode instead of clamping it against
physical Responses effort tiers. Share the selected collaboration effort
between turn fields and remove the redundant forwarding wrapper.

Carry the active parent thinking level through existing spawn context so
one-shot overrides reach native subagents without changing saved preferences.
Keep explicit child overrides and configured child defaults authoritative.

Scope Control UI thinking catalog fallback to the selected runtime, sharing
one prepared entry for picker options and the inherited default. Document
the native orchestration/budget boundary and active-turn inheritance.

* refactor: simplify Ultra reasoning fixtures

* fix: preserve active thinking across shared tool contexts

* docs: clarify Off thinking for side questions

(cherry picked from commit ee9e22b)

* fix(anthropic): Fable 5.1 sessions lose reasoning after model switches and runtime events (#136782)

* fix(anthropic): keep Fable 5.1 thinking valid across model switches and runtime context

Claude Fable 5.1 binds each thinking block to the producing model and to the
exact request prefix that preceded it. Three harness behaviors conflicted with
that contract on Anthropic-family routes:

- Moving a session onto Fable 5.1 (from Opus 5, Sonnet 5, Opus 4.8, Fable 5)
  dropped readable reasoning client-side; the replay contract now preserves it
  while leaving Fable 5.1 still drops.
- The per-turn runtime-context carrier was injected transiently after the
  active user turn, stripped on the next request, relocated inside tool loops,
  and removed by the context-engine assembly. It is now persisted right after
  its user turn and replayed in place; inline inbound metadata stays in place
  too, and consecutive user turns are no longer merged at load for the
  Messages API because the merged form lost the second turn's timestamp stamp.
- Direct API-key requests with adaptive thinking send the
  thinking-binding-controls beta with prefix_mismatch_behavior=drop_block, so
  a residual mismatch degrades to a server-side unbilled drop with a warning
  listing the dropped paths instead of a 400, a duplicate request, and a
  transcript-wide thinking wipe. OAuth, proxies, Bedrock, Vertex, and Foundry
  keep the existing strip-and-retry recovery.

Live-verified against api.anthropic.com: nine-request Fable/Opus/Fable session
with tool loops and carriers reports input_transformations: [] on every
request with four retained thinking blocks; a /think change on the direct API
yields a logged server-side drop and no retry.

* fix(anthropic): limit the preserved-thinking replay target to Fable 5.1

Mythos 5.1 is not registered in the bundled catalog and has no cross-model
replay proof, so unregistered Mythos targets keep the existing drop path.

(cherry picked from commit 30837ae)

* feat(openai): support GPT-6 Astra (#137550)

* feat(openai): support GPT-6 Astra

* fix(models): preserve declared pricing tiers during catalog refresh

(cherry picked from commit eb72093)

* fix(openai): require discovery before offering Astra for OAuth (#137561)

(cherry picked from commit 8b1add5)

* fix(diagnostics-prometheus): reject unauthorized metric scrapes (#140903)

* fix(diagnostics-prometheus): require operator.read for metric scrapes

The Prometheus scrape route registers under the trusted-operator runtime
scope surface, so the Gateway authenticates the caller and applies its
named-role scope ceiling before dispatch. The handler never consulted
those scopes, so an authenticated identity whose role grants no operator
scopes still received the full diagnostics document with 200, while the
same caller was correctly refused on equivalent read operations.

Check the runtime request scopes inside the handler and fail closed with
403 "missing scope: operator.read" unless the caller holds operator.read,
operator.write, or operator.admin, mirroring the Gateway read implication
set. The guard runs before rendering so HEAD probes cannot disclose the
document size either.

* test(diagnostics-prometheus): prove role-limited scrape denial

(cherry picked from commit 0c9330b)

* fix(discord): enforce sender media policy on guild asset uploads (#140334)

The Discord emoji-upload, sticker-upload, and event-create branches dropped
the sender-scoped media access options before dispatching the action, so the
guild runtime loaded the requested host-local path with only a byte limit. A
sender permitted to run those actions could therefore place bytes from a file
outside their allowed media roots into an outbound Discord emoji, sticker, or
event-cover request.

Forward the resolved action options from all three branches, carry
mediaAccess/mediaLocalRoots/mediaReadFile through the guild runtime, and load
upload sources through buildOutboundMediaLoadOptions like every other outbound
Discord media path. Adds regression coverage that a source outside the sender
roots is rejected before any request is issued, with an in-roots control.

(cherry picked from commit e5e7764)

* fix(discord): preserve realtime speaker and playback ownership (#137433)

* fix(discord): preserve realtime speaker and playback ownership

Bind provider connections to one Discord principal so delayed transcripts
and native consultations cannot inherit another speaker's authority.
Keep the shared agent route and serialize response-owned audio on one
room player, preserving continuations and recovery after playback gaps.

Admit host-requested responses before dispatch and map Google Live turn
completion to canonical terminal outcomes so queued speech can finish.

Closes #137349
Related: #136982, #123243
Follow-up: #137417

* test(discord): preserve room capture across speaker recovery

(cherry picked from commit 85d510c)

* fix(doctor): preserve enabled skills during automatic updates (#138730)

Use runtime-repair approval for optional skill disabling. Keep standalone explicit repair and required config migrations unchanged.

(cherry picked from commit acc9a65)

* fix: generated images disappear after failed tool calls (#131226)

## What Problem This Solves

WebChat drops generated media when a later tool failure is the turn's only reply payload.

## Root cause

The embedded-run terminal projection assigned successful tool media to the first non-reasoning payload. A later error warning could become that owner. Gateway error projection then discarded the attached media.

## Fix

- Attach tool media only to a successful, non-reasoning reply.
- Emit a separate media-only payload when the turn has no successful reply.
- Preserve the newer host-owned and automatic-delivery media paths from current `main`.
- Keep regression coverage at the payload owner and physical-delivery boundaries.
- Remove the mocked browser test that manually inserted its expected result.

## Evidence

- Baseline: current `main` at `8544aed05a5dbffb871483be781f71351203319e`.
- Real path: branch-built Control UI → real Gateway → mock OpenAI Responses provider → successful image tool → later failing tool → terminal WebChat event.
- Red: current `main` rendered zero generated images.
- Green: `d2a10d40c633bfe796ad4ab19222aa831184a327` rendered one generated image.
- Anti-cheat: the proof recorded `image-success` before `later-failure` and verified that Chromium loaded the exact Gateway-served asset from the branch build.

## Validation

- Focused unit and integration tests: 19 passed across 2 Vitest shards.
- Real Gateway and built Control UI proof: passed on current `main` and the candidate head with opposite image assertions.
- Targeted format, Oxlint, conflict-marker, max-lines, assertion-safety, and diff checks passed.
- Type checks run in continuous integration because repository policy forbids them on this host.

Production change: `+3/-3`, net zero. Test change: `+23/-1`, net `+22`.

Co-authored-by: A28Hui <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 88be1b8)

* fix(matrix): refresh verification status before reporting device trust (#136226)

* fix(matrix): refresh verification status before reporting device trust

Refresh own-device keys after crypto preparation and before the authoritative trust read. Keep the missing-device preflight and use the Matrix SDK’s existing query contract.

* test(slack): remove core-coupled threading duplicate

---------

Co-authored-by: Dallin Romney <[email protected]>
(cherry picked from commit a812054)

* chore(release): prepare extended-stable 2026.8.33

* fix(release): integrate model and Discord security backports

* docs(release): clarify extended-stable workflow baseline

* fix(release): complete stable-line backport integration

* fix(ios): restore dependency resolution with WebRTC 152 (#134942)

* fix(release): repair frozen validation inputs

* fix(discord): stop error replies after voice consult cancellation (#135380)

* fix(discord): stop error replies after voice consult cancellation

Treat host-cancelled Discord realtime consults as terminal cancellation, preserve late-call dedupe, and wait for every native delivery before returning forced playback ownership. Timeouts and genuine errors retain their normal handling.

Closes #135340. Related phone cancellation helper: #134924.

* test(acp): run CLI lifecycle checks against prepared runtime

* test(cli): cover selective runtime build admission

* test(ci): account for ACP runtime preparation

* fix(release): complete Discord cancellation backport

* test(release): keep candidate fixtures current

* test(update): isolate frozen release version

---------

Co-authored-by: tharuntejmeta <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: dclosefuturex <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: CGlashu <[email protected]>
Co-authored-by: A28Hui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. 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.

1 participant