Skip to content

Document and gate relaxed JSONL encoder use #3965

Description

@Widthdom

Problem

UnsafeRelaxedJsonEscaping is used for local JSONL sinks. The current comments say these streams are local-only, but the safety boundary is implicit and could be weakened by future reuse.

Evidence

  • Mcp/AuditLogSink.cs configures JavaScriptEncoder.UnsafeRelaxedJsonEscaping.
  • Cli/MetricsSink.cs configures JavaScriptEncoder.UnsafeRelaxedJsonEscaping.
  • Both appear intended for local append-only JSONL, not HTML or remote embedding.

Suggested fix

  • Centralize or clearly name the local-only JSONL serializer options.
  • Add comments/tests that assert these options are not used for HTTP responses, HTML contexts, or externally embedded JSON.
  • Consider a small guard or type distinction for local telemetry/audit JSONL output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions