Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
60a543b
fix(core): strip terminal escape sequences before output redaction (#…
smart-ssh-coder[bot] Nov 26, 2026
21328e5
fix(core): redact before and after stripping escapes so a lone ESC ca…
smart-ssh-coder[bot] Nov 26, 2026
d19e018
fix(core): gate test-only strip helper (#1605)
smart-ssh-coder[bot] Nov 26, 2026
248470b
refactor(core): move escape-aware redaction pass into terminal_escape…
smart-ssh-coder[bot] Nov 26, 2026
c328459
fix(core): keep placeholder when an escape introducer precedes it (#1…
smart-ssh-coder[bot] Nov 26, 2026
e83383a
fix(core): absorb inside each redaction pass, drop redundant final pa…
smart-ssh-coder[bot] Nov 26, 2026
097210e
fix(core): strip escapes once before redacting, keep lone ESC/CSI fro…
smart-ssh-coder[bot] Nov 27, 2026
fa430d4
fix(core): replace non-SGR escapes by one space, add escape property …
smart-ssh-coder[bot] Nov 27, 2026
214f985
fix(core): keep secrets whole around non-SGR escapes via matching sen…
smart-ssh-coder[bot] Nov 27, 2026
8e2b8d5
refactor(core): move separator handling into terminal_escapes to keep…
smart-ssh-coder[bot] Nov 27, 2026
ae4f32b
fix(core): mask the union of raw and stripped redaction views, no sen…
smart-ssh-coder[bot] Nov 27, 2026
7a2a34f
refactor(core): move plain/escape redaction dispatch into terminal_es…
smart-ssh-coder[bot] Nov 27, 2026
ef1d02b
fix(core): one U+FFFD per invalid sequence, exact-output and random-p…
smart-ssh-coder[bot] Nov 27, 2026
933f77a
test(core): insert escapes at any slot in the redactor property (#1605)
smart-ssh-coder[bot] Nov 27, 2026
3c87965
Merge branch 'release/0.8.0' into issue-1605-output-redactor-misses-s…
smart-ssh-coordinator[bot] Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.d/issue-1605-redact-secrets-in-coloured-output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Security
- Secrets in command output that contains terminal colour or cursor codes (for example `grep --color=always`) are now masked before the text reaches the AI, the chat or logs. The codes are removed from that text.
12 changes: 12 additions & 0 deletions crates/core/src/ai/live_redaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,16 @@ mod tests {
let all_but_last: String = (0..199).map(|i| format!("line {i}\n")).collect();
assert_eq!(shown, all_but_last);
}

#[test]
fn test_coloured_secret_across_chunks_is_never_shown_nor_half_escape() {
let raw = "ok\n\x1b[01;31m\x1b[Kpassword \x1b[m\x1b[K= hunter2\nnext\nmore\n";
assert_never_shows(raw, "hunter2");
for chunk in 1..=raw.len() {
let shown = live_view(raw, chunk);
assert!(!shown.contains('\u{1b}'), "chunk {chunk}: {shown:?}");
assert!(!shown.contains("[01;31m"), "chunk {chunk}: {shown:?}");
assert!(!shown.contains("[K"), "chunk {chunk}: {shown:?}");
}
}
}
1 change: 1 addition & 0 deletions crates/core/src/ai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mod redactor_property;
mod redactor_reference;
mod rejection;
mod second_opinion;
mod terminal_escapes;
mod types;

#[cfg(test)]
Expand Down
9 changes: 3 additions & 6 deletions crates/core/src/ai/redactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1409,12 +1409,9 @@ impl OutputRedactor for DefaultOutputRedactor {
/// erkannt" dem Fail-safe-Prinzip (Spec 0002 Abschnitt 1) angemessener als
/// die Redaction bei Nicht-UTF-8-Output ganz zu überspringen.
fn redact_bytes(data: &[u8], patterns: &[PatternRule]) -> Vec<u8> {
let mut text = String::from_utf8_lossy(data).into_owned();
for rule in patterns {
if rule.regex.is_match(&text) {
text = rule.regex.replace_all(&text, rule.replacement).into_owned();
}
}
let rules = patterns.iter().map(|r| (&r.regex, r.replacement));
// Issue #1605: escape sequences are handled in `terminal_escapes`.
let text = super::terminal_escapes::redact_decoded(data, rules, REDACTED_PLACEHOLDER);
absorb_fragments_next_to_placeholders(&text).into_bytes()
}

Expand Down
4 changes: 4 additions & 0 deletions crates/core/src/ai/redactor_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//!
//! A failure means a redactor change redacts less than before. Fix the
//! redactor, not the reference.
//!
//! The generated documents contain no terminal escape sequences (issue
//! #1605), so the current redactor's escape stripping changes nothing here and
//! both sides see the same text; the reference is intentionally unchanged.

use proptest::prelude::*;

Expand Down
Loading
Loading