Fix KeyError when metadata.container is missing in People parser - #593
Fix KeyError when metadata.container is missing in People parser#593SS-4 wants to merge 1 commit into
Conversation
…tainer is missing in People parser Fixes crash caused by missing "metadata.container" in Google responses. Replaced unsafe dictionary access with safe .get() checks across people.py. Prevents KeyError and allows parsing to continue when fields are missing.
|
Note: I replaced multiple unsafe accesses in one pass because the same issue occurs in several places (emails, names, photos, etc.). Happy to reduce this to minimal changes if preferred. |
|
I tested this locally on GHunt 2.3.4 and it fixes the The crash happens after authentication succeeds, inside the People API parser. The issue seems to be that Google People API can omit One important detail: this does not appear to be limited to The defensive Validation:
I am intentionally not including the tested email address, Google account, credentials path, tokens, cookies, session data, or OSINT results. Happy to help test further if useful. |
|
Small follow-up after local testing on GHunt 2.3.4. The Once that blocker is fixed, a separate issue becomes visible when running the same lookup with
This happens later in A minimal local fix that worked for me was to change the Maps export block in I think
That distinction matters for OSINT output quality. Using an empty list could incorrectly imply that GHunt verified there were no photos or reviews, when this path only appears to collect the Maps statistics. I would treat this as a separate JSON export issue. The |
…ields Google's People API now sometimes omits metadata.container on email, name, profileInfo, sourceIds, coverPhoto, and inAppReachability entries, which crashed ghunt/parsers/people.py with KeyError: 'container' (e.g. `ghunt email <address>`). Also guards the cover_photo imageUrl lookup against a missing field. Master already patched the coverPhoto case alone (11b845b); this extends the same defensive handling to the other fields, matching the approach proposed in unmerged upstream PR mxrch#593.
…bution - Use "skip this entry" instead of a synthetic "unknown" fallback key, per feedback on upstream mxrch#593: falling back to "unknown" risks silently colliding/overwriting two different container-less entries under the same key. - Fold in the fix from upstream mxrch#602: profile photos were looped inside readOnlyProfileInfo's loop and keyed by that loop's container instead of the photo's own metadata.container, so every photo got mis-attributed to whichever profile container the outer loop was on. Moved the photo loop out and keyed independently.
Problem
GHunt crashes with:
KeyError: 'container'
This happens because Google responses sometimes omit "metadata.container".
Fix
Replaced unsafe dictionary access:
data["metadata"]["container"]
with safe access:
data.get("metadata", {}).get("container")
Result
Tested locally — resolves crash across multiple emails.