Skip to content

fix(kas): trust the OS certificate store on the bundle route - #32587

Merged
bolichen97 merged 1 commit into
mainfrom
fix/kas-n11-platform
Nov 8, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/kas-n11-platform

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: KAS sessions on Crew's own engine bundle work behind a TLS-inspecting proxy whose CA is in the OS certificate store, as they already do through kiro-cli.

On the bundle route (Crew's own engine and Node, no kiro-cli in the chain), every engine TLS call fails behind such a proxy. Node trusts only its built-in roots unless NODE_USE_SYSTEM_CA is set, and Crew sets nothing (grep NODE_USE_SYSTEM_CA src/ returned 0 hits on main). kiro-cli defaults the variable to 1 when it spawns KAS (apply_node_system_ca_env in crates/chat-cli/src/launch.rs), so the relay route works.

Why it matters

Enterprise hosts behind TLS inspection cannot use the bundle route at all, and the bundle route is where Crew sends users whose kiro-cli cannot run KAS. This is row P0-20 of the kiro-cli to KAS migration gap list.

Not a goal

  • The other rows of batch N11 (P0-5 Windows sandbox, P1-6, P1-10, P1-36, P1-37, P1-38). They are re-checked below and left to follow-ups.
  • Changing the relay route: kiro-cli already sets the variable there.
  • Exporting NODE_EXTRA_CA_CERTS: kiro-cli does not, and the measurement below shows NODE_USE_SYSTEM_CA alone is enough.

What changed (motivation → approach → change)

Symptom: TLS fails on the bundle route behind a corporate proxy. Cause: the bundle's Node runs without NODE_USE_SYSTEM_CA. Change: KasHarness.apply_spawn_env calls env.setdefault("NODE_USE_SYSTEM_CA", "1") in the branch that already detects Crew's own engine bundle (_runs_crew_engine_bundle). An operator's own value, 0 included, is kept, which is kiro-cli's rule too. The launch scrub (sandbox_spawn.scrub_agent_subprocess_env) keeps the variable; checked directly.

Measured on a real OS run. The pinned bundle's Node is 22.23.3 (kas/0.66.33/manifest.json; sha256 of the download checked against the manifest). In a debian:bookworm-slim container, a private CA was added to the OS store only (update-ca-certificates), a local HTTPS server used a leaf signed by it, and the pinned Node fetched it:

--- NODE_USE_SYSTEM_CA unset
TLS FAIL: UNABLE_TO_VERIFY_LEAF_SIGNATURE
--- NODE_USE_SYSTEM_CA=1
TLS OK: ok
--- NODE_USE_SYSTEM_CA=0
TLS FAIL: UNABLE_TO_VERIFY_LEAF_SIGNATURE

Rest of batch N11, re-checked on main 347225fcdc. No open PR covers any of them.

Row State on main Here
P0-20 corporate CA open fixed
P0-5 Windows sandbox open follow-up: needs a real Windows proof (AppContainer, network mode)
P1-6 auto-compact partly fixed by #29335 (explicit thresholds); global session.autocompact_pct not sent follow-up
P1-10 Windows spawn message open (#29253 closed unmerged) follow-up
P1-36 telemetry off open; needs an owner pick of which Crew setting drives it follow-up
P1-37 chat.defaultModel open follow-up
P1-38 old kiro-cli / AL2 AL2 message landed in #29965; stale kiro-cli still only warns follow-up
U5 cedar-wasm measured: node_modules/@cedar-policy/cedar-wasm/nodejs ships in the pinned 0.66.33 linux-x64 bundle no change needed

Backwards compatibility

Compatible: the variable is only added when unset, on the bundle route only; an operator's value is untouched.

Removes nothing: the diff adds one environment default and a test.

Tests

test/test_kas_bundle_system_ca_env.py: the bundle gets 1; an operator 0 or 1 is kept; a relay or unknown binary gets nothing.

Proof: not provable -- other: prove.py returned INCONCLUSIVE (collection error on this AL2 host); a manual revert of kas.py to origin/main makes test_bundle_spawn_trusts_the_os_store fail with KeyError (head 69e5c14)

Manual verification

The container run above, with the pinned Node 22.23.3 binary.

Related Issues

Fixes #32561

Sibling sweep

Swept: git grep -nE "node_bin|build_kas_bundle_argv|NODE_USE_SYSTEM_CA" -- src/
Siblings: none -- the bundle route is the only place Crew itself starts the KAS Node; the relay is kiro-cli's own spawn

Pattern harvest

Not generalizable: a single missing env default for one runtime, mirrored from kiro-cli's own spawn.

Checklist

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

Contribution License Agreement

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d33f04f

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

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 7, 2026
Crew's own KAS bundle runs Node directly, and Node trusts only its
built-in roots unless NODE_USE_SYSTEM_CA is set. Behind a TLS-inspecting
proxy whose CA lives only in the OS store, every engine call failed on
the bundle route. kiro-cli already defaults the variable to 1 when it
spawns KAS, so the relay route worked.

The bundle spawn now defaults NODE_USE_SYSTEM_CA=1. An operator's own
value, 0 included, is kept, as on kiro-cli. The relay is left to
kiro-cli.

Fixes #32561
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design concerns: one setdefault in the bundle branch that already exists, copying the default kiro-cli applies on its own KAS spawn, so the operator's value still wins.

Notes

  • The container run only exercised Linux. Node's system-CA loading uses different OS stores on macOS (Keychain) and Windows (cert store). It adds to the built-in roots rather than replacing them, so it should only widen trust there, but the proof does not cover it.

[DESIGN-REVIEWED] d33f04f

Description read

[DESCRIPTION-READ] 286c04cc933e84b33add0b998bfbbe8961e809095d81c2c8aceea02da0f548d7

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d33f04fc70f357275c1e9a4b3896f50d72423197 — 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. A one-line env default fixes a reported defect (#32561) that the description reproduces, at the point where Crew itself starts the bundle's Node, and an operator's own value still wins.

Not checked: the claim that kiro-cli's launch.rs sets NODE_USE_SYSTEM_CA=1 on the relay route.

What this change ships

Inventory (2 items) — 2 justified

Intent: KAS sessions on Crew's own engine bundle work behind a TLS-inspecting proxy whose CA is only in the OS store. FIX.

  1. On the bundle route, Node now trusts the OS certificate store when the operator has not set NODE_USE_SYSTEM_CA — justified
  2. A new test pins the bundle default, the operator override and the relay being left alone — justified

[FIRST-PRINCIPLES-REVIEWED] d33f04f

Description read

[DESCRIPTION-READ] 5271e62272e174c94cade1c8f79d967e63841a5a798ca22995a119f1f7f66dfb

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

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

Notes:

  • The bundle-route paragraph in docs/system-specs/modules/acp-client.md (around line 4317) lists what apply_spawn_env does on that route. It does not yet mention the new NODE_USE_SYSTEM_CA=1 default.

[OPUS-REVIEWED] d33f04f

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

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

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 8, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving d33f04f as maintainer. All 97 checks pass. Fixes #32561.

On the engine-bundle route, apply_spawn_env now sets NODE_USE_SYSTEM_CA=1 with setdefault, so an operator's own value, 0 included, still wins. Node then trusts the OS certificate store as well as its built-in roots, so a corporate CA in the OS store works, the same default kiro-cli applies when it spawns KAS. The relay route is unchanged and left to kiro-cli. The three tests pin the bundle default, the operator override and the untouched relay spawn.

@bolichen97
bolichen97 merged commit 9b5bbfb into main Nov 8, 2026
97 checks passed
@bolichen97
bolichen97 deleted the fix/kas-n11-platform branch November 8, 2026 03:12
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 8, 2026
buluoray added a commit that referenced this pull request Nov 8, 2026
Crew's own KAS bundle runs Node directly, and Node trusts only its
built-in roots unless NODE_USE_SYSTEM_CA is set. Behind a TLS-inspecting
proxy whose CA lives only in the OS store, every engine call failed on
the bundle route. kiro-cli already defaults the variable to 1 when it
spawns KAS, so the relay route worked.

The bundle spawn now defaults NODE_USE_SYSTEM_CA=1. An operator's own
value, 0 included, is kept, as on kiro-cli. The relay is left to
kiro-cli.

Fixes #32561

(cherry picked from commit 9b5bbfb)

Original author: @iamwhatever
buluoray added a commit that referenced this pull request Nov 8, 2026
Crew's own KAS bundle runs Node directly, and Node trusts only its
built-in roots unless NODE_USE_SYSTEM_CA is set. Behind a TLS-inspecting
proxy whose CA lives only in the OS store, every engine call failed on
the bundle route. kiro-cli already defaults the variable to 1 when it
spawns KAS, so the relay route worked.

The bundle spawn now defaults NODE_USE_SYSTEM_CA=1. An operator's own
value, 0 included, is kept, as on kiro-cli. The relay is left to
kiro-cli.

Fixes #32561

(cherry picked from commit 9b5bbfb)

Original author: @iamwhatever
buluoray added a commit that referenced this pull request Nov 8, 2026
Crew's own KAS bundle runs Node directly, and Node trusts only its
built-in roots unless NODE_USE_SYSTEM_CA is set. Behind a TLS-inspecting
proxy whose CA lives only in the OS store, every engine call failed on
the bundle route. kiro-cli already defaults the variable to 1 when it
spawns KAS, so the relay route worked.

The bundle spawn now defaults NODE_USE_SYSTEM_CA=1. An operator's own
value, 0 included, is kept, as on kiro-cli. The relay is left to
kiro-cli.

Fixes #32561

(cherry picked from commit 9b5bbfb)

Original author: @iamwhatever
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.

KAS bundle route: corporate CA in the OS store is not trusted (no NODE_USE_SYSTEM_CA)

2 participants