Skip to content

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

Merged
pgondhi987 merged 3 commits into
openclaw:mainfrom
pgondhi987:fix/fix-1022
Sep 7, 2026
Merged

pgondhi987 merged 3 commits into
openclaw:mainfrom
pgondhi987:fix/fix-1022

Conversation

@pgondhi987

@pgondhi987 pgondhi987 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where authenticated identities whose effective operator scopes exclude reads could still scrape the Prometheus diagnostics endpoint. This also prevents unauthorized HEAD requests from learning the rendered metrics document size.

Why This Change Was Made

The diagnostics-prometheus route now requires operator.read, including its existing operator.write and operator.admin implications, before rendering any metrics. The route fails closed with a non-cacheable 403 response, and the operator documentation now describes the required scope and remediation.

User Impact

Authorized Prometheus scrapers continue to receive metrics normally. Scope-restricted identities without read access now receive 403 missing scope: operator.read and no metrics payload or content-length disclosure.

Evidence

  • Exact head: 03fb057fb46acab83061a66abe47d9cbdb7b093d
  • On Ubuntu, node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/{service.http-scope,service,service.event-loop,service.runtime-identity}.test.ts passed 4 files / 38 tests. The negative cases verify GET and HEAD requests without an effective read scope return 403 before metric rendering; the benign controls verify operator.read, operator.write, and operator.admin still receive metrics.
  • node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/install-runtime.e2e.test.ts passed its real Gateway, managed-install, and plugin-route scenario (1 test). The same Gateway permits the local password-authenticated scraper and rejects a trusted-proxy identity whose named-role ceiling contains operator.approvals but no read scope: GET returns 403 with no metric marker, while HEAD returns 403 without the authorized document size.
  • The protected metrics body and HEAD Content-Length are not exposed to callers lacking the required scope. Red/green proof confirmed the new tests reveal the marker with the guard removed and reject it with the guard restored.
  • Focused oxlint (--openclaw-focused-config), oxfmt, extension and extension-test type lanes, node scripts/check-changed.mjs, and git diff --check all passed. Removing the production guard made the real-Gateway E2E fail at the named-role request with 200 instead of 403; restoring it passed.
  • No live external Prometheus server was used; the production handler and real Gateway adapter were exercised locally.

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.
@clawsweeper

clawsweeper Bot commented Sep 7, 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 docs Improvements or additions to documentation gateway Gateway runtime extensions: diagnostics-prometheus size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 7, 2026, 3:16 AM ET / 07:16 UTC.

ClawSweeper review

What this changes

Require effective operator read permission before serving Prometheus metrics or HEAD metadata, with authorization coverage and troubleshooting guidance.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful fix: current main still permits metrics rendering without checking effective read permission. The updated real-Gateway evidence addresses the previous proof request, and no actionable patch defect was found.

Priority: P2
Reviewed head: 03fb057fb46acab83061a66abe47d9cbdb7b093d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful real-Gateway red/green evidence and no blocking correctness finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured exact-head Ubuntu results exercise the installed plugin through a real Gateway: shared-secret GET succeeds, the nearest forbidden role receives 403 for GET and HEAD without protected metrics metadata, and removing the guard reproduces the leak. This resolves the prior Gateway compatibility proof request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured exact-head Ubuntu results exercise the installed plugin through a real Gateway: shared-secret GET succeeds, the nearest forbidden role receives 403 for GET and HEAD without protected metrics metadata, and removing the guard reproduces the leak. This resolves the prior Gateway compatibility proof request.
Evidence reviewed 8 items Introduced authorization guard: The complete pinned introduction delta adds a synchronous scope check before rendering or computing Content-Length. Read, write, and admin scopes are accepted; missing request context fails closed.
Current main still needs the repair: The fetched main handler checks the HTTP method, then renders metrics and returns their Content-Length without consulting effective scopes. No equivalent enforcement exists in this handler.
Existing Gateway authority boundary: The registered route uses Gateway authentication and the trusted-operator surface. Gateway dispatch constructs a request-scoped client from effective operator scopes; the role ceiling filters existing grants. The new guard consumes this established SDK contract without introducing a new API or retained authority.
Findings None None.
Security None None.

How this fits together

The diagnostics-prometheus plugin collects runtime diagnostics and exposes them through a Gateway-authenticated HTTP endpoint. The Gateway supplies the caller’s effective scopes; the plugin decides whether to return metrics.

