Skip to content

Keep case-variant evidence files when the report volume folds case - #2027

Merged
abrignoni merged 3 commits into
abrignoni:mainfrom
forest-savage1234:forest/seeker-1948-dest-guard
Aug 24, 2026
Merged

abrignoni merged 3 commits into
abrignoni:mainfrom
forest-savage1234:forest/seeker-1948-dest-guard

Conversation

@forest-savage1234

@forest-savage1234 forest-savage1234 commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Keep case-variant evidence files when the report volume folds case

Same dest-guard as the sibling LEAPP seekers. Seeker only. Not an artifact. Please land this with the other three so the seekers stay level.

Closes #1948.

Summary

self.copied is keyed by the source path. The report destination is built from that path. On a case-insensitive report volume, com.apple.MobileSMS.plist and com.apple.mobileSMS.plist are two sources and one destination. The second write silently destroys the first.

This PR does only the seeker dest-guard named on the issue:

  1. Probe the data folder's real case behaviour once per seeker (create Aa / aA; do not trust os.path.normcase).
  2. When a destination is already claimed by a different source, write to name~caseN.ext instead of overwriting.
  3. Return and record that path so file_infos and the artifact's source path stay truthful.

Validation

Earlier local check on a case-sensitive ext4 volume (dest names folded to stand in for Windows / stock macOS): two sources plus one folded dest left one file. The dest-guard kept both; the second dest is *~case2.plist. The volume probe left no leftover probe names. This is not an artifact change, so the artifact report checkers were not run.

Files

  1. scripts/search_files.py (seeker dest-guard only)

Touched write sites: FileSeekerDir, FileSeekerItunes, FileSeekerTar, FileSeekerZip, FileSeekerFile.

Out of scope

How to review

On a case-insensitive report volume, search a zip that holds both com.apple.MobileSMS.plist and com.apple.mobileSMS.plist. data/ should keep two files (the second named *~case2.plist). Case-sensitive volumes should be unchanged: the probe sees two files and never mints ~caseN.

I am a volunteer. Thank you for the time. I am trying to become more useful on this work, so I welcome a critical look. If this is the wrong cut, or you want me to stand down, say so and I will recut from notes.

Seeker dest-guard only (volume probe + ~caseN). Not an artifact.
Closes abrignoni#1948.

Signed-off-by: Forest Savage <[email protected]>
@forest-savage1234

Copy link
Copy Markdown
Contributor Author

Thank you for the time on this review. This only keeps case-variant evidence files when the report volume folds case.

abrignoni and others added 2 commits August 24, 2026 13:37
…embers

Replaces the counter suffix with name~case-<tag>.ext, where the tag is the
sha256 of the evidence-relative source path (case preserved, separators
normalized). The same source now maps to the same destination on every
search, every run and every machine, so repeated or forced searches cannot
mint additional copies. Directory members take no dest-guard: case-variant
directories fold into one and their files disambiguate individually, which
also stops a spurious tagged twin when an archive stores a directory entry
after its contents.

The seekers hash the evidence-relative spelling (dir seeker: path relative
to the input root; iTunes seeker: the manifest-relative path) rather than
the mounted absolute path. Adds a regression suite covering both volume
behaviours, name determinism across instances and forced re-searches,
directory members, and a simulated Windows normcase.

Co-Authored-By: Claude Fable 5 <[email protected]>
The seeker now preserves case-variant copies under distinct destination
names, so the per-spelling re-search pass is no longer needed and would
miss tagged copies, since a tagged destination basename is not an archive
member name. Reads each found file once, labels rows with the source
spelling recorded by the seeker, and points each row's path at the copy
holding the bytes it reports. Row counts re-verified against the corpora
recorded in sample_data, including all six images carrying both spellings.

Co-Authored-By: Claude Fable 5 <[email protected]>
@abrignoni

Copy link
Copy Markdown
Owner

Thanks for this one. The direction was right, so rather than a recut round trip I pushed two commits on top of your branch.

What testing it turned up:

  1. Repeated searches with force=True minted a new ~caseN copy each time, because the claims table only remembered the base destination. Runs that re-search a pattern grew ~case2, ~case3, ~case4 copies of the same source.
  2. messageRetention, the one artifact that feeds a returned basename back into a search pattern, silently lost a row: a tagged basename is not an archive member name, so its per-spelling re-search found nothing. It was also the artifact written to work around this exact bug, so the two had to move together.
  3. A zip that stores a directory entry after its contents produced a spurious ~case2 directory, since the parent already existed on disk unclaimed.

The fixes: the alternate name is now derived from a hash of the evidence-relative source path (name~case-.ext), so the same source maps to the same destination on every search, every run and every machine, with no counter state to get wrong. Directory members skip the guard. messageRetention reads every preserved copy directly and labels each row with the source spelling the seeker recorded, which is simpler than the read-before-the-next-copy dance it needed before.

Validation: messageRetention run through the real ileapp.py on all six registered iOS images that carry both spellings (zip and tar inputs) plus a single-spelling control, main vs fixed, report folder on a case-insensitive volume. Row counts and values identical to main everywhere, both files preserved with distinct hashes on every pair image, and the control run byte-identical. The new suite in admin/test/scripts fails against the old seeker and covers both volume behaviours, name determinism across instances and forced re-searches, directory members, and a simulated Windows normcase. A full-suite before/after run comparison is going now ahead of the merge.

The same fixes are needed on the ALEAPP, VLEAPP and RLEAPP PRs; I will level them there.

@abrignoni
abrignoni merged commit 279f2eb into abrignoni:main Aug 24, 2026
8 checks passed
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.

Seeker overwrites evidence files whose paths differ only in case, so one file is silently lost from the report

2 participants