Repository navigation
fix(diagnostics-prometheus): reject unauthorized metric scrapes - #140903
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 3:16 AM ET / 07:16 UTC. ClawSweeper reviewWhat this changesRequire 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 Review scores
Verification
How this fits togetherThe 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +27, Tests +170, Docs +3. Total +200 across 6 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
ClawSweeper reviewReviewed September 7, 2026, 10:08 AM UTC. What this changesThe 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 readinessResult: needs maintainer review before merge. Overall: 🦞 diamond lobster Reviewed head: Review scores
VerificationStatus: sufficient How this fits togetherThe 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]
Decision needed
Before merge
Review detailsBest 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 detailsLabel justifications:
Evidence reviewedPR surface:
|
|
Behavior proof for
|
|
Verification before merge:
Maintainer decision before merge:
|
…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
…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)
* 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]>
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
HEADrequests from learning the rendered metrics document size.Why This Change Was Made
The diagnostics-prometheus route now requires
operator.read, including its existingoperator.writeandoperator.adminimplications, before rendering any metrics. The route fails closed with a non-cacheable403response, 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.readand no metrics payload or content-length disclosure.Evidence
03fb057fb46acab83061a66abe47d9cbdb7b093dnode scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/{service.http-scope,service,service.event-loop,service.runtime-identity}.test.tspassed 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 verifyoperator.read,operator.write, andoperator.adminstill receive metrics.node scripts/run-vitest.mjs run extensions/diagnostics-prometheus/src/install-runtime.e2e.test.tspassed 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 containsoperator.approvalsbut no read scope: GET returns403with no metric marker, while HEAD returns403without the authorized document size.Content-Lengthare 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.--openclaw-focused-config), oxfmt, extension and extension-test type lanes,node scripts/check-changed.mjs, andgit diff --checkall passed. Removing the production guard made the real-Gateway E2E fail at the named-role request with200instead of403; restoring it passed.