Repository navigation
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the maintainer asked for the scheme-1 refusal in #34319, and only fleets that turn on Notes
[DESIGN-REVIEWED] 6ff9df6 Description read[DESCRIPTION-READ] a4cffd8d16d457ca0d638d8188abc37f22343802c35902d45ad79c68cb6cfcd2 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item comes from the maintainer-filed defect #34319 or follows from it, and it all applies only when What this change shipsInventory (10 items) — 9 justifiedIntent: a fleet that requires app signatures should run only the code the publisher signed, so an app whose files changed after signing is refused. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 6ff9df6 Description read[DESCRIPTION-READ] f86c0596059da573841ab830a1bb47f02caf2a0ab3ef6f3018be9f7e32404ed6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING --
BLOCKING --
BLOCKING --
BLOCKING --
[BLOCK-MERGE] 6ff9df6 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F4: This is anchored to False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: Request changesWhy: the decider found 3 problems and estimates an 80% chance that this change introduces a defect, at or above the 80% level where it asks for changes. I'm requesting changes. The PR's goal is that, on a fleet with Problems found:
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 |
|
Re First Principles item 9 ("rides along; harm unnamed"): the redaction is not extra scope. This PR adds a new refusal, the signed-package check. Its detailed reason carries the app name and a file path the publisher wrote into
So the fixed classification ( |
6a1d626 to
2c39c00
Compare
|
This PR and #34469 both fix #34319: they bind an app's signature to its whole manifest and a SHA-256 inventory of its packaged files, and they change 28 of the same files, including |
2c39c00 to
15c90a7
Compare
15c90a7 to
ed663bc
Compare
ed663bc to
d5707f9
Compare
d41223d to
86765be
Compare
86765be to
3963552
Compare
3963552 to
f072509
Compare
|
A maintainer ruling is needed on two GPT 6.1 security-class findings on head c43e134. Both came after the last fix round, so this PR does not change code for them. Both are now under Known limitations in the description.
The lane's adjudicator flagged both as edge cases. Options per finding: accept it as a known limitation (an override that records the decision), or ask for a fix in this PR or a follow-up. |
|
Rebase only: The re-run lanes raised two findings on this head. Both are added to the open list under the owner's no-more-patches rule, and are not fixed here:
GPT also repeated the listed case-insensitive Backend Tests shard 3 is main's red #37243 ( |
|
Rebase only: head |
|
Two things on
|
|
Rebase: head Import cap: the same commit raises each ceiling in The GPT 6.1 finding on the rebased head ( |
|
Rebase: head Import cap: main raised each ceiling in No code changed. The open findings and the fenced rulings listed under Known limitations still wait as before. |
|
Head |
Under require_signature the app admission gate accepts only signature scheme 2: an HMAC over the complete app.json object, which carries a SHA-256 inventory of the packaged files. Install, update, the cloned registry checkout, enable, boot and restart check the files, and app_execution_denied applies the same check for every app root it is given. Unlisted files stay allowed. The builtin exemption needs a shipped package under the policy. kirocrew app sign writes the signature. Without the policy nothing changes. Refs #34319
|
Head |
|
Status on head
Next step for whoever picks this up: make the signed-first runner set the globals |
Problem / Motivation
Goal: On a fleet that requires app signatures, an app whose packaged files changed after the publisher signed it is refused at install, update, activation and every point where its code is registered or run.
The App Kit admission policy (
app_admission.json,require_signature) checks a signature over selected manifest fields only (AppManifest.signing_payload). No packaged file is bound, so a signed app's backend, hooks, agents, skills or UI bundle can be swapped with the signature still verifying. After install, only manifest fields are rechecked at enable, boot and restart, and nothing rechecks content where code is registered or run.Why it matters
A fleet turns on
require_signatureto run only publisher-approved code. Today the signature approves a description of the app, not the app: anyone who can change files in the package or in the installed app folder runs their code under the publisher's signature.Not a goal
require_signature.Intended? / Repro
Intended? No. The maintainer filed #34319 with the expected behavior: under the signature policy the signature binds the complete manifest and every packaged file, and install, update, activation and executable-resource registration refuse content that no longer matches. Code on main 4022acf:
src/kiro_crew/apps/manifest.py:851-1055(signing_payload) builds the signed bytes from selected manifest fields; no file content goes in.src/kiro_crew/apps/admission.py:162-176(_signature_valid) verifies only that payload.src/kiro_crew/apps/manager_activation.py:160andsrc/kiro_crew/apps/backend_runtime/startup.py:113,:189skip admission for any record whose writableinstalled.jsonsaysorigin: "builtin".Repro (by reading main; no local test run on this host): fleet policy
{"mode": "enforce", "require_signature": true, "trust_keys": {"acme": "<key>"}}. Sign an app'sapp.jsonthe scheme-1 way, install it, then replacebackend/app.pyin the installed folder.enable_app, boot and restart callapp_admission_denied(name, manifest=...), which recomputes the field payload. It still matches, so the app is admitted and the replaced backend runs. Settingorigin: "builtin"in the app's owninstalled.jsonskips admission entirely.What changed (motivation → approach → change)
Symptom → cause → change:
Signature scheme 2 (
src/kiro_crew/apps/package_signature.py, new). The HMAC (the sharedplatform.admission.hmac_signature) covers the whole parsedapp.jsonobject exceptsignature, throughcanonical_signing_bytes. The object carriessignatureScheme: 2andsignedFiles, a SHA-256 for each packaged file.inventory_refusalpins each directory through its parent (pinned_directory,child_if_real_dir) and opens the file through the pin (dir_fd-relative withO_NOFOLLOWon POSIX,open_file_no_reparse(links_only=True)on Windows), with anfstatregular-file check, so a link or junction at the file or above it is refused. Inventory keys that are absolute or contain..,., empty parts,\or:are refused with plain string checks (no regex). On POSIX, digests are cached by the opened file'sfstatidentity, so one activation reads each file once. On Windows, wherest_ctimeis the creation time, every check hashes again.AppManifest.documentkeeps the parsed object;to_dictleavessignedFilesout of app listings.Code paths must be signed.
declared_code_paths/unsigned_code_path, one rule: a path counts when it resolves to a file inside the app folder and is code. Code means an agent, skill or SOP, the backend entry point, a hook module (exactly{base}.py, the fileload_app_moduleopens), a cron script, a UI entry, or in MCP command/args,setup,openCommandand cron commands: the command word when it is a path, an interpreter's script argument, a-mtarget, or a.py/.js/.mjs/.cjs/.shword. Data words (state.db) never count. Paths are normalised (posixpath.normpath, backslashes as/); a relative path that leaves the folder is refused, a systempythonis not a packaged file. A code path underdata/,node_modules,.venvor another name the inventory builder leaves out can never be listed, so it is refused under the policy (no special case).Admission (
src/kiro_crew/apps/admission.py). Underrequire_signature, only a valid scheme-2 signature is admitted; scheme 1 gets a re-sign message.app_admission_denied(app_root=...)checks the package there. It is passed by:install_appandupdate_app, on the source (built-in adoption goes throughupdate_app;kirocrew app importoutput installs throughinstall_app);install_clone);enable_app, the boot resource pass and restart, onapp_dir(name).Execution and registration boundaries (
src/kiro_crew/apps/execution.py).app_execution_denied(manifest=...)takes the manifest the caller is about to act on. Given that and anapp_root, it:app.json;package_signing_payloadbytes for anAppManifest, or canonical JSON of the whole projection exceptcontributes. A caller with no manifest gets its own reason.Callers that pass a manifest: backend spawn; hook enable, boot and reconcile; bridge registration of agents, skills, MCP servers and crons (including the boot cron restore, now off the loop); lifecycle scripts;
openCommand. The async callers run the gate throughasyncio.to_thread.Audit rows. A signed-package refusal is a
PackageRefusal: astrthat also carries a fixed classification (signed_package_mismatch/signed_package_unverified). Every audit row that records an admission or execution refusal writes only that classification andresources="signed_package", never the app name or a path. That covers install, update, enable, self-registration, the three registry gates, the cloned-checkout gate, boot, restart and its backstop, andapp_execution_denied. The detailed reason still goes to the caller. The execution side reads the policy without an audit row per call; an unreadable policy counts as requiring signatures.Bytecode beside a signed
.py. Under the policy:The gateway starts an app's backend, the stdio MCP servers whose command is a Python interpreter itself (
python,python3.12,pythonw; never a console script such aspython-lsp-server) and cron scripts with-B -X pycache_prefix=<that spawn's own dir>right after the interpreter (signed_pycache_flags), which still holds under-E/-I.Those, plus lifecycle scripts,
openCommandandonInstall, also getPYTHONPYCACHEPREFIXandPYTHONDONTWRITEBYTECODE(signed_pycache_env). The dir is fresh and empty for each spawn (see Per-spawn bytecode cache).In-process hook modules compile from source (
_SourceOnlyLoader). Asys.path_hooksentry scoped to a signed app's root (_SignedFirstFinder, dropped on unload) imports the listed file when a module name has one, before any unlisted extension, package directory or bytecode of that name. Otherwise it keeps the stock search, including a listed bare.pyc.The same finder runs in the Python children the gateway builds the argv for (
src/kiro_crew/apps/signed_first.py, new, stdlib-only;module_loadernow imports it from there). The backend (plain and ASGI/uvicorn), stdio MCP servers and app cron scripts startpython [options] <abs>/signed_first.py <app> <target>(admission.signed_first_python_args); the shim installs the finder and runs the target throughdeps_boot's dispatch (launch_entries/run_target, split out ofdeps_boot.mainunchanged). The checked list (app, resolved root, every entry of the verifiedsignedFileswith its signed SHA-256, so an extensionless script or a.pyztarget is re-hashed too) is never written to a file; the shim is inserted whenever that inventory is non-empty, and its finder compares only importable names. A child the gateway spawns itself, the backend and a cron script, reads it from a pipe only that child inherits (admission.signed_first_pipe:pass_fdson POSIX, ahandle_liston Windows;KIROCREW_SIGNED_FIRST_FDholds the number). A stdio server is spawned by kiro-cli, so no fd can reach it; the gateway writes its list to<kiro agents dir>/.kirocrew-signed-first/<app>.jsonand its launch-config env holds only that path (KIROCREW_SIGNED_FIRST_LIST); the file is in the kiro agents tree, which every sandboxed spawn already mounts read-only (src/kiro_crew/sandbox_tiers.py:45_resolved_kiro_agents_targets, applied atsrc/kiro_crew/sandbox_argv.py:401). No new seal or mask. The shim reads the list once, before any app code, drops both variables, and refuses to run without a list for its app. So an unlistedbackend/app/__init__.pybeside a signedbackend/app.py, an unlistedworker/package beside a signedworker.pyunder-m, and an unlistedhelpers/beside a signedhelpers.pydo not load; an unlisted module whose name nothing signed uses imports as before.With the policy off, argv, env, spawn arguments, launcher text and loaders are as on main: no pipe, no variable, no file.
The gateway's npm installs. Under the policy only, the Node backend install runs
npm ci --omit=dev --no-audit --no-fundwhenpackage-lock.jsonexists andnpm install --production --no-audit --no-fund --no-saveotherwise; the registry build step runsnpm ci, ornpm install --no-save. The signed lockfile decides the versions and is never rewritten. With the policy off both argvs are unchanged.Built-ins (
builtin_admission_exempt). With the policy on, the exemption needs a shipped package under that name, not only anorigin: "builtin"record. It never raises.Dev mode. The
ui/skip applies only under the existing operator grant (dev_mode.dev_mode_granted_root), bound to the current resolveduiroot, when that root resolves outside the install (the--confirm-out-of-install-rootcase). Everyui/path the manifest names as code (agents, skills, SOPs, hooks, backend entry, cron script, MCP command, args and-mtargets,setupandopenCommandscripts) stays checked, compared case-folded; only the UI entry modules dev mode serves live are skipped. An in-installui/is always checked. No new bypass was added.Publisher command.
kirocrew app sign <dir> --signer <id>reads the key fromKIROCREW_APP_SIGNING_KEY(never argv) and writes all four fields.Registration sources and deferred launches (policy on only). The agent-config rebuild (
agent_materialization/mcp_sources.py,_collect_app_mcp_servers) runsinstalled_package_refusalon each app before taking its live spec or manifest fallback, so a server registration refused stays out. A builtin is recognised only from this build's own package (shipped_builtin_app_root), never from the data home or the app folder, and skips that check. Third-party crons register from the verified manifest (_cron_defs_from_manifest), never from the app-writableapp-crons.json; every caller (enable, boot, install route, CLI, boot restore, prune) goes throughbridges_crons._admitted_app_cron_defs.run_script_sandboxedre-checks an app script's package at every fire, before the spawn. Ownership comes from both the persisted path and the resolved file: a path under an app must resolve to that same app's listed regular file, so a signedjob.pyswapped for a link elsewhere is refused. The resolved file is opened once (no link followed at it), its bytes are checked against the signed digest, and the launcher runs exactly those bytes, handed over through the shim's pipe; it does not read the file again. The checked list handed to a child carries every signed file's SHA-256, and the shim re-hashes them before the target runs, which covers stdio servers that kiro-cli starts long after registration. A cron script spec is split drive-aware (cron_script_paths._split_script_spec), soC:\...\job.py:runis checked as that file. The signed-first path hook claims directories only, asFileFinder.path_hookdoes, sorunpy.run_path(<script>)still runs a script entry.Code-path rules (policy on only). A command word (MCP
command, croncommand,setup,openCommand, the backend entry) that names a file inside the app folder is code whatever its extension, so an extensionlesslaunchmust be signed; a systempython3ornpxnames no packaged file. MCP command and arguments are expanded as the runtime expands them (env.expand_spec_args) before the check, so a${HOME}argument naming an unsigneddata/server.pyis refused. A package directory beside a signed module of the same name (worker/besideworker.py) wins the import, so every module file in it must be signed too (signed_first.unlisted_package_files), at admission and again in the child. Contributed UI entries (sessionControlsand the rest) are checked like any other manifest-named path. Every hash this PR adds opens the file once and hashes that handle:O_NOFOLLOWon POSIX,open_file_no_reparsein the gateway on Windows, and in the stdlib-only shim a reparse-point andsamestatcheck of the name against the open handle.Child recheck exceptions. The checked list names
uncheckedentries the shim does not re-hash: exactly theui/files the dev-mode grant leaves out at admission (_ui_skip), and the listed files under directories the spawn hides (a granted cron's script folder), which the gateway checked at that spawn; the finder still uses the whole list. Clustered Python options (-Bm worker,-Bmworker,-Bc code) are split as Python consumes them before the shim takes the target's place. The rebuild's manifest fallback prepares a Python stdio spec with the same signed launch as registration (bridges_mcp._signed_stdio_launch: flags, shim, checked list), and an exempt shipped builtin's servers come from its shipped manifest (_registration_source), never the installed copy.Per-spawn bytecode cache. Each spawn gets its own fresh, empty bytecode cache dir:
admission.new_pycache_dirmakes a 0700mkdtempdir under<data home>/run/app-pycache/(gateway-owned, read-only to sandboxed children, never the sharedcache/app-pycache/<name>), passed as both-X pycache_prefix=andPYTHONPYCACHEPREFIX. It is removed when the child exits: a cron script in the run'sfinally; a lifecycle script,onInstallandopenCommandwhen the gateway's wait on the asyncio child returns (release_pycache_dir_after); a backend on stop, on a failed spawn, or when the next spawn replaces it (backend:<app>). kiro-cli starts stdio MCP servers, so their dir lives per registration (mcp:<app>): each re-registration makes a new one and removes the old, the agent-config rebuild reuses the held one, and deregistration removes it. Dirs a crashed gateway left behind stay, empty, underrun/app-pycache/.Builtin exemption. A shipped builtin skips admission only while everything its installed manifest runs is this build's shipped code: its
backend,mcpServers,crons,setupandopenCommandequal the shipped manifest's in the form the builtin install writes it (discovery._manifest_to_builtin_dict, through JSON), so an unmodified installed builtin matches and only an added or changed executed item differs, and a module-style backend entry resolves inside the shipped package (shipped_builtin_module_path); otherwise it takes the full signature and inventory checks (admission._runs_only_shipped_code). A module-style backend entry the build does not ship for the app (http.server) is checked against the installed folder at spawn. The shim's per-file hash follows no link or junction anywhere below the app root.Load preparation off the loop. For a third-party hook or route load,
module_loader.prepare_signed_load(the verified-inventory read and the realpath scan of the importer cache) runs in a worker thread when the caller is on the event loop (signed_load_off_loop, used byRouteRegistry.register_app_routesandLifecycleDispatcher._invoke);load_app_modulethen applies it without I/O. Unload drops signed roots by their recorded spellings with no I/O. The backend spawn log line names only the command and its argument count, never the argv.Stdio checked list by file. The checked list for a stdio server kiro-cli starts is no longer an environment value:
signed_first_launch_envwrites it tosigned_first_list_path(app)in the kiro agents tree (already read-only to every sandboxed spawn) and the env names only that path, so the launch env stays small whatever the inventory size. The shim opens the file once, no link followed, regular files only; deregistration removes it. Backend and cron children keep the inherited pipe.Self-registered apps keep main's launch.
signed_first_payloadapplies the same_self_registeredtest admission uses (alifecycle: "app"record, no manifest code in the folder, only allowed entries), so a real self-registered app gets no shim and no list.Shim imports never shadow a signed app module. The shim snapshots
sys.moduleson its first line. Before the target runs, every module cached since then (by the shim,deps_bootorrunpy, e.g.json,zipfile) whose top-level name a signed file provides at the top of the app's import path (the script's directory, or the app root for-m/-c) leavessys.moduleswith its submodules, so the app's own module wins, as on main;sys,os,builtins,importliband anything loaded before the shim are never dropped, and the shim keeps its own module references. Link checks work on interpreters older than 3.12: withoutos.path.isjunctiona Windows junction is read fromlstat's reparse-point attribute, and the shim anddeps_bootparse under the 3.8 grammar.Docs, same commit:
docs/app-kit/manifest-reference.md,docs/system-specs/modules/app-kit-platform.md§38,docs/system-specs/modules/security.md,docs/system-specs/modules/cli.md.Design not taken: refuse any file the inventory does not list (strict). It lost because it refuses every registry app whose build step or
onInstallwrites output into its checkout, and every app that writes into its own folder outsidedata/. The chosen rule refuses a missing, changed, non-regular or relinked signed file, and a manifest code path that is not signed.Review fixes on 05d340e (after the rebase onto main bebda6d, where main's §38 took the number; after the rebase onto main ee52eac, where main added §39 and §40, this PR's section was §41; after the rebase onto main 549cc1a, where main added §41, it is §42):
app-kit-platform.mdsection is renumbered §41 and the two§39links incli.mdandsecurity.mdfollow it;manager_install.pyandcli_commands.pykeep both main's and this PR's imports.§41links incli.mdandsecurity.mdfollow it, andmodule_loader.pykeeps both main'sseamsimport and this PR'sverified_signed_filesimport._restore_deniedto the boot cron restore inapps/bridges_crons.py; it now calls this PR's_cron_restore_denied, so the unreadable-record branch also passes the source manifest to the execution decision.kirocrew app signparsesapp.jsonwithloads_user_json, asAppManifest.from_json_filedoes, so a manifest with a leading UTF-8 byte-order mark signs as it installs (Opus 5.5 on cf7d433). Test:test_a_manifest_with_a_byte_order_mark_signs_and_is_admitted.O_NONBLOCK, so a FIFO in their place gets the existing not-a-regular-file refusal instead of hanging MCP, backend or cron startup (GPT 6.1 on cf7d433). The gateway side already opened withO_NONBLOCK(PinnedDirectory._open_file). Tests:test_a_fifo_in_a_listed_files_place_is_refused_without_a_writer,test_a_fifo_as_the_checked_list_file_is_refused_without_a_writer.Known limitations
Medium: Hash-to-use window. Files are hashed at each boundary and read again by the loader, interpreter or shell that runs them. A process that can write the app folder can swap a listed file in between. The boundaries include every cron fire and every stdio server start (the shim re-hashes the listed files against the signed digests); the check does not run continuously.
Medium: Child-process shadowing of unsigned names. Unlisted files are allowed. In a Python child the gateway starts, the script's own folder comes first on
sys.path, and the signed-first finder only decides names a signed file uses, so an unlistedjson.py(or a dependency name) beside a signed script still shadows the standard library or that dependency for that child.Low: Launches the gateway does not build the Python argv for. Python started through an exec backend's shebang, a cron
command, or a lifecycle,openCommandoronInstallshell line gets no signed-first finder, and with-E/-Ialso keeps the stock bytecode behaviour (it still gets the environment variables otherwise). A gateway-built launch whose shape the shim cannot take (-x, a--before a dash-led operand) keeps the stock import order.Medium: Windows stdio servers. App children on Windows run without an OS sandbox, so nothing seals the kiro agents tree there, and an app child could rewrite the launch config that carries its stdio servers' checked list (and their command). Backend and cron children on Windows get the list over an inherited handle and are not affected.
Medium: Writable-path limit. A file the inventory does not list is not checked, apart from the code paths the manifest names. Sealing the installed tree is the separate decision named in the issue.
Low: Build output must not touch signed files. The registry checkout is checked before the build and
install_appchecks the built tree, so a build step oronInstallthat rewrites a committed file is refused. Publishers sign only files that ship unchanged (documented).Low: Re-sign required. Under
require_signature, scheme-1 signatures stop being admitted until the publisher runskirocrew app sign.Medium: Self-registered first-boot rule.
register_external_appand the registry prefetch have no package on disk, so only the manifest signature is checked there. A self-registered app keeps that rule at every later enable, boot, restart and execution boundary only while all three hold: its record sayslifecycle: "app", no code path its verified signed manifest names is an existing file inside the app folder (its agents, skills and commands live elsewhere), and the folder holds nothing beyondapp.json,installed.json,approved-grants.json(an older install's copy: fix: keep app approvals and the owner's disable out of the app's tree #34177 moved the approved set tomember-records/app-grants/and its import leaves the old file),.app_secretanddata/. The record is app-writable, so it never decides this alone; otherwise the full inventory and code-path checks run. Test: a registry app withlifecycleforged to"app"and a changed listedbackend/app.pyis refused.Low: Unreadable policy. A present but unreadable
app_admission.jsonalso counts as requiring signatures at the execution boundaries, not only at install and enable.Low: Cost of each check. Under the policy, each boundary opens and
fstats every listed file and reads a file again only when itsfstatidentity changed (every time on Windows). With the policy off, the added work per decision is onestatofapp_admission.jsonplus a deep copy of each parsed manifest.Low: Code paths under dropped names. A code file under
data/,node_modules,.venvor another namebuild_file_inventoryleaves out can never be insignedFiles, so a signing fleet refuses a manifest that names one.Low: Overlap with fix(apps): mint app tokens only for owner-enabled apps #34251 (merged). It also touches
manager_activation.py,manager_external.pyandapp-kit-platform.mdand addshost_exec_grants; the overlap is in files only. This PR does not reuse its grant record as a self-registration marker: no real self-registered app ships code in its installed folder, so the folder contents and the signed manifest decide the skip without a new trust record.Medium, fails closed: GPT 6.1 on c43e134 (security-class, machine-flagged as an edge case): a backend or stdio MCP server launched through the dependency shim (
deps_boot.pyinsidesigned_first.py) hastarget[0]set to the shim, so_yield_namesevicts nothing (src/kiro_crew/apps/signed_first.py:392). A signed app that ships its own module under a name the shim already imported (backend/json.py) gets the stdlib copy and fails to start with anImportError. Nothing unsigned runs. A maintainer rules on it (see the PR comment).Medium: GPT 6.1 on c43e134 (security-class, machine-flagged as an edge case): under the operator's out-of-install
ui/dev grant, an ABSOLUTEsetup,openCommand, MCP or cron path into the installedui/is not mapped back to an inventory path, so a changed file there is not checked (src/kiro_crew/apps/admission.py:278). The relative spelling is refused. Same class as the f6faf61ui/server.mjsfinding above. A maintainer rules on it (see the PR comment).Open review findings (not fixed in this PR)
-Xflags but not the env vars, so a grandchild Python reads__pycache__(src/kiro_crew/cron_script.py:382).-X(src/kiro_crew/apps/backend.py:1077).sh -c '...',cd sub && ...ornode -e(src/kiro_crew/apps/package_signature.py,_argv_groups).src/kiro_crew/apps/signed_first.py:129). A signed package listed asWorker/but imported asworkermisses the match, so an unlistedWorker/helper.socan win over the signedhelper.pyinside the gateway. GPT 6.1 raised it again on 85c30d0 (security-class, so it blocks that lane), also naming the child-side finder (signed_first.py:426), and again on 6e7b967 (fenced, upheld). Listed under the owner's no-more-patches rule.ui/grant, an absolute MCP argument that names<app_root>/ui/server.mjsis skipped by the inventory check, so a changedui/script can still be registered and run (src/kiro_crew/apps/admission.py:277). Listed under the owner's no-more-patches rule.node_modulesis checked before the gateway'snpm ci/npm install. An npm lifecycle script can then rewrite the signed entry point before Node starts, and Node has no child-side recheck (src/kiro_crew/apps/backend.py:1035). Listed under the same rule.require_signaturewas turned on is reused by_collect_app_mcp_serverswithout the signed-launch preparation (src/kiro_crew/agent_materialization/mcp_sources.py:170). The next re-registration prepares it. GPT 6.1 raised it again on 05d340e (security-class, upheld; it also names the app-agent spec copies inagent_capabilities.pyandbridges_agents.py). Left open under the owner's last-pass rule; a maintainer rules on it.PinnedDirectory._open_file,manager_tree._COPY_IGNORE);_owning_rootiterates a dict another thread may change;cron_scriptimports the app layer even with the policy off; Windows rehashes every check; line growth insrc/kiro_crew/apps/backend.pyandsrc/kiro_crew/apps/registry_pipeline/install.py;contributesis left out of the projection compare (src/kiro_crew/apps/admission.py,_acted_on_refusal).Backwards compatibility
Compatible for fleets without
require_signature: admission, activation and every execution boundary decide exactly as on main. No child argv or environment changes, the module loader uses the stock loaders, and the npm flags are unchanged.verified_signer(provenance only, never denies) also names a valid scheme-2 signer.AppManifest.to_dictdrops onlysignedFiles, a key nothing before this change wrote. Audit rows for refusals other than a signed-package refusal are written as before.Breaking for fleets that set
require_signature: a scheme-1 signature is no longer admitted. This is the re-sign requirement the issue asks to document. Also, anorigin: "builtin"record for a name this build does not ship no longer skips admission, and a signed manifest whose code path inside the app is not insignedFilesis refused. Writer sweep on origin/main @ 4022acf: no shipped built-in carries a signature (test_no_shipped_builtin_carries_a_signature). The only in-repo writers of app signatures are tests, updated here to sign with scheme 2 (test_app_manager.py,test_external_registry.py). The scheme-1 payload tests now read the provenance check (test_app_signing_payload_*).Reader: src/kiro_crew/apps/admission.py:verified_signer -- app -- accepts either scheme, so provenance for scheme-1 apps is unchanged | test_a_signature_issued_under_the_pre_change_payload_still_verifies
Reader: src/kiro_crew/apps/manager_activation.py:enable_app -- app -- real shipped built-ins keep the exemption through shipped_builtin_app_root | test_a_builtin_is_not_refused_by_admission_under_require_signature
Reader: src/kiro_crew/apps/backend_runtime/startup.py:start_enabled_app_backends -- release -- same exemption at boot | test_builtin_still_boots_under_require_signature
Reader: src/kiro_crew/apps/builtin_adoption_checks.py:admission_refusal -- release -- an unsigned adoption stays refused under the policy, as before | test_an_admission_policy_blocks_visibly_then_adopts_once_relaxed
Reader: src/kiro_crew/apps/manager_lookup.py:get_app -- crew page -- the listing loses only signedFiles, which no reader consumes | test_app_package_signature_boundaries.py::test_a_boundary_judges_the_manifest_the_caller_acts_on
Tests
test/test_app_package_signature.py:make_escaping_link), one under a linked directory (make_dir_link), and a listed path that is not a regular file. Unlisted files are tolerated.signedFilesis refused under the policy and admitted with it off. A systempython -mcommand is not a packaged file. A file an MCP argument names must be signed. A hook needs exactly{base}.pysigned, and a hook underdata/is refused; a data word in args (state.db) does not count; a path that normalises out of the folder is refused; only a Python interpreter itself counts as one (python-lsp-serverdoes not). The digest cache skips stamps within 2 s of the hash (clock injected).kirocrew app signreads its key from the environment.test/test_app_package_signature_boundaries.py:AppManifestdocument), gives its own reason to a caller with no manifest, and refuses when the check raises. Code from a shipped built-in package is exempt, and the built-in exemption falls back to provenance when the policy cannot be read.app_execution_denied.ui/under the grant skips only non-codeui/files, so aui/agent and aui/script named bysetupstay checked; an in-install grant skips nothing..pyc(asserted inside the app root) is run by the stock loader (control) and not by_SourceOnlyLoader; a hook's sibling import skips it; a signed module wins over an unlisted package of the same name; a listed bare.pycstill imports. An autouse fixture restoressys.path_hooks, the signed roots and the digest cache.test_app_package_signature_children.py, real subprocesses through the shim, list handed over a pipe as the gateway does): an unlistedbackend/app/__init__.pydoes not stand in for the signed ASGIbackend/app.py(control: a plain launch picks the package),-m workerruns the signedworker.pyover an unlistedworker/package, an unlisted helper that shadows nothing still imports, and app code that forges its list (a planted list file, both channel variables, a pipe of its own) still gets the signedhelpers.py. The shim refuses to run with no list or another app's. Without the policy the argv helpers, the launch env and the pipe are all empty and nothing is written; with it the shim sits at the launch target (including-mworker) and only importable entries are handed over.test_app_package_signature_children.py): a script entry runs through the shim; the shim refuses a listed file changed after the list was made; a cron script changed after activation is refused at the next fire (control: the signed script reaches its spawn); a job planted inapp-crons.jsonis not registered; a refused app's MCP server is not restored by a config rebuild (control first); a drive-qualified cron script names its file; a signedjob.pyswapped for a link to an unsignedcrons/file is refused; a changed extensionless signed MCP target is refused at child start; mochi's MCP servers survive a rebuild under the policy; a data-home app whoseinstalled.jsonandapp.jsonclaim to be builtin is still checked and refused when unsigned.sessionControlsentry is refused; a${HOME}argument naming an unsigneddata/server.pyis refused; the shim refuses a listed file reached through a link (make_escaping_link);["-Bm", "worker"]launches through the shim; the child skips exactly the dev-modeui/files admission skips, and an edited skipped file does not stop it; a granted signed cron reaches its spawn; a server added to an installed builtin's manifest is not emitted; the manifest fallback spec carries the shim. The link-swap cron test usesmake_escaping_linkand no longer skips on Windows.http.serverloses its exemption while the unmodified one keeps it; the granted-cron test reaches its spawn behind a wrapped argv.register_builtin_appswrites them, stay exempt, and enable, boot and restart all decide through that exemption; one with an added stdio server loses it and is refused unsigned; thehttp.servercase still refuses; the boot test's fake shipped root now has the manifest a real one has; the load preparation runs off the loop thread and the load reuses it.test_app_signed_first_unit.pycalls the shim in-process (read_checked by pipe, file, missing, other app, forged or malformed list, linked or non-file list path; the finder's signed-wins, package, extension and pass-through cases; the directory-only path hook; install and cache dropping; the per-file hash and recheck on match, mismatch, missing, linked file, linked directory, non-regular; main's usage, refusal and success paths) with sys import state restored after each test. A ~300 KiB list keeps the stdio launch env under 4 KiB and the shim still reads it; a self-registered app's launch carries no shim and no list.Child-environment sites, each asserting the flags or keys under the policy and their absence without it:
test_app_backend_spawn_env.py, argv and env;test_app_bridges_mcp.py, args and env;test_lifecycle_scripts_cov80.py;openCommand:test_app_execution.py;onInstallenv helper and cron script argv:test_app_package_signature_children.py.test_app_package_signature_children.pyalso pins both npm argvs, policy on and off.test_app_bridges_mcp.pychecks a console-script server keeps its args.test_app_package_signature_boundaries.pychecks a self-registered app is judged by its manifest signature only, and that the enable route audits only the classification.test_apps_registry_identity_admission.pychecks that the cloned-checkout gate is handed the checkout asapp_rootand audits only the classification.Updated for the new contract:
test_app_manager.py,test_external_registry.py,test_app_backend_spawn_env.py,test_app_signing_payload_executed_fields.py,test_app_signing_payload_resource_and_ui_fields.py,test_apps_registry_identity_admission.py,test_app_bridges_agent_configs.py,test_app_bridges_mcp.py,test_hook_reconcile.py,test_app_sync_keeps_crons.py,test_apps_routes_coverage_update_uninstall.py,test_app_backend_composition_contract.pyandtest_apps_registry_composition_contract.py(new frozen names).Proof: not provable -- other: this host forbids local test runs, so prove.py was not run; CI runs the suite
Manual verification
N/A: CI runs the unit tests for each gate and boundary. Static gates were run locally with the repo pins (black 26.10.1 on touched non-baselined files, isort 6.0.0, flake8 7.1.0, mypy 1.14.1 on touched files), plus
check_comment_history,check_brand_name,check_file_line_capandcheck_sync_io_in_async.Related Issues
Refs #34319
Sibling sweep
Swept: git grep -n "app_admission_denied(|app_execution_denied(|origin") != "builtin"|origin != "builtin"" -- src/kiro_crew/apps
Sibling: src/kiro_crew/apps/registry_pipeline/install.py -- changed here -- onInstall gets the out-of-folder bytecode cache; its post-build gates run before install_app, which checks the files
Sibling: src/kiro_crew/apps/manager_external.py -- not affected -- self-registration ships no files; its later registrations check app_dir
Sibling: src/kiro_crew/apps/builtin_adoption_checks.py -- not affected -- adoption installs through update_app, which checks the files
Sibling: src/kiro_crew/cron_script.py -- changed here -- an app cron script child gets the pycache-prefix flags
Sibling: src/kiro_crew/apps/backend_runtime/supervision.py -- not affected -- re-asks about a running backend with no app root; it runs no new code
Sibling: src/kiro_crew/apps/module_loader.py -- changed here -- loads hook modules after the hook gate; under the policy it compiles from source
Pattern harvest
Rule candidate: review-prompt
Pattern: a signature or trust check over a description of executable content (manifest fields) instead of the content itself
Known limitations
src/kiro_crew/apps/backend.py1,909 vs 1,819 on main,src/kiro_crew/apps/manifest.py1,618 vs 1,610,src/kiro_crew/apps/registry_pipeline/install.py1,736 vs 1,699,test/test_app_bridges_agent_configs.py1,621 vs 1,616.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.