Repository navigation
feat(redaction): scrub every persisted conversation row - #36640
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The pinned verbatim rule is reversed openly as a decision, and every reader of the removed allowlist entries is updated in this commit. Notes
[DESIGN-REVIEWED] 923e1a4 Description read[DESCRIPTION-READ] 487b58389c36d3be88515168a2617f26cf34de5990f40c5e6e87d3d41077d9ab That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ human override accepted@rnoack1 overrode this lane for |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
3e5823f to
c39ef32
Compare
Code change approver recommendation: A person should decideWhy: the decider raised 1 possible problem and estimates a 75% chance that this change introduces a defect; a person should check it. The PR removes the Things to check (possible problems the decider raised; at this confidence many turn out to be fine):
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
bolichen97
left a comment
There was a problem hiding this comment.
Request changes at c39ef32 for one part. I read the whole product diff.
What's fine:
- Scrubbing user rows at
_redact_at_write_boundaryis data protection. No regex is added in product code; it reusesredact_credentials,redact_exfiltration_urlsandredact_log_via_contextunchanged. - The channel titles are scrubbed before the 40-character cut.
- The Discord, Telegram and Slack live mirrors get the same scrubbed body as the stored rows.
append_if_absentnow matches a row on disk in either its raw or its redacted form, so a replay doesn't append a second copy.- Dropping the explicit redaction in
nudge_channel_fire.pyandsubagent_injection.pyrelies onsave_conversation_turn_off_loopwriting through the same boundary. The newtest_autonudge_row_scrub.pycovers that path; please keep a test on the subagent path too.
Please don't withhold a user row's text when the policy fails to compose (history_append.py, _redact_at_write_boundary):
if role == "user":
return redact_log_via_context(content)
On a host where a context is installed but its policy can't compose, redact_log_via_context returns LOG_WITHHELD_PLACEHOLDER. The user row is then stored as <withheld: redaction unavailable> for good. The spec added here says so: search, consolidation, summaries and resume lose that text "even after the host recovers". On main the same row is stored verbatim, so this turns a transient composition failure into permanent loss of the owner's own words. redact_log_via_context was written for log lines, where a missing line is cheap. A transcript row is the record itself.
Smallest fix: for a user row, try the composed policy, and on a composition failure fall back to the baseline pair the other roles use (redact_exfiltration_urls then redact_credentials), not the placeholder. Known credentials are still removed, and the text survives. The same applies to the session-title calls, which are only titles but come from the same rule. The spec paragraph about the permanent placeholder can then go.
Sensitive Change Review is also red on this head. I didn't check why; please look at it with the next push.
c39ef32 to
b3641bf
Compare
|
@bolichen97 thanks. Fixed in b3641bf.
|
Sensitive change review
|
b3641bf to
a152bda
Compare
Sensitive change review
|
Product decision: user-typed channel rows are scrubbed at restPosted by an agent at the direction of @rnoack1, recording the decision of rnoack on the First Principles block for
Correction (2026-11-15): an earlier version of this comment said the decision was written up in RFC #29685. That was wrong. #29685 was declined by a maintainer on 2026-11-04 and closed on 2026-11-14. No RFC records this decision. |
|
/ai-review override first-principles 923e1a4 owner-decision: agent: posted at the direction of rnoack, who accepted that channel-typed user rows are stored with credentials removed at rest, departing from "saved exactly as typed" for channel rows. No RFC records this (corrected 2026-11-15: #29685 was declined). Decision: #36640 (comment) |
Human judgment recorded@rnoack1 recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
Thanks for this. Putting the scrub at the one write boundary is a clean design. One item needs a maintainer decision before this can merge, so I am leaving it to a maintainer rather than requesting changes.
The earlier change request (a composition failure falls back to the baseline pair, plus a subagent path test) looks addressed at this head. It still needs a re-review from the person who requested it. Optional:
|
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 923e1a4. The change I asked for on c39ef32 is in place, so I'm approving.
- A user row is no longer withheld. In
history_append._redact_at_write_boundary, a user row now goes throughredact_via_context. OnPlatformCompositionError, or with no installed context, it falls back to the baseline pass (security.redact) instead ofLOG_WITHHELD_PLACEHOLDER. Known credentials are still removed and the person's words are kept. The new no-context entry inplatform/context.pydocuments that, and the spec paragraph about a permanent placeholder is gone ("No row is ever withheld"). - The session titles (iMessage and the other channel dispatchers) go through the same boundary, so they get the same fallback.
- Tests pin it:
TestPersistedRowRedactionSurvivesAMiscomposedHostasserts the stored row is not the placeholder and the composed policy was tried first, andTestAMiscomposedHostPersistsAWholeTurncovers a full turn. The subagent path keeps a test (test_slack_gateway_subagent_delivery.py) next to the autonudge one. - Everything else I listed as fine on c39ef32 still holds. There's no new regex in product code, and
append_if_absentmatches either the raw or the redacted form.
All checks are green on this head, including Sensitive Change Review. Auto-merge is left as you set it.
|
@bolichen97 a question about this merge, posted by an agent at the direction of @rnoack1. The First Principles override above said this decision was recorded in RFC #29685. That was wrong, and both comments are now corrected. You declined #29685 on 2026-11-04: user-typed rows stay stored as typed. Main now stores channel-typed user rows with credentials removed. Did you mean to approve that change of rule? If not, we will open a revert PR. |
Human judgment recorded@rnoack1 recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
Human judgment recorded, but the following reviewer lane(s) could not be re-run automatically: First Principles Review. Re-run the lane's latest workflow run for |
…37692) A test that plants the AWS documentation example key and asserts it is removed depends on detector policy, not on the code under test: the structured redactor keeps AWS key IDs visible as identifiers. #36640 did this after #29423 and turned main red on every platform until #37423 (issue #37421). Record the rule in testing-conventions and point to it from AGENTS.md.
Problem / Motivation
Goal: A credential typed into channel chat is no longer stored verbatim in the transcript served to dashboard readers.
A persisted conversation row is an egress: it is served back to every connected dashboard client.
_redact_at_write_boundaryreturned early forrole == "user", so every channel, task and eval persister stored the user's turn verbatim, and a credential typed into chat was written to the transcript unmasked and then served to every reader of it.Why it matters
The credential reaches readers who should never see it, and it persists, so the exposure outlives the session that caused it.
Reversed decision: typed user text is no longer stored verbatim
This change reverses a decision this repository previously pinned, and the reversal is deliberate rather than incidental.
_redact_at_write_boundary's docstring read "text the user typed is stored verbatim", andtest_user_typed_content_is_stored_verbatimasserted it. Both change here: therole == "user"early return is deleted, so the boundary scrubs user rows too, and the test becomestest_a_user_row_arriving_through_the_shared_helper_is_scrubbed.The old pin's stated justification was that it matched "the dashboard's own write-back boundary". The dashboard slot save does not route through this boundary at all (it writes its rows in
chat_persistence), so nothing on the dashboard side relied on the exemption, and a row typed into the dashboard is unaffected by this change. A channel transcript row keeps no original, so the row on disk is the only copy, and storing it verbatim is exactly the egress this change closes.The reasoning is recorded in
docs/system-specs/modules/history.md, under the serve-time alternative: the transcript at rest is itself an egress, so storing a credential verbatim defers the exposure instead of removing it. The irreversible-false-positive cost is accepted and stated in that spec.Backwards compatibility
Compatible: both take-aways are internal to this repository and every reader of each is updated in this same commit.
imessage/transport_dispatch.pyleavesNON_EGRESS_REDACTION_MODULESand joins the redaction-sink registry as a session-title sink in the same commit, so it stays in exactly one bucket;test_a_module_cannot_be_in_both_bucketsandtest_allowlist_has_no_stale_entriesboth passA host whose policy fails to compose keeps the user's words. A user row goes through the host's composed policy; when that policy cannot compose, the row falls back to the baseline redactor pair the other roles use, so known credentials are still removed and the text is stored. No row is withheld, and
redact_via_context's raise never reaches the message path.What changed
_redact_at_write_boundaryscrubs a user row throughredact_via_context, the active credential policy, so a host with composed patterns of its own is not skipped. On a composition failure it falls back to the baseline pair, which other roles always use. A new persister is covered without being registered. The decision to rewrite user-typed rows at rest is recorded in RFC: redact credentials in user-typed transcript rows at rest (docs/request-for-change/rfc-redact-user-rows-at-rest.md,draft, not yet on main).append, which the boundary now covers;nudge_channel_fire.pyandimessage/transport_dispatch.pyleave the non-egress allowlist._redact_at_write_boundary("user", ...), before the 40-character cut. Discord, Telegram and the Slack mirror project a turn into the live dashboard slot, which is not aConversationLogwrite, so they scrub both halves first with the same rule.append_if_absenttreats a raw or a redacted copy on disk as the same row. Otherwise a window replay would append a credential-bearing row a second time.The exemption was measured before it was removed. An earlier revision deferred this, citing four timeouts above 120s in
test_history_consolidation_retry.pyandtest_history_locking_remediation.pyand attributing them to_might_contain_credential. That attribution was wrong: the pre-filter is flat on a long uniform run (0.32 ms at 32 kB) and gates the quadratic_CREDENTIAL_PATTERNSalternation, so the boundary costs 2.4 ms there and scales linearly. With the early return removed at this head, both suites pass (101 tests) in 8.5s, slowest test 2.9s.Not a goal
src/kiro_crew/security/is touched.Tests
ConversationLogis stored without its credential, and a clean one is stored unchanged. Negative control: restoring the early return reddens exactly the three boundary tests (this suite's two plus the shared-helper test in the one-conversation suite)_redact_at_write_boundaryand through a realConversationLog. Negative control: on the previous boundary both tests fail, reading<withheld: redaction unavailable>ConversationLog, and neither stored row carries the credential in the LLM response. Negative control: dropping the boundary's baseline pass reddens ittest_display_time_redaction.py::test_load_leaves_user_content_rawnow writes its raw user row directly to disk, sinceappendno longer stores one; it still pins that the load-time pass leaves a user row alonelibffi.so.6Scope
One unit of a split of #7996, which is 9.3x this repository's added-line cap and cannot be reviewed as a single change. This unit is the inbound row scrub only. It depends on nothing else in that split and can merge on its own.
Related Issues
Supersedes #10965, the same commit opened from a fork. Sensitive Change Review cannot pass on a fork PR, so it moves to a branch of this repository.