Skip to content

feat: AgentCore identity, inbound inject, and Gateway MCP access - #6387

Closed
kyleseaman wants to merge 1 commit into
mainfrom
feat/agentcore-identity-impl-1b02
Closed

kyleseaman wants to merge 1 commit into
mainfrom
feat/agentcore-identity-impl-1b02

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Review notes

Squashed to one commit on current main (includes #6264 governance distribution). Security Settings keeps both the central-distribution block and AgentCore Identity.

Please review as workload V1 + login attach. An existing AWS_IAM Gateway + standalone AgentCore identity + credentials that can InvokeGateway can be wired from Settings without a restart. Login inbound is wired (companion JWT → Authorization: Bearer sidecar; no JWT → oauth_challenge sidecar). The remaining live gap is kiro-cli's hosted Authorize hop (_kiro.dev/mcp/oauth_request) — designed and unit-covered, not yet driven against AgentCore.

Known documented limits (not this PR):

  • Desktop/Homebrew PEP 668 cannot pip install kirocrew[agentcore] (venv extra is fine)
  • CFN instance-role Invoke stays gateway/kirocrew-*; Settings customers with their own creds can invoke a pasted existing Gateway
  • Phase 5 GetResourceOauth2Token stays out — Gateway already vends outbound OAuth

Problem / Motivation

A deployed Crew can have an AgentCore Identity and talk to AgentCore Gateway, but the public default wheel must not import AWS SDKs, persist inbound JWTs in ~/.kiro/agents/kirocrew.json, or treat a companion enabled() flag as permission. Login posture also has to withhold Kiro's default MCP merge until Gateway is attached for that session. A launched box that opted in still needs to actually fetch tokens — including a box that configured identity later, without the CFN --agentcore flag. The Gateway MCP URL also has to be authorable on that crew, not only as a launch env var. kiro-cli does not SigV4-sign InvokeGateway, so a raw Gateway URL on workload posture cannot authenticate. Once wired, an operator debugging a 403, a stale catalog, or a PENDING_AUTH target still had a blank URL box and no way to see what the Gateway actually exposes.

Why it matters

Without this path, Settings can name a posture and CFN can create a workload identity, but the agent never actually reaches Gateway MCP tools. Tokens in the agent file would leak into every session and into backups. An expired sidecar without a session recycle would leave kiro-cli presenting a dead JWT until restart. Shipping fetch only in an out-of-tree companion left the IaC path as identity-without-vending. Installing the extra only at launch left Settings-configured crews on the no-op adapter. An env-only Gateway URL left a local/already-running crew unable to point at an existing Gateway. An unsigned workload URL left IAM Gateways returning 403. Without a catalog, the operator cannot tell a posture/authorizer mismatch from a missing target, a stale DEFAULT listing, or a workload name that cannot vend.

What changed (motivation → approach → change)

Single implementation PR, rebased onto main. The docs-only plan (#6362) is closed as superseded. Spec-builder commits that accidentally rode along are gone.

Goal: a Crew that names an identity and a Gateway URL can actually use that Gateway's MCP servers — and the operator can see why it is or is not working. AWS fetch is an opt-in extra installed by IaC or when identity is configured, not a default-wheel import and not a kirocrew.plugins companion (that would flip the enterprise profile).

Approach: sidecar path + localhost SigV4 proxy. Crew already writes 0600 MCP env sidecars and injects servers on session/new. Header-proxy MCP is not implemented.

  • CPP agent_identity slot + capabilities.agentcore postures
  • Policy.json instance siblings + successor boundary + login MCP withhold
  • Session principal derivation (injected envelopes are not a user)
  • CFN AWS::BedrockAgentCore::WorkloadIdentity + Settings → Security see/configure
  • Workload inbound: rebuild emits a URL-only spec. The extra rewrites that URL to a 127.0.0.1 SigV4 proxy (platform/agentcore_sigv4.py, service bedrock-agentcore) so kiro-cli can InvokeGateway. Fail closed if the proxy cannot start. A WAT is never a Gateway bearer
  • Login inbound: 0600 session sidecar. A companion JWT becomes RFC 6750 Authorization: Bearer. Without one, the sidecar is URL-only (oauth_challenge) so kiro-cli can start its MCP OAuth challenge (_kiro.dev/mcp/oauth_request, already surfaced as Authorize). Login attach always writes the https Gateway URL, never the SigV4 proxy, even when leftover env posture is still workload
  • 3LO consent allowlist (allow_agentcore_consent_url / oauth_endpoints.json) + GET /api/agentcore/consent; unknown hosts 403 consent_host_refused
  • Unattended: login never attaches for cron: / taskrunner: keys; workload user/OBO without vaultedOwnerToken writes a deny sidecar (disabled: true)
  • Expired inbound JWT recycles that session's ACP child (SessionManager.remove, map preserved) before re-attach — not an mcp_gateway blue-green drain
  • kirocrew[agentcore] extra (platform/agentcore_aws.py): lazy boto3 GetWorkloadAccessToken / ForJWT. Bootstrap swaps only agent_identity on standalone when opted in
  • Force-install on configure: Settings PUT (workload/login) and standalone boot call ensure_extra() so kirocrew[agentcore] lands in the gateway interpreter when the home policy or env posture is already set. GET never pips. Desktop/PEP 668 reports no_install_channel
  • Gateway URL + workload name in Settings/policy: capabilities.agentcore.gateway_url and workload_name are policy-only like posture. Runtime prefers the authored home file over leftover systemd env. Settings-only empty stays unnamed — do not invent kirocrew. Launch env posture without a systemd name still uses the RFC default. PUT posture-on without a name is 400 workload_name_required. resolved_posture() is policy-first the same way
  • Hot-apply Save: owner-dashboard PUT (is_owner_dashboard_request, same gate as consent GET) reloads the home file onto the running ceiling and AWS adapter (apply_agentcore_runtime) and rebuilds the agent config. restart_required stays true only when that apply cannot attach the extra
  • Verify = agent path: catalog tools/list on workload+IAM goes through the same localhost SigV4 proxy kiro-cli uses. A green tools check is no longer a direct signed POST to the Gateway hostname. Proxy start failure is proxy_unavailable.
  • Live session inject: workload attach still clears the sidecar (IAM, no JWT). session_gateway_servers injects the live loopback SigV4 listen URL onto session/new so kiro-cli outranks a stale agent-file port after a gateway restart. The unsigned https Gateway hostname is never injected. The proxy prefers 127.0.0.1:18765 (KIROCREW_AGENTCORE_PROXY_PORT overrides; bind failure falls back to ephemeral)
  • Gateway catalog / verify / tools: Settings → Security → Identity lists targets (type, status, last sync, PENDING_AUTH) and the data-plane tool catalog. Verify runs GetGateway + authorizer-vs-posture + URL match + tools/list. Workload catalog also vends-and-discards a WAT so a wrong or Gateway-linked identity name shows as the identity check (service_linked / identity_denied / not_named); login skips that probe. Sync refreshes a DEFAULT listing-mode target. Saving identity invalidates the catalog query so a posture/name change does not leave a stale green snapshot. Owner-only GET/POST /api/agentcore/gateway. Instance IAM inspect SID on gateway/* (Invoke stays on kirocrew-*). Catalog invoke_scope is credential-proved: green when tools/list just invoked via the SigV4 proxy, so a pasted existing Gateway is not falsely red. Prefix is the unproved fallback; a data-plane 401/403 is invoke_denied. ListOauth2CredentialProviders is not on this pane
  • IaC: install.sh --agentcore when AgentCorePosture != none; systemd KIROCREW_AGENTCORE_GATEWAY_URL; CLI --agentcore-gateway-url (https only)

Screenshots / video

Captured against the tagged e2e Gateway kirocrew-e2e-n9pk1rdrea / standalone identity kirocrew-e2e in account 199621702461 / us-east-1. Settings → Security → Identity. Files live under temp-screenshots/agentcore-identity/.

Unset — posture Off

Workload form filled

Live catalog — all checks green

Full pane, login vs IAM mismatch, service-linked name, mobile

Full Settings pane with catalog

Login vs IAM authorizer mismatch

Service-linked identity name rejected

Mobile identity form

Saving identity invalidates the catalog query so a posture/name change does not leave a stale green snapshot. Save also hot-applies, so the restart banner is gone on a successful apply.

Tests

test/test_agentcore_inspect.py (URL parse, snapshot codes, mocked control plane, live Lambda targetConfiguration shape, identity check, invoke-scope proved via proxy / prefix fallback / invoke_denied, app-token refuse, no token material), test/test_agentcore_sigv4.py (region parse, localhost proxy forward, https-only ensure), test/test_agentcore_aws.py (mocked boto3 and pip; WAT probe discards the token; Settings-only empty name stays unnamed; hot-apply swaps ceiling+adapter), test/test_agentcore_gateway_inject.py (login URL-only OAuth-challenge sidecar; companion JWT → Bearer), test/test_agentcore_consent.py, test/test_agentcore_unattended.py, plus identity / IAM / principal / CPP / cloud launch coverage. SecurityPanel vitest covers verify, tools list, name-required Save disable, and the service-linked identity hint.

Manual verification

Live against account 199621702461 / us-east-1 using local IAM (trackout-email). Tagged stack kirocrew:e2e=true left in-account.

  • AWS_IAM MCP Gateway kirocrew-e2e-n9pk1rdrea (READY) + standalone identity kirocrew-e2e + Lambda target echo-hello
  • Catalog + Settings verify: READY, AWS_IAM, URL match, kirocrew-* invoke scope, tools/list echo-hello___echo_hello
  • Workload SigV4 localhost proxy: MCP initialize, tools/list, tools/call ({"message":"hello proxy"})
  • Unsigned Gateway and WAT-as-Authorization both 401. WAT vends (opaque). vend_gateway_inbound_token without a user JWT is None
  • Identity probe (vend-and-discard): standalone kirocrew-e2e → ok; Gateway-linked kirocrew-e2e-n9pk1rdrea → service_linked; default kirocrew → identity_denied. Token never in the snapshot
  • Policy workload_name / gateway_url / posture win over leftover systemd env. Settings login against this IAM Gateway shows the authorizer mismatch
  • Login sidecar is the https Gateway URL (not 127.0.0.1) and emits Authorization: Bearer
  • Lambda Sync returns not_syncable. Target type is inferred from mcp.lambda because GetGatewayTarget omits targetType

Leftover-validation pass (live): Homebrew Python is PEP 668 (pip install kirocrew[agentcore] exits 1; venv extra is ok). ListOauth2CredentialProviders is empty; GetResourceOauth2Token against a missing provider is ValidationException — Phase 5 stays out. Non-kirocrew-* Gateway existing-customer-oonks9wcjt is invoke-green under admin via proxy and invoke_denied under kirocrew-e2e-instance. CUSTOM_JWT Gateway kirocrew-e2e-jwt + tagged Cognito test IdP: unsigned 401; Cognito IdToken + allowedAudience initialize/tools/list 200; product login attach writes oauth_challenge without a JWT and Authorization: Bearer with one. kiro-cli's hosted Authorize challenge was not driven.

Still open (not v1 blockers): kiro-cli hosted MCP OAuth challenge; MCP initialize on this Gateway does not return mcp-session-id; Phase 5 GetResourceOauth2Token; desktop/PEP 668 extra; widening Invoke to gateway/*.

Live on this pass (instance-role + MCP_SERVER): assumed-role kirocrew-e2e-instance (not admin) catalog/WAT/tools/list/Sync all green. MCP_SERVER target public-docs / 2L1SFWDBDE is READY, inferred from mcp.mcpServer, syncable, and lists public-docs___ tools next to the Lambda echo tool. FAILED targets now show AWS statusReasons in Settings.

Live on the agent-path honesty pass: assumed-role kirocrew-e2e-instance catalog tools/list reports via=proxy, gateway_mcp_spec() is http://127.0.0.1:<port>/mcp, and tools/call echo-hello___echo_hello succeeded through that listener. Isolated rebuild persists the proxy URL.

Existing-Gateway honesty pass: catalog invoke_scope greens when tools/list succeeded via the SigV4 proxy, even if the Gateway id is not kirocrew-*. Prefix remains the unproved fallback. IAM documents are unchanged. Settings copy is credential-honest (this crew's AWS credentials), not instance-role-only.

OOTB session-inject pass: session/new injects the live loopback proxy URL on workload (companion https specs still inject []). Preferred listen port is 18765. Isolated kiro-cli 2.20.1 rejected {name, url} (untagged enum McpServer); inject is now {name, type: http, url, headers} and deny uses a disabled HTTP placeholder. Isolated KIRO_HOME session/new overrode the stale agent-file port, launched agentcore-gateway through the SigV4 proxy, and emitted _kiro.dev/mcp/server_initialized. Did not write ~/.kiro/agents.

Related Issues

Supersedes #6362

Checklist

  • At most two commits (one feat commit)
  • Tests added; AgentCore suites green
  • Docs updated (RFC, plan Task 7, cloud.md, platform-context.md, session.md, mcp.md, governance.md)
  • No bedrock-agentcore SDK imports; boto3 is lazy inside the opt-in extra

Security follow-up

Verified the review findings against this branch and closed the ones that still held:

  • HIGH — agentcore-inbound is now on _CREW_SECRET_LEAVES (read+write+extract, both home prefixes). Same-UID 0600 is not a ceiling.
  • MEDIUM — unattended bind/attach errors write a deny sidecar (reason=attach_failed) + SEL agentcore.unattended_denied so a workload agent-file Gateway cannot stay reachable. Human dashboard turns still do not fail solely because attach raised.
  • MEDIUM — GET /api/agentcore/consent and PUT /api/agentcore/identity are owner-dashboard-cookie only (is_owner_dashboard_request); app tokens 403 dashboard_owner_required. Catalog/verify/sync use the same owner gate.
  • MEDIUM — probe_instance_invoke_gateway() remains a public no-op False (companion override). Comments/docs now say False is "no mismatch detected", not "IAM inbound is impossible."
  • SigV4 proxy — 127.0.0.1 only; forwards solely to the configured Gateway host+path; never logs Authorization; WAT is still never a Gateway bearer.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 27, 2026
@kyleseaman
kyleseaman force-pushed the feat/agentcore-identity-impl-1b02 branch from aa4c009 to ce23e6c Compare August 27, 2026 20:03
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 98508c4e20d6c866e0b79b34f6a2d0fa65598979.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/platform/bootstrap.py:192 -- Optional installation blocks gateway readiness (origin: validation)

extra_code = ensure_extra()
Configured posture -> gateway boot -> synchronous pip subprocess (up to 180 seconds) -> dashboard socket and readiness are delayed.
Anchor: no-new-work-on-gateway-boot-path
Fix: Defer installation until after readiness or an explicit Settings action.

BLOCKING -- src/kiro_crew/dashboard/handlers/agentcore_identity.py:527 -- Hot apply leaves pre-change Gateway credentials live

applied = apply_agentcore_runtime()
Active workload/login session -> posture disabled or changed -> context updates without stopping the proxy or recycling ACP sessions -> old Gateway access remains usable.
Anchor: residual/security
Fix: Stop the proxy, clear sidecars, and recycle affected sessions before reporting runtime apply success.

BLOCKING -- src/kiro_crew/platform/agentcore_aws.py:131 -- Workload proxy signs requests to arbitrary HTTPS hosts

return url
Operator-supplied non-Gateway HTTPS URL -> workload MCP proxy -> SigV4 headers, including the AWS session token, are forwarded to that host.
Anchor: residual/security
Fix: Restrict accepted URLs to valid AgentCore Gateway hostnames in supported AWS partitions.

FINDING -- src/kiro_crew/dashboard/handlers/files.py:842 -- link.channel_type == "telegram" removes existing Discord document delivery despite the AgentCore-only scope -> Fix: Restore the Discord branch and its removed send_document transport methods. (origin: validation)

[BLOCK-MERGE] 98508c4
[GPT-REVIEWED] 98508c4
False positive or not applicable? A repository writer can comment:
/ai-review override gpt 98508c4e20d6c866e0b79b34f6a2d0fa65598979: <one-sentence reason>

@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 Aug 27, 2026
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of 98508c4e20d6c866e0b79b34f6a2d0fa65598979 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Failed connection checks read as passing: affirmative labels with an aria-hidden warn icon, plus raw enum codes appended.

Watch

  • CheckRow renders failure as ⚠ Inbound auth matches this identity · AWS_IAM (screenshot 05): the label asserts the positive, the icon carrying the negation is aria-hidden, and the detail is a raw code (login_needs_sign_in, AWS_IAM) with no CATALOG_CODE_HINT entry — screen-reader users hear the inverted meaning and skimmers see codes; hits every failed verify, persistent. Fix: failed rows get a negative label variant (or visible "Failed" text) and map details through the hint table with a humane fallback.
  • agent_identity_tools_empty hedges — "inbound auth may not match, or this identity cannot call the Gateway" — while data.checks holding the authorizer and invoke results is in hand at the render site; users are sent guessing at states the panel already displays. Branch the message on the checks, or drop the guesses.
  • instance_policy_hint "Instance role only — do not attach this to the launch principal" is the one line preventing a privilege misconfiguration, rendered muted 12px beside two visually identical copy buttons; promote the warning out of muted styling.

Suggestions

  • Rail summary reuses the full option label ("Workload — reach the gateway with…", truncated in screenshot 04); use short state words like RemoteCrewPanel's posture_workload ("Workload").
  • agent_identity_sync_ok says "Refresh in a moment" but no control is named Refresh; say "then Verify connection to see the new catalog."
  • Screenshot 06 shows the identity-mismatch sentence twice (banner + check detail, same string via catalogHint and checkDetailLabel); suppress the duplicate in one place.

[UX-REVIEWED] 98508c4

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🔴 BLOCK (blocking)

Design-level review of 98508c4e20d6c866e0b79b34f6a2d0fa65598979 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: BLOCK

The squashed commit was built from a stale tree: merging it silently reverts the last four commits on main alongside the AgentCore work.

Blockers

Watch

  • The unauthenticated loopback SigV4 proxy signs any request with credentials the agent is otherwise denied (~/.aws is a sensitive path), so on workload posture the agent can curl 127.0.0.1:<port> and invoke Gateway tools directly, bypassing the PreToolUse governance gate that the login-posture JWT sidecar (agent-unreadable via _CREW_SECRET_LEAVES) does not bypass.
  • Settings PUT running ensure_extra() makes a config save also a live pip install: network failure or a partial install now shares a failure domain with policy writes, and the installed extra can skew against the running wheel version.

Suggestions

  • Move the 1.3 MB of temp-screenshots/ binaries out of the tree (attach to the PR instead); once merged they live in history forever under a name that promises removal.

[DESIGN-REVIEWED] 98508c4

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🔴 BLOCK

Premise-level review of 98508c4e20d6c866e0b79b34f6a2d0fa65598979 — 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/CONCERNS are advisory.

All evidence is in hand. The AgentCore body itself is thoroughly declared and boundary-derived; the fatal problem is that the squash silently reverts four commits that landed on main after the author's working tree was taken, while the description claims the branch sits on current main with riders removed. The screenshots are fine — temp-screenshots/<feature>/ is the documented prepare-pr convention.

First-Principles-Verdict: BLOCK

The squash silently reverts four shipped main commits — Discord document sends, a lockfile CI gate, and two test-determinism fixes — while claiming to sit on current main.

What this change ships

Intent: let a crew that names an AgentCore identity and Gateway URL actually reach that Gateway's MCP tools, visibly to the operator. ADDITION.

  1. Settings → Security gains an AgentCore Identity pane with hot-apply save — justified
  2. Gateway target + tool catalog with verify/sync for debugging 403s — justified
  3. Workload posture reaches Gateway via a localhost SigV4 proxy — justified (kiro-cli cannot SigV4-sign; protocol constraint)
  4. Login posture: per-session 0600 bearer sidecar, non-Gateway MCP withheld — justified (governance-ceiling boundary)
  5. kirocrew[agentcore] extra auto-installs when identity is configured — justified
  6. IaC surface: CFN WorkloadIdentity, install.sh --agentcore, CLI/env Gateway URL — justified
  7. Injected cron/subagent envelopes never bind a user principal — justified (untrusted-input boundary)
  8. 3LO consent allowlist behind the oauth_endpoints.json keystone — justified
  9. Discord PDF/document delivery degrades back to dashboard links — undeclared rider (revert)
  10. Lockfile-floor CI job, its guard test, the @pierre/theming pin, session-sharing polling, and the GRADLE_OPTS marker all deleted — undeclared riders (reverts)

Blockers

Four main commits are silently reverted by the squash. git merge-base of head 98508c4e2 and main 66b803537 is main itself, so every deletion is real shipped change, contradicting "Squashed to one commit on current main" and "Spec-builder commits that accidentally rode along are gone":

One root cause — the squash was built from a pre-66b803537 tree. One subtraction resolves all four: rebuild the squashed commit on current main and drop every hunk in discord/*, files.py's Discord branch, ci.yml, test_node_version_pins.py, website/package{,-lock}.json, test_session_sharing.py, and test_terminal_commands.py.

Watch

  • docs/request-for-change/README.md adds a row asserting "Nothing. … no AgentCore import under src/kiro_crew/" in the very commit that adds platform/agent_identity.py and three sibling modules — the audit table is false on merge; the RFC also stays status: draft while its implementation ships.

[FIRST-PRINCIPLES-REVIEWED] 98508c4

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — 🔴 changes requested (blocking)

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

Command injection: the AgentCoreGatewayUrl deploy parameter reaches the systemd unit heredoc unconstrained, so a crafted value injects a [Service] directive that runs on the instance.

[BLOCK-MERGE] 98508c4
BLOCKING — src/kiro_crew/cloud/templates/kirocrew-ec2.yaml:139

  AgentCoreGatewayUrl:
    Type: String
    Default: ""
    MaxLength: 512

and (line 718) Environment=KIROCREW_AGENTCORE_GATEWAY_URL=${AgentCoreGatewayUrl}
A deploy with AgentCoreGatewayUrl containing a newline (CFN String params allow them; MaxLength alone does not forbid them) → !Sub substitutes it verbatim into the heredoc that writes /etc/systemd/system/kirocrew.service, so the injected ExecStartPre=+/bin/sh -c "…" lands as its own [Service] line → systemctl enable --now executes it as root at boot. This re-opens exactly the user-data-injection boundary the file's own AllowedPatterns defend ("a leaked launcher credential…"), which its two siblings AgentCorePosture (AllowedValues) and AgentCoreWorkloadName (AllowedPattern) — both also written into this unit — already close.
Fix: give AgentCoreGatewayUrl a newline-free AllowedPattern (e.g. "^$|^https://[A-Za-z0-9._~:/?#@!$&'()*+,;=%-]{1,505}$"), mirroring the sibling params.

[OPUS-REVIEWED] 98508c4

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 98508c4e20d6c866e0b79b34f6a2d0fa65598979: <one-sentence reason>

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Aug 27, 2026
@kyleseaman kyleseaman changed the title feat: AgentCore identity seams, Settings, and inbound token inject feat: AgentCore identity, inbound inject, and IaC token fetch Aug 27, 2026
@kyleseaman kyleseaman changed the title feat: AgentCore identity, inbound inject, and IaC token fetch feat: AgentCore identity, inbound inject, and Gateway MCP access Aug 28, 2026
@kyleseaman
kyleseaman force-pushed the feat/agentcore-identity-impl-1b02 branch from 4d1a77f to 4da61df Compare August 28, 2026 16:21
@kyleseaman
kyleseaman marked this pull request as ready for review August 28, 2026 16:23
@kyleseaman
kyleseaman requested review from a team and CrysisDeu August 28, 2026 16:23
@kyleseaman
kyleseaman force-pushed the feat/agentcore-identity-impl-1b02 branch from 73424eb to e04ce52 Compare August 28, 2026 16:30
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Aug 28, 2026
Wire an existing AgentCore Gateway and standalone identity onto a crew
from Settings. Workload posture vends a first-party WAT and reaches the
Gateway over a localhost SigV4 proxy; login posture injects a per-session
sidecar and withholds non-Gateway MCP until the operator signs in.
@kyleseaman
kyleseaman force-pushed the feat/agentcore-identity-impl-1b02 branch from e04ce52 to 98508c4 Compare August 28, 2026 17:41

@kyleseaman kyleseaman left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Security/code review found four blocking trust-boundary issues plus a regression from current main. I left inline details and concrete failure paths. The commit also removes the Discord name-preserving document-send capability that landed in parent commit #6500; that unrelated reversion should be restored along with the Node-floor guard called out inline.

path.parent.mkdir(parents=True, exist_ok=True)
payload = json.dumps(data, indent=2, sort_keys=False) + "\n"
tmp = Path(str(path) + ".tmp")
tmp.write_text(payload, encoding="utf-8")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P1] Use a non-following atomic temp-file primitive for this keystone write. security_policy.json.tmp is not covered by the sensitive-path floor (is_sensitive_path(.../security_policy.json) is true while the .tmp sibling is false), so a same-UID agent can pre-create it as a symlink. write_text() then follows that link and replace() promotes the symlink itself to security_policy.json; after the operator saves once, the agent can edit the symlink target and weaken the next loaded ceiling. I reproduced that exact sequence locally. Please use the project's exclusive owner-only atomic-write pattern (or mkstemp/O_EXCL plus link checks and replace) and add a regression test with a pre-planted .tmp symlink.

handler = self._handler_class()
preferred = preferred_bind_port()
try:
httpd = ThreadingHTTPServer((PROXY_HOST, preferred), handler)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P1] Loopback binding is not client authentication. This handler accepts an unauthenticated MCP body from any local process and signs it with the instance-role credentials; the fixed preferred port makes discovery trivial. A prompt-injected agent can call this URL through shell/network tooling and issue tools/call directly, bypassing the MCP PreToolUse/governance/approval path because the request reaches the signer as ordinary HTTP rather than as a governed tool call. This also reintroduces the RFC's stated inability to distinguish Crew from a sibling/compromised local process. Please require a capability/peer credential at the proxy before signing, scoped so arbitrary tool subprocesses cannot use it, and cover rejection of an unauthenticated loopback request.

systemd ``KIROCREW_AGENTCORE_POSTURE=workload`` cannot hide a
Settings ``login`` from catalog, probe, and ``gateway_mcp_spec``.
"""
authored = authored_posture()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P1] Resolve these values from the selected Level-1 ceiling, not directly from the tier-4 home file. load_security_policy() gives env override / central distribution / bundled policy precedence over home, and GovernanceCeiling already carries agentcore_identity_posture, agentcore_gateway_url, and agentcore_workload_name; this home-first resolver bypasses that ordering after boot. For example, a centrally distributed login policy can still have its JWT sent to a different home-authored Gateway URL, while a central workload policy plus a stale home login value makes gateway_mcp_spec() return the unsigned HTTPS URL instead of the SigV4 proxy. Use the installed ceiling accessors for runtime decisions (with a narrowly defined pre-bootstrap fallback if needed), and refuse/accurately report Settings writes when a higher-precedence ceiling is active.

)
except Exception:
logger.debug("publish_turn_identity failed for %s", session_key, exc_info=True)
if surface and raw_id:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P1] The fail-closed principal logic is not wired into the actual non-dashboard turn paths. Every existing channel/cron caller still invokes publish_turn_identity(sessions, session_key) without surface/raw_id, so this branch never runs; cron also calls it after get_or_create, which is too late for session/new. Consequently a workload cron using user/OBO credentials never gets the promised deny sidecar and falls through to _workload_live_proxy_servers(), while Slack/Discord/etc. in login posture never receive a principal or Gateway. inherit_parent_principal() is likewise only referenced by tests, not the subagent path. Please bind ground-truth identities before acquisition on every surface (or centralize it in session acquisition), and test real cron/channel/subagent entry paths rather than only calling the helper directly.

Comment thread .github/workflows/ci.yml
# exists because that is a property of today's dependency tree, not a guarantee:
# the next package with an unsatisfiable optional peer reintroduces the whole
# class, and without a job on the floor nothing would notice.
lockfile-engines-floor:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P1] Please restore this current-main guard. The PR's parent already contains #6553, but this commit removes both the Node 22 npm ci job and its matching @pierre/theming override/test. That change was added because npm 10 and npm 11 produce different optional-peer trees and the supported Node 22 install had already broken twice while all Node 24 jobs stayed green. Removing the fix and the only floor runner together silently reopens the production install regression; it is unrelated to AgentCore.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Superseded by GitHub stack #6601, split by independent security/trust boundaries (not by directory). Each PR is merge-safe and inert by default. The unrelated Node/theming and Discord reversions from this monolith are not in the stack.

  1. feat: AgentCore core interfaces and governance schema #6594 — Core interfaces and governance schema (no AWS)
  2. feat: AgentCore principal propagation (default-off) #6595 — Principal propagation (default-off)
  3. feat: AgentCore AWS provisioning and adapter #6597 — AWS provisioning and adapter
  4. feat: AgentCore Workload Gateway integration #6598 — Workload Gateway integration (SigV4 proxy)
  5. feat: AgentCore login attach and consent #6600 — Login attach and consent
  6. feat: AgentCore dashboard identity settings #6602 — Dashboard management UI

Review the stack, not this 111-file PR.

@kyleseaman kyleseaman closed this Aug 28, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Aug 28, 2026
@bolichen97
bolichen97 deleted the feat/agentcore-identity-impl-1b02 branch September 6, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant