Skip to content

feat(security): settings surface for the ssh-agent forward consent - #18395

Open
CrysisDeu wants to merge 2 commits into
mainfrom
fix/ssh-auth-sock-consent-settings-18223
Open

CrysisDeu wants to merge 2 commits into
mainfrom
fix/ssh-auth-sock-consent-settings-18223

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An operator can allow, see, and withdraw SSH agent forwarding into sessions from Settings → Security, instead of hand-editing a keystone file.

The sandbox env scrub removes SSH_AUTH_SOCK from agent spawns whose sandbox hides ~/.ssh (strict, or a harness mask over ~/.ssh), so git fetch/push over SSH and SSH commit signing fail inside those sessions. The sanctioned re-enable is the keystone leaf ssh_auth_sock_consent.json → {"enabled": true}, but the only grant path is that hand edit: no Settings control, no risk text at grant time, no audit record. Issue #18223.

Why it matters

A developer whose git fetch stops working inside a session has to know the forward was removed, that a consent file exists, its exact path and strict-boolean semantics, and then edit a keystone file by hand. The sibling keystone consents (aws_service_consent.json, credential_redaction.json, registry_trust.json) all have an owner-gated Settings surface; this one did not.

Not a goal

  • Weakening the gate. Off by default where the sandbox hides the keys; the store stays on the keystone (agent file tools refuse it, the OS sandbox mounts it read-only); nothing moves into config.json; no agent.* field.
  • A per-session or per-command grant. The grant stays durable and coarse (an unattended cron must be able to sign), as ssh_auth_sock_consent.py states.
  • A host step-up. The arm-in-dashboard / approve-from-terminal step-up this PR used to carry is dropped, following main: feat(security): let the owner download flagged files directly #24792 removed that pattern from flagged-file delivery and made the owner's dashboard act the grant. This PR now has the same one-step shape as the paid-AWS consent (handlers/aws_consent.py): no CLI verb, no nonce leaf, no approve route, no argv floor.

Intended? / Repro

Intended? No. The consent exists on main and is read at spawn (src/kiro_crew/sandbox_unavailable.py:258 ssh_auth_sock_consent_notice, src/kiro_crew/ssh_auth_sock_consent.py is_granted), but main has no surface that writes it: ssh_auth_sock_consent.py on main is read-only, and the notice tells the operator to hand-write the file from a terminal. #18223 asks for the Settings control; the maintainer review on this PR asked for it to follow main's grant shape.

Repro (current main e858e5b378): open Settings → Security. The rail has no SSH agent section (before frame below), and ?section=ssh_agent lands on Live Security Posture. With agent.sandbox = "strict" and an ssh-agent running, a new session starts without SSH_AUTH_SOCK and the gateway log's only remedy is "write {"enabled": true} to …/ssh_auth_sock_consent.json from a terminal outside Kiro Crew".

What changed (motivation → approach → change)

Approach: the repository's existing one-step owner consent (handlers/aws_consent.py): an owner-gated GET/POST/DELETE handler that writes the keystone leaf directly.

Backend:

  • src/kiro_crew/ssh_auth_sock_consent.py: is_granted() unchanged. Adds read_grant, record_grant ({"enabled": true, "granted_at": …}), revoke (writes an explicit {"enabled": false}, even when the current record cannot be read; a write failure propagates), socket_present (resolved the way the spawn resolves it, via agent_sdk.drivers.acp.resolve_ssh_auth_sock on a copy of the environment, then an exists check), forwarding_harnesses (the harnesses, in the config-file spelling via backend_to_stored so Kiro CLI's empty runtime id reads kiro, whose new sessions keep the socket without the grant: the configured tier leaves ~/.ssh readable and the harness's declared credential mask does not hide it, judged by the spawn's own _forwards_without_consent over each adapter_hidden_credential_dirs, the same inputs kirocrew doctor reads) and forwarded_without_consent (that list covers every harness), harness_labels (config id -> display name for every harness the verdict covers) and audit_decision(caller=…) (SEL ssh_auth_sock_forward_consent.<granted|revoked|refused>, naming the requesting dashboard user for every outcome; record_grant and revoke take the same caller). Writes go through rewrite_in_place(restrict_to_owner=True), which keeps the inode under a running sandbox's read-only bind, under an in-process lock (no agent-reachable lock file). Docstring says how the grant is made now.
  • src/kiro_crew/dashboard/handlers/ssh_auth_sock_consent.py (new) + routes in routes/system.py right after the AWS consent: GET, POST, DELETE /api/ssh-agent/consent. Every verb, GET included, refuses anyone the owner gate (is_owner_dashboard_request) does not admit: the dashboard owner and a Shared Crew teammate it admits can use these routes; app tokens and allow-listed messaging non-owners are refused. Every grant, every withdrawal that removed a grant, and every refusal is audited under caller = str(request.get("user") or "anonymous"), as source_providers._audit_source_api does. A refused app token carries its human's id as user, so its refusal row also names the app in the detail. A withdrawal when nothing was granted records no row, except on an unreadable store, where it records a revoked row saying any mcp_gateway_backends grant was not kept. POST/DELETE answer only after the write landed; a failed write is a 500, never a 200.
  • sandbox_unavailable.ssh_auth_sock_consent_notice: the remedy now names Settings > Security > SSH agent first, the hand edit second.

Frontend (website/):

  • SecurityPanelSshAgent.tsx (new), wired into SecurityPanel.tsx as rail section ssh_agent under Your settings. Purpose line first, then the always-visible risk text as two short lines (what a session can do as you; a running session keeps it until it ends), then one row: a badge, one primary control (Allow SSH agent, or "Allow for these sessions" when the row is scoped) or Withdraw. Beside Allow, the row says what it gets you ("Lets new sessions run git push, git fetch and commit signing with your SSH keys.") and that it can be withdrawn at any time. The risk text makes no claim about the key files: on the standard level ~/.ssh stays readable, so "hidden" would be false there. The purpose line reads "Turn this on if git push, git fetch over SSH, or commit signing fails inside a session." The card has three scopes, read from the GET:
    • the setting decides every session: badge Allowed / Not allowed;
    • some harnesses forward at the configured level regardless (the usual default: Kiro CLI on standard, while masked harnesses such as codex need the grant): the card shows one status per group of sessions. A short line above both rows says "Some sessions already get your SSH agent from their sandbox level.", so the first row's "Not allowed" is never read alone; like the labels, it names no harness. Each group's label says what the group is, so two rows never share a label with opposite badges. The first group, the sessions this setting decides, is labelled "Sessions whose sandbox hides your SSH keys" with the Not allowed / Allowed badge, and Allow reads "Allow for these sessions" ("Allow SSH agent" when the gateway names no harness this setting decides). Below the action, the second group, the sessions that already forward, is labelled "Sessions whose sandbox level already gives them your SSH agent" with the "On at your sandbox level" badge and the note "Allow does not change the sessions your sandbox level already gives your SSH agent to. To stop that, choose the Strict level of Process Sandbox and leave this setting at Not allowed. Both apply to new sessions only." When every session is decided by this setting, or every session forwards, only one group shows, labelled "The SSH agent on this computer". Strict alone is not enough when a grant is held, because a retained grant forwards on Strict too, so the note names both steps. The card lists no harness names: most are harnesses the operator never configured, so a list does not tell them whether Allow covers their own sessions. The new GET field harness_labels only decides whether Allow says "for these sessions". A link ("Change Process Sandbox") opens Process Sandbox;
    • every harness forwards at the configured level: the badge reads "On at your sandbox level", Allow is not offered (it would change nothing), and the same sandbox link is the control. A grant already held keeps the same "Withdraw" button as every other state, with a help line that states the effect first: "Removes your permission now. Sessions still get the SSH agent until you switch Process Sandbox to Strict." Allowed uses the warn badge, never the green ok, because that is the risky state; "On at your sandbox level" is a different fact (no grant involved), so it uses the neutral badge with a layers icon.
      Allow is held when no ssh-agent is visible, with the concrete steps; the query re-reads on focus and remount (staleTime: 0), so another owner tab's change shows; a hand-written grant says where it came from; a granted row says "Applies to new sessions." An unreadable state renders no state (gated on isError), and the card invalidates after every write instead of asserting the new state.
  • A viewer the owner gate refuses (a 403 that is not the re-auth 403, tested with the redaction card's isOwnerGateRefusal) sees "Only the dashboard owner can see or change whether sessions can use the SSH agent." instead of "Could not read". That refusal is not retried and stays cached for the tab, so focus and remount do not repeat it: one audited refusal per tab, not one per open or refocus. An owner keeps the re-read on focus and remount. Any other failed first read (for example a 502 that used up its retries) is read again when the section is reopened, so the card recovers without a focus change.
  • api/client/security.ts: sshAgentConsent, grantSshAgentConsent, revokeSshAgentConsent; SshAgentConsentStatus type.
  • pages.settings.securityPanel.ssh_agent_* keys in every catalog, including the two group labels ssh_agent_group_decided and ssh_agent_group_forwarded and the mixed-scope line ssh_agent_mixed_intro; en-XA regenerated; ui-index.generated.json regenerated.
  • scripts/capture-ssh-agent-consent.mjs: screenshot harness.

Docs: docs/system-specs/modules/security.md (how the grant is made; who may call the routes (owner or admitted teammate), the audited caller, and the GET's forwarded_harnesses / harness_labels), docs/architecture/security-deep-dive.md, docs/feature-map/README.md.

Security

area: security. The consent authorizes session-long USE of the operator's ssh-agent keys. The only new writer is a dashboard handler behind the owner gate (the owner, or a Shared Crew teammate it admits, each audited by name), the same trust shape main uses for the paid-AWS consent and, since #24792, for flagged-file delivery. The leaf stays on _CREW_SECRET_LEAVES and the read-only sandbox leaves, so an agent still cannot write it with file tools or a shell. No route is exposed beyond the existing authenticated dashboard; reads are behind the same gate because the answer says whether the owner's agent is reachable from a session.

Open, for a maintainer to rule: GPT 6.1 (security-class, fenced) flags ssh_auth_sock_consent.py revoke: when the consent file exists but cannot be read, Withdraw still writes {"enabled": false} and so drops any mcp_gateway_backends list (logged and audited as revoked with a detail saying the backend grant was not kept). This is the chosen design: a Withdraw always turns the forward off. The alternative GPT proposes, failing the DELETE with 500 and writing nothing, keeps the backend list but leaves forwarding on until the read error is fixed. Not changed here; a maintainer decides which loss is worse.

Backwards compatibility

Compatible: is_granted() is the same check, so an existing hand-written {"enabled": true} keeps forwarding and renders as "Allowed" with no timestamp. Removes nothing: only routes and a Settings section are added; the hand-edit path stays valid.

Tests

Backend (test/test_ssh_auth_sock_consent_grant.py, new): store round trip and shape, hand-written grant equivalence, strict-boolean read, revoke writes false even on an unreadable store, a failed revoke write propagates, owner-only mode, no lock artifact, socket_present / forwarding_harnesses / forwarded_without_consent verdicts (mixed, keyed by the real runtime ids so Kiro CLI comes out as kiro, and all-harness) and fail-closed, keystone fencing, no CLI verb or step-up symbols, non-owner refusal on every verb (audited, grants nothing), owner GET shape, POST→GET→DELETE round trip, 500 on failed grant / withdraw, audit events driven through the handler for an owner request and an admitted-teammate request, each checking the audited caller, a refused app token named in the detail, a refused non-owner audited by name, a refusal with no user audited as anonymous, the caller on both a failed grant and a failed withdraw, and that a synthetic token in a refused app id reaches no field of the audit call.

Frontend (SecurityPanel.sshAgent.test.tsx, new): risk text always visible and makes no "hidden" claim, benefit line beside Allow, purpose before risk, Allow is one POST then a server re-read, all-harness scope (On badge, no Allow, sandbox link, no "until you withdraw"), mixed scope (each status row's label says what its group means and no harness names are listed; a test over the full ACP_BACKEND_ROUTING harness set, with the default-level forwarded set claude / kas / kiro, asserts both labels; the mixed-scope tests assert the line above the rows by exact text, and the single-scope tests assert it is absent; scoped badge for both grant states, the two-step note, sandbox link), outside mixed scope the single row keeps the label "The SSH agent on this computer", tier note with the plain "Withdraw" label and the effect-first help line, no-socket note holds Allow, hand-written grant wording, grant time + "Applies to new sessions." + Withdraw is a DELETE, failed read never shows Not allowed, a transient first-read failure re-reads on remount while a cached owner refusal does not, failed re-read after Allow, failed grant, failed withdraw, rail row has no summary. SecurityPanel.rail.test.tsx, SecurityPanel.owners.test.tsx and ApiClient.refactor.surface.test.ts list the new section, file and methods.

Manual verification

Static gates on the changed files: black, isort, flake8; tsc --noEmit, eslint, i18n-check.mjs (with I18N_BASE_REF=origin/main), gen-ui-index.mjs --check, pseudolocale regenerate (no diff). Test suites run in CI. The capture harness builds the SPA and asserts each state rendered before its frame; the before frame is main built and served by the same harness.

Screenshots / video

Before (main): no SSH agent section; the deep link lands on Live Security Posture.

before

After, on head da854d4, some harnesses forward at this level (the usual default): one line saying some sessions already get the SSH agent from their sandbox level, then two groups, each labelled by what it means, with its own status and no harness-name list; the first is Not allowed with "Allow for these sessions", the second is "On at your sandbox level" with the note and the Process Sandbox link. (The "Couldn't load your starred bots" toast in these frames is a dashboard endpoint the capture script does not stub, not part of this card.)

some forward

Light theme:

some forward light

Same, with the grant held (Allowed, Withdraw):

some forward allowed

Same, from a gateway that sends no session names: the labels are the same, and Allow reads "Allow SSH agent":

some forward no names

Same, no session names, with the grant held:

some forward no names allowed

Same, no session names, light theme:

some forward no names light

The frames below, down to "More states", are from earlier heads of this PR (9166a54 or before); none of them shows the mixed scope. After, every harness forwards: "On at your sandbox level" in its own neutral badge with a layers icon (Allowed keeps the yellow warn badge), no Allow, sandbox link:

tier forwards

Same, with a grant already held (frame from before the UX fix; the current label and help line are in the UX fix section below):

tier forwards allowed

After, not allowed (the setting decides every session):

not allowed

After, allowed (warn badge, timestamp, "Applies to new sessions.", Withdraw):

allowed

More states

Hand-written {"enabled": true} (granted, no timestamp):

allowed hand written

No ssh-agent visible (Allow held, concrete steps):

no socket

Grant write failed (row still Not allowed, save-failed notice):

save failed

Consent read failed (renders as unknown, not as "Not allowed"):

read failed

Light theme:

not allowed light

Narrow (rail stacks above the pane):

narrow

A viewer the owner gate refuses (403 dashboard_owner_required) sees the owner-only notice, with no grant row and no "could not read" message. Light and dark, from the built SPA on head 1d91437:

Owner-only notice, light

Owner-only notice, dark

UX fix on a7bf097 (UX Review BLOCK on b85ca74)

The withdraw button reads "Withdraw" in every state; at a level that already forwards the SSH agent, the help line under it says what it changes now. On that head the row label kept one noun in every scope with the scoping on a muted line; da854d4 labels each group by what it means, with no harness-name list and a line above both groups (frames above). Before is b85ca74, after is a7bf097, from the same capture harness (scripts/capture-ssh-agent-consent.mjs).

Grant held, every harness forwards, before / after (dark):

tier forwards allowed, before
tier forwards allowed, after

Same, light:

tier forwards allowed light, before
tier forwards allowed light, after

Some harnesses forward, not allowed, before (b85ca74) / after (a7bf097), row label and muted line as they were on those heads:

some forward, before
some forward, after

Some harnesses forward, allowed, before (b85ca74) / after (a7bf097):

some forward allowed, before
some forward allowed, after

Still open from the same UX Review: the owner-only notice keeps its "Ask the agent" action. The blocking errors-use-error-notice rule (website/AUTOSDE.yaml) requires a refusal notice to keep askAgent, and relabelling it only here would differ from the rest of the app.

Known limitations

  • The mixed-scope line above both groups, like the forwarded group's label, says some sessions already get your SSH agent; the card shows it in mixed scope even when no ssh-agent socket is present on this computer. The line has no test pinning that it sits above both rows.
  • docs/system-specs/modules/security.md's withdrawal sentence does not say that a store whose read raised no OSError counts as readable even when it is malformed (a malformed store is read as empty, so that withdrawal records no row).
  • The same sentence does not say that a withdrawal on a readable store keeps any mcp_gateway_backends grant it read; only the enabled field is set to false.
  • The decided group's label, "Sessions whose sandbox hides your SSH keys", overstates the case when an operator has explicitly opted out of isolation (agent.sandbox_allow_no_isolation): such sessions run with no sandbox at all. Main's own text makes the same assumption, so this PR does not change it.
  • fr: the two new group labels write "la sandbox" and "ton niveau de sandbox", where main's fr catalog writes "le sandbox" / "bac à sable" ("Niveau du bac à sable"). The meaning is the same.
  • The real-routing-set test keeps its own copy of the harness ids and labels; adding a harness on the Python side does not fail it.
  • The audit-redaction test checks that the synthetic token is absent from the refusal's audit call, but not that the non-secret part of the app id is still recorded, so a handler that dropped the app id entirely would also pass it.

Related Issues

Closes #18223. Context: #9131 (the consent leaf), #24792 (main dropped the host step-up; this PR follows it).

Sibling sweep

Swept: git grep -n "ssh_auth_sock_consent" -- src/ docs/
Sibling: src/kiro_crew/sandbox_unavailable.py -- changed here (the withheld-socket notice names the new control)
Sibling: src/kiro_crew/config/loader_locations.py -- changed here (the docstring said Kiro Crew only reads the leaf; it now names the dashboard handler as the only in-tree writer)
Sibling: src/kiro_crew/doctor_checks/confinement.py -- not affected (prints the same notice text)
Sibling: docs/request-for-change/rfc-host-credential-vending.md -- not affected (draft RFC, describes the leaf, not how it is granted)

Pattern harvest

Rule candidate: none. This is the third owner consent with the same GET/POST/DELETE handler shape (aws_consent.py, credential_redaction.py); no new rule beyond following that shape.

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 (CI runs the suites)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 9, 2026 08:20
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/sandbox_precreate.py

  • src/kiro_crew/sandbox_unavailable.py

  • src/kiro_crew/security_posture.py

  • @CrysisDeu posted a complete reasoning template for da854d4.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns: it reuses the existing one-step owner-consent shape from aws_consent.py, keeps the leaf on the keystone with in-place rewrites, and takes nothing away.

Notes

  • is_owner_dashboard_request also admits Shared Crew teammates, so a teammate can turn on forwarding of the owner's SSH keys. The AWS consent works the same way, but the spec should say this outright as a deliberate choice for this consent.

[DESIGN-REVIEWED] da854d4

Description read

[DESCRIPTION-READ] 32f66c7eff07fb0d461a44c5b438417ff9db86d075e9024cedec1934b7374d30

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 added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🔴 BLOCK

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

UX-Verdict: BLOCK

Users won't press "Allow for these sessions" because they can't tell which sessions it covers. The PR says this two-group card is the usual default, so most owners will see this label.

Blockers

"Allow for these sessions" doesn't say which sessions
Trigger: the default mixed case (tierScope === 'some', e.g. Kiro CLI on Standard). The card shows "Sessions whose sandbox hides your SSH keys" with "Not allowed", next to "Sessions whose sandbox level already gives them your SSH agent" with "On at your sandbox level".
Outcome: "these sessions" only makes sense if you already understand the sandbox wording in the row label. The blind reader on shot-02 saw what the button does but would not click it: "no. I don't know what 'these sessions' are." They also had "no idea how or why" some sessions get the agent anyway. So the main control of the PR gets skipped by most owners, every time they open the card.
Severity: high frequency (default state) × task failure (the grant never happens) × persistent.
Fix: name the group in the button itself, e.g. "Allow where your SSH keys are hidden", and use the same words in the group label so the two match.

Notes

  • ssh_agent_owner_only uses askAgent, but the agent can't change who owns the dashboard. The reader on shot-18: "no idea what the agent could do about someone else's permission". Drop askAgent here, and say who the owner is instead.
  • In the all-sessions case, "Withdraw" plus ssh_agent_revoke_tier_help (shot-21) still left the reader at "I still don't see what changes". Start the help line with what the user will see, e.g. "Nothing changes until Process Sandbox is Strict".
  • shot-09/20/22 ("Withdraw for Strict level") and shot-24 to 27 (harness-name lists) show copy that isn't in this diff. Remove them from the description so reviewers only judge the shipped wording.

[UX-REVIEWED] da854d4

Description read

[DESCRIPTION-READ] b1c9ac21247451c4b8ac4a86cff0896c7d431ae8a1500f895c29ff58b27d6704

That sha256 names everything this verdict read: the PR description, plus the 30 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 Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of da854d468c34f6ef41d5a6d42c7df4651b2d64fc — 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. One field in the GET response repeats what two other fields already say.

Notes

  • Item 10 — one consumer, generalized: forwarded_without_consent is true exactly when forwarded_harnesses lists every key of harness_labels, and both of those are in the same response. Its only reader is SecurityPanelSshAgent.tsx:137. Subtraction: delete ssh_auth_sock_consent.forwarded_without_consent and the response key. The card works out all as decided.length === 0 && forwarded.length > 0.
  • Item 1 — duplicate of doctor_checks/confinement.py:339-341: _harness_masks() is a second copy of doctor's for backend in sorted(ACP_BACKEND_ROUTING): adapter_hidden_credential_dirs(backend) loop (2 sites). Subtraction: have doctor's withheld-socket check iterate ssh_auth_sock_consent._harness_masks() so only one copy remains.

What this change ships

Inventory (10 items) — 7 justified

Intent: let the operator allow, see and withdraw SSH agent forwarding from Settings → Security instead of hand-editing a keystone file (#18223). ADDITION.

  1. New Settings → Security → "SSH agent" section with Allow / Withdraw — justified
  2. Owner-gated GET/POST/DELETE /api/ssh-agent/consent routes — justified
  3. SEL rows for every grant, withdrawal and refusal, naming the caller — justified
  4. Card shows separate status for sessions the sandbox level already forwards to — justified
  5. Allow is disabled with a "no ssh-agent detected" message when there is no socket — justified
  6. Gateway log and doctor notice now name the Settings path before the hand edit — justified
  7. Withdraw writes an explicit {"enabled": false}; a grant records granted_at — justified
  8. An unparseable store now also counts ValueError/RecursionError as unreadable — undeclared, rides along
  9. Screenshot-script boot setup moved into the shared installSettingsShell helper — undeclared, rides along
  10. GET also sends forwarded_without_consent, which the other fields already imply — one consumer, generalized

[FIRST-PRINCIPLES-REVIEWED] da854d4

Description read

[DESCRIPTION-READ] 38ed6d184c59b992fdba473b987b1aa50d2a102bf1432ca781dcf1073fe66318

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 Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] da854d4

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

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

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] da854d4

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

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 94d0c69931ac09fd101513f693a337e7b2cf0ddc 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): 16 classified, 0 newly refused, 16 still allowed.
  • ubuntu-latest (platform posix): 16 classified, 0 newly refused, 16 still allowed.
  • windows-latest (platform windows): 12 classified, 0 newly refused, 12 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The new ungated argv floor only refuses the product CLI when its leading operands are exactly ssh-agent approve, so the real OpenSSH ssh-agent/ssh-add tools, help forms, and mentions are outside its reach. No regression is confirmed. The new ssh-auth-sock-consent-pending file-tool secret leaf and sandbox mask are not shell-classifiable, so they are named under UNADJUDICATED.

TIGHTENING: Self-protection argv floor (sensitive-command tier, deny_gate.is_denied ungated floor loop) -- refuses an in-sandbox agent completing the owner's SSH agent forwarding step-up itself: + ("self-protection-ssh-agent", _argv._is_self_ssh_agent), with + return _matches_self_subcommand(text_lower, ("ssh-agent", _SELF_SSH_AGENT_VERBS)) and +_SELF_SSH_AGENT_VERBS = frozenset({"approve"}).

ADJUDICATED: 21 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: posix -- covers the real OpenSSH ssh-agent binary with the same word as the new subcommand (eval "$(ssh-agent -s)", ssh-agent -k, ssh-agent bash -c ...), ssh-add -l, $SSH_AUTH_SOCK, a pipe into grep, and a grep for the quoted verb. windows -- covers the .exe console-script spelling that _SELF_PROGRAM_RE accepts (kirocrew.exe ssh-agent --help), the py -m kiro_crew module launcher, ssh-add.exe, the PowerShell Get-Service ssh-agent check, and %SSH_AUTH_SOCK% in cmd spelling. any -- covers the bare and --help/-h forms (including with an interposed global flag), an echo that relays the approve instruction, commit signing, the new tests, and the sibling file-delivery --help in the same floor loop. Not probed: the kirocrew.cmd / kiro-crew spellings of the help form. The floor is verb-gated, so they follow the .exe row.

UNADJUDICATED: (1) File-tool secret-leaf gate: ssh-auth-sock-consent-pending is added to security._CREW_SECRET_LEAVES (paths_lists.py). Agent Read/Write/Glob tool paths reach it through the sensitive-path check, which the shell classifier does not reach. The legitimate inputs I would have submitted are a Read of ~/.kirocrew/ssh_auth_sock_consent_pending_notes.md (a sibling name sharing the prefix) and a Glob of ~/.kirocrew/*consent*.json that an operator-facing doctor flow might run. (2) Sandbox mask: ssh-auth-sock-consent-pending is added to sandbox_leaves._CREW_HIDDEN_LEAVES and precreated in sandbox_precreate._CREW_PRECREATE_HIDDEN_DIR_LEAVES. That runs at agent spawn through the bind-mount/Seatbelt plan, and the only legitimate input would be a sandboxed ls ~/.kirocrew whose listing changes. (3) Dashboard guards: owner-gated /api/ssh-agent/consent[/arm] and loopback-only STRICT-internal /api/ssh-agent/consent/approve. These are new endpoints, not tightened existing ones, so nothing was previously allowed that is now refused.

[SCOPE-REVIEWED] 94d0c69

@CrysisDeu
CrysisDeu force-pushed the fix/ssh-auth-sock-consent-settings-18223 branch from e045be1 to 224dfd6 Compare October 9, 2026 09:03
@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 Oct 9, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 224dfd6
  • What rule changed: (1) a new ungated self-protection argv floor self-protection-ssh-agent (argv_floor._is_self_ssh_agent, verbs {"approve"}), registered in security.__init__ beside self-protection-file-delivery, vocabulary.py, _exports.py, denied_rules.py; (2) a new data-home leaf ssh-auth-sock-consent-pending added to security._CREW_SECRET_LEAVES (file tools refuse it), sandbox._CREW_HIDDEN_LEAVES (bind-masked in every sandbox mode) and sandbox._CREW_PRECREATE_HIDDEN_DIR_LEAVES (precreated so the isdir-guarded mask is non-vacuous on a fresh install). No existing rule, leaf disposition or scrub prefix is changed; ssh_auth_sock_consent.json keeps its READONLY disposition.
  • Before -> after (what was allowed/blocked, now): before, kirocrew ssh-agent … did not exist and no ssh-auth-sock-consent-pending/ leaf existed. After, the agent is refused kirocrew ssh-agent approve (and python -m kiro_crew ssh-agent approve, with interposed flags) by the floor; kirocrew ssh-agent --help stays allowed; the pending-nonce directory is invisible to a sandboxed shell and refused by the file tools. Everything the agent could run before is unchanged (the Security Scope Review confirms 12/12 posix and 11/11 windows candidates still allowed; the one newly-refused row is kirocrew ssh-agent approve --help, which is the same posture the three sibling self-protection floors already have for update --help, restart --help, file-delivery approve --help).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a floor that over-matches would refuse an unrelated command whose argv is the product CLI followed by ssh-agent approve — there is no such legitimate agent command, and the operator's own terminal is not subject to the floor. A leaf registration that under-masks would let an in-sandbox shell read the armed nonce and complete the owner's step-up without a human; the leaf is in all three lists and test_sandbox_governance_mask pins the union, so a missing entry fails the suite rather than shipping. No user lockout path: the grant is OFF by default, revoke is one owner-gated DELETE with no step-up, and the hand-edit path remains valid.
  • Evidence checked (which sandbox result proves it): local classifier run on this head — is_denied("kirocrew ssh-agent approve") → self-protection-ssh-agent; is_denied("kirocrew ssh-agent approve --help") → refused (same as kirocrew file-delivery approve --help and kirocrew update --help on origin/main); is_denied("kirocrew ssh-agent --help") → allowed. test/test_ssh_auth_sock_consent_grant.py::test_the_nonce_leaf_is_masked_from_the_agent_sandbox, ::test_the_grant_file_is_fenced_from_agent_file_tools, ::test_precreate_materialises_the_nonce_dir_before_spawn and ::test_the_agent_is_refused_the_verb_by_the_denied_command_floor pin the three registrations and the floor; test_denied_commands_security.py gains the floor's templates, subcommand dressings and non-dispatching forms.
  • No regression:
    • Tools still work (which tools/commands were run, result): the ordinary git/gh/python/npm commands used to build this PR ran under the same gateway with this branch's rules loaded; kirocrew ssh-agent --help allowed; none of the 12 Security Scope Review "still allowed" candidates changed classification.
    • Backward compatible (old config / old data / old callers still work, how checked): a hand-written {"enabled": true} in ssh_auth_sock_consent.json still reads as granted (is_granted unchanged; pinned by test_a_hand_written_enable_is_the_same_grant). No existing route, verb, leaf or scrub prefix is renamed or removed.
    • Existing tests (which suites passed on this head): static gates locally (black, isort, flake8, mypy --platform linux, check_black_formatting, check_subprocess_encoding, check_harness_parity, docs-lint, tsc, eslint, i18n-check). Backend and frontend suites run in CI on this head.
  • How to undo: revert the commit. Removing the floor entry and the three leaf registrations restores the base classification exactly; the data-home directory ssh-auth-sock-consent-pending/, if precreated, is inert (nothing reads it without the module).

@CrysisDeu

CrysisDeu commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author
  • fixed — span=7de4faa54ac2 — src/kiro_crew/dashboard/handlers/ssh_auth_sock_consent.py:256 in-flight approval can undo a successful cancellation

Fixed at 224dfd6. ssh_auth_sock_consent gains a _TXN_LOCK and two transactions: claim_and_record(nonce, granted_at) (claim the nonce, persist the grant, restore on a failed write) and withdraw() (revoke the grant, discard the pending request), each held across BOTH steps.
The approve route now calls claim_and_record; the DELETE route calls withdraw. A DELETE arriving during an approve waits, then revokes the grant the approve just wrote; one arriving before leaves the approve a stale nonce (409). Nothing the owner was told succeeded is undone afterwards.
Pinned by test_a_withdraw_during_an_approve_waits_and_then_wins (a withdraw started while the lock is held completes after the transaction, final store {"enabled": false}, audit revoked) and test_a_withdraw_before_the_claim_leaves_the_approve_a_stale_nonce.
mechanism: a per-store transaction lock serialising approve against withdraw
self-added: yes

@CrysisDeu

CrysisDeu commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author
  • fixed — span=1f21f5541cdf — test/test_ssh_auth_sock_consent_grant.py:541 expiry test changes the entire worker's wall clock

Fixed at 224dfd6. The expiry test now rebinds the MODULE's own time name (clock.setattr(ssh_auth_sock_consent, "time", SimpleNamespace(time=...))) inside a MonkeyPatch.context(), never the stdlib module's attribute, so only ssh_auth_sock_consent sees the jump (AUTOSDE tests-are-deterministic item 11).
The autouse _isolated_store fixture also moved to _floor_monkeypatch (D11), which clears the Semgrep test-autouse-shared-monkeypatch finding on the same file.
self-added: yes

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • fixed — Blocker: the primary control, Allow, is one the reader would not dare to press

Fixed at 224dfd6. The risk line is now followed by one plain sentence on when someone wants this (ssh_agent_when: "Needed when git push, git fetch over SSH, or commit signing fails inside a session."). ssh_agent_allow_help says the request is finished "by pasting one command into a terminal on this computer". The armed block (ssh_agent_armed_help) now says exactly where: "Open a terminal on the computer running Kiro Crew (Terminal on macOS, PowerShell on Windows) and paste this command within 10 minutes."
Screenshots after-not-allowed and after-armed in the description show the new copy; SecurityPanel.sshAgent.test.tsx pins both strings.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • fixed — Blocker: Allow is still offered when there is nothing to forward

Fixed at 224dfd6. Allow is disabled while socket_present is false. The note is rewritten as an action and names one machine: "Kiro Crew cannot see an ssh-agent on this computer. Start Kiro Crew from a shell where ssh-agent is running, then come back here." (ssh-add was not used: it adds keys to an agent, it does not start one, and what must see the agent is the gateway process, so a page reload would not help.) SSH_AUTH_SOCK is gone from the visible text.
Screenshot after-no-socket shows the held control; says what to do first, and holds Allow, when Kiro Crew sees no ssh-agent pins it.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • fixed — Watch: three names for one machine

Fixed at 224dfd6. ssh_agent_no_socket now says "this computer" and no longer mentions SSH_AUTH_SOCK; ssh_agent_armed_help names "the computer running Kiro Crew" once and then says "this command". The remaining "Waiting on this machine" is the shared file_delivery_waiting key used by the sibling row; it is left as is so the two consent rows keep one vocabulary.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • rebutted — Watch: "Ask the agent" on this card, and no Retry on a failed read

"Ask the agent" is the product-wide recovery affordance of the shared ErrorNotice component (askAgent), the same one the flagged-file delivery row and every other Settings card render on a failed read. Renaming or hiding it on this one card would fork the shared component's vocabulary for a single surface. The card title no longer leads with the word "agent" ("Let sessions use your SSH keys"), which removes the collision the reader hit.
Retry: the read is a React Query query; it refetches on window focus, on remount and on the panel's own invalidations, exactly as the sibling delivery row does. Adding a per-card Retry control would be a new affordance no other Security card has; if the product wants one it belongs in ErrorNotice, not here.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • fixed — Suggestions: full stop between "Since …" and "Applies to new sessions."; title without "forwarding"

Fixed at 224dfd6. The two sentences render on separate lines (two <div>s) rather than editing the shared file_delivery_since key. ssh_agent_title is now "Let sessions use your SSH keys"; the rail label stays "SSH agent".

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • accepted-and-deferred — Subtraction, item 2: the step-up nonce code is a second copy of file_delivery_consent's

Agreed that one implementation should exist. It is deferred, not done here, because the PR's Not-a-goal list excludes touching file_delivery_consent: lifting its arm/claim/restore/view functions into a shared, leaf-keyed module is a refactor of the sibling's security code and of its approve handler, which this additive PR should not carry. The generic pieces that could be shared without that refactor already are (safety_epoch, StepUpError, GRANT_PENDING_TTL_SECS, _approve_is_local, _live_agent_pids).
Follow-up: #18418 (label deferred-finding, assignee @CrysisDeu, Due 2026-11-09) names the extraction task, including the approve-route fence set and the per-store transaction lock added at 224dfd6.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • rebutted — Check what happens when Allow is used on a host where the sandbox mask does not apply: approve always returns 403

That is the intended outcome, and the same posture as the flagged-file delivery approve. On a host where the mask does not apply (or masking is delegated), the pending nonce is readable by an in-sandbox process, so the host step-up no longer proves a human is present; the approve route refuses with a 403 whose error text names the reason and whose code (ssh_agent_approve_unsandboxed) the CLI prints, and the refusal is SEL-audited. Arming is harmless (it records no grant) and the owner's Cancel discards it.
Surfacing "approve will refuse on this host" before the click would need the panel to read sandbox confinement state the Security panel does not expose today; if wanted it is a panel-wide affordance for both consents, not a change to this grant.

@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 Oct 9, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/ssh-auth-sock-consent-settings-18223 branch from 224dfd6 to c520b6f Compare October 9, 2026 09:36
@KiroCrewCaptain

KiroCrewCaptain commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider raised 1 possible problem and estimates a 55% chance that this change introduces a defect; a person should check it.

This PR adds an owner-gated GET/POST/DELETE handler and a Settings → Security → SSH agent card, so the owner can grant and withdraw the keystone ssh_auth_sock_consent.json consent without editing the file by hand. The backend is consistent with the paid-AWS consent pattern on main: owner-gated on every verb, writes in place on the keystone leaf, an in-process lock, fail-loud 500s and audit rows, and it is well tested. What blocks it is the card itself: in the default scoped state (some harnesses forward at the sandbox level with no grant) the main status reads "The SSH agent on this computer — Not allowed" while Kiro CLI / Claude Code sessions already have the agent. Only a muted line and a footnote say otherwise. For a security consent surface this misstates the exposure in the dangerous direction. UX Review is still BLOCK on this head, and the repo counts that as a readiness blocker. Most test suites were still pending at decision time. Request changes: scope the status per group of sessions, and fix the stale loader docstring.

Things to check (possible problems the decider raised; at this confidence many turn out to be fine):

  • The PR's goal is that an operator can see whether SSH agent forwarding reaches sessions. In the default state, this security status card's main status says "Not allowed" for "The SSH agent on this computer" while the default harness's sessions are already forwarded the agent. That misstates a secu (website/src/pages/settings/SecurityPanelSshAgent.tsx, medium)

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 3871e61f3d · 2376 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 605e625
  • What rule changed: none since 8a2b98c. This head is a rebase onto main bebda6d to clear a merge conflict. The conflicts were outside src/kiro_crew/security/ and sandbox: website/src/test/ApiClient.refactor.surface.test.ts (main added setProjectHooksConsent / getProjectHooksConsent to the same list line; both sides kept) and the generated src/kiro_crew/docs/ui-index.generated.json (regenerated with npm run gen:ui).
  • Before -> after (what was allowed/blocked, now): unchanged from the latest template on this PR. No security rule, leaf or sandbox disposition file conflicted.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): same as the latest template; the rebase adds no behaviour.
  • Evidence checked (which sandbox result proves it): git merge-tree listed only those two files as conflicts.
  • No regression:
    • Tools still work (which tools/commands were run, result): flake8 on the changed Python files, file line cap check (0 failures), gen:ui regeneration. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): no code change beyond the rebase.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f1ab10a
  • What rule changed: none since 605e625. This head is a rebase onto main d9839ee to clear a merge conflict. The conflicts were outside src/kiro_crew/security/ and sandbox: docs/feature-map/README.md (main rewrote the security and connections rows; this PR's "ssh-agent forward consent" phrase is put back into main's security row) and the generated src/kiro_crew/docs/ui-index.generated.json (regenerated with npm run gen:ui).
  • Before -> after (what was allowed/blocked, now): unchanged from the 8a2b98c template. No security rule, leaf or sandbox disposition file conflicted.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): same as the 8a2b98c template; the rebase adds no behaviour.
  • Evidence checked (which sandbox result proves it): git merge-tree listed only those two files as conflicts.
  • No regression:
    • Tools still work (which tools/commands were run, result): docs lint, file line cap check (0 failures), gen:ui regeneration. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): no code change beyond the rebase.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment). The previous head 605e625 was green on every check.
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2022cb0
  • What rule changed: none since f1ab10a. This head only restores three entries in the security row of docs/feature-map/README.md that the rebase onto d9839ee dropped: SecurityPanelSshAgent.tsx, handlers/ssh_auth_sock_consent.py and GET,POST,DELETE /api/ssh-agent/consent (Opus 5.5 and GPT 6.1 on f1ab10a, feature-map-correctness).
  • Before -> after (what was allowed/blocked, now): unchanged from the 8a2b98c template. Docs only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): none; no code changed.
  • Evidence checked (which sandbox result proves it): git diff origin/main HEAD -- docs/feature-map/README.md is the one security row.
  • No regression:
    • Tools still work (which tools/commands were run, result): docs lint, clean. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): docs only.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2022cb0
  • What rule changed: none since f1ab10a. This head only restores three entries in the security row of docs/feature-map/README.md that the rebase onto d9839ee dropped: SecurityPanelSshAgent.tsx, handlers/ssh_auth_sock_consent.py and GET,POST,DELETE /api/ssh-agent/consent (Opus 5.5 and GPT 6.1 on f1ab10a, feature-map-correctness).
  • Before -> after (what was allowed/blocked, now): unchanged from the 8a2b98c template; this head changes documentation only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): none, because no code or rule changed on this head.
  • Evidence checked (which sandbox result proves it): git diff origin/main HEAD -- docs/feature-map/README.md is the one security row.
  • No regression:
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

CrysisDeu commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2aaadc0
  • What rule changed: the consent store's writer (ssh_auth_sock_consent._write_all) now rewrites ssh_auth_sock_consent.json in place with atomic_write.rewrite_in_place, as decisions/consent.py and security/redaction_switch.py already do, instead of atomic_write (temp file + rename). The sandbox_precreate.py comments now list this leaf among the in-place writers.
  • Before -> after (what was allowed/blocked, now): before, a dashboard Allow or Withdraw renamed a new file over the leaf, which detaches the read-only bind a running Linux sandbox holds on it, so the agent in that sandbox could then write its own consent (Opus 5.5 on 2022cb0). After, the inode is kept and the read-only bind stays in force; no rule, leaf disposition or allow changed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): an Allow or Withdraw fails with a 500 (a hard-linked leaf, or a Windows file lock without the old retry); a crash mid-write leaves the leaf empty, which reads as no consent and can drop the separate backend grant on the next Allow.
  • Evidence checked (which sandbox result proves it): blind adversarial review of the diff (artifact and contract only), verdict LOW-ONLY: every write path keeps the inode, a torn read never parses as consent, symlinks and hard links are refused, mode stays 0600.
  • No regression:
    • Tools still work (which tools/commands were run, result): flake8, black, isort, comment-history gate and file line cap, all clean. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): the file format and the callers are unchanged; every new failure is an OSError, which the handler already answers with 500.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment); new test_grant_and_revoke_rewrite_the_record_in_place pins the inode.
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: b85ca74
  • What rule changed: none since 2aaadc0. This head is a rebase onto main ee52eac to clear a merge conflict. The only conflict was the generated src/kiro_crew/docs/ui-index.generated.json, rebuilt with node website/scripts/gen-ui-index.mjs on each commit (--check says up to date). Nothing under src/kiro_crew/security/, sandbox* or the consent store changed.
  • Before -> after (what was allowed/blocked, now): unchanged from the 2aaadc0 template; the per-file diff against main is line-for-line the same size as before the rebase.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a stale UI index entry for the SSH agent card, which the UI-index freshness check would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): git diff --numstat of the PR against its old base and of this head against main are identical; the feature-map security row still lists SecurityPanelSshAgent.tsx.
  • No regression:
    • Tools still work (which tools/commands were run, result): gen-ui-index.mjs --check, up to date. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, the rebase changes no code path of this PR.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: a7bf097
  • What rule changed: none since b85ca74. This head changes only the SSH agent card's copy for the UX Review BLOCK on b85ca74: the withdraw button reads "Withdraw" in every state (ssh_agent_revoke_tier dropped), the help line under it at a forwarding sandbox level states the effect first (ssh_agent_revoke_tier_help), and the row label uses one noun in every scope with the scoping on the muted line (ssh_agent_row_label_scoped dropped, ssh_agent_row_scoped_names reworded). All 12 catalogs and en-XA updated. Nothing under src/kiro_crew/security/, sandbox*, the consent store or the ssh-agent floor changed.
  • Before -> after (what was allowed/blocked, now): unchanged from the 2aaadc0 template; the same states render, the same grant / revoke calls run.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a wrong or missing translation of the two reworded strings; no rule, route or verdict changes.
  • Evidence checked (which sandbox result proves it): blind adversarial review of the copy diff (artifact and contract only), verdict CLEAN: no reader of a dropped key remains, each catalog changes only those keys, {{harnesses}} intact, state logic and API calls unchanged. Real before/after screenshots of 14 card states are in the description.
  • No regression:
    • Tools still work (which tools/commands were run, result): i18n check, tsc and eslint on the touched files, clean. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, copy only.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment); SecurityPanel.sshAgent.test.tsx expectations updated to the new copy.
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 014dd5a
  • What rule changed: none since a7bf097. This head is a rebase onto main 46707f8 to clear a merge conflict. The only conflict was the generated src/kiro_crew/docs/ui-index.generated.json, rebuilt with node website/scripts/gen-ui-index.mjs (--check says up to date). Nothing under src/kiro_crew/security/, sandbox* or the consent store changed.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template; the per-file diff against main, apart from the generated index, is the same as before the rebase.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a stale UI index entry, which the UI-index freshness check would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): git diff --numstat of the PR against its old base and of this head against main are identical outside the generated index.
  • No regression:
    • Tools still work (which tools/commands were run, result): gen-ui-index.mjs --check, up to date. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, the rebase changes no code path of this PR.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 1b63f05
  • What rule changed: none since a7bf097. This head is a rebase onto main 549cc1a to clear a merge conflict. The only conflict was the generated src/kiro_crew/docs/ui-index.generated.json, rebuilt with node website/scripts/gen-ui-index.mjs (--check says up to date). Nothing under src/kiro_crew/security/, sandbox* or the consent store changed.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template; the per-file diff against main, apart from the generated index, is the same as before the rebase.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a stale UI index entry, which the UI-index freshness check would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): git diff --numstat of the PR against its old base and of this head against main are identical outside the generated index.
  • No regression:
    • Tools still work (which tools/commands were run, result): gen-ui-index.mjs --check, up to date. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, the rebase changes no code path of this PR.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 984acdf
  • What rule changed: none since a7bf097. This head is a rebase onto main 6178815 to clear a merge conflict. The only conflict was the generated src/kiro_crew/docs/ui-index.generated.json, rebuilt with node website/scripts/gen-ui-index.mjs (--check says up to date). Nothing under src/kiro_crew/security/, sandbox* or the consent store changed.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template; the per-file diff against main, apart from the generated index, is the same as before the rebase.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a stale UI index entry, which the UI-index freshness check would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): git diff --numstat of the PR against its old base and of this head against main are identical outside the generated index.
  • No regression:
    • Tools still work (which tools/commands were run, result): gen-ui-index.mjs --check, up to date. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, the rebase changes no code path of this PR.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 3871e61
  • What rule changed: none since a7bf097. This head is a rebase onto main 1dee6bb to clear a merge conflict. Main added two Security sections (Message body fields, Safety switches) to the same lists this PR adds the SSH agent section to: the section key type, titles, rail, render switch, owners list, settings-extract map, API client exports, surface test and the feature-map row. Each list now keeps main's entries and adds this PR's one after them. handlers/__init__.py keeps both import blocks in isort order. The sandbox_precreate.py comment lists mcp_body_fields.json from main and ssh_auth_sock_consent.json from this PR. ui-index.generated.json was rebuilt with gen-ui-index.mjs.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template. The SSH agent card sits after Safety switches in the rail.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a Security section missing from the rail, which the rail and owners tests would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): tsc -b --noEmit shows no new error in the merged files; flake8, isort, black gate, docs-lint, line cap, comment history and brand gates pass on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, main's new sections are kept as they are, and this PR's code paths are unchanged.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • left for the UX owner: Blocker "Not allowed" badge next to "The SSH agent on this computer" in the scoped state

    The card states each fact correctly. In the scoped state the row shows "For new sessions only" under the label, so "Not allowed" is the grant for those sessions. The footnote names the sessions that already have the agent at the sandbox level. The finding is that the layout reads as a single status. Showing a status per group of sessions is a design change to this card, so the call is the UX owner's, as with the earlier rounds on this PR. No change on this head.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Rebase only: head 50167a4f6d on main 10e113c8d6 to clear a conflict in website/scripts/capture-credential-redaction.mjs, the 13 locale JSONs under website/src/i18n/locales/ and website/src/test/ApiClient.refactor.surface.test.ts. Main (#37408) cut the redaction card to one switch and dropped the engine/seams keys and client calls; this head keeps main's version of each file and re-applies only this PR's parts: the capture script calls installSettingsShell(page, 'light') in place of main's inline init script, the surface test adds the three sshAgentConsent keys to main's lists, and each locale is main's file plus this PR's 27 ssh_agent_* keys (no other key differs from main, no duplicate keys). ui-index.generated.json merged cleanly and gen-ui-index.mjs --check says up to date. Still 2 commits.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 50167a4
  • What rule changed: none since a7bf097. This head is a rebase onto main 10e113c to clear a merge conflict. The conflicts were outside src/kiro_crew/security/, sandbox* and the consent store: website/scripts/capture-credential-redaction.mjs (main's one-switch capture keeps its states; this PR's installSettingsShell helper replaces the inline init script), website/src/test/ApiClient.refactor.surface.test.ts (main dropped setCredentialRedactionEngine / setCredentialRedactionSeams; this PR's three sshAgentConsent keys are added to main's list) and the 13 locale catalogs (main's file plus this PR's 27 ssh_agent_* keys, replayed key by key; no other key differs from main). ui-index.generated.json merged cleanly; gen-ui-index.mjs --check says up to date.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a missing or wrong SSH agent string on the card, or a broken redaction capture script, which the frontend and i18n tests would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): tsc --noEmit in website/ shows no error; black, isort, flake8 on the PR's Python files, line cap, comment history and brand gates pass on this head; each locale parses with no duplicate keys.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, main's files are kept as they are, and this PR's code paths are unchanged.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 0ffe0e3
  • What rule changed: none since a7bf097. This head is a rebase onto main 44769db to clear a merge conflict. The conflicts were outside src/kiro_crew/security/, sandbox* and the consent store: website/src/test/ApiClient.refactor.surface.test.ts (main's test: assert properties instead of hand-kept lists in website tests #39011 dropped the hand-kept API_KEY_ORDER list; main's file is kept and this PR's sshAgentConsent is added to NO_SESSION_KEY only) and website/src/pages/settings/SecurityPanel.sshAgent.test.tsx (import lines only). website/src/api/client.ts is over the 1,600-line target, so this PR no longer re-exports SshAgentConsentStatus from it; SecurityPanelSshAgent.tsx and its test import the type from api/client/security directly, and client.ts ends at main's 1,907 lines. The 13 locale catalogs merged cleanly: main's keys are all present and unchanged, plus this PR's 27 ssh_agent_* keys, with no duplicate keys. ui-index.generated.json merged cleanly; gen-ui-index.mjs --check says up to date.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a missing or wrong SSH agent string or type import on the card, which the frontend, i18n and typecheck lanes would fail; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): tsc --noEmit in website/ shows no error in any file this PR touches; eslint on the PR's TypeScript files, npm run i18n:check, black, isort, flake8 on the PR's Python files, line cap, comment history, brand and docs-lint gates pass on this head; git merge-tree against main is clean.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes, main's files are kept as they are, and this PR's code paths are unchanged apart from where one type is imported from.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review found one blocking problem on this head (0ffe0e3) in the code this PR adds.

  1. website/src/pages/settings/SecurityPanelSshAgent.tsx:189-206, with website/src/i18n/locales/en.manual.json:10248 and :10260. Take the default scoped state: Kiro CLI or Claude Code forward the agent at the standard sandbox level, and only the masked harnesses wait for the grant. The row shows the label "The SSH agent on this computer" with a "Not allowed" badge, but some sessions already have the operator's SSH agent. The only correction is muted 11px text: the "For new ... sessions only" line, and a note below the action that adds "whatever this setting says". The headline understates the exposure, which is the dangerous direction for a security consent, and the "see" half of the goal fails in the most common state. The UX lane recorded this as a BLOCK on this head with both a Trigger and an Outcome. Its header reads PASS only because the Outcome text starts on the next line. No disposition answers it yet. Smallest fix: scope the headline to the sessions the setting decides, for example a label and status per group of sessions, so the Kiro CLI sessions read "On at your sandbox level". Open the note with what Allow covers and drop "whatever this setting says". Then refresh the default-state screenshots. If you think the current layout is right, post a disposition for this blocker on this head.

The standing change request from 2026-10-21 also still needs its reviewer to re-review or dismiss it before this can merge.

Optional:

  • The body says a maintainer asked for the one-step grant shape. The thread shows the question to the reviewer, but no answer. Please reword that line so a maintainer can rule on dropping the step-up.
  • The ssh_auth_sock_consent_path docstring in src/kiro_crew/config/loader_locations.py:513-517 still says Kiro Crew only reads this leaf. The body says writes use atomic_write, but the code uses rewrite_in_place, which is the right choice because it keeps the inode under the read-only bind. Please fix both, and the sibling-sweep line.
  • SecurityPanelSshAgent.tsx:70-76 rebuilds the client retry default by hand. Importing retryPolicy, as SecurityPanelRedaction.tsx does, removes a second copy that can drift.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 9166a54
  • What rule changed: none since a7bf097. This head changes only what the Settings > Security "SSH agent" card shows, in answer to KiroCrewCaptain's review 5963164673: in mixed scope (some sessions forward the SSH agent at the sandbox level whatever this setting says) the card shows one status per group of sessions instead of one unqualified "Not allowed" line, the decided group says which sessions it covers (or "For other new sessions only" when the gateway sends no session names), and the ssh_agent_tier_forwards_some note is reworded in every catalog with its {{harnesses}} placeholder dropped. No file under src/kiro_crew/security/, sandbox* or the consent store changes.
  • Before -> after (what was allowed/blocked, now): unchanged from the a7bf097 template. The setting's value, its write path and who may change it are the same.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a card that mislabels which sessions a status covers, so a person misreads what Allow changes; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): three blind review rounds on the delta (BLOCK, BLOCK, LOW-ONLY; the round 3 zh-CN grammar Low is fixed on this head); tsc --noEmit, eslint on the touched files, npm run i18n:check (its two remaining flags are remoteCrewPanel values main changed, not this PR), comment history, brand and line cap pass; git merge-tree against main is clean.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes; a gateway that sends no session names gets the generic wording, covered by the fallback test.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Reply to KiroCrewCaptain's CHANGES_REQUESTED review 5963164673 (2026-11-18T19:01:29Z, head 0ffe0e3).

Head: 9166a5454b79746cf9e3398ef08a7eb4b5b54038 (three blind review rounds on the change: BLOCK, BLOCK, LOW-ONLY; the round-3 zh-CN grammar Low is fixed on this head).

1. Blocker: "Not allowed" headline while some sessions already have the agent. Fixed in commit 1 (the commit that adds the card).

  • In the mixed scope the card now shows one label and status per group of sessions. The decided group keeps "The SSH agent on this computer: Not allowed / Allowed", and in mixed scope it always says which sessions it covers: "For new sessions only", or "For other new sessions only" when the gateway sends no harness names (website/src/pages/settings/SecurityPanelSshAgent.tsx:214-224). Below the action, the forwarded group shows the same label with the existing "On at your sandbox level" badge and "For new sessions only" (website/src/pages/settings/SecurityPanelSshAgent.tsx:300-312). These reuse existing keys (ssh_agent_row_label, ssh_agent_state_on_by_tier, ssh_agent_row_scoped_names), plus one new key, ssh_agent_row_other_sessions (website/src/i18n/locales/en.manual.json:10250), in all 12 catalogs with en-XA regenerated.
  • The note names the group it covers by what the sandbox level does and no longer says "whatever this setting says": ssh_agent_tier_forwards_some is now "Allow does not change the sessions your sandbox level already gives your SSH agent to. To stop that, choose the Strict level of Process Sandbox and leave this setting at Not allowed. Both apply to new sessions only." (website/src/i18n/locales/en.manual.json:10261). It no longer takes {{harnesses}}, because the group's own names line carries them. Reworded in all 12 catalogs, en-XA regenerated.
  • The forwarded group's names line always has a name: tierScope is some only when at least one harness forwards, and each name falls back to the server label, then the raw id. The second label has its own test id, ssh-agent-tier-label, so no query matches two labels.
  • Tests: website/src/pages/settings/SecurityPanel.sshAgent.test.tsx. The no-labels case now forwards kiro and an unknown id acme and asserts "For new Kiro CLI, acme sessions only". The labelled and the no-labels mixed-scope cases assert both groups' names lines ("For new OpenAI Codex sessions only" / "For other new sessions only", and "For new Claude Code, Kiro CLI sessions only" / "For new Kiro CLI sessions only") and that ssh-agent-tier-state reads "On at your sandbox level". The all-forward case asserts there is no second group.
  • Screenshots of the mixed-scope states are refreshed in the description (some-forward, some-forward-allowed, light, and the no-labels gateway).

2. UX lane header reads PASS on a BLOCK. On 0ffe0e3 the lane wrote a Blocker with Trigger: on one line and Outcome: followed by a bullet list on the next lines. The substantiation check at .github/workflows/ux-review.yml:1695 needs text on the same line as Outcome:, so it downgraded the verdict to PASS ("The BLOCK for 0ffe0e3 states no Trigger: line and no Outcome: line, so it is treated as PASS"). We treat it as the BLOCK it was meant to be. Its finding is the same as item 1, and the commit above answers it. The parse quirk is in the lane, not in this PR, so this PR does not change it.

3. The UX BLOCK that had no disposition. Answered by item 1. The lane's own Fix asked for exactly that: open the note with what Allow covers, name the always-on sessions as a separate fact with the sandbox link, and drop "whatever this setting says". Its notes are not changed here:

  • askAgent on the owner-only notice (website/src/pages/settings/SecurityPanelSshAgent.tsx:323) is still shown.
  • The "On (set by sandbox level)" rename is not made. The badge keeps the existing key.
  • The stale shots 02/03/20/22 are replaced by the refreshed captures in the description.

4. @dodgeblaster's 2026-10-21 change request (review 5596721843, on 7fb2c12). All three points were answered in #18395 (comment):

Optional items (not changed in this push):

  • Body line about a maintainer asking for the one-step grant: not reworded in this round; whether to drop the step-up stays a maintainer's call.
  • src/kiro_crew/config/loader_locations.py:513-517 docstring ("Kiro Crew only reads it", "NO CLI verb") and the body's atomic_write line: not changed in this round. Writes go through rewrite_in_place.
  • website/src/pages/settings/SecurityPanelSshAgent.tsx:70-76 hand-rebuilt retry default: not changed in this round. SecurityPanelRedaction.tsx:8,61 imports retryPolicy from ../../api/queryClient, which would be the drop-in replacement.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review found one blocking problem in the code this PR adds, on head 9166a54.

  1. src/kiro_crew/ssh_auth_sock_consent.py:430, with test/test_ssh_auth_sock_consent_grant.py:495-512. A Shared Crew teammate (an invite guest, relay teammate or tailnet collaborator) sends POST or DELETE /api/ssh-agent/consent. is_owner_dashboard_request admits them through teammate_passes_owner_gate, because no owner-only rule in teammate_access.is_owner_only_for_teammates covers this route. record_grant or revoke then calls audit_decision, which hardcodes caller="owner". The SEL row therefore names the owner as the person who allowed or withdrew forwarding of the owner's ssh-agent keys. That breaks the rule in shared_crew/teammate_access.py that every audit row names the teammate. Refusals record "gateway" and drop the refused caller. The audit test calls record_grant/revoke with no request and asserts "owner", so the suite pins the wrong value. Smallest fix: add a caller argument to audit_decision, record_grant and revoke. Pass str(request.get("user") or "anonymous") from all three handler sites, as source_providers._audit_source_api does. Use it for every outcome. Replace the :509 assertion with a test driven through the handler, for both an owner request and a teammate request. Keep the authorization policy as it is. Admitting the teammate follows the recorded Shared Crew policy. Then correct the handler docstring at dashboard/handlers/ssh_auth_sock_consent.py:10 and the body, so they say the owner or an admitted teammate can use these routes. This one fix also clears the open automated security BLOCK at the same line.

Follow-up on my earlier review (0ffe0e3):

  • "Not allowed" headline understating exposure: partly fixed. The card now shows a status for each group of sessions, so it no longer understates. But in the default mixed state both rows use the same label, "The SSH agent on this computer", with opposite badges, and the UX lane blocks this head on that. Smallest fix: drop the label and badge row at SecurityPanelSshAgent.tsx:301-304 and keep the names line, the tier note and the sandbox link. Or give each row a label that names its group. Then update the assertions at SecurityPanel.sshAgent.test.tsx:176 and :212-213.
  • Optional items (step-up wording, loader_locations.py docstring and atomic_write body line, hand-built retry): declined for now, which is fine because they were optional.

The change request from 2026-10-21 still needs its reviewer, or a maintainer, to re-review or dismiss it before this can merge.

Optional:

  • src/kiro_crew/config/loader_locations.py:514-515 still says Kiro Crew only reads this leaf, and the new handler says it is the only writer. One sentence fixes the contradiction.
  • docs/system-specs/modules/security.md:1825 documents the GET without forwarded_harnesses and harness_labels, which the card depends on.
  • The refusal-generation cache in SecurityPanelSshAgent.tsx:39-115 could become the one-line retry: (c, e) => !isOwnerGateRefusal(e) && retryPolicy(c, e) that the sibling Security cards use.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2208121
  • What rule changed: none. Who may call the consent routes is unchanged: _deny_non_owner still gates on is_owner_dashboard_request (the owner, or a Shared Crew teammate it admits; app tokens and allow-listed messaging non-owners are refused). This head changes what is audited, in answer to KiroCrewCaptain's review 5966361922: audit_decision, record_grant and revoke take a required caller, every handler site passes str(request.get("user") or "anonymous") (the same expression as source_providers._audit_source_api), and every outcome is recorded with it: grant, withdrawal, a failed write of either, and a refusal. A refused app-token request's row also names the app in its detail. The fixed "owner" / "gateway" caller is gone.
  • Before -> after (what was allowed/blocked, now): allowed and refused requests are the same as on 9166a54. Before, the SEL rows carried a fixed caller; now each row names the requesting dashboard user (or anonymous), and an app-token refusal names the app.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): an audit row with the wrong caller. No route, gate or verdict changes; the caller and app text go through the SEL's structured record and its redact-and-clip.
  • Evidence checked (which sandbox result proves it): full blind review on two lenses (security and logic; UI, i18n and project rules): round 1 BLOCK on both, round 2 LOW-ONLY on both, round 3 on the follow-up fixes LOW-ONLY. Handler-driven tests cover an owner, an admitted teammate, an app-token refusal, a plain refusal, an empty user (anonymous) and failed writes on POST and DELETE. Static gates pass on this head: black, isort, flake8, mypy --platform linux, tsc, eslint, i18n:check, comment history, brand, line cap, subprocess encoding, docs-lint; git merge-tree against main is clean.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. The consent file format is unchanged, and the only callers of the three functions are this PR's handler and tests (grep of src and test).
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Reply to the review of 2026-11-18T22:40:57Z (on 9166a54). Every point is addressed on head 2208121. The PR is still 2 commits, and each change is in the commit that added the code it touches.

1. Blocker: the audit row named the owner for a teammate's grant or withdrawal. Fixed in commit 1.

  • audit_decision, record_grant and revoke now take a required keyword-only caller, and every outcome records it: granted, revoked and refused. See src/kiro_crew/ssh_auth_sock_consent.py:238, :254 and :415. The fixed "owner" / "gateway" value is gone (:442).
  • The handler passes str(request.get("user") or "anonymous") through _caller (src/kiro_crew/dashboard/handlers/ssh_auth_sock_consent.py:49), the same expression as source_providers._audit_source_api. It does so at every audit call: the refusal (:77), the grant and its failed write (:117, :123), and the withdrawal and its failed write (:148, :153).
  • A refused app token carries its human's id as request["user"]. Its refusal row keeps that caller and also names the app in the detail, "…: non-owner caller refused (app token )" (:70-74).
  • Who may call each route is unchanged: _deny_non_owner still gates on is_owner_dashboard_request.
  • The old store-level assertion is replaced with handler-driven tests in test/test_ssh_auth_sock_consent_grant.py:
    • :559: an owner POST/DELETE is audited as the owner.
    • :571: a teammate the owner gate admits is audited as the teammate.
    • :590: a failed grant and a failed withdraw each name their caller.
    • :375: a refused app token is named in the detail.
    • :396: a refusal with no user is audited as anonymous.
    • :412: a refused non-owner is audited by name.
  • The handler module docstring (src/kiro_crew/dashboard/handlers/ssh_auth_sock_consent.py:10-14) and the audit_decision docstring now say the caller is whoever made the request. That is the owner or an admitted teammate on a grant or withdrawal, and the refused requester (or anonymous) on a refusal. The description says the owner or an admitted teammate can use these routes.

2. Both mixed-scope rows used the same label with opposite badges. Fixed in commit 1, with existing strings only.

  • The decided row is labelled "For new sessions only", or "For other new sessions only" when the gateway sends no names (website/src/pages/settings/SecurityPanelSshAgent.tsx:202).
  • The forwarded row is labelled "For new sessions only" (:298). Both rows stay.
  • Outside mixed scope the single row keeps "The SSH agent on this computer".
  • Tests: website/src/pages/settings/SecurityPanel.sshAgent.test.tsx:
    • :115: the single row keeps the generic label.
    • :178 and :187: each mixed-scope label.
    • :188: the generic label is absent in mixed scope.
    • :205: the granted mixed scope.
    • :215 and :219: a gateway that sends no names.
  • The mixed-scope screenshots in the description are refreshed.

3. Optional items.

  • src/kiro_crew/config/loader_locations.py:514-516 now names the owner-gated dashboard handler as the only in-tree writer; a hand edit still works.
  • docs/system-specs/modules/security.md:1825 now documents forwarded_harnesses and harness_labels on the GET, who may call the routes, the audited caller, and what a withdrawal records when nothing readable was granted.
    • Two doc-only gaps in that withdrawal sentence are listed under Known limitations in the description: a malformed store counts as readable, and a withdrawal on a readable store keeps any mcp_gateway_backends grant.
  • Retry/refusal-generation refactor: not taken in this PR.

4. zh-CN wording. Every SSH agent string in zh-CN uses 沙箱, "strict 级别", and 进程沙箱 for the Process Sandbox control, as main's zh-CN does. The Known limitations line about it is removed from the description.

5. The 2026-10-21 change request from @dodgeblaster (review 5596721843, on 7fb2c12) still needs that reviewer, or a maintainer, to re-review or dismiss it before this can merge. Its points were answered in #18395 (comment), and the branch merges cleanly with current main.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review found one blocking problem on head 2208121, in the code this PR adds.

  1. website/src/pages/settings/SecurityPanelSshAgent.tsx:145 and :206, with ssh_auth_sock_consent.py:309 and :354.
    • Trigger: the usual default, the Kiro CLI on the standard sandbox level. harness_labels() returns a label for every harness in ACP_BACKEND_ROUTING. decidedNames keeps every one of them that does not forward. Every enforced harness hides ~/.ssh, so all of them land in the decided group.
    • Outcome: the capture shows the row above Allow as "For new OpenAI Codex, GitHub Copilot CLI, DeepSeek Harness, goose, Kiro Agent, OpenCode, Pi sessions only". A real gateway lists even more. Most operators never configured any of these harnesses, so they cannot tell whether Allow affects their own sessions. The body says this row reads "For new OpenAI Codex sessions only", but no configuration renders that. The UX lane blocks this head on the same state, and no disposition answers it.
    • Smallest fix: label each group by what it means, for example "Sessions whose sandbox hides your SSH keys" and "Sessions whose sandbox level already gives them your SSH agent". Or name only the harnesses the operator has configured or selected. Then add a mixed-scope test whose harness_labels matches the real set. Finally, correct the body's mixed-scope paragraph and screenshots so they match the head.

Follow-up on my earlier reviews:

  • The audit row named the owner when a teammate made the change (9166a54): fixed. Every handler site passes the requesting user as caller. Handler-driven tests cover the owner, a teammate, refusals and failed writes.
  • Both mixed-scope rows shared one label with opposite badges (0ffe0e3, 9166a54): fixed. Each group now has its own label. The name list that replaced the shared label is item 1 above.
  • Optional: the loader_locations.py docstring and the security.md GET fields are fixed.

The change request from 2026-10-21 still needs its reviewer, or a maintainer, to re-review or dismiss it before this can merge. The body asks whether Withdraw may drop the mcp_gateway_backends grant when the store cannot be read. That question still needs a maintainer ruling.

Optional:

  • forwarded_without_consent repeats what forwarded_harnesses and harness_labels already say. The client can work out the "all" scope from those two fields, or a disposition can rebut the First Principles note.
  • No test fails if redact_log_via_context is removed from the audit write at ssh_auth_sock_consent.py:438. One test would pin it: send a refused request whose app id carries a token from kiro_crew.testing.synthetic_credentials.
  • test_socket_present_answers_as_the_spawn_path_would replaces the global os.path.exists with a lambda that only accepts strings. The fake resolver could return a real path under tmp_path instead, which avoids the global patch.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 68a2a82
  • What rule changed: none. This head answers KiroCrewCaptain's review 5968341865. In mixed scope the SSH agent card's two status rows are labelled by what each group means ("Sessions whose sandbox hides your SSH keys" / "Sessions whose sandbox level already gives them your SSH agent"), with no harness-name list; the strings are in every catalog and the unused ssh_agent_row_scoped_names and ssh_agent_row_other_sessions keys are removed. A new backend test pins that a synthetic credential in a refused request's app id is redacted from the audit call. No route, owner gate, tool_gate or sandbox verdict, consent write or audit write changes.
  • Before -> after (what was allowed/blocked, now): unchanged from the 2208121 template. Who may call the routes, what each outcome audits, and which sessions get SSH_AUTH_SOCK are the same.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a card label that misdescribes a group, so an operator misreads what Allow covers; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): blind review on two lenses (UI and i18n; security): the first pair on 957daf2ca3 was superseded by the names-line removal; on this head both are LOW-ONLY. The mixed-scope test uses the real ACP_BACKEND_ROUTING ids with claude, kas and kiro forwarding at the standard level, as tool_gate.ENFORCED_ROUTINGS and the credential masks on main give. Static gates pass on this head: black, isort, flake8, mypy --platform linux, tsc, eslint, i18n:check, comment history, brand, line cap, subprocess encoding, docs-lint; git merge-tree against main is clean.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes; display only. A gateway that sends no harness names gets the same meaning labels.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Reply to KiroCrewCaptain's CHANGES_REQUESTED review 5968341865 (2026-11-19T02:16:11Z, on 2208121). All points are addressed on head 68a2a82. The PR is still 2 commits.

1. Blocker: the mixed-scope row labels were harness-name lists. Fixed in commit 1.

  • In mixed scope each status row is now labelled by what its group means:
    • The group this setting decides: "Sessions whose sandbox hides your SSH keys" (website/src/pages/settings/SecurityPanelSshAgent.tsx:193-197, key ssh_agent_group_decided at website/src/i18n/locales/en.manual.json:10249).
    • The forwarded group: "Sessions whose sandbox level already gives them your SSH agent" (SecurityPanelSshAgent.tsx:287-289, key ssh_agent_group_forwarded at en.manual.json:10250).
  • The card lists no harness names in either group. Most of those harnesses are ones the operator never configured, so a list does not help them tell whether Allow covers their own sessions.
    • The code that built the lists is removed: nameOf, forwardedNames and decidedNames, and the acpBackendName import.
    • The ssh_agent_row_scoped_names key is removed from every catalog, since nothing else used it, and en-XA is regenerated.
    • Allow still reads "Allow for these sessions" when the gateway names a harness this setting decides, and "Allow SSH agent" otherwise.
  • Outside mixed scope the single row keeps "The SSH agent on this computer".
  • The two new strings are in en.manual.json and all 11 translated catalogs. zh-CN uses 沙箱, and ja uses 「SSH 鍵」, as the rest of the card does.
  • Tests (website/src/pages/settings/SecurityPanel.sshAgent.test.tsx):
    • :223: a mixed-scope test with harness_labels set to the full ACP_BACKEND_ROUTING set from agent_sdk/backends_routing.py (ROUTING_LABELS at :69). It uses the default-level forwarded set ['claude', 'kas', 'kiro']: on main, those three routings are not in tool_gate.ENFORCED_ROUTINGS, so adapter_hidden_credential_dirs gives them no mask. It asserts both labels exactly.
    • :180, :212 and :237 assert the labels, and that no names line and no harness names show in either group.
  • The description's mixed-scope paragraph and screenshots are updated to this head.

2. Optional, redact_log_via_context in the audit write: taken.

  • test/test_ssh_auth_sock_consent_grant.py:413 sends a refused POST whose app id carries a synthetic GitHub token from kiro_crew.testing.synthetic_credentials.github_classic.
  • It asserts the token and its prefix appear in no field of the audit call: the whole kwargs repr, plus caller explicitly. The detail is written through redact_log_via_context at src/kiro_crew/ssh_auth_sock_consent.py:446.

3. Other optionals: not taken.

  • forwarded_without_consent: kept. It is the server's own "every harness" verdict, computed against the full harness mask set. The client cannot rebuild it from harness_labels, which is empty when that set cannot be resolved.
  • The os.path.exists patch in test_socket_present_answers_as_the_spawn_path_would (test/test_ssh_auth_sock_consent_grant.py:203): not changed. The test's own monkeypatch fixture undoes it when the test ends, and swapping it for a tmp-path resolver is a test-only refactor outside this round.

Still open, for a maintainer:

  • @dodgeblaster's 2026-10-21 change request (review 5596721843) needs that reviewer, or a maintainer, to re-review or dismiss it. We dismiss nothing.
  • The open question in the description, whether Withdraw may drop the mcp_gateway_backends grant when the store cannot be read, still needs a maintainer ruling.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

This head fixes the blocking item from my last review, but it cannot be approved yet.

Follow-up on my review of 2208121:

  • The mixed-scope rows listed harness names: fixed. Each group now has a label that says what it means, and the name lists and their unused keys are gone.
  • Optional, redaction pin: fixed. A new test plants a synthetic credential in a refused app id and checks that the audit call redacts it.
  • Optional, forwarded_without_consent redundancy: rebutted. The client cannot rebuild this field when the forwarded set cannot be resolved, and that reason holds.

The review of this head found no blocking problem in correctness, security, scope or tests. The owner gate covers all three verbs. The store stays a read-only keystone leaf. Writes go through rewrite_in_place and keep the mcp_gateway_backends grant. Every grant, withdrawal and refusal is audited as the real caller. The reuse of the AWS consent's one-step shape is well done.

Before this can merge:

  • Every Backend Tests and Frontend Tests job on 68a2a82 was cancelled, so the tests added since 2208121 have never run. Please re-run CI on this head.
  • The change request from 2026-10-21 still needs its reviewer, or a maintainer, to re-review or dismiss it.
  • The body asks whether Withdraw may drop the mcp_gateway_backends grant when the store cannot be read. That still needs a maintainer ruling. The review found that path is narrow: common read errors also fail the in-place write and return a 500, so nothing is lost.

Optional:

  • harness_labels is only read through Object.keys, and in "some" scope its one use matches tierScope === 'some'. You could remove the field, its type member, decided and the "no session names" capture states, and set scoped = tierScope === 'some'.
  • ssh_auth_sock_consent.py:318 and :357-360, security.ts:78 and :83, and docs/system-specs/modules/security.md:1825 still say the card names harnesses. It no longer does.
  • The body has no ## Real-machine verification section, and every "after" frame comes from a stubbed consent route. A run on a strict-tier machine would cover the end-to-end claim: Allow, then SSH works in a new session; Withdraw, then it is scrubbed again.

Zezhen Xu added 2 commits November 19, 2026 09:58
The owner grants or withdraws the SSH_AUTH_SOCK forward consent from
Settings > Security > SSH agent. The owner-gated POST writes the keystone
grant directly, the same one-step shape as the paid-AWS consent; DELETE
withdraws it. No CLI verb and no host step-up, following main.
… read it once

A viewer the owner gate refuses saw "Could not read whether sessions can use
your SSH agent", and every open and refocus re-read the route, writing a new
audited refusal each time. The card now tells an owner-gate refusal apart with
the redaction card's isOwnerGateRefusal, says only the owner can see or change
it, does not retry that refusal, and keeps it cached for the tab so focus and
remount do not repeat it. An owner keeps the re-read on focus and remount.

The non-owner test settles react-query's focus pass with the shared
refocusWindow barrier before it checks that the refused read was not repeated.

The owner-only refusal is cached for the tab, so the card re-reads its grant
on mc-auth-recovered: a stale pre-owner session that signs in again as the
owner would otherwise stay on the refusal, since the client's recovery refetch
skips an error that kept earlier data. The card loads as its own lazy chunk,
which keeps the SettingsPage chunk within its bundle budget.
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: da854d4
  • What rule changed: none. This head answers UX Review's BLOCK on 68a2a82 with display only: in mixed scope the SSH agent card shows one line above both group rows, "Some sessions already get your SSH agent from their sandbox level." (ssh_agent_mixed_intro, in every catalog; it names no harness). No route, owner gate, tool_gate or sandbox verdict, consent write or audit write changes.
  • Before -> after (what was allowed/blocked, now): unchanged from the 68a2a82 template.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a card line that misdescribes which sessions get the SSH agent; no rule or verdict changes.
  • Evidence checked (which sandbox result proves it): short blind review on the delta: LOW-ONLY. Static gates pass on this head: black, isort, flake8, mypy --platform linux, tsc, eslint, i18n:check, comment history, brand, line cap, subprocess encoding, docs-lint; git merge-tree against main is clean.
  • No regression:
    • Tools still work (which tools/commands were run, result): the static gates above. No local test runs on this host; CI runs the suites.
    • Backward compatible (old config / old data / old callers still work, how checked): yes; display only, shown in mixed scope only.
    • Existing tests (which suites passed on this head): CI on this head (pending at the time of this comment).
  • How to undo: revert the two commits; the settings card, the ssh-agent command and its floor go away and the consent file is left as it was.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Re the UX Review BLOCK on 68a2a82. This is addressed on head da854d4; the PR is still 2 commits.

  • In mixed scope only, the card now opens with one short line above both group rows: "Some sessions already get your SSH agent from their sandbox level." It is at website/src/pages/settings/SecurityPanelSshAgent.tsx:186-192, with the new key ssh_agent_mixed_intro at website/src/i18n/locales/en.manual.json:10249, in every catalog. That way the "Not allowed" row is never the first thing read.
  • No harness names are listed. Most of them are harnesses the operator never configured, so a name list does not tell them whether Allow covers their own sessions; the line states the fact without the list.
  • Tests: the four mixed-scope tests in website/src/pages/settings/SecurityPanel.sshAgent.test.tsx check the line's exact text, and four single-scope tests (not allowed, allowed, every harness forwards, and every harness forwards with a grant held) check that it is absent.
  • The mixed-scope screenshots in the description are refreshed.

This branch has not been deployed

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

Labels

parked Kept open as a request; not on the current plan readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose SSH_AUTH_SOCK forward consent in Settings: a basic git fetch over SSH now requires hand-editing a keystone file, no UI (ergonomics regression)

4 participants