Skip to content

Add log sanitization #103

Closed
Closed

Description

We already noticed one place where secrets could leak in logs: https://github.com/agent-substrate/substrate/pull/20/changes#r3313203264. We should add a sanitizer based on field tagging for printing structs/protos and basic regexp redaction for common credential formats as a backup.

Activity

  1. juli4n commented on Jun 11, 2026

    @juli4n
    Collaborator

    Protobuf has debug_redact = true to hint that a field can have sensitive content (e.g. key material). IIUC we are slog-ging the proto message directly, which will traverse the proto struct using reflection to convert it into a json-value.

    How about annotating all sensitive fields in our services with debug_redact and then implementing a small utility function to redact fields with this annotation? I couldn't find official protobuf/go support for this, but something like https://github.com/ntk221/redact

    Then we could instrument internal/contextlogging which defines the slog handler we use in all servers to sanitize the value if it's a protobuf Message.

  2. mtaufen commented on Jun 11, 2026

    @mtaufen
    CollaboratorAuthor
  3. added a commit that references this issue on Oct 29, 2026
  4. destijl commented on Oct 29, 2026

    @destijl
    Collaborator

    Implemented on main:

    • Sensitive proto fields across ateapi.proto and internal RPC protos are annotated with [debug_redact = true] and scrubbed via internal/protoredact.
    • Structured logger context attributes are sanitized via internal/contextlogging (PR #1942, 3a5fc51a).
    • Validation error messages mask sensitive secret/credential inputs (PR #3071, faed88cb).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions