Skip to content

E11: Secret redaction — scrub secrets from transcript before provider calls #23

Closed

Description

@ajianaz

What

Redact secrets (env values matching secret-looking patterns, API keys, tokens) from the transcript before it is sent to any provider, so leaked secrets never leave the host.

Why

Adopted from oh-my-pi's SecretObfuscator + obfuscateToolArguments pattern (see research notes). Tole sends the full durable transcript to providers on every step (drive(): s.entries().to_vec()). As soon as tools can read environment or files (E7 file read, gh CLI), tool results can carry secrets into the transcript, and every subsequent provider call re-sends them. Cheap, deterministic, security-relevant.

Design sketch

  • New module tole-core/src/redact.rs: pattern list (AWS key, GitHub token, generic sk-, high-entropy base64/hex strings ≥ some length), replace with [REDACTED:<kind>]
  • Pure function over entries → entries, applied in drive() before p.complete()
  • No new deps — regex-free where possible (prefix/charset scan), entropy check where needed
  • Tier A tests with synthetic secrets

Acceptance criteria

  • Known token shapes (ghp_, github_pat_, AKIA, sk-, xoxb-) redacted
  • Long high-entropy strings (≥32 chars, mixed-case alnum) redacted
  • Normal prose and code identifiers untouched
  • Redaction applied on every provider call path (run + resume)
  • both run_turn and resume_turn drive paths
  • Unit tests over entry payloads (user text, tool results, errors)
  • cargo clippy clean, cora review clean

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions