Repository navigation
Conversation
|
Intent: Close the third serialization surface of the #8717 untrusted-free-text class: every agent-record free-text field |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Projection mask hand-copies eventlog's Watch
Suggestions
[DESIGN-REVIEWED] 14e0bf7 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the undeclared projections-roster masking rider: its premises hold (MembersPage.tsx:400 prefers the snapshot; the scrub is in-place), but the description never mentions it. Not justified as shipped
What this change shipsInventory (5 items) — 4 justifiedIntent: stop agent-/package-writable free text on
[FIRST-PRINCIPLES-REVIEWED] 14e0bf7 |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsThe new roster mask covers only the HTTP copy of the projected FINDING — src/kiro_crew/dashboard/handlers/members.py:485 — the in-diff [OPUS-REVIEWED] 14e0bf7 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
114d222 to
457646e
Compare
457646e to
b17c368
Compare
|
span=cd9678020c04
self-added: no
|
bolichen97
left a comment
There was a problem hiding this comment.
Maintainer review (agent-assisted), pinned to b17c368. The core masking is sound and the isolated-worktree tests pass (26 targeted; 84 for the full members DM test file), but please address two small issues before merge. (1) api_members reads owner_member without normalizing falsy values. The loader permits null; _mask_agent_free_text(None) returns a truthy sentinel. MembersPage.memberMemoryDisplay therefore changes a V1 row from legacy to ownership_mismatch even though there was no owner. Preserve absence separately from suspicious text—for example normalize the existing falsy/no-owner cases to an empty string before masking—and add a regression for owner_member=None. Keep actual credential-shaped owners masked. (2) The body explicitly says memory_owner is untouched and lists masking it as future work, but this head masks it and tests that behavior. Update the description to own this hunk and explain the frontend comparison semantics. I verified the backend output and frontend truthiness checks at the pinned head. No approval until these are resolved.
b17c368 to
5e68395
Compare
|
Thanks for the review — both points addressed at 5e68395 (rebased onto current main, still one commit). (1) owner = getattr(record, "owner_member", "") or ""so a JSON (2) PR description now owns the Re-requesting your review. |
|
Not approving for now: bolichen97 has an outstanding maintainer CHANGES_REQUESTED on this head, and as a redaction/masking change on the members roster it needs that review cleared rather than a second opinion stacked on top. |
5e68395 to
66d82a9
Compare
|
Rebased onto main Conflicts resolved (only these files were hand-merged, nothing else changed manually):
Same single commit, same author, same message. No manual edits outside the conflict hunk; other main changes were inherited by the rebase. The original three-file PR scope and diff statistics are unchanged (321 insertions, 10 deletions). Validation: changed Python files compile; git diff --check passes; no conflict markers; targeted test file: 97 passed. Any prior approval was dismissed by the push and needs to be re-given after CI re-runs. |
) GET /api/members shipped the agent-record free-text fields verbatim, and its only gate on `name` was the agent-name grammar, which an alphanumeric credential-shaped string passes. These are the same agent- and package-writable fields the config endpoint masks since #8717 (PR #8775), so a credential- or exfiltration-shaped value reached the members payload unmasked -- the third serialization surface of that class. Apply the same policy, confined to members.py: - Every `_AGENT_UNTRUSTED_TEXT_FIELDS` member the row ships (`kiro_agent`, `workspace`, `memory_store`, `model`, `description`, `triggers`) goes through `_mask_agent_free_text` (function-local import from handlers.core, mirroring agents.py's cycle-avoiding form): a value the redactors would alter ships as the fixed sentinel wholesale; benign values are byte-identical. - A credential-shaped `name` DROPS the row instead of masking it: the name is the row identity (slug derivation, binding match, DM thread route), so a masked name would be unaddressable -- same removal policy #8775 applies to a credential-shaped agent key. - `memory_owner` (a member-name reference off the memory-store record) is masked too. Absence is normalized to "" BEFORE masking: the loader passes a JSON null through as None and the mask treats every non-string as suspicious, so an ownerless V1 store would otherwise ship the truthy sentinel and read as an ownership mismatch on the frontend. The frontend only tests the field for truthiness and equality with the row's name, so "" stays the legacy branch and a masked owner resolves to ownership_mismatch exactly as the raw suspicious value would. - `slug`, `avatar` (shape-validated), `source` (normalized), `starred` (coerced bool) and `memory_version` (int) are untouched. Tests pin the redactor preconditions and cover sentinel masking, benign passthrough, name-row removal, the untouched shape-guarded fields, a credential-shaped owner masking, an absent owner (None / "") staying "", and a parity gate asserting no `_AGENT_UNTRUSTED_TEXT_FIELDS` member the row ships ever comes back raw. Closes #8781
66d82a9 to
14e0bf7
Compare
|
Rebased onto main Conflicts resolved in:
Semantic fixes (main moved under the PR):
Verified locally: pytest over 18 test files importing/exercising Shared files with sibling PRs being rebased in the same wave: none. |
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: The only real red is the Comment History Gate — one added comment line in Two things I am explicitly not doing. The masking logic and the roster-projection hunk stay exactly as they are — that design is @bolichen97's rebase work and the author's, not mine to redirect. And @bolichen97's If you'd prefer I don't touch this PR, add the |
|
Thank you, @CrysisDeu, for catching and fixing this! You correctly identified that Main has since closed this same gap, a bit more broadly, in #13156 (commit 6c38f03, "fix(dashboard): mask the record strings GET /api/members ships"). That change routes every one of those fields — plus Since the fix is now on main, I am closing this as superseded. Really appreciate the sharp find and the thorough write-up. 🙏 |
Problem / Motivation
GET /api/members(src/kiro_crew/dashboard/handlers/members.py::api_members) ships the agent-record free-text fields —kiro_agent,workspace,memory_store,model,description,triggers— verbatim, and its only gate onnameis_AGENT_NAME_RE, which an alphanumeric credential-shaped string (an AWS access-key-id shape) passes. These are the same agent- and package-writable fields with no load-time shape guard that the config endpoint masks since #8717 (PR #8775) and thatagents.py::_roster_maskcovers on the roster. A credential- or exfiltration-shaped value stored in any of them therefore reached the members payload unmasked — the third serialization surface of the #8717 class.Why it matters
Any agent (via a
config.jsonwrite) or third-party package (the agent sync copiesdescriptionstraight off a discovered agent spec) controls these strings. A secret that lands in one of them is serialized into the members response and rendered in the browser — the exact leak class two sibling endpoints already refuse.What changed (motivation → approach → change)
Symptom: unmasked free text on
GET /api/members→ root cause: the row builder's explicit allowlist gates which fields ship but applies no redaction to their values → change: apply #8775's exact policy, confined tomembers.py:_AGENT_UNTRUSTED_TEXT_FIELDSmember the row ships (kiro_agent,workspace,memory_store,model,description,triggers) goes through_mask_agent_free_text(function-local import fromhandlers.core—handlers/__init__importsmembersbeforecore, so a module-level import risks a cycle;agents.pyuses the same form). A value the redactors would alter ships as the fixed_SENSITIVE_MASKsentinel wholesale; benign values are byte-identical.nameDROPS the row (removal, not masking): the name is the row identity — it feedsslug_for_name, thebinding["member"] == row["name"]check and the DM thread route — so a masked name would be unaddressable. Same removal policy fix(dashboard): mask agent free-text fields in the config endpoint response (#8717) #8775 applies to a credential-shaped agent key.memory_owneris masked too. It is a member-name reference off the memory-store record (MemoryStoreConfig.owner_member), free text that, likename, can be credential-shaped and still pass the grammar. The frontend (MembersPage.memberMemoryDisplay) reads it in exactly two ways: a truthiness test (row.memory_owner && ...,!row.memory_owner) and an equality test againstrow.name. Masking is safe under both. Absence stays absent: the handler normalizes the loader's falsy/no-owner cases ("", and the JSONnullthe loader passes through asNone) to""before masking, so a V1 store with no owner still ships""and renders aslegacy, never as the truthy sentinel. A suspicious owner ships as the sentinel, which is truthy and can never equal a surviving row's redactor-cleanname, so the frontend resolves it toownership_mismatch— the same fail-closed reading the raw suspicious value would have produced, without the raw text reaching the browser.slug,avatar(_safe_avatar-validated),source(normalized to a closed vocabulary),starred(coerced bool),memory_version(int) are untouched.Pre-merge review: an Opus-pinned local review lane blocked on
description/triggersbeing left raw in the first cut; both are masked in this diff and the parity-gate test below is the mutation proof. Maintainer review (bolichen97) caught that the firstmemory_ownercut maskedNoneinto the sentinel; this head normalizes absence first and adds theowner_member=Noneregression.Overlap note: open PR #8465 also adds redaction to
members.py(broader change across both roster serializers, currently conflicting andneeds-author-decision). This PR is deliberately narrow — it closes #8781 only and does not touchagents.py; whichever lands second has a small mechanical rebase inapi_members.Follow-ups (out of scope here, from #8781's advisory items):
test_config_agent_fields_redaction.py's type-ratchet to optional-str annotation forms (str | None)._mask_agent_free_text/_roster_mask/_redact_externalinto one shared browser-view helper once fix(dashboard): name every field GET /api/agents ships, instead of spreading the record #8472/fix(dashboard): redact crew record strings at both roster serializers #8465 land — this PR is the third consumer, so the hoist now pays for itself.Tests
test/test_members_dm_thread.py::TestRosterFreeTextMasking:test_payload_preconditions_pin_the_redactor— pins that the fixtures verifiably trip/pass_redact_external, and that_AGENT_NAME_REgenuinely admits the credential-shaped name (the premise of the drop rule).test_credential_shaped_values_ship_as_the_sentinel— all six masked fields come back as_SENSITIVE_MASKand the raw values are absent from the serialized body (the network boundary), not merely from the parsed rows.test_benign_values_are_byte_identical— a benign sibling row is untouched.test_credential_shaped_name_drops_the_row— the credential-shaped-but-grammar-valid name is absent from the roster; the benign row survives.test_shape_guarded_and_coerced_fields_are_untouched—avatar/source/starrednever go through the mask.test_credential_shaped_memory_owner_ships_as_the_sentinel— a credential-shapedowner_memberships as the sentinel and is absent from the body; a benign owner passes through byte-identical.test_absent_memory_owner_is_not_masked(parametrized overNoneand"") — no owner ships as"", never as the sentinel, so the frontend'slegacybranch still fires for an ownerless V1 store.test_every_untrusted_text_field_in_the_row_is_guarded— parity gate: every_AGENT_UNTRUSTED_TEXT_FIELDSmember the row ships is masked, normalized, or explicitly exempted, so the next free-text field added to the row fails here instead of shipping raw.Manual verification
N/A — unit coverage sufficient: the endpoint is exercised end-to-end through the aiohttp test client against the serialized JSON body, which is exactly the surface the issue reports.
Related Issues
Closes #8781. Refs #8717, #8775, #8472, #8465.
Pattern harvest
Rule candidate: review-prompt
Pattern: an explicit field allowlist at a serialization boundary gates which fields ship but not their values — every free-text member of an untrusted record class needs the class's masking helper, enforced by a parity test binding the class enumeration to the endpoint's rows. When the helper masks non-strings, normalize "absent" to the type's empty value first so a missing field is not turned into a truthy sentinel.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)