flowchart TD
  A[Scraper request] --> B[Gateway authentication]
  B --> C[Apply identity role ceiling]
  C --> D{Effective read permission?}
  E[Collected diagnostics] --> F[Render metrics]
  D -->|Yes| F
  D -->|No| G[Non-cacheable 403]
  F --> H[Metrics or HEAD metadata]
Loading

Before merge

  • Resolve merge risk (P1) - Existing identity-authenticated scrapers whose effective scopes exclude reads will stop receiving metrics and require a role adjustment; this intentional transition is documented and demonstrated through the real Gateway.
Agent review details

Security

None.

PR surface

Source +27, Tests +170, Docs +3. Total +200 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 1 27 0 +27
Tests 4 176 6 +170
Docs 1 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 207 7 +200

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Adopt the documented read requirement (recommended)
    Accept the intentional 403 transition for read-restricted identities, supported by real-Gateway denial and shared-secret compatibility evidence.

Technical review

Best possible solution:

Keep mandatory read authorization at the plugin’s response boundary, preserve authorized shared-secret scrapes, and retain the documented role-adjustment guidance.

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

Yes, from source: an authenticated identity with a role ceiling excluding reads reaches main’s metrics handler, which renders without checking those scopes. The contributor also reports a real-Gateway red/green reproduction; this review executed no target code.

Is this the best way to solve the issue?

Yes. The guard uses the existing request-scope contract at the metrics response owner, matches core scope implications, and prevents both payload and HEAD metadata disclosure without changing stored settings.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 00fd5d6a4049.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured exact-head Ubuntu results exercise the installed plugin through a real Gateway: shared-secret GET succeeds, the nearest forbidden role receives 403 for GET and HEAD without protected metrics metadata, and removing the guard reproduces the leak. This resolves the prior Gateway compatibility proof request.

Label justifications:

  • P2: This repairs a bounded diagnostics authorization gap within the documented shared Gateway trust domain.
  • merge-risk: 🚨 compatibility: Previously successful scrapers without effective read permission will receive 403 until their operator role is adjusted.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 exact-head Ubuntu results exercise the installed plugin through a real Gateway: shared-secret GET succeeds, the nearest forbidden role receives 403 for GET and HEAD without protected metrics metadata, and removing the guard reproduces the leak. This resolves the prior Gateway compatibility proof request.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured exact-head Ubuntu results exercise the installed plugin through a real Gateway: shared-secret GET succeeds, the nearest forbidden role receives 403 for GET and HEAD without protected metrics metadata, and removing the guard reproduces the leak. This resolves the prior Gateway compatibility proof request.

Evidence

What I checked:

  • Introduced authorization guard: The complete pinned introduction delta adds a synchronous scope check before rendering or computing Content-Length. Read, write, and admin scopes are accepted; missing request context fails closed. (extensions/diagnostics-prometheus/src/service.ts:1012, 03fb057fb46a)
  • Current main still needs the repair: The fetched main handler checks the HTTP method, then renders metrics and returns their Content-Length without consulting effective scopes. No equivalent enforcement exists in this handler. (extensions/diagnostics-prometheus/src/service.ts, 00fd5d6a4049)
  • Existing Gateway authority boundary: The registered route uses Gateway authentication and the trusted-operator surface. Gateway dispatch constructs a request-scoped client from effective operator scopes; the role ceiling filters existing grants. The new guard consumes this established SDK contract without introducing a new API or retained authority. (src/gateway/server/plugins-http.ts:125, 03fb057fb46a)
  • Scope implications match core authorization: Core authorization accepts operator.admin for all operator scopes and operator.write for reads, matching the plugin’s three accepted scopes. (src/gateway/method-scopes.ts:267, 03fb057fb46a)
  • Real Gateway proof resolves the previous request: The captured body at sourceRevision 7da8b43ffe27c9f0d0d45642e7279f3683ba83bcff8605e6c6f3d1859b885740 reports an Ubuntu run at the exact head: managed plugin installation and a real Gateway permit password-authenticated scrapes, reject a trusted-proxy identity limited to operator.approvals, and deny HEAD metadata. It reports the same E2E failing with 200 when the production guard is removed and passing when restored. The inspected harness launches openclaw.mjs and uses real HTTP requests, rather than mocking Gateway authentication. (extensions/diagnostics-prometheus/src/install-runtime.e2e.test.ts:388, 03fb057fb46a)
  • Documented operational transition: The PR explicitly documents that identities without effective read permission now receive 403 and explains how to grant the scraper role read permission. Shared-secret access retains its existing trusted-operator semantics. Public docs: docs/gateway/prometheus.md. (docs/gateway/prometheus.md:377, 03fb057fb46a)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • zengLingbiao: 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 (2 earlier review cycles)
  • reviewed 2026-09-07T06:10:23.732Z sha c9db523 :: blocked before merge. :: none
  • reviewed 2026-09-07T06:20:15.798Z sha c9db523 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 7, 2026
