[medium] fix: [mobilebackup] is_compatible() raises TypeError when the case model is unknown - #247
Open
elhoim wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
elhoim
force-pushed
the
fix/mobilebackup-case-model-none
branch
2 times, most recently
from
September 9, 2026 07:30
78026f8 to
d8ab0b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF
MobileBackupParser.is_compatible()raisesTypeError: argument of type 'NoneType' is not iterablewhenever the case metadata carries nomodel.case_modelis documented as optional.BaseInterface.case_modelis typedstr | Noneand returnsself.case.get("model"), soNoneis a legitimate, expected value — but the device check does"AppleTV" not in self.case_modelwith no guard.BaseInterface._execute_and_write()callsis_compatible()outside its owntry/exceptcrash guard, so theTypeErroris not caught, escapesSysdiagnose.parse(), and aborts the entire invocation — every remaining parser and every remaining case is skipped.""before the substring test. A case with an unknown model is treated as compatible, which is the safe default for a forensic tool — better to run the parser and produce nothing than to skip it silently.Reproducing
Any case whose
cases.jsonentry has nomodelkey — which happens wheneverget_case_metadata()could not determine the device model from the archive:The fix
This parser is not compatible with Apple TV or Apple Watch, and that exclusion is preserved exactly.
Test
test_is_compatible_without_case_modelbuilds a case dict with nomodel, assertscase_modelisNone, and assertsis_compatible()returns aboolinstead of raising. Verified to fail onmainwith the exactTypeErrorabove and pass with this change.Note
Sibling parsers (
mcstate_shared_profile,itunesstore,networkextension) carry the identical unguarded pattern. They are submitted as separate PRs so each can be reviewed and reverted independently.