Repository navigation
fix(apps): degrade a non-list value for a manifest list field - #24453
iamwhatever merged 1 commit into
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the guard sits in the parser that owns these fields, and the two restricting fields ( Notes
[DESIGN-REVIEWED] e9c5833 Description read[DESCRIPTION-READ] f05513aaf8e4b1e88a5cb381b941dabb8fc6c19be17e8d4916fdb6bf6ddedc74 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, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This is a fix at the mechanism level: the grep below finds no What this change shipsInventory (7 items) — 7 justifiedIntent: make an app manifest with a
Unfixed siblings: grepped [FIRST-PRINCIPLES-REVIEWED] e9c5833 Description read[DESCRIPTION-READ] 18e1d5479950bd3dbf90e4d53929832ff9fdde33efb5cb298628de49b630731b That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
Replies to the two non-blocking notes on 08ebf6d:
|
08ebf6d to
589ccc5
Compare
|
Pushed 589ccc5 (still one commit, rebased on main 66c0a87). CI shard 5 on 08ebf6d failed |
|
Fixed in 1cc5587, which addresses the blocking finding on 589ccc5 from both GPT 6.1 and Opus 5.5 ("invalid OS values silently widen support on enable"). A non-null, non-list |
589ccc5 to
1cc5587
Compare
|
CI on 1cc5587: the two failing shards are outside this diff (which touches only
All four AI reviews on this head are PASS with no blocking findings. The one remaining Design Review note (track the |
1cc5587 to
cb0689f
Compare
cb0689f to
ab77391
Compare
|
Both blocking findings on cb0689f are addressed in ab77391 (still one commit):
prove.py |
|
CI on 27b5d72: every AI review is PASS or has no blocking findings (Design, First Principles, GPT 6.1, Opus 5.5). This diff touches only
Once #24530 merges, I'll rebase once, which also picks up #24531. |
27b5d72 to
7381cbd
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Requesting changes for a missing follow-up issue; the code itself looks sound.
The fix guards all eight list reads in manifest_sections.py. platform.os and publishProvider.kinds fail closed instead of widening, and the registry client-install gate now reads the parsed os. Tests cover every field and value shape. CI is green and every AI lane is PASS or has no blocking findings.
Blocker: the same present-non-list hazard is still in manifest.py for crons, agents, skills, sops, tags and jobFamilies (manifest.py#L975, #L1041-L1062). The PR defers it under Not a goal, and Design Review on this head asks for an issue, but none was filed. A stray null in crons still fails install with a TypeError. Please open one issue covering those six sites and link it in the PR description. Folding the same isinstance(..., list) guard into manifest.py here also clears this.
Reviewed head: 7381cbd423061c0861c86279f9ae6dc4a2948d64.
— crew-pr-reviewer (r131)
Fourteen list fields in the app manifest iterated data.get(key, []) directly: the top-level crons, agents, skills, sops, tags and jobFamilies, and in the typed blocks ui.pages, dependencies.capabilities mcp/skills/agents, platform os/arch, publishProvider.kinds and notifications.channels. When the key is present with a non-list value, get returns that value instead of the default. A hand-edited null or number raised TypeError out of AppManifest.from_dict, so the manifest failed to parse instead of degrading, and a string was split into single-character entries. The module's contract is that a wrong JSON type degrades to the field's empty value; ui.overlays already guards exactly this. Iterate each of those fields only when it is a list, the overlays shape. Every non-list reads as the field being absent. Two fields restrict rather than add, so a wrong type must not widen them: - platform.os restricts where an app runs. A null reads as unset and keeps the default of macos and linux. Any other non-list parses to an empty os, which supports no platform, so a reader that never calls validate() (the enable path's supports_platform check) fails closed. The value is also recorded and refused by validate(). - publishProvider.kinds restricts which artifacts a provider publishes, and an empty list means every kind. A null reads as unset. Any other non-list makes the provider serialize to nothing, so the artifact page never offers it. The registry install's platform gate read os from the raw manifest JSON, so the same null or number reached supports_platform and the OS label and the endpoint answered HTTP 500. It now reads the parsed os. Well-formed lists parse as before.
7381cbd to
e9c5833
Compare
|
@iamwhatever The six manifest.py sites (crons, agents, skills, sops, tags, jobFamilies) are now guarded in this PR, with failing-first tests for each, on e9c5833. |
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does the review scope was never resolved: the generate job did not finish (it timed out, failed or was cancelled), so no leg ran; its log names the step that stopped No |
|
Design Review note on e9c5833 (a non-list publishProvider.kinds drops the provider with no validate() message): leaving that out of this PR, which is about not crashing or widening on a wrong type; a validate() refusal for kinds is listed under Not a goal and fits a small follow-up. |
iamwhatever
left a comment
There was a problem hiding this comment.
Approve at e9c5833.
My previous request is cleared: the six top-level list reads in manifest.py (crons, agents, skills, sops, tags, jobFamilies) now carry the same isinstance(..., list) guard, with tests (manifest.py#L975-L981, #L1046-L1080). The two restricting fields fail closed: a non-list platform.os supports no platform and validate() refuses it, and a non-list publishProvider.kinds offers the provider for no kind (manifest_sections.py#L943-L964). The client-install gate reads the parsed os, so it no longer returns a 500 (install.py#L559-L565).
AI findings judged non-blocking:
- Design Review note, a non-list
kindsdrops the provider without avalidate()message: on main a string already matched no kind silently and a number crashed the parse, so this adds no new harm, and wrong-type validation is an explicit Not a goal (manifest_sections.py#L1019-L1034). - Security Scope Review comment showing BLOCK: it came from a run that never finished; the newer Security Scope Review check on this head concluded success with no security-surface path touched.
The GPT and Opus lanes have no findings, and every check on this head is green.
— crew-pr-reviewer (r134)
Problem / Motivation
Goal: An app manifest with a
null(or other non-list) value in a list field installs with that field empty instead of failing to parse.src/kiro_crew/apps/manifest_sections.pydocuments its parsing as defensive: "a wrong JSON type degrades to the field's empty value".ui.overlaysfollows that rule. Fourteen other list fields iteratedata.get(key, [])directly: inmanifest_sections.py,ui.pages,dependencies.capabilitiesmcp/skills/agents,platformos/arch,publishProvider.kindsandnotifications.channels; inmanifest.py, the top-levelcrons,agents,skills,sops,tagsandjobFamilies. A key that is present with a non-list value is returned bygetinstead of the default. A hand-editednullor a number then raisesTypeErrorout ofAppManifest.from_dict, and a string is split into one-character entries.Why it matters
AppManifest.from_dictruns on the registry-install admission pass and onPOST /api/apps/register, and neither catches aTypeError. One straynullin an optional field (e.g."crons": null) therefore fails the whole install or registration with a traceback, when that one field should simply be ignored. The string case silently produces nonsense values instead, e.g."arch": "arm64"becomes five one-letter architectures.Not a goal
What changed (motivation → approach → change)
TypeErrorout ofAppManifest.from_dict(null, number, bool) or is split into characters (string).dict.get(key, [])returns the stored value when the key exists, so the[]default never applies to a presentnull.list, the sameisinstanceshapeUIConfig.from_dictalready uses foroverlays. Every non-list degrades to[], exceptplatform.os, which restricts where an app runs and so must never widen:"os": nullreads as unset and keeps the absent-key default["macos", "linux"]."os": "windows", a number) fails closed. It parses to an emptyos, whichPlatformConfig.supports_platformmatches against no host, and the value is recorded onPlatformConfig.os_type_invalidsovalidate()refuses it asplatform.os: unknown value .... The enable path's client-app check (routes_enable._client_install_manifest→supports_platform) never callsvalidate(), so an empty list is what keeps it from running anonEnablescript where the author restricted the app. On main, the character split made that check fail as well. The marker field iscompare=Falseand never serialized, the same shape asCronEntry.type_invalid_fields.publishProvider.kindsrestricts too. An empty list means every kind (PublishHub.tsx:if (p.kinds.length && !p.kinds.includes(kind)) continue), so a wrong type must not degrade to it."kinds": nullreads as unset. Any other non-list is recorded onPublishProviderConfig.kinds_type_invalid, andto_dict()then serializes the provider to nothing.collect_publish_providersreads the serialized manifest, so the artifact page offers that provider for no kind. The parse has to fail closed itself because a self-managed app'sapp.jsonnever passes install validation. Adding avalidate()refusal for it is out of scope (see Not a goal).manifest.pyAppManifest.from_dict:crons,agents,skills,sops,tagsandjobFamiliesget the same guard, inline at each site. A non-list reads exactly as the key being absent: no crons, agents, skills or SOPs are registered and no tags or job families are listed. None of these widens anything, since an empty value already means "declares nothing" (discovery.pyandto_dict()omit them). The installed-app view (get_app→to_dict()) and the uninstall preview read the parsed manifest, so they no longer see the rawnulleither. Open PR feat(apps): list a third-party app's agentTools on an opt-in prompted kirocrew-apps server #17015 also editsAppManifest.from_dict(it adds fields); these hunks change existing lines only.registry_pipeline/install.pyinstall_from_registry: the client-install platform gate readosfrom the raw registry JSON, so"os": nullor a number reachedPlatformConfig(os=...).supports_platformand the OS label as a non-iterable, and the endpoint answered HTTP 500. It now reads the parsedadmission_manifest.platform.os, sonullgives the default and any other non-list supports no platform, the same as the enable path. feat(governance): let a policy govern extension install, app versions and app dev mode #24373 (now merged) edited a different hunk of this function, the admission call just above it; this hunk is the platform gate below it, and the rebase onto it was clean.The guard is inlined at each site rather than shared through a new helper.
test/test_manifest_facade.pyrequires every name an owner module defines to be re-exported throughkiro_crew.apps.manifest, and this PR does not touch that file.Backwards compatibility
Compatible: every list value parses exactly as before. Only a non-list value changes. It used to raise
TypeError(null, number, bool) or yield single-character or dict-key entries (string, object). Now it yields the field's absent-key value. A non-null non-listplatform.osstill supports no platform and is still refused byvalidate(), as on main; it just no longer raises first. A non-null non-listpublishProvider.kindsmakes that provider unavailable; on main a string happened to match no kind (split into characters) and a number failed the whole parse, so neither ever offered it everywhere.Removes nothing: no field, key, validator or function is removed or renamed; the change only stops non-list input from raising or being split.
Tests
In
test/test_app_manifest.py:test_non_list_value_for_a_list_field_degradesruns each of the 13 degrade-to-empty fields (the seven inmanifest_sections.pyand the six top-level ones inmanifest.py) withNone,7,True,"abc"and{"id": "x"}, 65 cases. It asserts that the parse does not raise and that the field is[].test_a_non_list_platform_os_fails_closed_and_is_refused(7,True,"windows",{"id": "x"}) asserts three things:os == []; no platform is supported, before and after ato_dictround trip (the path enable reads); andvalidate()reportsplatform.os: unknown value.test_a_null_platform_os_reads_as_unsetasserts that"os": nullgives the default and validates clean.test_a_non_list_publish_provider_kinds_offers_the_provider_for_no_kind(7,True,"html",{"id": "x"}) asserts the parse does not raise andcollect_publish_providersover the serialized manifest offers nothing.In
test/test_apps_registry_coverage_install.py(placed away from #24373's hunks in that file, with a signature-tolerant admission stub):test_a_non_list_platform_os_reaches_the_client_install_answer(None,7,True,"windows",{"id": "x"}on a host no default names) asserts the client-install answer comes back withrequired= the default forNoneand[]otherwise.Red with the fix reverted on main (8ae4e4f): 36 failed, 4 passed of 40. Every field fails for
None/7/TruewithTypeError ... is not iterable.mcp/skills/agents/arch/kindsandosalso fail for a string or object (assert ['a', 'b', 'c'] == []). The 4 passes arepages/channelswith a string or object, which theirisinstance(dict)element filter already drops. Green with the fix: 40 passed.test_app_manifest_platform_vocabulary.pypasses too.The six
manifest.pyfields run red on main (c575687) first: 28 failed, 2 passed of 30. Every field fails forNone/7/TruewithTypeError ... is not iterable, andagents/skills/sops/tags/jobFamiliesalso fail for a string or object (assert ['a', 'b', 'c'] == [],assert ['id'] == []). The 2 passes arecronswith a string or object, which itsisinstance(dict)element filter already drops. Green with the fix: 30 passed.The kinds and install tests run red on cb0689f first: the kinds test 4 failed of 4 (
assert [{'app': 'test-app', ... }] == [], the provider offered for every kind); the install test 5 failed of 5 (None/7/True:TypeError ... is not iterable;"windows"/{"id": "x"}: the raw value came back asrequired). Green with the fix: 9 passed.prove.py --per-hunkcatches every production hunk.Proof: PROVEN test/test_app_manifest.py::test_non_list_value_for_a_list_field_degrades[crons-None], test/test_app_manifest.py::test_non_list_value_for_a_list_field_degrades[crons-7], test/test_app_manifest.py::test_non_list_value_for_a_list_field_degrades[crons-True], test/test_app_manifest.py::test_non_list_value_for_a_list_field_degrades[agents-None], test/test_app_manifest.py::test_non_list_value_for_a_list_field_degrades[agents-7] (head e9c5833)
Local checks on e9c5833 (rebased on 3fccc01):
prove.py --per-hunkcatches every production hunk.test/test_app_manifest.py,test/test_manifest_facade.py,test/test_publish_providers.py,test/test_apps_registry_coverage_install.pyand the other app-manifest/registry tests give 1,543 passed. Every test file that importskiro_crew.apps.manifestor namesAppManifest(73 files) gives 3,577 passed and 1 failed; that one,test_app_agent_launch_copy.py::...[opted-out], fails the same way on main on this box and passes with a clean$HOME(it reads the host's own~/.kiro).mypyon the production files is clean, and black, isort and flake8 pass.Manual verification
N/A: this is a pure parsing function, and the parametrized unit test exercises every field and value shape directly.
Related Issues
Closes #24452
Sibling sweep
Swept: git grep -nE 'data.get("[A-Za-z]+", [' -- src/kiro_crew/apps/manifest*.py
Sibling: src/kiro_crew/apps/manifest_sections.py -- changed here
Sibling: src/kiro_crew/apps/registry_pipeline/install.py:526-545 -- changed here
Sibling: src/kiro_crew/apps/routes_listing.py:212 -- not affected -- collect_publish_providers reads the serialized manifest, which no longer carries a non-list kinds
Swept: src/kiro_crew/apps/manifest_contributes.py already guards every list read (commands, sessionControls, panelTabs, fileMenuItems, hosts, keywords, extensions, kinds, surfaces) with isinstance(list).
Sibling: src/kiro_crew/apps/manifest.py -- changed here
Sibling: src/kiro_crew/apps/routes_uninstall.py:156-158 -- not affected -- reads get_app's manifest, which is the parsed and re-serialized manifest
Sibling: src/kiro_crew/apps/execution.py:333 -- not affected -- already checks isinstance(agents, list)
Pattern harvest
Rule candidate: semgrep
Pattern: iterating
d.get(key, [])(or passing it tolist()) without anisinstance(..., list)check, whendis parsed JSON that can hold a presentnull.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; see the Licensing section of CONTRIBUTING.md.