Repository navigation
fix(artifacts): take nested container families from bytes - #1553
Merged
Merged
Conversation
Inventory gave nested members a ZIP or ASAR family from their path suffix. Byte classification replaced it only for ZIP magic, so text named `.apk` or `.asar` stayed a container, and encrypted entries and symlinks kept the suffix guess. A filesystem `.asar` without an ASAR header failed the whole inventory as a malformed archive. Nested ZIP families now follow ZIP magic and ASAR follows its header pickle, shared with root classification. An unread member named like a container has an unknown format and a limitation naming the suffix. ASAR expansion requires the header. The Android projection adds a limitation when no root AndroidManifest.xml was observed, and its rejection names the observed root format. Fixes #1491 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
Inventory gave nested members a ZIP or ASAR family from their path suffix. Byte classification replaced it only for ZIP magic, so text named `.apk` or `.asar` stayed a container, and encrypted entries and symlinks kept the suffix guess. A filesystem `.asar` without an ASAR header failed the whole inventory as a malformed archive. Nested ZIP families now follow ZIP magic and ASAR follows its header pickle, shared with root classification. An unread member named like a container has an unknown format and a limitation naming the suffix. ASAR expansion requires the header. The Android projection adds a limitation when no root AndroidManifest.xml was observed, and its rejection names the observed root format. Fixes morluto#1491
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.
Summary
Fixes #1491.
#1513 made root classification byte-first, so the root cases in the issue (ELF or APK bytes named
.dmg,.pkg,.apkor.asar) already report the byte format on main. This PR covers what was still open: nested members, and the Android projection of a ZIP that only has an.apkname.Problem and expected behavior
On
2d99e1e3, a ZIP holdinginner-text.apk(text),inner-text.asar(text) and a symlink entrylink.apkgave these occurrences:inner-text.apkcontainer/apkresource/fileinner-text.asarcontainer/asarresource/filelink.apk(symlink)container/apk,not-hashedunknown/unknown, with a limitationinner-real.apk(ZIP bytes)container/apkclassifyArtifactPathreturned a container family from the suffix, and byte classification only replaced it when the bytes were ZIP. Encrypted entries and symlinks were never read, so they kept the guess. A filesystem.asarwithout an ASAR header also failed the whole inventory as a malformed archive, while the same bytes as a root were already classified asfile.A plain ZIP named
.apkwas projected as an Android application with no sign that no manifest was present.Change and scope
classifyArtifactPathno longer returns container families. Nested ZIP families follow ZIP magic (zipPackageFormatForPathonly picks among them after magic). ASAR follows the header pickle check, now shared by root and nested classification (hasAsarHeadermoved fromclassify.tstoArtifactGraphConstruction.ts).unknown/unknownand the limitationThe path suffix suggests APK, but these bytes were not read, so the container family is unknown.Other suffix role hints (.js,.plist,.dylib, ...) are unchanged..asarwith a valid header but a malformed body still fails withformat.project_android_application_graphaddsNo root AndroidManifest.xml occurrence was observed. The APK family comes from the .apk suffix of a ZIP archive, so these bytes may not be an APK.when the root has no manifest. Its rejection names the observed root format (... the inventory root format is zip. APK is chosen for a ZIP archive whose name ends in .apk.).Not included: accepting a real APK named
.zipin the Android projection. Its result contract hasroot_format: "apk", and inferring APK from contents would be a separate contract decision. The error now says what to do.Contract and boundary impact
src/artifacts/inventory), then the Android domain projection.artifact_kind/artifact_formatvalues for affected nested members change as in the table above; existing enum values only..asarfile in an app directory is hashed as a file instead of being opened by the ASAR reader.npm run docs:checkpasses).Evidence and regression coverage
tests/boundary/filesystem/zipDetection.test.ts: nested ZIP members by bytes (text.apk, ZIP.apk, ZIP.bin, encrypted.ipa) and an unfollowed filesystem symlinklink.apk.tests/boundary/filesystem/asarInventoryContainment.test.ts: real/ordinary/encrypted.asarmembers in a ZIP; a headerless filesystem.asaris a file; a header with malformed JSON is still rejected. The old test "keeps malformed filesystem archives rejected" pinned the headerless case as a failure and is replaced.tests/composition/android/application.test.ts: the missing-manifest limitation and the rejection message.rea inspect-artifacton main and on this branch (table above).For evidence-bearing changes:
Validation performed
npm run check:fast— passed.npm run check:changed— 44 files, 444 tests passed.npm run test:focused --all oftests/boundary/filesystem,tests/boundary/providers/native,tests/composition,artifactMcp,mobileApplicationGraphMcp,cliOutput,nonBinaryComposition— 1446 passed, 8 failed. The same 8 fail on unchanged main on this Mac (noibtoolwith Command Line Tools only; the realhdiutilverify-refusal test).npm run docs:check— passed.rea inspect-artifact /Applications/Discord.appgives the same 580 occurrences (kind, format, hash status, limitations) on main and on this branch;Contents/Resources/app.asaris stillcontainer/asarand expanded.Compatibility, safety, and release
No breaking schema change. Callers that relied on a suffix-only
apk/ipa/asarformat for unread or non-container nested members now seeunknownorfile.🤖 Generated with Claude Code