Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cd38a59
refactor(macho): extract non-throwing container and slice load-comman…
chordpli Oct 20, 2026
2b41ca6
feat(macho): report per-slice encryption status in inspect_macho
chordpli Oct 20, 2026
f210a4f
fix(macho): keep slice facts and failures under large tables and clos…
chordpli Oct 20, 2026
ee6f565
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 20, 2026
c128c72
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 20, 2026
c6c8c75
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 21, 2026
15db4e6
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 22, 2026
c54ff26
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 24, 2026
0d506e2
fix(macho): map encrypted ranges only within segment VM extents
chordpli Oct 25, 2026
3bd1541
Merge remote-tracking branch 'origin/main' into HEAD
Oct 26, 2026
611ae1e
fix(macho): read encryption through the admitted descriptor facts
chordpli Oct 26, 2026
7e6d57f
fix(macho): retain a finished report when the target close fails
chordpli Oct 26, 2026
9c74d8d
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 26, 2026
d95f4e3
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 26, 2026
5a22d73
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 26, 2026
811c47d
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 26, 2026
08ed647
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 27, 2026
29f37e6
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 27, 2026
d3f63a8
test(native): supply readEncryption in merged dyld refusal cases
chordpli Oct 27, 2026
014a868
test(views): bind the Mach-O encryption page to its facet
chordpli Oct 27, 2026
c2c2e93
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 28, 2026
7fb4355
Merge remote-tracking branch 'origin/main' into tmp5359
chordpli Oct 28, 2026
3476a90
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 29, 2026
13904db
fix(macho): bound encryption commands and range mapping across slices
chordpli Oct 29, 2026
1bc25f6
Merge remote-tracking branch 'origin/main' into feat/macho-encryption…
chordpli Oct 29, 2026
27edcc0
style(macho): format encryption reader and binding test
chordpli Oct 29, 2026
c806969
fix(macho): stop retaining segments past the mapping budget
chordpli Oct 29, 2026
26280c7
feat(macho): preserve per-slice encryption facts and mapping budgets
gensokyo-dev Oct 29, 2026
90ee1c6
chore(macho): align encryption reporting with current main
gensokyo-dev Oct 29, 2026
0eba2e7
docs(macho): clarify retained mapping allowance
gensokyo-dev Oct 29, 2026
5ffb40d
fix(ci): own the Mach-O encryption test in Apple scope
gensokyo-dev Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(macho): retain a finished report when the target close fails
The file owner keeps the completed callback value when the descriptor close
fails or cancellation arrives during close. inspect_macho now validates that
value and retains the report as the error's partial observation, as
inspect_signature does, instead of returning only the cleanup or
cancellation error.
  • Loading branch information
chordpli committed Oct 26, 2026
commit 7e6d57f30c1fa33663c1796330855f727009870f
6 changes: 5 additions & 1 deletion src/domain/analysisErrorBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ import type {
AdbPackagePullPartialObservation,
AdbDisplayPartialObservation,
} from "./adb/adbDeviceAnalysis.js";
import type { InspectSignature } from "./native/nativeInspection.js";
import type {
InspectMacho,
InspectSignature,
} from "./native/nativeInspection.js";
import type { NativeUiObservationResult } from "./native/nativeUiObservation.js";
import type { BinaryLayout } from "./native/binaryLayout.js";
import type {
Expand Down Expand Up @@ -328,6 +331,7 @@ export type AnalysisPartialObservation =
| FirmwarePartialObservation
| NativeUiObservationResult
| InspectSignature
| InspectMacho
| ElectronPagePartialObservation
| AdbActivityStartPartialObservation
| AdbAcquiredFilePartialObservation
Expand Down
22 changes: 20 additions & 2 deletions src/native/NativeMacOSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
resolveBundleResourcePlistSelection,
} from "./NativePlistSource.js";
import {
artifactFileCompletion,
assertArtifactReadActive,
bindArtifactFileCleanup,
withArtifactRegularFile,
Expand Down Expand Up @@ -98,6 +99,7 @@ import {
} from "../domain/propertyListKeys.js";
import {
demangleSwiftSchema,
inspectMachoSchema,
inspectPlistSchema,
inspectSignatureSchema,
type InspectSignature,
Expand Down Expand Up @@ -1269,8 +1271,24 @@ class NativeMacOSClient implements AnalysisClient {
} catch (cause: unknown) {
// Only an unopenable target leaves the tool facts without a byte read;
// cancellation, read and cleanup failures stay errors.
if (admitted || signal?.aborted === true || !isUnopenableTarget(cause))
return err(appleDispatchMetadataFailure(cause, path, "inspect_macho"));
if (admitted || signal?.aborted === true || !isUnopenableTarget(cause)) {
const failure = appleDispatchMetadataFailure(
cause,
path,
"inspect_macho",
);
// A report finished before close failed or was cancelled survives.
const completed = artifactFileCompletion(cause)?.value as
| Awaited<ReturnType<typeof inspect>>
| undefined;
const report =
completed?.ok === true
? inspectMachoSchema.safeParse(completed.value.result)
: undefined;
if (report?.success === true)
failure.retainPartialObservation(report.data);
return err(failure);
}
return inspect(() =>
Promise.resolve({
status: "unread",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
import { join } from "node:path";
import { expect, it, onTestFinished, vi } from "vitest";
import { machoImage } from "../../../../src/artifacts/apple/MachoImage.fixture.js";
import type { AnalysisError } from "../../../../src/domain/analysisErrorBase.js";
import { projectAnalysisError } from "../../../../src/domain/analysisErrorProjection.js";
import { inspectMachoSchema } from "../../../../src/domain/native/nativeInspection.js";
import { ProviderCleanupError } from "../../../../src/domain/providerCleanupError.js";
import { NativeMacOSProvider } from "../../../../src/native/NativeMacOSProvider.js";
Expand Down Expand Up @@ -164,6 +166,15 @@ const failingClose = async (onClosed?: () => void) => {
return state;
};

/** The finished report survives a failure that arrives after the read completed. */
const expectRetainedReport = (error: AnalysisError) => {
const report = inspectMachoSchema.parse(error.partialObservation);
expect(report.encryption.items).toMatchObject([{ status: "encrypted" }]);
expect(projectAnalysisError(error).details?.partial_observation).toEqual(
error.partialObservation,
);
};

it("retains the target descriptor when close rejects and retries it on client close", async () => {
const path = await writeTarget();
const state = await failingClose();
Expand All @@ -174,6 +185,7 @@ it("retains the target descriptor when close rejects and retries it on client cl
expect(result.error.cleanupIncomplete).toBe(true);
expect(result.error.cleanupResources).toEqual([path]);
expect(state.attempts).toBe(1);
expectRetainedReport(result.error);

expect((await client.close()).ok).toBe(false);
expect(state.attempts).toBe(2);
Expand All @@ -195,6 +207,7 @@ it("keeps the inspection failure primary when the descriptor close also rejects"
expect(result.error.cleanupPrimary?._tag).toBe(
"AnalysisArtifactChangedError",
);
expect(result.error.partialObservation).toBeUndefined();

state.failing = false;
expect((await client.close()).ok).toBe(true);
Expand Down Expand Up @@ -225,4 +238,5 @@ it("reports cancellation that arrives during the final close without retaining t
_tag: "AnalysisCancelledError",
cleanupIncomplete: false,
});
expectRetainedReport(result.error);
});