Skip to content

Hooks cut captured text before redaction, so a <private> block across the limit is stored #1600

Closed

Description

@dmazhukov

Version: main @ 14dfd6e

Hooks shorten captured text before sending it, and the server redacts afterwards. stripPrivateData matches only a closed <private>...</private> block, so when the cut lands inside one, the opening tag and the secret after it are stored. Affected: task-completed (description, 2000), post-tool-failure (input and error, 4000), session-end (transcript prompts, 8000), subagent-stop (reply, 4000; #1599 also fixes it), and truncateCaptureOutput in src/hooks/_capture-filter.ts, which post-tool-use applies to tool output (8000). The same order keeps the start of a token the cut lands in, such as ghp_ followed by fewer than 36 characters, which its pattern no longer matches.

Reproduced through plugin/scripts/*.mjs, with <private>secret starting just before each limit and </private> after it, and the observe payload run through scrubRecord: every site above stores the secret.

src/hooks/stop.ts already redacts the whole reply before shortening it.

Expected: hooks redact captured text before cutting it to their length limit, so a <private> block or a token that the cut lands in is not stored, and text within the limit is sent unchanged.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions