Skip to content

REST mutating server endpoints lack agent-token gating (enable/disable/restart/quarantine/…) #878

Closed

Description

@Dumbris

Found during the cross-model review of PR #876: agent tokens (mcp_agt_) authenticate on the REST API (apiKeyAuthMiddleware → handleAgentTokenAuth → AuthTypeAgent, internal/httpapi/server.go:~384), but most mutating per-server endpoints have no IsAdmin() gate — an agent token blocked from an operation on the MCP surface (the upstream_servers agent-token denylist, internal/server/mcp.go:~2833) can perform the same operation over HTTP.

PR #876 gated the two endpoints it introduced/escalated (POST /servers/{id}/refresh, POST /servers/{id}/discover-tools, both 403 for agents, matching handleSetToolEnabled's pattern). Still ungated (pre-existing): enable/disable/restart/quarantine and possibly other mutating routes.

Suggested fix: a consistency pass aligning REST agent-token authorization with the MCP operation denylist — ideally one shared policy table instead of per-handler checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions