Repository navigation
feat(api-keys): let a monitoring key read the stream timeseries - #3242
Conversation
admin:monitor:read already admitted the playback-activity, top-activity and downloads stats reads but not GET /api/v2/admin/stats/timeseries, the concurrent-stream and egress history. The handler already ignores refresh=true for scoped keys and returns only counts, rates, byte totals and timestamps. /admin/stats stays outside the scope. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The new monitor-key access to Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Major change: #1190 C2 (Server)C2 is recorded as passed on build 807 · Please replace the current line with:
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Problem
Related issue: N/A
Validation tasks: none (#1190 C2 checked key scopes before
admin:monitor:readexisted)A monitoring tool holding an
admin:monitor:readkey can read three of the dashboard stats routes but gets403fromGET /api/v2/admin/stats/timeseries. That route is the history of concurrent streams and egress, which is what a monitoring tool charts. It was left out of #3182, which added the scope; that PR's description never discusses it. This change adds it to the scope.Approach
timeseriesjoinsplayback-activity,top-activityanddownloadsin the monitor scope's allowlist pattern, and the scope table indocs/api-keys-api.mdlists it.The handler already passes
refreshthrough the same check as the other three reads, so a scoped key that sendsrefresh=truegets the shared cached aggregate and cannot force the query on every poll. The response carries only stream counts, kbps, byte totals and timestamps, with no paths, addresses or error text./admin/statsstays outside the scope. It returns library totals and watch-provider counters, and its handler does not ignorerefreshfor scoped keys.Validation
timeseriesfor a monitor key failed before the change and passes after; the existing row refusing/admin/statsstill passes.internal/api/middleware,internal/apiv2andinternal/auth: pass.make lint-changed,gofmt,make verify-apiv2-openapi,make verify-apiv2-contract,make verify-local-paths: pass.Evidence
Evidence: none, no user-visible change
Risks
A monitor key can now read sampled stream counts and egress for up to 31 days. No route is removed and no response changes. The user manual does not list the routes this scope covers, so it needs no update.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Allow
admin:monitor:readAPI keys to access the stream timeseries stats endpointAdds the timeseries stats path to the GET routes in the
apiKeyScopeRoutesscope-route table in api_key_scopes.go. A monitoring-scoped key can now read this endpoint with GET. Covered by a new case inTestAPIKeyScopesAllowand documented in api-keys-api.md.Macroscope summarized 723e68f.