T09 · Insecure Skill Coding Practices
- Location
SKILL-logging.md:70- Finding
Unredacted MCP Request and Response Data Written to Logs
- Content
View full analysis
Vulnerability Details
File Location:
SKILL-logging.md:70-73,SKILL-logging.md:79-85,SKILL-logging.md:94-97, andSKILL-logging.md:117-118
Vulnerability Type: Sensitive information exposure through logging
Risk Level: MediumVulnerable Code
go if resp.StatusCode != http.StatusOK { xlogging.D().Error(fmt.Sprintf("mcp service returned non-200 status: %d, body: %s", resp.StatusCode, string(body))) return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode) }Additional affected examples include:
go xlogging.D().Debug(fmt.Sprintf("mcp request params: %+v", params))go if resp.StatusCode != 200 { xlogging.D().Warn(fmt.Sprintf("mcp service returned non-200 status: %d, body: %s", resp.StatusCode, body)) }go func callMCPTool(ctx context.Context, toolName string, params map[string]interface{}) (interface{}, error) { xlogging.D().Debug(fmt.Sprintf("calling mcp tool: %s, params: %+v", toolName, params)) start := time.Now() resp, err := mcpClient.Call(ctx, toolName, params) if err != nil { xlogging.D().Error(fmt.Sprintf("mcp tool %s failed: %+v", toolName, err)) return nil, err } xlogging.D().Info(fmt.Sprintf("mcp tool %s success, cost: %v", toolName, time.Since(start))) return resp, nil }Technical Analysis
The Skill recommends logging complete MCP request parameters and complete non-success response bodies. Request parameters may contain organization names, UUIDs, search terms, procurement criteria, personal information, or credentials introduced by future callers. Error responses may contain backend diagnostics, internal identifiers, request content, stack traces, or secrets.
Although the document separately prohibits logging passwords, tokens, and personal information, the examples do not implement redaction or field selection. Because these examples are presented as ...[truncated 1459 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace complete parameter logging with an explicit allowlist of non-sensitive metadata, such as tool name, request ID, parameter count, and execution duration.
- Do not log response bodies by default. Record the HTTP status, request ID, endpoint identifier, and a sanitized error category instead.
- Implement centralized redaction for tokens, authorization headers, cookies, passwords, UUIDs, personal data, and query text.
- Apply strict length limits after redaction if body excerpts are explicitly required for diagnostics.
- Disable Debug and Trace output in production and ensure runtime configuration cannot enable them without authorization.
- Add automated tests that verify secrets and representative personal information never appear in generated log output.
- Update the Skill examples so their implementation is consistent with the document's stated prohibition against sensitive-data logging.
