Skip to content

fix(mcp): a manifest parse error can put manifest text on the append-only audit row #4265

Open

Description

@vybe

Problem

An apply_system YAML parse failure returns a 400 whose detail quotes the manifest line (system_service.py, detail=f"{e.code}: {e}"). load_hardened_yaml was run on a malformed manifest and its message did contain the value from that line. After #4246, httpAuditReason (src/mcp-server/src/tools/systems.ts) keeps the first 200 characters of that detail on the audit row. The step from the message to the row was read from the code, not run.

The audit log is hash-chained and append-only, so what is written there cannot be purged. deploy_system's throw path already writes the same 400 uncapped through ApiError.message and the withAudit catch, so this exists today. Manifests are not designed to carry secrets, but an operator can paste one that does.

Expected

  • A manifest parse failure on either tool records a reason that carries no manifest text, such as a bare HTTP 400 or the error code alone.
  • Both paths are covered: the detail arm of httpAuditReason and the withAudit catch path.
  • Reasons on the row are capped in one place. Today only detail is capped, while status and the non-ApiError branches are not.

Acceptance criteria

  • A test drives a malformed manifest containing a marker value through apply_system and deploy_system and asserts the marker is absent from the audit row.
  • The caller's JSON is unchanged.

Activity

  1. added
    priority-p3
    type-bug
    theme-security
    complexity-low
    on Nov 5, 2026
  2. added
    status-ready
    on Nov 18, 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

    complexity-lowpriority-p3status-readytheme-securitytype-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions