[security] fix(observer): restrict monitoring endpoints to admin roles#1604
[security] fix(observer): restrict monitoring endpoints to admin roles#1604Hinotoi-agent wants to merge 5 commits into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
5f62d3f to
3df2a48
Compare
|
This change will break current usage, so we'll discussion more carefully |
|
Thanks for the heads-up. I re-checked the branch and agree this is too disruptive to land as-is. The current patch changes all I’m not going to push another code change on this PR until there’s agreement on the intended compatibility/security tradeoff. Happy to rework it into a narrower fix once the desired behavior is clear. |
qin-ctx
left a comment
There was a problem hiding this comment.
Thanks for tightening observer authorization. The security issue is real and the router-level fix is directionally right, but this patch currently introduces two blocking compatibility regressions: (1) trusted mode loses observer access entirely because every trusted request resolves to Role.USER, so the new router-level guard now returns 403 for all /api/v1/observer/* routes; and (2) the official CLI and docs still route openviking observer * and the top-level openviking status flow through /api/v1/observer/system without a matching sudo/admin path, so existing status/observer workflows now fail for non-admin keys. Please address those regressions, or make the breaking change explicit across the CLI/docs/tests in the same patch.
The focused api_key regression test is useful, but it should be extended to cover the auth modes and user-facing entry points affected by this guard.
|
Thanks — the requested compatibility follow-ups are already on this branch at Included in that update:
Revalidated on the branch:
I also replied on the blocking review threads and resolved them. The PR is currently mergeable; the remaining |
|
Follow-up for the trusted-mode/CLI compatibility concern: Pushed What changed:
Validation:
|
240ec8d to
af4c58d
Compare
|
Follow-up after the CI rerun surfaced an unrelated VitePress docs-build blocker on the rebased merge ref: Pushed
This fixes the docs build errors around raw Validation now passing locally:
|
af4c58d to
d23a7fe
Compare
|
Pushed a small docs-build follow-up in The failure was VitePress parsing raw angle-bracket placeholders in the API doc writing guide as Vue/HTML tags. I escaped those placeholders in both the English and Chinese guide files. Validation:
|
b71aecc to
b230f13
Compare
b230f13 to
d994f4f
Compare
Summary
This PR hardens the OpenViking observer API so deployment-wide monitoring endpoints are no longer readable by low-privilege users.
ADMINorROOTfor/api/v1/observer/queue,/vikingdb,/models,/lock,/retrieval, and/systemUSERkeys are rejected whileADMINandROOTstill succeedSecurity issues covered
Before this PR
/api/v1/observer/*endpoint only required a normal authenticated request contextUSERAPI keys could read deployment-global monitoring data instead of only tenant-scoped stateAfter this PR
ADMINorROOTUSERkeys now receivePERMISSION_DENIEDWhy this matters
The observer API is a monitoring/control-plane surface, not ordinary tenant data access. Its responses summarize global queue backlog, active lock state, retrieval-quality metrics, and system health. Allowing any authenticated user to read that data leaks other tenants' activity and deployment health information across the intended tenant boundary.
Attack flow
Affected code
openviking/server/routers/observer.py,tests/server/test_observer_auth.pyRoot cause
Issue 1: observer route authorization gap
get_request_context, so any authenticated caller could reach itCVSS assessment
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:NRationale:
Safe reproduction steps
1. Observer telemetry disclosure to low-privilege users
api_keymode with a normalUSERAPI key and anADMINAPI key.USER, call any of:GET /api/v1/observer/queueGET /api/v1/observer/lockGET /api/v1/observer/retrievalGET /api/v1/observer/systemUSERkey.PERMISSION_DENIED, whileADMINandROOTrequests still succeed.Expected vulnerable behavior
/api/v1/observer/*Changes in this PR
ADMIN/ROOTdependency across the full observer route familyFiles changed
openviking/server/routers/observer.pyADMINorROOTfor the full observer route familytests/server/test_observer_auth.pyUSERrejection andADMIN/ROOTsuccessMaintainer impact
Suggested fix rationale
Adjacent public context
ROOTaccess for monitoring routes without tenant headers.ROOTmonitoring behavior, and instead fixes the remaining role-enforcement gap that still allowed authenticatedUSERkeys to read the observer surface.Type of change
Test plan
PYTHONPATH=. /Users/lennon/.hermes/hermes-agent/venv/bin/python -m py_compile openviking/server/routers/observer.py tests/server/test_observer_auth.pyPYTHONPATH=. /Users/lennon/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts='' tests/server/test_observer_auth.py -qExecuted with:
PYTHONPATH=. /Users/lennon/.hermes/hermes-agent/venv/bin/python -m py_compile openviking/server/routers/observer.py tests/server/test_observer_auth.pyPYTHONPATH=. /Users/lennon/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts='' tests/server/test_observer_auth.py -qDisclosure notes