← Back to issue list

Validate snapd payload

View original Github issue

Metadata

Project
craft-parts
Number
#838
Type
issue
State
open
Author
sergiusens
Labels
—
Created
Updated
Closed
—

Current evaluation

Validate snapd API JSON payloads in craft_parts/packages/snaps.py; raw json()["result"] access is still unvalidated, so TypeError: 'NoneType' object is not subscriptable can still surface. Maintainer-filed, no labels, no comments, untriaged.

Suggested action: needs triage

Reason: The gap is real and still present at HEAD: `_get_local_snap_info`, `_get_store_snap_info`, and `get_installed_snaps` in craft_parts/packages/snaps.py all do unguarded `snap_info.json()["result"]` / `["result"][0]` access with no check for snapd's `error-code`/`error-message` response fields, matching the reported 'NoneType object is not subscriptable' class of crash (craft-parts `install_snaps` even does `store_snap_info["channel"]`). However, the issue carries no labels, no assignee and zero comments, so there is no evidence it has been categorised or prioritised, and the traceback points at snapcraft_legacy's vendored copy rather than craft-parts, making the exact scope/priority a maintainer call. Impact is moderate (confusing crash instead of a clear error when snapd returns a null result) rather than data loss or app breakage.

Evaluated by: mr-cal-bot

Impact: 38 Quick Win: 16 Complexity: 30 Confidence: 78 Actionability: 62

Issue body

### What needs to get done We need to validate the snapd API return payload in craft_parts/packages/snaps.py ### Why it needs to get done This will allow us to gracefully handle errors such as ``` File "/snap/snapcraft/12504/lib/python3.10/site-packages/snapcraft_legacy/internal/repo/snaps.py", line 295, in install_snaps snap_pkg_channel = snap_info["channel"] TypeError: 'NoneType' object is not subscriptable ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 38
Quick Win: 16
Complexity: 30
Confidence: 78
Actionability: 62
needs triage Validate snapd API JSON payloads in craft_parts/packages/snaps.py; raw json()["result"] access is still unvalidated, so TypeError: 'NoneType' object is not subscriptable can still surface. Maintainer-filed, no labels, no comments, untriaged.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 13
Complexity: 30
Confidence: 70
Actionability: 60
needs triage Add validation for snapd API return payload in craft_parts/packages/snaps.py to prevent TypeError when accessing None values
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29
Staleness: 75
Complexity: 35
Confidence: 75
Support Request: 0
keep open Task to validate snapd API return payloads in craft_parts/packages/snaps.py to prevent TypeError crashes when result is None. Filed by maintainer, unlabelled, unassigned, inactive 538 days; code still lacks validation.
qwen/qwen3.6-35b-a3b
Staleness: 80
Complexity: 20
Confidence: 75
Support Request: 0
needs triage Task to validate snapd API payloads in craft_parts to prevent NoneType errors during snap installation. Currently unlabelled, unassigned, and inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 20
Confidence: 85
Support Request: 0
needs triage Task to add payload validation to snapd API calls in craft_parts/packages/snaps.py to prevent NoneType errors. Currently unlabelled, unassigned, and inactive for over a year.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.