[GH-ISSUE #657] Feature request: Redact specified strings / regexes #949

Closed
opened 2026-03-15 11:06:20 +03:00 by kerem · 2 comments
Owner

Originally created by @5HT2 on GitHub (Oct 16, 2024).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/657

Describe the feature

I would appreciate the ability to redact specific strings or regexes from recordings & streams.

I did consider "just pipe your commands through a filter", but I would like to present the following points:

  1. ssh & similar make it incredibly annoying and difficult to share recordings of a session where you can't as easily pipe the entire session through a filter
  2. high-throughput recordings make it easy to miss data / env variables / keys / similar
  3. what needs redacted is an IP / hostname / something that is part of a machine's shell prompt a.k.a. PS1
  4. what if I would like to replace it with auitable placeholder text?

I understand that this entirely free software with hosting that is paid for out of pocket - the ability to redact specific information in-real-time is important to me, however much I would like to use this tool otherwise.

I would also be just as happy to open a pull request if this is a feature that you are willing to consider.

Behavior goals

The usage flags could include:

  • --redact-mode: [none (default) | string (exact string match) | regex | config]
  • --redact-char: char to replace redacted content with.
    • Default to a single space, or maybe / *
    • Making the default a single space means it's easy to change it to literally nothing, for a use case where the length of the redacted content is already a giveaway.
  • For more complicated replacement configurations it would make more sense to take a key:value config file, though I suppose it could just be done by taking each addition duplicate parameter as an additional redaction key
Originally created by @5HT2 on GitHub (Oct 16, 2024). Original GitHub issue: https://github.com/asciinema/asciinema/issues/657 **Describe the feature** I would appreciate the ability to redact specific strings or regexes from recordings & streams. I did consider "just pipe your commands through a filter", but I would like to present the following points: 1. ssh & similar make it incredibly annoying and difficult to share recordings of a session where you can't as easily pipe the entire session through a filter 2. high-throughput recordings make it easy to miss data / env variables / keys / similar 3. what needs redacted is an IP / hostname / something that is part of a machine's shell prompt a.k.a. PS1 4. what if I would like to replace it with auitable placeholder text? I understand that this entirely free software with hosting that is paid for out of pocket - the ability to redact specific information in-real-time is important to me, however much I would like to use this tool otherwise. I would also be just as happy to open a pull request if this is a feature that you are willing to consider. **Behavior goals** The usage flags could include: - `--redact-mode`: [none (default) | string (exact string match) | regex | config] - `--redact-char`: `char` to replace redacted content with. - Default to a single space, or maybe `•` / `*` - Making the default a single space means it's easy to change it to literally nothing, for a use case where the length of the redacted content is already a giveaway. - For more complicated replacement configurations it would make more sense to take a key:value config file, though I suppose it could just be done by taking each addition duplicate parameter as an additional redaction key
kerem closed this issue 2026-03-15 11:06:25 +03:00
Author
Owner

@ku1ik commented on GitHub (Oct 20, 2024):

Have you tried using awk, sed or similar tool to replace occurrences of sensitive information in existing .cast files? The recordings encode the terminal output in plain text, which is easily greppable, so it should be pretty easy to setup an awk pipeline/script/alias to do that automatically after every recording session.

<!-- gh-comment-id:2425109190 --> @ku1ik commented on GitHub (Oct 20, 2024): Have you tried using `awk`, `sed` or similar tool to replace occurrences of sensitive information in existing `.cast` files? The recordings encode the terminal output in plain text, which is easily greppable, so it should be pretty easy to setup an `awk` pipeline/script/alias to do that automatically after every recording session.
Author
Owner

@5HT2 commented on GitHub (Oct 23, 2024):

Oh I did not realize that you could just modify the cast files after the fact. That's a fine solution then, thank you!

<!-- gh-comment-id:2430596696 --> @5HT2 commented on GitHub (Oct 23, 2024): Oh I did not realize that you could just modify the cast files after the fact. That's a fine solution then, thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#949
No description provided.