@pgondhi987

pgondhi987 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

ClawSweeper review

Reviewed September 7, 2026, 10:08 AM UTC.

What this changes

The PR requires effective read authority for Prometheus diagnostics scrapes, denies unauthorized GET and HEAD requests before rendering metrics, and documents the resulting 403 response.

PR surface: Source +27, Tests +170, Docs +3. Total +200 across 6 files.

Merge readiness

Result: needs maintainer review before merge.

Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster

Reviewed head: 03fb057fb46a

Review scores

  • Overall: 🦞 diamond lobster
  • Proof: 🦞 diamond lobster (sufficient)
  • Patch quality: 🦞 diamond lobster
  • Security: cleared

Verification

Status: sufficient

How this fits together

The diagnostics Prometheus plugin exposes Gateway telemetry to authenticated HTTP scrapers. Gateway authentication and named-role policy produce effective operator scopes, which the plugin uses to decide whether metrics may leave the process.

flowchart LR
  A[Prometheus scraper] --> B[Gateway authentication]
  B --> C[Named role policy]
  C --> D[Effective operator scopes]
  D --> E{Read allowed?}
  E -->|Yes| F[Metrics response]
  E -->|No| G[403 no-store]
Loading

Decision needed

  • Question: Should the Prometheus endpoint immediately enforce operator.read for identity-bearing authenticated scrapers, accepting that existing no-read named roles will begin receiving 403?
  • Rationale: The operator-scope contract supports the guard, but SECURITY.md treats named roles as trusted-domain guardrails rather than hostile-tenant isolation, and the latest release permits these scrapes; rollout timing therefore needs explicit owner intent.
  • Likely owner: Peter Steinberger - Raw commit 345b223 adds src/gateway/server/plugin-route-runtime-scopes.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger.
    Options:
  1. Enforce read scope now (recommended)
    Land the fail-closed guard and communicate that affected named-role scraper configurations must grant operator.read or an implying scope.
  2. Stage the enforcement
    Hold the PR while defining a time-bounded compatibility or migration path for existing scope-restricted scraper roles.

Before merge

  • [P2] Existing identity-bearing Prometheus scrapers whose named-role ceiling excludes operator.read will change from successful scrapes to 403 after upgrading and must be assigned a read-capable role.
  • Record maintainer acceptance of the remaining decision before merge.
Review details

Best possible solution:

Enforce read authority at the final metrics-response boundary once the scope owner accepts the rollout, while retaining shared-secret scraper compatibility and clear role-grant guidance for affected operators.

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

Yes. The supplied red/green real-Gateway scenario observed a 200 response for a no-read named role without the guard and a 403 without metrics or document-size disclosure after restoration; current main contains the same unguarded handler.

Is this the best way to solve the issue?

Yes. Checking effective authority at the final handler boundary is the narrowest maintainable repair, and the accepted scopes match the canonical implication contract; only rollout timing remains a maintainer choice.

AGENTS.md: found_applied

Codex review notes: model internal, reasoning high; reviewed against 6ab14c0.

Label details

Label justifications:

  • P2: This is a bounded authorization repair in one optional diagnostics plugin with limited operational blast radius.
  • merge-risk: 🚨 compatibility: Merging intentionally turns previously successful scrapes into 403 responses for authenticated named roles lacking read authority.
Evidence reviewed

PR surface:

Area Files Added Removed Net
Source 1 27 0 +27
Tests 4 176 6 +170
Docs 1 4 1 +3
Config 0 0 0 +0
Generated 0 0 0 +0
Other 0 0 0 +0
Total 6 207 7 +200
  • Current-main defect: Fetched current main authenticates the route but renders GET and HEAD metrics without checking the effective operator scopes passed to the plugin.
  • Final-effect authorization: The introduced handler reads request-local effective scopes and returns a non-cacheable 403 before rendering metrics when read authority is absent.
  • Effective-scope handoff: Gateway plugin dispatch derives authenticated route scopes, attaches them to the request-local runtime client, and invokes the handler inside that scope.
  • Canonical scope implications: Gateway authorization defines operator.admin as universal and operator.write as satisfying operator.read, matching the three scopes accepted by the patch.
  • Real Gateway proof: The supplied exact-head evidence reports a packaged-plugin E2E using the real Gateway and HTTP route: password-authenticated scraping remains 200, while a trusted-proxy identity limited to operator.approvals receives 403 for GET and HEAD without the metrics marker or authorized document length. Removing the guard reportedly restored the forbidden 200 response.
  • Shipped compatibility baseline: The latest release, v2026.9.2, renders metrics and Content-Length after Gateway authentication without a route-level read-scope check, so the PR intentionally changes upgrade behavior for restricted named roles.
  • Feature history: Commit 0f2e751 introduced the protected Prometheus route and its handler; later scope-policy work in commit 345b223 added the current named-role ceiling behavior consumed by this patch.
  • Re-review continuity: The current head resolves the earlier P3 review note by pointing the event-loop test comment to the dedicated HTTP-scope suite, and the production guard is unchanged from the previously reviewed head.

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Behavior proof for 03fb057fb46acab83061a66abe47d9cbdb7b093d:

  • Negative scenario: a real local Gateway receives GET and HEAD requests for the installed Prometheus plugin from a trusted-proxy identity whose named-role ceiling contains operator.approvals but no operator.read. Both requests return 403 before metrics are rendered; GET exposes no metric marker and HEAD does not expose the authorized document size.
  • Positive control: the same Gateway continues to serve metrics to its authorized password-authenticated scraper.
  • Protected result: neither the metrics body nor its rendered Content-Length crosses the plugin route for the restricted identity.
  • Focused command: node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/install-runtime.e2e.test.ts passed 1 / 1 on Ubuntu. Removing the production guard made the restricted named-role request return 200 and fail the test; restoring the guard passed.
  • Supporting command: node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/{service.http-scope,service,service.event-loop,service.runtime-identity}.test.ts passed 4 files / 38 tests, including read/write/admin controls.
  • Environment gap: no live external Prometheus server was used; the production handler, managed plugin installation, real Gateway adapter, and real HTTP requests were exercised locally.

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Verification before merge:

  • Exact head: 03fb057fb46acab83061a66abe47d9cbdb7b093d.
  • Behavior addressed: the Prometheus diagnostics route now requires an effective operator.read scope before rendering metrics, so restricted authenticated identities cannot retrieve the metrics body or infer its rendered size with HEAD.
  • Environment: Ubuntu, using the production plugin handler and a real local Gateway with a managed plugin installation; no live external Prometheus server was used.
  • Focused validation: node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/{service.http-scope,service,service.event-loop,service.runtime-identity}.test.ts passed 4 files / 38 tests; node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/install-runtime.e2e.test.ts passed 1 / 1 real-Gateway adapter test. Focused oxlint with --openclaw-focused-config, oxfmt, extension and extension-test type lanes, node scripts/check-changed.mjs, and git diff --check also passed.
  • Observed result: an authorized password-authenticated scraper still receives metrics; a trusted-proxy identity capped by a named role without operator.read receives 403 for both GET and HEAD, with no metrics marker or authorized document length. Removing the guard restores the forbidden 200 response, confirming red/green coverage.
  • Review status: the canonical exact-head ClawSweeper review rated the patch and proof A, found no actionable review findings, and cleared security. Optional review-pr and autoreview were disabled and skipped.
  • CI: 170 checks observed; 126 passed, 0 failed, 0 pending, and 44 were skipped by workflow scope. No remediation was required.
  • Gaps and risk: no external Prometheus service was exercised. Regression risk is limited to existing identity-bearing scraper roles that omit operator.read; those roles will now receive 403 and must be granted a read-capable scope.
  • Best-fix verdict: the final response boundary is the correct enforcement point because it blocks both GET payload and HEAD size disclosure while preserving authorized scrapes. The user-visible behavior change is an explicit 403 for authenticated identities without read authority.

Maintainer decision before merge:

  • Required acceptance: Should the Prometheus endpoint immediately enforce operator.read for identity-bearing authenticated scrapers, accepting that existing no-read named roles will begin receiving 403?
  • Recommended option: Enforce read scope now — Land the fail-closed guard and communicate that affected named-role scraper configurations must grant operator.read or an implying scope.
  • Acceptance owner: Peter Steinberger must explicitly accept this behavior/tradeoff before merge.
  • Workflow status: all required review, delivery, and CI stages completed; this merge-time decision does not block readiness or final reporting.

@pgondhi987
pgondhi987 merged commit 0c9330b into openclaw:main Sep 7, 2026
21 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…claw#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
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
…claw#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)
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

docs Improvements or additions to documentation extensions: diagnostics-prometheus gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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.

1 participant