Skip to content

Shell commands are stored and logged with only pattern-based redaction #825

Open

Description

@null-axiom

AFT: 0.62.0, OpenCode 2.1.4, macOS.

Full shell command text is persisted and logged with only pattern-based redaction.

  • bash_background/registry.rs logs cmd= (first 200 chars) at INFO for background tasks.
  • aft.db keeps the full command in bash_tasks.command (longest here 9,579 chars) and in compression_events.command (~14K rows over 9 days, longest 15,794 chars). compression_events isn't covered by the retention items in Bash-task storage and log hygiene (several small items) #759.
  • The plugin log duplicates engine output (see Bash-task storage and log hygiene (several small items) #759), so each logged command is written twice, with no rotation.
  • log_redact.rs covers headers, sk- keys, ghp_ tokens, JWTs, AKIA keys, URL userinfo and query tokens. It doesn't cover generic FOO_TOKEN=value / API_KEY=value, --password x / -p x, or values in export X="…".

Locally the logs contain commands like gcloud secrets versions access … and export AWS_…="$(gcloud secrets …)" (names and project ids, no secret values in our case). A command typed with an inline credential would persist in the log indefinitely and in the DB for the retention window. Files are mode 0600 in a 0700 directory, which limits exposure to the local user.

Suggestions: store/log a redacted form only (or a hash plus the first word for compression stats); extend redaction to NAME=value where NAME matches *TOKEN*|*SECRET*|*PASSWORD*|*KEY*, common --password/--token flags, and export assignments; apply retention to compression_events.command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions