Skip to content

fix(security): make security audit scan session transcripts - #27257

Merged
RohanK6 merged 1 commit into
mainfrom
crew/conductor/audit-sessions-u4
Nov 7, 2026
Merged

RohanK6 merged 1 commit into
mainfrom
crew/conductor/audit-sessions-u4

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew security audit checks the newest session transcript rows and never calls a scan clean when it read nothing.

The audit read ~/.kiro/crew/history/, the Slack observe-mode channel buffer, not ~/.kiro/crew/sessions/. It never saw an agent transcript, so it always printed "✅ No suspicious tool usage found in recent history."

Why it matters

An owner who runs the audit gets a clean result that checked nothing. A flagged shell command in a transcript is never reported. Runtime command gating is not affected; only this report is wrong.

Not a goal

  • Changing which commands audit_bash_command flags.
  • Scanning archived segments under sessions/archive/.
  • Changing the vector-memory half of the audit.

What changed (motivation → approach → change)

The audit pointed at the wrong folder and read each file from its head. It now reads sessions/*.jsonl.

Case Before After
Flagged command in a transcript not seen reported, exit 1
One tool call over several rows n/a one finding, one slot, at its latest row's time
No transcripts at all ✅ clean "No session transcripts scanned: none found"
Transcripts with no rows to audit ✅ clean "held no rows to audit"
Transcript it cannot read skipped reported as not audited
Transcript removed mid-scan n/a skipped, not reported
Long or busy transcript oldest rows of newest file newest 100 rows across files, by row ts

scan_history in security/memory_audit.py reads the transcript row shape: assistant text, and the shell command in a tool row's meta.input, read with shell_command_from_tool_params, a thin wrapper in agent_sdk/__init__.py over the tool gate's own extractor, so use_aws payloads count too. A tool row whose ACP kind can never run a shell command (read, edit, delete, move, search, think, fetch, switch_mode) is not read as a command; for any other kind, an input stored cut off (not valid JSON) is audited as its text. The rows of one tool call share a tool_call_id and fold into one entry, as compaction_keep folds them; a later row of the call moves the entry to the newest end with that row's time, so a call approved after newer rows still counts as recent. It reads records through jsonl_util.bounded_records, skips the metadata header, audits each row as it reads it, and keeps only the row's time, warning and a 200-character snippet, keyed by a fixed-size digest of its call id, so memory stays bounded. It returns (findings, rows_scanned) so cli_commands_security.py can tell "read nothing" from "clean", and the CLI says whether transcripts were absent or held nothing. Each finding prints on one line, a small readability tidy-up. The security.md spec line names the new behaviour.

Backwards compatibility

Compatible: the CLI verb, its flags and its exit codes keep their meaning. scan_history has one production caller, updated here.

Removes nothing: the audit reads a different folder and reports more; no option, key or record goes away.

Tests

  • test_security_stream_redaction.py::TestScanHistory: tool-row commands (Bash, use_aws and cut-off shell or use_aws inputs), the newest rows of a long file, rows picked by timestamp across files (offset-free legacy ts read as local time, a ts ahead of its file mtime, boundary-year stamps), an unreadable file or one past the JSON parser limits as a finding, the empty and missing folder; one call over three rows is one finding and one slot; a call approved after another transcript gained newer rows still counts as recent; a read row is not audited while an other row is; a kind of the wrong type does not stop the scan; a file removed mid-scan is skipped; a huge flagged row is kept as its bounded snippet.
  • test_cli_commands_coverage_agent_security.py: a seeded transcript under a temp data home gives one finding and exit 1; an empty home prints the not-scanned line, not the green check; transcripts holding no rows print "held no rows to audit", not "none found".
  • test_scan_memory_stores.py: the empty-home audit now asserts the not-scanned line instead of the old clean line.
  • test_security_gate_liveness.py: the security package line budget rises by 107 from main's 34,894 to 35,001 for this change (the net lines memory_audit.py adds), with a note naming what grew.
  • Repeats: the TestScanHistory class passed 3 runs in a row. The tests use tmp_path and fixed timestamps only.

Proof: PROVEN test/test_cli_commands_coverage_agent_security.py::TestSecurityCli::test_audit_reads_session_transcripts, test/test_cli_commands_coverage_agent_security.py::TestSecurityCli::test_audit_with_no_transcripts_says_nothing_was_scanned, test/test_cli_commands_coverage_agent_security.py::TestSecurityCli::test_audit_of_transcripts_with_no_rows_does_not_say_none_were_found, test/test_scan_memory_stores.py::TestAnInstallWithNoNamedStoresIsUnchanged::test_a_clean_global_lessons_file_leaves_the_verdict_clean, test/test_security_stream_redaction.py::TestScanHistory::test_budget_spans_files_newest_first (head 5b09753)

Manual verification

N/A — unit coverage sufficient: the CLI tests run the real _security audit path against files on a temp data home.

Related Issues

Fixes #27254

Sibling sweep

Swept: git grep -nE 'config_dir() / "history"' -- src/
Siblings: none -- no other reader treats the channel-history folder as session transcripts

Pattern harvest

Not generalizable: one CLI verb pointed at the wrong data folder; no other audit reads that folder.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 1, 2026 18:28
@RohanK6
RohanK6 requested a review from dodgeblaster November 1, 2026 18:28
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/memory_audit.py

  • @RohanK6 posted a complete reasoning template for 5b09753.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@RohanK6

RohanK6 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 738bf7a
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript rows across files, reports an unreadable transcript as not audited, and prints "No session transcripts scanned" when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; an empty home prints the not-scanned line. prove.py: PROVEN on this head (the new tests fail with the fix reverted).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes. scan_history has one production caller (the CLI), updated here; git grep found no other caller.
    • Existing tests (which suites passed on this head): test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py, test_security_split_patch_reach.py, test_cli_lazy_imports.py, test_cli_commands_split_facade.py, test_flake_pattern_ratchet.py (303 + 64 passed); isort, flake8, mypy clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the audit now reads the session transcripts it was meant to check, and an empty scan no longer reports clean. scan_history's one production caller is updated in this PR.

Notes

  • scan_history reads every sessions/*.jsonl file in full to keep its newest 100 rows, so on a home with many large transcripts the audit's run time grows with total transcript size. If that becomes slow, the CLI can cap it by mtime; the change is easy to revert.

[DESIGN-REVIEWED] 5b09753

Description read

[DESCRIPTION-READ] 0a5d2ae3dabec4b299edf27219c9e642b648f6ff7ad596f426a9f15c3ccb94ba

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix is aimed at the cause: the audit read the wrong folder. Each added piece supports the frozen Goal of reading the newest transcript rows and never calling an unread scan clean.

What this change ships

Inventory (8 items) — 7 justified

Intent: let an owner who runs kirocrew security audit trust that it actually checked the agent's session transcripts. This is a FIX (#27254).

  1. The audit now reads sessions/*.jsonl instead of the Slack channel buffer in history/ — justified
  2. A shell command in a tool row (Bash, use_aws, or an input cut off mid-write) is now audited, using the tool gate's own extractor — justified
  3. The rows of one tool call count as one finding and one slot — justified
  4. The newest 100 rows are now picked across all files by row time, not the oldest rows of the newest file — justified
  5. An empty home or empty transcripts print "No session transcripts scanned" instead of the green check — justified
  6. A transcript it cannot read is now reported as not audited instead of being skipped silently — justified
  7. Each finding prints on one sanitized line — rides along
  8. The security package line budget rises by 107 lines — justified

[FIRST-PRINCIPLES-REVIEWED] 5b09753

Description read

[DESCRIPTION-READ] 004255ad5704b6371ccf9e50511da154e5b7dffabfa4ee7dd257b27261eb4852

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5b09753

Verdict parsed from the review's SHA-scoped output markers for commit 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5b09753

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 5b09753b6c27b64052c7ddd2cbe189d99d7ebe60 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 10 classified, 0 newly refused, 9 still allowed.
  • ubuntu-latest (platform posix): 10 classified, 0 newly refused, 9 still allowed.
  • windows-latest (platform windows): 7 classified, 0 newly refused, 6 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The patch leaves the tool-call deny composite (sensitive-bash, exfil, deny-rules) alone. The added shell_command_from_tool_params only wraps the gate's existing extractor, and only the offline audit calls it. What got stricter is the after-the-fact security audit report, which now reads tool rows in sessions/*.jsonl. It doesn't refuse any tool call, so the classifier can't judge it, and that gap is described under UNADJUDICATED below.

TIGHTENING: scan_history in security/memory_audit.py now covers more input. It moved from history/ assistant text to the newest rows of sessions/*.jsonl, and it now runs audit_bash_command on each tool row's meta.input (command = _row_shell_command(entry) / warning = audit_bash_command(command) if command else None). That includes use_aws payloads and cut-off inputs (return tool_input on JSONDecodeError). The one threat it catches is a suspicious shell command an agent ran (for example chmod 777 /srv) that the audit used to miss because it lived in a tool row rather than assistant text. The audit no longer reports an unread scan as clean (elif not rows_scanned: → "No session transcripts scanned").

ADJUDICATED: 17 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: posix and windows.

  • Posix rows: the kirocrew security audit CLI, $KIROCREW_HOME/sessions listing and tail reads, and commands one token off the test fixtures (chmod 755, git clean -n, rm -rf ./build, read-only aws ssm list-command-invocations).
  • Windows rows: the .exe CLI shim, %VAR% and $env: spellings with \ separators in cmd and PowerShell listings and tails, rmdir /s /q, the SSM read, and a .venv\Scripts\python.exe test run.
  • The diff's only platform assumptions are the config_dir() / "sessions" path join and the *.jsonl glob. Both are pathlib calls and never reach the shell gate as command text, so these rows probe gate neighbours; they don't exercise those assumptions. No any row was written.

UNADJUDICATED: The guard is scan_history → _transcript_tail_rows → _row_shell_command → audit_bash_command, matched against SUSPICIOUS_BASH_PATTERNS (denied_rules.py:1241). The call path is kirocrew security audit → cli_commands_security._security (action == "audit") → scan_history(config_dir() / "sessions"). The only result is a report finding and exit code 1; no tool call is refused. The new risk runs toward over-reporting, because the patterns are unanchored substrings now applied to every tool row whose kind is outside _NON_SHELL_TOOL_KINDS, including other and no kind at all. These are the inputs I would have submitted, all argued and none confirmed:

  • An execute row running git clean -fdx inside a throwaway build worktree.
  • truncate -s 0 app.log during log rotation.
  • npm run build | sh-style lines quoted inside generated docs.
  • A use_aws ssm send-command whose commands list holds a routine chmod 755. This one shouldn't match chmod 777 and is listed only as a control.
  • An other-kind row whose cut-off meta.input is a non-shell payload that happens to contain | python.
  • A legacy assistant row that just quotes the text rm -rf / in prose, which was already flagged at base.

None of this can be expressed as a gate refusal, so it doesn't block.

[SCOPE-REVIEWED] 5b09753

@RohanK6
RohanK6 force-pushed the crew/conductor/audit-sessions-u4 branch from 738bf7a to 01a93ca Compare November 1, 2026 18:46
@RohanK6

RohanK6 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=82970a401636 Legacy timestamps hide genuinely recent suspicious commands

fixed in 01a93ca: _row_epoch reads an offset-free ts as local time, as history_schema sorts it; only a missing or unparseable ts falls back to the file mtime.
Test: TestScanHistory::test_naive_legacy_timestamps_are_read_as_local_time.

@RohanK6

RohanK6 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=82970a401636 The row cap retains unbounded transcript payloads

fixed in 01a93ca: each row is audited as it streams in, and the deque keeps only (epoch, warning, snippet), the snippet capped at _HISTORY_SNIPPET_CHARS (200). No decoded transcript object is retained.

@RohanK6

RohanK6 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 01a93ca
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript rows across files by row time, keeps only a bounded record per row, reports an unreadable transcript as not audited, and prints "No session transcripts scanned" when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; an empty home prints the not-scanned line. prove.py: PROVEN on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; legacy offset-free row timestamps are read. scan_history has one production caller (the CLI), updated here; git grep found no other caller.
    • Existing tests (which suites passed on this head): test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py (223 passed); black, isort, flake8, mypy clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 1, 2026
@RohanK6
RohanK6 force-pushed the crew/conductor/audit-sessions-u4 branch from 01a93ca to 5faac82 Compare November 1, 2026 19:08
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 1, 2026
@RohanK6

RohanK6 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author
  • span=82970a401636 File mtime is not an upper bound on transcript timestamps

fixed in 5faac82: the mtime early exit is removed; every transcript contributes its bounded tail and rows are merged by ts.
Test: TestScanHistory::test_a_row_stamped_after_its_file_mtime_is_still_read.

@RohanK6

RohanK6 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author
  • span=c54be106a882 Out-of-range ts crashes the audit

fixed in 5faac82: _row_epoch converts inside the try and catches ValueError, OverflowError and OSError, falling back to the file mtime.
Test: TestScanHistory::test_a_boundary_year_stamp_does_not_stop_the_scan (0001 and 9999 stamps).

@RohanK6

RohanK6 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 5faac82
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript rows across files by row time, keeps only a bounded record per row, reports an unreadable transcript as not audited, and prints "No session transcripts scanned" when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; an empty home prints the not-scanned line. prove.py: PROVEN on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; legacy offset-free and boundary-year row timestamps are read without error. scan_history has one production caller (the CLI), updated here; git grep found no other caller.
    • Existing tests (which suites passed on this head): test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py (226 passed); black, isort, flake8, mypy clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 1, 2026
@RohanK6
RohanK6 force-pushed the crew/conductor/audit-sessions-u4 branch from 5faac82 to 322d459 Compare November 1, 2026 20:01
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 1, 2026
@RohanK6

RohanK6 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/security.md since this head went green (2d57650 -> e666f7a); CI re-running. Same push fixes two backend reds on 5faac82: test_jsonl_util.py::TestNoUnboundedHandleIteration (the scan now reads through jsonl_util.bounded_records) and test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget (budget raised by 28 with its note).

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 8eede67
  • What rule changed: none. No deny rule, pattern or gate changed. This head is a clean rebase of 206573a onto main, to pick up the Electron fix from test(linux): skip lease-held publish checks where the kernel refuses write leases #29444; main moved no file this change reads except an unrelated agent_sdk/backends.py. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it reads sessions/*.jsonl instead of history/, reads a tool row shell command through agent_sdk.shell_command_from_tool_params (the gate own extractor), folds one tool call by a digest of tool_call_id, skips non-shell ACP tool kinds, audits each row as read keeping a 200-character snippet, and skips a transcript removed mid-scan. The package line budget rises by 113 from main 33,959 to 34,072; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it. prove.py: PROVEN on this head (8eede67).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; legacy timestamps read; use_aws rows still audited. scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py, test_security_split_patch_reach.py, test_flake_pattern_ratchet.py (336 passed); black, isort, flake8, mypy, comment-history and brand gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 4, 2026
@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 070b784
  • What rule changed: none. No deny rule, pattern or gate changed. This head is a rebase of 8eede67 onto main. The one conflict was the package line budget in test_security_gate_liveness.py: main raised it to 33,967 for its own kirocrew-bin entry, and this change adds its same 113 lines on top, to 34,080. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it reads sessions/*.jsonl instead of history/, reads a tool row shell command through agent_sdk.shell_command_from_tool_params (the gate own extractor), folds one tool call by a digest of tool_call_id, skips non-shell ACP tool kinds, audits each row as read keeping a 200-character snippet, and skips a transcript removed mid-scan. No check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it. prove.py: PROVEN on this head (070b784).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; legacy timestamps read; use_aws rows still audited. scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py, test_security_split_patch_reach.py, test_flake_pattern_ratchet.py (336 passed); black, isort, flake8, mypy, comment-history and brand gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 3b82e51
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it reads sessions/*.jsonl instead of history/, reads a tool row shell command through agent_sdk.shell_command_from_tool_params (the gate own extractor), folds one tool call by a digest of tool_call_id, skips non-shell ACP tool kinds, audits each row as read keeping a 200-character snippet, and skips a transcript removed mid-scan. On this head a folded call takes its latest row time and moves to the newest end, so a call approved after newer rows is still audited. The package line budget rises by 107 from main 33,967 to 34,074; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it; the new recency test fails on the previous head and passes here. prove.py: PROVEN on this head (3b82e51).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; legacy timestamps read; use_aws rows still audited. scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py, test_security_split_patch_reach.py, test_flake_pattern_ratchet.py (337 passed); black, isort, flake8, mypy, comment-history and brand gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

New head 3b82e51. GPT's upheld finding on 070b784 was real and narrow: a folded tool call kept its first row's time, so a call approved after another transcript gained newer rows fell out of the newest 100. Both sites it named are fixed. A later row of the call now moves the entry to the newest end and gives it that row's time, so eviction follows the same order. A new test fails on 070b784 and passes here. Nothing else changed. The line budget is +107 over main (34,074). Backend shard 7's red on the last head was a pip download timeout in setup, not a test.

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 79963b7
  • What rule changed: none. No deny rule, pattern or gate changed. This head is a rebase of 3b82e51 onto main. The one conflict was the package line budget in test_security_gate_liveness.py: main raised it to 34,312 for its own Outlook and Slack link matching, and this change adds its same 107 lines on top, to 34,419. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it reads sessions/*.jsonl instead of history/, reads a tool row shell command through agent_sdk.shell_command_from_tool_params (the gate own extractor), folds one tool call by a digest of tool_call_id at its latest row time, skips non-shell ACP tool kinds, audits each row as read keeping a 200-character snippet, and skips a transcript removed mid-scan. No check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it. prove.py: PROVEN on this head (79963b7).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass); security deny-list tests pass unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; legacy timestamps read; use_aws rows still audited. scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py, test_security_split_patch_reach.py, test_flake_pattern_ratchet.py (337 passed); black, isort, flake8, mypy, comment-history and brand gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 5170ed4
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/, and reads a tool row shell command through agent_sdk.shell_command_from_tool_params, a wrapper over the gate own extractor. The rows of one tool call fold by tool_call_id, rows of non-shell ACP tool kinds are not read as commands, only the kept rows are pattern-matched, and a transcript removed mid-scan is skipped. Rebased onto main 8e3673f: the package line budget in test_security_gate_liveness.py keeps main note and rises by 107 from main 34,352 to 34,459, the net lines this change adds; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; one call over three rows is one finding; an empty home prints the not-scanned line. prove.py: PROVEN on this head (5170ed4).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py (258 passed); black, isort, flake8, mypy, comment-history, brand and file-line-cap gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 7299e14
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/, and reads a tool row shell command through agent_sdk.shell_command_from_tool_params, a wrapper over the gate own extractor. The rows of one tool call fold by tool_call_id, rows of non-shell ACP tool kinds are not read as commands, only the kept rows are pattern-matched, and a transcript removed mid-scan is skipped. Rebased onto main 3c6eee9: the package line budget in test_security_gate_liveness.py keeps main note and rises by 107 from main 34,522 to 34,629, the net lines this change adds; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; one call over three rows is one finding; an empty home prints the not-scanned line. prove.py: PROVEN on this head (7299e14).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py (258 passed); black, isort, flake8, mypy, comment-history, brand and file-line-cap gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@RohanK6

RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: d34221e
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/, and reads a tool row shell command through agent_sdk.shell_command_from_tool_params, a wrapper over the gate own extractor. The rows of one tool call fold by tool_call_id, rows of non-shell ACP tool kinds are not read as commands, only the kept rows are pattern-matched, and a transcript removed mid-scan is skipped. Rebased onto main e86fbdc so the run picks up test(scale): delete the scale-F4 markers its merged catalog gate left #29942, which fixed the scale-F4 catalog budget tests that were red on main. The package line budget in test_security_gate_liveness.py keeps main note and rises by 107 from main 34,522 to 34,629, the net lines this change adds; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; one call over three rows is one finding; an empty home prints the not-scanned line. prove.py: PROVEN on this head (d34221e).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py, scale_budget/test_catalog_budget.py, test_snapshot_listing_word_refusal.py (268 passed).
  • How to undo: revert this one commit; the audit goes back to reading history/.

@bolichen97

Copy link
Copy Markdown
Contributor

Thanks for this PR. It now conflicts with main. Could you rebase onto the latest main and resolve the conflicts? That also brings in #29623, which raises the time limit in test_decisions_end_to_end.py::test_jev_response_reaches_the_assembled_message, the test that fails on this head and is not part of this change. We will review it again once it is rebased and CI is green.

@RohanK6

RohanK6 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2b568ce
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/, and reads a tool row shell command through agent_sdk.shell_command_from_tool_params, a wrapper over the gate own extractor. The rows of one tool call fold by tool_call_id, rows of non-shell ACP tool kinds are not read as commands, only the kept rows are pattern-matched, and a transcript removed mid-scan is skipped. Rebased onto main 6b5caca to clear a merge conflict: the package line budget in test_security_gate_liveness.py keeps main note and rises by 107 from main 34,523 to 34,630, the net lines this change adds; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time through jsonl_util.bounded_records, keeps only a bounded record per row, reports an unreadable or unparseable transcript as not audited, and says whether transcripts were absent or held nothing when there is nothing to read.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. Unit tests on a temp data home prove it: a seeded flagged command gives one finding and exit 1; one call over three rows is one finding; an empty home prints the not-scanned line. prove.py: PROVEN on this head (2b568ce).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py (258 passed); black, isort, flake8, mypy, comment-history, brand and file-line-cap gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD for human review at 2b568ce47f22e4a24ae93ca1cfaa7fc3d74699d1 (policy: security module).

This PR rewrites scan_history in security/memory_audit.py, the audit behind kirocrew security audit. It now reads the newest rows of sessions/*.jsonl, takes tool-row shell commands through the gate's own extractor, and prints a not-scanned line instead of a clean result when it read nothing (memory_audit.py#L164, cli_commands_security.py#L126). Our review policy reserves behaviour changes in security modules for a person, so this is not an approval.

I found no concrete defect on this head. Rows stream through bounded_records, the rows of one tool call fold into one bounded entry (#L76), and an unreadable transcript is reported rather than skipped. All current-head AI lanes pass, and checks are green. A reviewer may want to weigh Design's note that each run reads every transcript in full, and Security Scope's note that routine commands in tool rows can now produce exit-1 findings.

What clears this: a maintainer's review of the audit behaviour change.

— crew-pr-reviewer (r146)

@RohanK6

RohanK6 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2d4d5ce
  • What rule changed: none. No deny rule, pattern or gate changed. scan_history in security/memory_audit.py is the read-only report behind kirocrew security audit; it now reads sessions/*.jsonl instead of history/, and reads a tool row shell command through agent_sdk.shell_command_from_tool_params, a wrapper over the gate own extractor. Rebased onto main 142d40e to clear a merge conflict: the package line budget in test_security_gate_liveness.py keeps main note and rises by 107 from main 34,524 to 34,631, the net lines this change adds; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently. Before, the report read the channel-history folder and printed a clean result without reading any transcript. After, it reads the newest 100 transcript calls or messages across files by row time, keeps only a bounded record per row, reports an unreadable transcript as not audited, and says whether transcripts were absent or held nothing.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched; runtime command gating is a separate path and unchanged.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (2d4d5ce).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path run end to end in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes; scan_history has one production caller (the CLI), updated here.
    • Existing tests (which suites passed on this head): test_security_gate_liveness.py, test_security_stream_redaction.py, test_cli_commands_coverage_agent_security.py, test_scan_memory_stores.py (258 passed); black, isort, flake8, comment-history and file-line-cap gates clean.
  • How to undo: revert this one commit; the audit goes back to reading history/.

@RohanK6

RohanK6 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: ae1680e
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as 2d4d5ce, rebased onto main so the run picks up fix(apps): read was_installed again before a registry install #30762, which fixed the undefined was_installed that failed Backend Lint on every PR. The package line budget stays main 34,524 plus this change 107, at 34,631; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (ae1680e).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites (258 passed); flake8 clean.
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 64a7f3e
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as ae1680e, rebased onto main after test: raise the security package line budget to its size on main #31469 raised the package line budget to main's measured 34,733. The budget is now main 34,733 plus this change 107, at 34,840, with main's note kept; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (64a7f3e).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites (258 passed); black and flake8 clean.
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2bc6f5d
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as 64a7f3e, rebased onto main. That head's first Security Scope run hit the API rate limit and published a failure the per-head floor kept. The package line budget stays main 34,733 plus this change 107, at 34,840; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (2bc6f5d).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites (258 passed).
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f5937d7
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as 2bc6f5d, rebased onto main after test: raise the security package line budget for the git publish check #31625 raised the package line budget to 34,753. That head's Security Scope rerun passed, but the per-head floor kept the failure its first, rate-limited run published. The budget is now main 34,753 plus this change 107, at 34,860, with main's notes kept; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (f5937d7).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites (258 passed); black and flake8 clean.
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: e1dbaf1
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as f5937d7, rebased onto main after ci: allow the sensitive change review on pull_request_target #31803 fixed main's pull_request_target allowlist test. The package line budget stays main 34,753 plus this change 107, at 34,860; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on the same tree (ca62b735a567, before a conflict-free rebase).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites plus the allowlist test (265 passed); black and flake8 clean.
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Security Scope Review on head e1dbaf1 needs a maintainer override, please.

Its first run on this head could not finish: the publish step hit the GitHub API rate limit and published a failure without a verdict. The rerun at 00:40 UTC adjudicated the change as a pass with zero confirmed regressions, but the per-head floor keeps the earlier failure. Candidates, validation and adjudication on all three platforms passed.

This is the third head where a rate-limited first run left that hold. The change itself is unchanged since the earlier passes. I will not push again for this.

@RohanK6

RohanK6 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 49bc5f5
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as e1dbaf1, rebased onto main to clear a conflict in the package line budget. The budget is now main 34,777 plus this change 107, at 34,884, with main's notes kept; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (49bc5f5).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites (258 passed); black and flake8 clean.
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

The override I asked for on e1dbaf1 is no longer needed. This PR was rebased to clear a merge conflict, so the new head 49bc5f5 gets its own Security Scope run.

@RohanK6

RohanK6 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Security Scope Review on head 49bc5f5 needs a maintainer override, please.

Every real lane on this head passed: candidates, validation, and adjudication on all three platforms. Only the final publish step failed, because it hit the GitHub API rate limit, and the per-head floor now holds that failure. The change is the same as the earlier heads that passed. I will not push or rerun for this.

@RohanK6

RohanK6 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f95019e
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as 49bc5f5, rebased onto main to clear a conflict in the package line budget. The budget is now main 34,845 plus this change 107, at 34,952, with main's notes kept; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on 879f50202201, the same change one base earlier.
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites pass except the package line budget, which also fails on main at b65af1a (main measures 34,855 against its own 34,845).
  • How to undo: revert this one commit.

@RohanK6

RohanK6 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 5b09753
  • What rule changed: none. No deny rule, pattern or gate changed. Same change as f95019e, rebased onto main after fix: keep a chat display redaction consistent across renders #32252 raised the package line budget to 34,894. The budget is now main 34,894 plus this change 107, at 35,001, with main's notes kept; no check was relaxed.
  • Before -> after (what was allowed/blocked, now): nothing is allowed or blocked differently; the read-only audit report reads sessions/*.jsonl instead of history/.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the report shows a wrong finding or misses one. Commands, secrets and access are not touched.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox behaviour changes. prove.py: PROVEN on this head (5b09753).
  • No regression:
    • Tools still work (which tools/commands were run, result): kirocrew security audit path in test_cli_commands_coverage_agent_security.py::TestSecurityCli (all pass).
    • Backward compatible (old config / old data / old callers still work, how checked): yes. Same verb, flags and exit codes.
    • Existing tests (which suites passed on this head): the four security audit suites (258 passed); black and flake8 clean.
  • How to undo: revert this one commit.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving 5b09753 as maintainer. All 112 checks pass. Fixes #27254.

What I checked:

  • kirocrew security audit now reads sessions/*.jsonl, where transcripts actually live, instead of the old history directory. It still matches with the existing audit_bash_command / SUSPICIOUS_BASH_PATTERNS, so no new pattern and no new refusal. It is a read-only report.
  • An empty or missing sessions folder now says nothing was scanned instead of printing "No suspicious tool usage found", and an unreadable file is a finding. So a clean result means rows were actually read.
  • Tool rows take their command from meta.input through the tool gate's own extractor (shell_command_from_tool_params). Only the kinds that cannot run a shell are skipped, and the up to three rows of one call fold into one entry by a digest of tool_call_id.
  • Memory stays bounded. Each file keeps only its newest last_n entries with a capped snippet, and the merged list is cut to last_n by row ts, with the file mtime as fallback.
  • Printed file names, warnings and snippets go through safe_terminal_line, so transcript text cannot drive the terminal.

Auto-merge is already set by the author, so I am not setting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kirocrew security audit reports a clean result without scanning session transcripts

3 participants