Skip to content

Activity log drops the payload of upstream_servers / quarantine_security mutations (records only operation + name) #1146

Closed

Description

@Dumbris

Summary

The activity log records that an upstream server was patched but not what was patched. Every mutation payload field is dropped before the record is written, so the audit trail for the two config-mutating MCP tools is unusable for answering "what changed?".

Observed

A real upstream_servers patch that changed a server's Docker isolation settings. Activity-log detail drawer:

Request Arguments — 58 bytes:

{
  "name": "gcore-mcp-server",
  "operation": "patch"
}

The actual call also carried isolation_json: {"enabled": true, "image": "ghcr.io/astral-sh/uv:python3.13-bookworm"}. It is nowhere in the record.

The Response Body happens to contain a changes diff for this operation, which is the only reason the change is recoverable at all — but that's a property of patch's response shape, not of the activity log. Operations whose response doesn't echo a diff leave no trace of the payload.

Root cause

internal/server/mcp.go:3268-3274:

// Build arguments map for activity logging (Spec 024)
args := map[string]interface{}{
	"operation": operation,
}
if name := request.GetString("name", ""); name != "" {
	args["name"] = name
}

Only operation and name are captured. Dropped: isolation_json, env_json, args_json, headers_json, oauth_json, command, url, protocol, enabled, trust_mode, init_timeout, registry, id.

quarantine_security has the identical two-field builder at mcp.go:3393-3399.

This is inverted relative to the read-only tools: read_cache (mcp.go:5354) records key, offset and limit. The two tools that mutate security-relevant configuration are the two that record the least.

Second defect: the row shows no server

In the list view the row's Type is Internal Tool, Details is upstream_servers, and Server is - — even though the target server name is known and is already in args.

handleUpstreamServers passes targetServer: "" at every one of its ~10 emit sites, and EmitActivityInternalToolCall omits target_server entirely when empty. Consequences:

  • the list row can't be read without opening the drawer
  • filtering by Server misses these rows, so "show me everything that touched this server" silently omits every mutation applied to it

Passing the resolved server name as targetServer fixes both.

Suggested fix

  1. Record the full argument set for upstream_servers and quarantine_security, with redaction — env_json, headers_json, and oauth_json can carry secrets. internal/oauth/logging.go already provides RedactEnvValues, RedactStringHeaders, and RedactSensitiveData; the machinery exists, it just isn't wired to this path.
  2. Pass the target server name as targetServer so the row renders and server-filtering works.
  3. Consider recording the resolved before/after diff for patch/update rather than the raw request, which is what an operator actually wants and what the response already computes.

A test asserting that a patch activity record contains the mutated field names (and that a secret-bearing field is present-but-redacted, not absent) would keep this from regressing.

Found while diagnosing #1142: reconstructing what a patch actually did required reading the response diff, because the request record had already thrown the payload away.

Activity

  1. added
    kind/bug
    area/proxy
    area/web-ui
    priority/high
    on Aug 31, 2026
  2. Dumbris commented on Aug 31, 2026

    @Dumbris
    MemberAuthor

    QA finding: the activity log already persists secrets in the clear — via the response

    Reproduced on main (0750fcd) against a scratch instance. The picture is worse than the original report: the request payload is dropped, and the response that is recorded leaks secrets.

    MCP call:

    {"operation":"patch","name":"qa-inherit",
     "isolation_json":"{\"image\":\"node:22\"}",
     "env_json":"{\"QA_SECRET_TOKEN\":\"sk-super-secret-value-12345\"}"}

    Resulting activity record (GET /api/v1/activity?type=internal_tool_call):

    tool: upstream_servers   server_name: None
    ARGUMENTS: {"name": "qa-inherit", "operation": "patch"}
    RESPONSE contains secret: True
    RESPONSE: {"changes":{"modified":{
        "env":{"path":"env","from":null,"to":{"QA_SECRET_TOKEN":"sk-super-secret-value-12345"}},
        "isolation":{"path":"isolation","from":{"image":"node:20"},"to":{"image":"node:22"}}}},...}
    

    Three things confirmed at once:

    1. Payload dropped from arguments — as reported.
    2. server_name is null — as reported; the Server column and server-filter miss the row.
    3. NEW: the env var value is stored verbatim in the activity record, because handlePatchUpstream puts configDiff into the response and the response is what gets recorded. The same value is also returned to the MCP caller in the clear.

    So the store is already a secret sink today. That reframes the fix:

    • Redacting only the newly-added request arguments would be insufficient — the leak that exists right now is on the response side.
    • configDiff must be redacted before it enters either the MCP response or the activity record. Env values, headers, and OAuth secrets all flow through MergeServerConfig's diff.
    • The from/to shape should keep the key and drop the value ("QA_SECRET_TOKEN": "***"), so an operator can still see which credential changed.

    Raising this to a security-relevant defect rather than a pure observability gap.

  3. added
    kind/security
    on Aug 31, 2026
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

    area/proxyarea/web-uikind/bugkind/securitypriority/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions