Repository navigation
Commit adf2cd9
committed
test(agentsessions): the newline case asserts the halves survive, not just the newline
Raised by CodeRabbit.
The comment said the halves "must NOT become the secret" and nothing checked it.
The newline assertion alone passes just as well if the matcher spans the newline
and redacts both halves as one, because the separator would survive inside a
"[REDACTED]" that ate the text around it.
Both halves are now named, and so is the absence of any redaction at all. The
failure this guards against is over-redaction: a credential cannot contain a raw
newline, so treating a newline-split pair as one destroys legitimate transcript
content while protecting nothing. It is also what stops stripControl being
widened to strip newlines, which would make the NUL case in the test above pass
for the wrong reason.
Measured, to pin the three-way distinction:
newline -> "before sk-ant-api03-\nAAAA... after" not redacted, halves intact
joined -> "before [REDACTED] after"
NUL -> "before [REDACTED] after" stripped, so it rejoins
Mutation-checked: removing the '\t'/'\n' exemption from stripControl fires all
four assertions.
Origin-Session: local-13d543 | Claude Code | 2 prompts
Origin-Snapshot: a939509c08a81 parent 638ef36 commit adf2cd9
1 file changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
102 | 122 | | |
0 commit comments