Skip to content

Guard date-converter calls in 9 artifacts against string/empty dates#1614

Merged
abrignoni merged 2 commits into
mainfrom
fix-date-converter-guards
Jun 25, 2026
Merged

Guard date-converter calls in 9 artifacts against string/empty dates#1614
abrignoni merged 2 commits into
mainfrom
fix-date-converter-guards

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Problem

convert_plist_date_to_utc / convert_time_obj_to_utc expect a datetime object and crash (AttributeError / TypeError) when handed a string or empty value — which happens when a plist stores a date as an ISO string rather than a <date> object. This is the same root cause as the appItunesmeta crash from testing (#1613); these 9 artifacts call the same converters and would hit it on similar data.

Fix

Route each artifact's converter calls through a small local guard (_safe_plist_date / _safe_time_obj) that converts only datetime instances and passes strings/None/empties through unchanged.

Covers: appleAlarms, appleWifiPlist, biomeIntents, biomeUseractmeta, booking, callHistoryTransactions, cloudkit_cache, instagramThreads, weatherAppLocations.

Note

The proper fix is hardening the two converters in ilapfuncs.py directly (one change for all + future artifacts), but CI lints the whole changed file and ilapfuncs.py has 35 pre-existing issues (including a real E0601 used-before-assignment error) — so that's tracked as a separate dedicated cleanup.

Validation

  • pylint 10.00/10 on all 9.
  • Guards verified: datetime → aware UTC; string / '' / None → passed through unchanged (no crash).

convert_plist_date_to_utc / convert_time_obj_to_utc expect a datetime object (they read
.year / call .replace(tzinfo=...)). In some iTunesMetadata.plist files purchaseDate (and
releaseDate/installDate) are stored as ISO strings rather than plist <date> objects, so the
converters raised AttributeError ('str' object has no attribute 'year') and aborted the
artifact. Guard all three: convert only datetime objects; pass strings through unchanged
(the framework parses ISO strings for the datetime columns).

Pre-existing bug surfaced during testing.
convert_plist_date_to_utc / convert_time_obj_to_utc expect a datetime object and crash
(AttributeError / TypeError) when handed a string or empty value - which happens when a
plist stores a date as an ISO string rather than a <date> object (the appItunesmeta crash
seen in testing). Route each artifact's calls through a small local guard that converts only
datetime objects and passes strings/None/empties through unchanged.

Covers: appleAlarms, appleWifiPlist, biomeIntents, biomeUseractmeta, booking,
callHistoryTransactions, cloudkit_cache, instagramThreads, weatherAppLocations.

A framework-level fix of the two converters is the proper long-term solution but is blocked
by pre-existing lint debt in ilapfuncs.py (CI lints the whole changed file); tracked
separately. pylint 10.00 on all 9; guards verified to convert datetimes and pass through
strings/None.
@abrignoni abrignoni merged commit 1fede47 into main Jun 25, 2026
1 check passed
@abrignoni abrignoni deleted the fix-date-converter-guards branch June 25, 2026 15:08
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.

1 participant