Skip to content

redact()'s generic keyword rule leaves an orphaned quote on quoted values #15

Description

@jsirish

Found during the v0.5.0 (#5/#6/#7) review, pre-existing on the command path and out of scope for that PR.

redact()'s generic keyword+separator rule in hooks/_lib.sh (tl_jq_redact_defs) has a value-capture group \"?(?:...|[^\s"]+) that optionally consumes a leading quote but never consumes a matching trailing quote. A quoted value like:

password="hunter2superlongvalue"

redacts to:

password=***"

The secret itself IS masked (no leak) - this is purely a cosmetic malformed-output bug: an orphaned trailing quote left in the buffer/handoff log.

Repro:

printf '%s' '{"session_id":"q","tool_name":"Bash","tool_input":{"description":"x","command":"config: password=\"hunter2superlongvalue\""}}' | sh hooks/session-capture.sh

Fix: the value-capture group's quoted alternative needs to consume a trailing quote to match the leading one, e.g. distinguish "..." (quoted, consume both) from an unquoted bare run, rather than one shared alternation.

Low priority - cosmetic, no security impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions