fix: owner-gate remaining MCP/config mutations - #5161
Conversation
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
716d7d5 to
b824cff
Compare
|
🤖 Kiro Crew [operator: bolichen97#66809557]: This PR has been inactive with a blocked CI state. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: The branch is behind If you'd prefer I don't touch this PR, add the |
b824cff to
6adfb57
Compare
|
🤖 Kiro Crew [operator: bolichen97#66809557] Rebased this PR onto current main (was CONFLICTING) and pushed Conflict resolution — main's structure + this PR's consolidation, guard semantics untouched:
Rebase-integration fixes:
Local gates: isort / flake8 / black-baseline clean; mypy clean on the touched files; 1090 targeted tests pass (all 24 test files this PR touches + the stale-signal and error-code contract suites). Single commit preserved (original authorship kept, Kiro Crew co-author trailer added). |
6adfb57 to
608d606
Compare
|
🤖 Kiro Crew [operator: bolichen97#66809557] Review-ready ✅ at head
Drive summary (from CONFLICTING + F401 to green):
Not merged — that decision stays with maintainers. Thanks @atomsbaza for the original consolidation design; the fail-closed guard semantics are exactly as you wrote them. |
Head branch was pushed to by a user without write access
810560d to
9fbd254
Compare
48111dd to
4dc72a9
Compare
|
I re-read the complete current 26-file diff after the head changed from Already merged coverage:
Keep the distinct residual: owner gates for the remaining MCP/custom/discovery/gateway/config mutations (including probe/measure/quarantine/sync/toggle/remove/apply, custom add/update, discovery install, gateway enable/stub/resolve refresh, and config/theme writes), plus the route-walk and route-specific authorization tests. Dropping the already-merged helper and agent-spec portions will make the security delta reviewable without losing those uncovered routes. |
Audit note — part of this has already landed; the rest has notThis PR is not a duplicate and is not finished by anything on Already landedOnly ONE claimed reference really landed and touches this work: #6245 -- the issue/PR reference check row Which parts
|
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
Rebase-integration fixes by Kiro Crew (original change by PISIT KOOLPLUKPOL): - keep main's stale_owner_session_response relabel on the shared guard's deny path (lazy import; relabel-only, never grants) - re-export is_owner_dashboard_request from source_providers for its existing importers; keep _LOCAL_DASHBOARD_OWNER_SUBJECTS from _shared - give rebase-added TestFallbackModelPatch the owner-identity app pattern - migrate the agents stale-label test to the shared guard - regenerate error-code-baseline.json (missing_code 1285 -> 1284) Co-authored-by: Kiro Crew <noreply@kirodotdev.github.io>
|
Rebased onto main Conflict resolutions:
Rebase follow-ups: Gates run locally on changed files: black (8 files remain in Please review the resolutions. A maintainer push makes the maintainer the last pusher, so a second approver is needed under the repo's last-push rule. Reply if anything looks wrong. Note, not changed here: main's |
Problem / Motivation
The dashboard still exposes MCP and configuration mutation routes that can write machine-global state, restart sessions, install or remove capabilities, or change gateway behavior. The routes this PR targets did not share one owner authorization boundary, so the protection could drift between handlers. Several owner-denial helpers also duplicated the same identity rule in different modules.
Why it matters
MCP and dashboard configuration writes affect the host and future sessions, not only the requesting tab. An app-scoped token or an authenticated non-owner must not be able to trigger those side effects. Authorization must happen before JSON parsing, locks, resolver work, process spawning, or any other mutation side effect.
What changed
403with machine-readable codeowner_only.X-Internal-Secretremains an explicit opt-in exception only for MCP server registration (PUT/DELETE /api/mcp/servers/{name}); it does not bypass the other mutation routes.403 owner_onlybefore a handler can return a body-parse error or perform a side effect.Tests
py_compilepassed for all changed Python files.git diff --checkpassed.The final targeted run deselected 6 environment-only test nodes. The broader relevant run had 3 environment-only failures: two pip-channel checks because the uv-created environment has no
pipmodule, and one optional STT capability check because voice/Transcribe dependencies were not installed. Formatting/lint executables (black,isort,flake8, andruff) were unavailable in the isolated worktree environment.Review and CI status
The local diff was reviewed and the available targeted validation passed. No separate model-pinned review is claimed here. Upstream automated checks for this fork PR are currently held by GitHub
action_requiredapproval for the fork workflows; this is an execution-permission blocker, not a source-test failure. After an upstream maintainer approves and runs the workflows, CI and review results should be evaluated for the current head revision.Scope
Backend-only authorization and regression coverage. No frontend behavior changes and no screenshot evidence is applicable.
Closes #5014