mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
refactor(domain): move the binary image, Mach-O selection and fixup readers into domain (#11482)
This commit is contained in:
1 parent
acb10754c1
commit
7f61563cae
74 files changed
+192
-191
No files matched your search
@@ -29,15 +29,11 @@
|
||||
"desktop -> browser": 1,
|
||||
"desktop -> electron": 1,
|
||||
"flutter -> artifacts": 1,
|
||||
"go -> native": 2,
|
||||
"gpu -> artifacts": 2,
|
||||
"il2cpp -> ghidra": 1,
|
||||
"il2cpp -> native": 5,
|
||||
"inspector -> browser": 2,
|
||||
"kuna -> native": 2,
|
||||
"model -> artifacts": 1,
|
||||
"native -> artifacts": 5,
|
||||
"rust -> native": 2
|
||||
"native -> artifacts": 5
|
||||
},
|
||||
"entry": {
|
||||
"application -> artifacts": 9,
|
||||
|
||||
@@ -25,8 +25,11 @@
|
||||
"src/domain/apkSignature/apkSignatureSchemes.ts": 1,
|
||||
"src/domain/apkSignature/apkSigningBlock.ts": 7,
|
||||
"src/domain/apkSignature/apkV1Signature.ts": 15,
|
||||
"src/domain/apple/appleMachoFixups.ts": 22,
|
||||
"src/domain/apple/appleMachoSelection.ts": 2,
|
||||
"src/domain/apple/diskImageFormat.ts": 4,
|
||||
"src/domain/apple/jvmClassFile.ts": 2,
|
||||
"src/domain/apple/machoCommandNames.ts": 35,
|
||||
"src/domain/apple/machoContainer.ts": 13,
|
||||
"src/domain/apple/machoDylibCommand.ts": 4,
|
||||
"src/domain/apple/machoEncryptionReader.ts": 1,
|
||||
@@ -56,8 +59,10 @@
|
||||
"src/domain/inesContainer.ts": 5,
|
||||
"src/domain/managed/managedCliHeaderPrefix.ts": 5,
|
||||
"src/domain/native/elfNoteLayout.ts": 3,
|
||||
"src/domain/native/elfPointerRelocations.ts": 6,
|
||||
"src/domain/native/elfSectionNameTable.ts": 6,
|
||||
"src/domain/native/nativeAotPe.ts": 37,
|
||||
"src/domain/native/readBinaryContainer.ts": 1,
|
||||
"src/domain/peCoffHeader.ts": 4,
|
||||
"src/domain/peOptionalHeader.ts": 12,
|
||||
"src/domain/peSectionHeader.ts": 5,
|
||||
@@ -106,12 +111,9 @@
|
||||
"src/model/GgufHeader.ts": 26,
|
||||
"src/model/SafetensorsHeader.ts": 2,
|
||||
"src/native/AppleDispatchMetadata.ts": 4,
|
||||
"src/native/AppleMachoFixups.ts": 22,
|
||||
"src/native/AppleMachoSelection.ts": 2,
|
||||
"src/native/AppleObjcClassImportBindings.ts": 1,
|
||||
"src/native/AppleObjcDispatchFacets.ts": 1,
|
||||
"src/native/AppleSwiftDispatchFacets.ts": 1,
|
||||
"src/native/MachoCommandNames.ts": 35,
|
||||
"src/native/elf/ElfNoteParser.ts": 27,
|
||||
"src/native/elf/ElfUnwindTables.ts": 6,
|
||||
"src/native/elf/KernelBuildConfig.ts": 7,
|
||||
@@ -121,8 +123,6 @@
|
||||
"src/native/initializers/ElfInitializerSymbols.ts": 4,
|
||||
"src/native/initializers/MachoInitializers.ts": 22,
|
||||
"src/native/initializers/NativeInitializersProvider.ts": 1,
|
||||
"src/native/metadata/ElfPointerRelocations.ts": 6,
|
||||
"src/native/metadata/readBinaryContainer.ts": 1,
|
||||
"src/native/pe/PeCertificateAsn1.ts": 2,
|
||||
"src/native/pe/PeCertificateParser.ts": 3,
|
||||
"src/native/pe/PeLoadConfigParser.ts": 7,
|
||||
|
||||
File renamed without changes.
@@ -3,12 +3,12 @@ import {
|
||||
malformedInput,
|
||||
truncatedInput,
|
||||
unsupportedInput,
|
||||
} from "../domain/parseFailure.js";
|
||||
import type { Segment } from "./AppleMachoSelection.js";
|
||||
import { readLeb128, type Leb128Read } from "../domain/leb128.js";
|
||||
import { issue } from "./AppleDispatchDecodeFacts.js";
|
||||
import type { DecodeIssue } from "./AppleDispatchDecodeFacts.js";
|
||||
import { decodeMachoName, type MachoName } from "./AppleMachoNames.js";
|
||||
} from "../parseFailure.js";
|
||||
import type { Segment } from "./appleMachoSelection.js";
|
||||
import { readLeb128, type Leb128Read } from "../leb128.js";
|
||||
import { issue } from "./appleDispatchDecodeFacts.js";
|
||||
import type { DecodeIssue } from "./appleDispatchDecodeFacts.js";
|
||||
import { decodeMachoName, type MachoName } from "./appleMachoNames.js";
|
||||
|
||||
/** Where a Mach-O stores pointer fixups, from its load commands. */
|
||||
export interface FixupCommands {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { decodeStrictUtf8 } from "../domain/strictUtf8.js";
|
||||
import { decodeStrictUtf8 } from "../strictUtf8.js";
|
||||
/** A dyld byte name projected losslessly as UTF-8, or retained exactly. */
|
||||
export type MachoName = string | { readonly bytes_base64: string };
|
||||
|
||||
@@ -2,33 +2,30 @@ import {
|
||||
malformedInput,
|
||||
truncatedInput,
|
||||
unsupportedInput,
|
||||
} from "../domain/parseFailure.js";
|
||||
import { LC } from "../domain/apple/machoLoadCommandCodes.js";
|
||||
import type {
|
||||
FileMapping,
|
||||
ZeroFillMapping,
|
||||
} from "../domain/virtualFileMapping.js";
|
||||
} from "../parseFailure.js";
|
||||
import { LC } from "./machoLoadCommandCodes.js";
|
||||
import type { FileMapping, ZeroFillMapping } from "../virtualFileMapping.js";
|
||||
import {
|
||||
machoDependencyCommand,
|
||||
readMachoDylibCommandFacts,
|
||||
} from "../domain/apple/machoDylibCommand.js";
|
||||
import { readMachoSectionHeader } from "../domain/apple/machoSectionHeader.js";
|
||||
} from "./machoDylibCommand.js";
|
||||
import { readMachoSectionHeader } from "./machoSectionHeader.js";
|
||||
import {
|
||||
admitMachoSegmentMapping,
|
||||
readMachoSegmentHeader,
|
||||
} from "../domain/apple/machoSegmentHeader.js";
|
||||
} from "./machoSegmentHeader.js";
|
||||
import {
|
||||
MachoLoadCommandCursor,
|
||||
readMachoLoadCommandDeclarations,
|
||||
} from "../domain/apple/machoLoadCommands.js";
|
||||
} from "./machoLoadCommands.js";
|
||||
import {
|
||||
BinaryFormatFailure,
|
||||
createFileMappingIndex,
|
||||
} from "../domain/binaryContainer.js";
|
||||
} from "../binaryContainer.js";
|
||||
|
||||
import type { FixupCommands } from "./AppleMachoFixups.js";
|
||||
import { decodeMachoFixedName, decodeMachoName } from "./AppleMachoNames.js";
|
||||
import type { SelectedNativeImage } from "./metadata/MachoSliceSelection.js";
|
||||
import type { FixupCommands } from "./appleMachoFixups.js";
|
||||
import { decodeMachoFixedName, decodeMachoName } from "./appleMachoNames.js";
|
||||
import type { SelectedNativeImage } from "./machoSliceSelection.js";
|
||||
|
||||
/** One mapped Mach-O segment with file-backed VA range. */
|
||||
export interface Segment {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { selectLipoArchitecture } from "./MachoArchitectureSelection.js";
|
||||
import type { LipoArchitecture } from "../domain/apple/lipo.js";
|
||||
import { selectLipoArchitecture } from "./machoArchitectureSelection.js";
|
||||
import type { LipoArchitecture } from "./lipo.js";
|
||||
|
||||
const record = (
|
||||
name: string,
|
||||
+5
-5
@@ -4,14 +4,14 @@ import {
|
||||
machoCpuSubtypeBase,
|
||||
X86_64_HOST_SUBTYPE_PREFERENCE,
|
||||
X86_HOST_SUBTYPE_PREFERENCE,
|
||||
} from "../domain/apple/machoCpuIdentity.js";
|
||||
import { keyedBy, uniqueKeyed } from "../domain/keyedCollection.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
} from "./machoCpuIdentity.js";
|
||||
import { keyedBy, uniqueKeyed } from "../keyedCollection.js";
|
||||
import { err, ok, type Result } from "../result.js";
|
||||
import type {
|
||||
AdmittedMachoSlice,
|
||||
MachoSliceSelectionRefusal,
|
||||
} from "./metadata/MachoSliceSelection.js";
|
||||
import type { LipoArchitecture } from "../domain/apple/lipo.js";
|
||||
} from "./machoSliceSelection.js";
|
||||
import type { LipoArchitecture } from "./lipo.js";
|
||||
|
||||
/** Apple tool names for the domain-owned host subtype preference. */
|
||||
const preferredSubtypes = <Subtype extends number>(
|
||||
@@ -1,23 +1,23 @@
|
||||
import { LC, LC_REQ_DYLD } from "../domain/apple/machoLoadCommandCodes.js";
|
||||
import { LC, LC_REQ_DYLD } from "./machoLoadCommandCodes.js";
|
||||
import {
|
||||
MachoLoadCommandCursor,
|
||||
decodeMachoFixedWordFields,
|
||||
machoFixedWordFieldNames,
|
||||
readMachoLoadCommandTableHeader,
|
||||
} from "../domain/apple/machoLoadCommands.js";
|
||||
} from "./machoLoadCommands.js";
|
||||
import {
|
||||
MACHO_VERSION_MIN_PLATFORMS,
|
||||
type MachoVersionMinPlatform,
|
||||
} from "../domain/apple/machoPlatform.js";
|
||||
import { readMachoSegmentHeader } from "../domain/apple/machoSegmentHeader.js";
|
||||
import { readMachoSectionHeader } from "../domain/apple/machoSectionHeader.js";
|
||||
} from "./machoPlatform.js";
|
||||
import { readMachoSegmentHeader } from "./machoSegmentHeader.js";
|
||||
import { readMachoSectionHeader } from "./machoSectionHeader.js";
|
||||
import { createHash } from "node:crypto";
|
||||
import {
|
||||
malformedInput,
|
||||
ParseFailureError,
|
||||
truncatedInput,
|
||||
} from "../domain/parseFailure.js";
|
||||
import { invariantViolation } from "../domain/internalInvariant.js";
|
||||
} from "../parseFailure.js";
|
||||
import { invariantViolation } from "../internalInvariant.js";
|
||||
|
||||
/** loader.h defines these with LC_REQ_DYLD; the reader also accepts each code without that bit. */
|
||||
const withoutRequiredByDyld = (code: number): number => code & ~LC_REQ_DYLD;
|
||||
@@ -1,18 +1,15 @@
|
||||
import { LC } from "../../domain/apple/machoLoadCommandCodes.js";
|
||||
import type {
|
||||
FileMapping,
|
||||
ZeroFillMapping,
|
||||
} from "../../domain/virtualFileMapping.js";
|
||||
import { decodeMachoFixedName } from "../AppleMachoNames.js";
|
||||
import { LC } from "./machoLoadCommandCodes.js";
|
||||
import type { FileMapping, ZeroFillMapping } from "../virtualFileMapping.js";
|
||||
import { decodeMachoFixedName } from "./appleMachoNames.js";
|
||||
import {
|
||||
isMachoZeroFillSection,
|
||||
readMachoSectionHeader,
|
||||
type MachoSectionHeader,
|
||||
} from "../../domain/apple/machoSectionHeader.js";
|
||||
} from "./machoSectionHeader.js";
|
||||
import {
|
||||
admitMachoSegmentCommand,
|
||||
readMachoSegmentHeader,
|
||||
} from "../../domain/apple/machoSegmentHeader.js";
|
||||
} from "./machoSegmentHeader.js";
|
||||
import {
|
||||
declaredFileRange,
|
||||
BinaryFormatFailure,
|
||||
@@ -20,11 +17,11 @@ import {
|
||||
type BinaryContainer,
|
||||
type ImageSection,
|
||||
type LoadRegion,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
} from "../binaryContainer.js";
|
||||
import {
|
||||
MachoLoadCommandCursor,
|
||||
readMachoLoadCommandDeclarations,
|
||||
} from "../../domain/apple/machoLoadCommands.js";
|
||||
} from "./machoLoadCommands.js";
|
||||
|
||||
/** Read thin Mach-O images, retaining the slice's exact file-backed mappings. */
|
||||
export const readMachoImage = (bytes: Buffer): BinaryContainer => {
|
||||
+6
-6
@@ -3,21 +3,21 @@ import { createHash } from "node:crypto";
|
||||
import {
|
||||
readUniversalMachoImage,
|
||||
readUniversalMachoSlice,
|
||||
} from "../../domain/apple/machoImageSelection.js";
|
||||
} from "./machoImageSelection.js";
|
||||
import {
|
||||
readMachoHeaderPrefixFacts,
|
||||
type FatSliceDeclaration,
|
||||
} from "../../domain/apple/machoContainer.js";
|
||||
} from "./machoContainer.js";
|
||||
import {
|
||||
MACHO_CPU_TYPES,
|
||||
machoSliceFamily,
|
||||
machoSliceSubtypeSelector,
|
||||
type MachoSliceArchitecture,
|
||||
type MachoTargetSelection,
|
||||
} from "../../domain/apple/machoTargetSelection.js";
|
||||
import { AnalysisInputError } from "../../domain/analysisErrorCore.js";
|
||||
import { err, ok, type Result } from "../../domain/result.js";
|
||||
import { MACHO_ARCHITECTURE_POLICIES } from "../MachoArchitectureSelection.js";
|
||||
} from "./machoTargetSelection.js";
|
||||
import { AnalysisInputError } from "../analysisErrorCore.js";
|
||||
import { err, ok, type Result } from "../result.js";
|
||||
import { MACHO_ARCHITECTURE_POLICIES } from "./machoArchitectureSelection.js";
|
||||
|
||||
const cpuName = (cpuType: number, cpuSubtype: number): string => {
|
||||
const name = Object.entries(MACHO_CPU_TYPES).find(
|
||||
@@ -1,8 +1,5 @@
|
||||
import type {
|
||||
FileMapping,
|
||||
ZeroFillMapping,
|
||||
} from "../../domain/virtualFileMapping.js";
|
||||
import { admitElfLoadSegment } from "../../domain/elfProgramHeader.js";
|
||||
import type { FileMapping, ZeroFillMapping } from "../virtualFileMapping.js";
|
||||
import { admitElfLoadSegment } from "../elfProgramHeader.js";
|
||||
import {
|
||||
declaredFileRange,
|
||||
BinaryFormatFailure,
|
||||
@@ -11,9 +8,9 @@ import {
|
||||
type ElfDynamicSegment,
|
||||
type ImageSection,
|
||||
type LoadRegion,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { elfArchitecture } from "../../domain/elfFixedHeader.js";
|
||||
import { readElfDirectoryFromBuffer } from "../../domain/native/nativeSectionDirectory.js";
|
||||
} from "../binaryContainer.js";
|
||||
import { elfArchitecture } from "../elfFixedHeader.js";
|
||||
import { readElfDirectoryFromBuffer } from "./nativeSectionDirectory.js";
|
||||
|
||||
/** Read ELF sections and file-backed program mappings without interpreting language metadata. */
|
||||
export const readElfImage = (
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { expect, it, vi } from "vitest";
|
||||
import type { FileMapping } from "../../domain/virtualFileMapping.js";
|
||||
import type { FileMapping } from "../virtualFileMapping.js";
|
||||
import {
|
||||
ElfPointerRelocationFailure,
|
||||
elfAbsoluteRelocationType,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
readElfRelocationWritesSteps,
|
||||
readElfPointerValuesSteps,
|
||||
type ElfPointerWrite,
|
||||
} from "./ElfPointerRelocations.js";
|
||||
} from "./elfPointerRelocations.js";
|
||||
|
||||
const EM_X86_64 = 62;
|
||||
|
||||
+8
-11
@@ -1,24 +1,21 @@
|
||||
import type {
|
||||
FileMapping,
|
||||
ZeroFillMapping,
|
||||
} from "../../domain/virtualFileMapping.js";
|
||||
import { readElfDynamicEntry } from "../../domain/elfDynamicEntry.js";
|
||||
import { readElfRelocationEntry } from "../../domain/elfRelocation.js";
|
||||
import { readElfSymbol } from "../../domain/elfSymbol.js";
|
||||
import type { FileMapping, ZeroFillMapping } from "../virtualFileMapping.js";
|
||||
import { readElfDynamicEntry } from "../elfDynamicEntry.js";
|
||||
import { readElfRelocationEntry } from "../elfRelocation.js";
|
||||
import { readElfSymbol } from "../elfSymbol.js";
|
||||
import {
|
||||
readElfHashSymbolCount,
|
||||
readElfGnuHashSymbolCount,
|
||||
type ElfHashWordReader,
|
||||
} from "../../domain/elfHashSymbolCount.js";
|
||||
import { err, ok } from "../../domain/result.js";
|
||||
} from "../elfHashSymbolCount.js";
|
||||
import { err, ok } from "../result.js";
|
||||
import {
|
||||
BinaryMappingFailure,
|
||||
BinaryReader,
|
||||
createFileMappingIndex,
|
||||
isZeroFilledSpan,
|
||||
type ElfDynamicSegment,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { ParseFailureError } from "../../domain/parseFailure.js";
|
||||
} from "../binaryContainer.js";
|
||||
import { ParseFailureError } from "../parseFailure.js";
|
||||
|
||||
/** The ParseFailure format of ELF loader pointer interpretation. */
|
||||
export const ELF_POINTER_RELOCATION_FORMAT = "elf-pointer-relocations";
|
||||
@@ -1,21 +1,18 @@
|
||||
import type {
|
||||
FileMapping,
|
||||
ZeroFillMapping,
|
||||
} from "../../domain/virtualFileMapping.js";
|
||||
import { readPeCoffHeader } from "../../domain/peCoffHeader.js";
|
||||
import { readPeOptionalHeader } from "../../domain/peMachine.js";
|
||||
import { readPeSectionHeader } from "../../domain/peSectionHeader.js";
|
||||
import type { FileMapping, ZeroFillMapping } from "../virtualFileMapping.js";
|
||||
import { readPeCoffHeader } from "../peCoffHeader.js";
|
||||
import { readPeOptionalHeader } from "../peMachine.js";
|
||||
import { readPeSectionHeader } from "../peSectionHeader.js";
|
||||
import {
|
||||
mzWindowsHeaderLayoutLimitation,
|
||||
parseMzHeaderEvidence,
|
||||
} from "../../domain/dosMz.js";
|
||||
} from "../dosMz.js";
|
||||
import {
|
||||
declaredFileRange,
|
||||
BinaryFormatFailure,
|
||||
BinaryReader,
|
||||
type BinaryContainer,
|
||||
type ImageSection,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
} from "../binaryContainer.js";
|
||||
|
||||
const peHeaderOffset = (reader: BinaryReader): number => {
|
||||
const evidence = parseMzHeaderEvidence(reader.bytes);
|
||||
+5
-5
@@ -1,16 +1,16 @@
|
||||
import {
|
||||
BinaryFormatFailure,
|
||||
type BinaryContainer,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
} from "../binaryContainer.js";
|
||||
import {
|
||||
classifyFatContainerIdentity,
|
||||
readFatContainerHeader,
|
||||
readFatHeaderPrefix,
|
||||
readMachoHeaderPrefixFacts,
|
||||
} from "../../domain/apple/machoContainer.js";
|
||||
import { readElfImage } from "./ElfImage.js";
|
||||
import { readPeImage } from "./PeImage.js";
|
||||
import { readMachoImage } from "./MachoImage.js";
|
||||
} from "../apple/machoContainer.js";
|
||||
import { readElfImage } from "./elfImage.js";
|
||||
import { readPeImage } from "./peImage.js";
|
||||
import { readMachoImage } from "../apple/machoImage.js";
|
||||
|
||||
/** Identify an ELF, PE, or thin Mach-O image and its file sections. */
|
||||
export const readBinaryContainer = (bytes: Buffer): BinaryContainer => {
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
isZeroFilledSpan,
|
||||
type BinaryContainer,
|
||||
} from "../domain/binaryContainer.js";
|
||||
import { readBinaryContainer } from "../native/metadata/readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../domain/native/readBinaryContainer.js";
|
||||
import {
|
||||
goAnalysisBudgets,
|
||||
type GoAnalysisBudgets,
|
||||
|
||||
@@ -35,7 +35,7 @@ import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
||||
import { fixedAllowanceOptions } from "../domain/fixedAllowanceRemediation.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import { readGoBinaryImage, type GoBinaryImage } from "./GoBinaryImage.js";
|
||||
import { requireSelectedNativeImage } from "../native/metadata/MachoSliceSelection.js";
|
||||
import { requireSelectedNativeImage } from "../domain/apple/machoSliceSelection.js";
|
||||
import { BinaryResourceFailure } from "../domain/binaryContainer.js";
|
||||
|
||||
const OPERATION = "inspect_go_binary";
|
||||
|
||||
@@ -14,23 +14,23 @@ import {
|
||||
type BinaryContainer,
|
||||
type FileMappingIndex,
|
||||
} from "../domain/binaryContainer.js";
|
||||
import { readBinaryContainer } from "../native/metadata/readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../domain/native/readBinaryContainer.js";
|
||||
import {
|
||||
requireSelectedNativeImage,
|
||||
type SelectedNativeImage,
|
||||
type SliceSelectionInput,
|
||||
selectMachoSlice,
|
||||
} from "../native/metadata/MachoSliceSelection.js";
|
||||
} from "../domain/apple/machoSliceSelection.js";
|
||||
import {
|
||||
parsePointerFixupsSteps,
|
||||
type PointerFixups,
|
||||
} from "../native/AppleMachoFixups.js";
|
||||
import { parseMachoLayout } from "../native/AppleMachoSelection.js";
|
||||
} from "../domain/apple/appleMachoFixups.js";
|
||||
import { parseMachoLayout } from "../domain/apple/appleMachoSelection.js";
|
||||
import {
|
||||
readElfPointerValuesSteps,
|
||||
ElfPointerRelocationFailure,
|
||||
type ElfVirtualPointerWrites,
|
||||
} from "../native/metadata/ElfPointerRelocations.js";
|
||||
} from "../domain/native/elfPointerRelocations.js";
|
||||
import {
|
||||
Il2cppBinaryFormatFailure,
|
||||
IL2CPP_BINARY_BYTES,
|
||||
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
readMachoHeaderDeclarations,
|
||||
readMachoLoadCommandTableHeader,
|
||||
} from "../domain/apple/machoLoadCommands.js";
|
||||
import { decodeMachoFixedName } from "../native/AppleMachoNames.js";
|
||||
import { decodeMachoFixedName } from "../domain/apple/appleMachoNames.js";
|
||||
import { parseFailureFromCause } from "../domain/parseFailure.js";
|
||||
import { readMachoCommandNames } from "../native/MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import type { KunaInputPrefix } from "./KunaCommand.js";
|
||||
import type { KunaInventoryFunction } from "./KunaProjectFiles.js";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ObjcSwiftMetadata } from "../domain/native/objcSwiftMetadata.js";
|
||||
import type { PointerFixups } from "./AppleMachoFixups.js";
|
||||
import type { PointerFixups } from "../domain/apple/appleMachoFixups.js";
|
||||
import type {
|
||||
DecodeIssue,
|
||||
FacetDecodeFacts,
|
||||
} from "./AppleDispatchDecodeFacts.js";
|
||||
} from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
|
||||
const describeFixups = (fixups: PointerFixups): string => {
|
||||
const descriptions: string[] = [];
|
||||
|
||||
@@ -47,13 +47,13 @@ import { NATIVE_MACOS_PROVIDER_IDENTITY as IDENTITY } from "./NativeMacosProvide
|
||||
import { readBoundedFileBytes } from "../process/BoundedFileBytes.js";
|
||||
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
|
||||
import { pushDispatchCoverage } from "./AppleDispatchCoverage.js";
|
||||
import { parsePointerFixupsSteps } from "./AppleMachoFixups.js";
|
||||
import { parsePointerFixupsSteps } from "../domain/apple/appleMachoFixups.js";
|
||||
import { BinaryFormatFailure } from "../domain/binaryContainer.js";
|
||||
import { parseMachoLayout } from "./AppleMachoSelection.js";
|
||||
import { parseMachoLayout } from "../domain/apple/appleMachoSelection.js";
|
||||
import {
|
||||
selectMachoSlice,
|
||||
type AdmittedMachoSlice,
|
||||
} from "./metadata/MachoSliceSelection.js";
|
||||
} from "../domain/apple/machoSliceSelection.js";
|
||||
import { decodeObjcDispatchFacets } from "./AppleObjcDispatchFacets.js";
|
||||
import {
|
||||
createSwiftRelativeReader,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parsePointerFixupsSteps } from "./AppleMachoFixups.js";
|
||||
import { parsePointerFixupsSteps } from "../domain/apple/appleMachoFixups.js";
|
||||
|
||||
export const parsePointerFixups = (
|
||||
...args: Parameters<typeof parsePointerFixupsSteps>
|
||||
|
||||
@@ -4,9 +4,9 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
chainedImportNames,
|
||||
decodeChainedPointer,
|
||||
} from "./AppleMachoFixups.js";
|
||||
} from "../domain/apple/appleMachoFixups.js";
|
||||
import { parsePointerFixups } from "./AppleMachoFixups.fixture.js";
|
||||
import type { Segment } from "./AppleMachoSelection.js";
|
||||
import type { Segment } from "../domain/apple/appleMachoSelection.js";
|
||||
|
||||
const BASE = 0x100000000n;
|
||||
const IMPORTS = [
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { malformedInput } from "../domain/parseFailure.js";
|
||||
import { parseMachoLayout, type MachoLayout } from "./AppleMachoSelection.js";
|
||||
import {
|
||||
parseMachoLayout,
|
||||
type MachoLayout,
|
||||
} from "../domain/apple/appleMachoSelection.js";
|
||||
import {
|
||||
selectMachoSlice,
|
||||
type AdmittedMachoSlice,
|
||||
type MachoSliceSelectionRefusal,
|
||||
} from "./metadata/MachoSliceSelection.js";
|
||||
} from "../domain/apple/machoSliceSelection.js";
|
||||
|
||||
/** A refused admitted selection, thrown so a test can assert its kind. */
|
||||
export class MachoSliceRefused extends Error {
|
||||
|
||||
@@ -17,13 +17,13 @@ import {
|
||||
machoImageWithUnknownCommand,
|
||||
} from "../artifacts/apple/MachoImage.fixture.js";
|
||||
import { readMachoImage } from "../domain/apple/machoLoadCommandReader.js";
|
||||
import { readMachoImage as readMachoMetadataImage } from "./metadata/MachoImage.js";
|
||||
import { readMachoImage as readMachoMetadataImage } from "../domain/apple/machoImage.js";
|
||||
import { BinaryFormatFailure } from "../domain/binaryContainer.js";
|
||||
import { layoutFor, MachoSliceRefused } from "./AppleMachoSelection.fixture.js";
|
||||
import {
|
||||
selectMachoSlice,
|
||||
type AdmittedMachoSlice,
|
||||
} from "./metadata/MachoSliceSelection.js";
|
||||
} from "../domain/apple/machoSliceSelection.js";
|
||||
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
||||
|
||||
const admittedSlice = (
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { malformedInput } from "../domain/parseFailure.js";
|
||||
import { expectedAppleMetadataReadFailure } from "./AppleMetadataReadFailure.js";
|
||||
import type { ObjcSwiftMetadata } from "../domain/native/objcSwiftMetadata.js";
|
||||
import type { Section } from "./AppleMachoSelection.js";
|
||||
import type { Section } from "../domain/apple/appleMachoSelection.js";
|
||||
import type { ObjcDispatchReaders } from "./AppleObjcDispatchFacets.js";
|
||||
import { readObjcPropertiesOf } from "./AppleObjcProperties.js";
|
||||
import { issue, type DecodeIssue } from "./AppleDispatchDecodeFacts.js";
|
||||
import {
|
||||
issue,
|
||||
type DecodeIssue,
|
||||
} from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
import { BinaryFormatFailure } from "../domain/binaryContainer.js";
|
||||
import type { ObjcProtocolListResult } from "./AppleObjcProtocols.js";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { malformedInput } from "../domain/parseFailure.js";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { PointerFixups } from "./AppleMachoFixups.js";
|
||||
import type { PointerFixups } from "../domain/apple/appleMachoFixups.js";
|
||||
import { parsePointerFixups } from "./AppleMachoFixups.fixture.js";
|
||||
import type { MachoLayout } from "./AppleMachoSelection.js";
|
||||
import type { MachoLayout } from "../domain/apple/appleMachoSelection.js";
|
||||
import { inspectObjcClassImportBindings } from "./AppleObjcClassImportBindings.js";
|
||||
|
||||
const createInput = (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PointerFixups } from "./AppleMachoFixups.js";
|
||||
import type { MachoLayout } from "./AppleMachoSelection.js";
|
||||
import type { PointerFixups } from "../domain/apple/appleMachoFixups.js";
|
||||
import type { MachoLayout } from "../domain/apple/appleMachoSelection.js";
|
||||
import type { MachoImportBinding } from "../domain/native/objcSwiftMetadata.js";
|
||||
|
||||
export interface ObjcClassImportBindingScan {
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
projectObjcClassMethods,
|
||||
type ObjcSwiftMetadata,
|
||||
} from "../domain/native/objcSwiftMetadata.js";
|
||||
import type { Segment, Section } from "./AppleMachoSelection.js";
|
||||
import type { Segment, Section } from "../domain/apple/appleMachoSelection.js";
|
||||
import { boundClassName, decodeObjcCategories } from "./AppleObjcCategories.js";
|
||||
import { readObjcPropertiesOf } from "./AppleObjcProperties.js";
|
||||
import { BinaryFormatFailure } from "../domain/binaryContainer.js";
|
||||
import type { DecodeIssue } from "./AppleDispatchDecodeFacts.js";
|
||||
import type { DecodeIssue } from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
import { createObjcProtocolReader } from "./AppleObjcProtocols.js";
|
||||
import type {
|
||||
BinaryMetadataEvidence,
|
||||
|
||||
@@ -3,7 +3,10 @@ import { expectedAppleMetadataReadFailure } from "./AppleMetadataReadFailure.js"
|
||||
import type { z } from "zod";
|
||||
|
||||
import type { objcPropertySchema } from "../domain/native/objcSwiftMetadata.js";
|
||||
import { issue, type DecodeIssue } from "./AppleDispatchDecodeFacts.js";
|
||||
import {
|
||||
issue,
|
||||
type DecodeIssue,
|
||||
} from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
|
||||
type ObjcProperty = z.infer<typeof objcPropertySchema>;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
createSwiftContextReader,
|
||||
type SwiftContextReader,
|
||||
} from "./AppleSwiftNominalTypes.js";
|
||||
import type { PointerResolution } from "./AppleMachoFixups.js";
|
||||
import type { PointerResolution } from "../domain/apple/appleMachoFixups.js";
|
||||
import type {
|
||||
SwiftDispatchReaders,
|
||||
SwiftRelativeField,
|
||||
|
||||
@@ -4,10 +4,13 @@ import {
|
||||
type SwiftContextReader,
|
||||
} from "./AppleSwiftNominalTypes.js";
|
||||
import type { ObjcSwiftMetadata } from "../domain/native/objcSwiftMetadata.js";
|
||||
import type { PointerResolution } from "./AppleMachoFixups.js";
|
||||
import type { Segment, Section } from "./AppleMachoSelection.js";
|
||||
import type { PointerResolution } from "../domain/apple/appleMachoFixups.js";
|
||||
import type { Segment, Section } from "../domain/apple/appleMachoSelection.js";
|
||||
import { BinaryFormatFailure } from "../domain/binaryContainer.js";
|
||||
import { issue, type FacetDecodeFacts } from "./AppleDispatchDecodeFacts.js";
|
||||
import {
|
||||
issue,
|
||||
type FacetDecodeFacts,
|
||||
} from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
import {
|
||||
decodeSwiftConformanceTypeReference,
|
||||
requiredSwiftRelativeTarget,
|
||||
|
||||
@@ -4,7 +4,10 @@ import type {
|
||||
NativeMetadataLocation,
|
||||
ObjcSwiftMetadata,
|
||||
} from "../domain/native/objcSwiftMetadata.js";
|
||||
import { issue, type FacetDecodeFacts } from "./AppleDispatchDecodeFacts.js";
|
||||
import {
|
||||
issue,
|
||||
type FacetDecodeFacts,
|
||||
} from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
import {
|
||||
unresolvedSwiftRelativeReason,
|
||||
type SwiftRelativeField,
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
DispatchRecordBudget,
|
||||
SwiftDispatchReaders,
|
||||
} from "./AppleSwiftDispatchFacets.js";
|
||||
import { issue } from "./AppleDispatchDecodeFacts.js";
|
||||
import { issue } from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
|
||||
it("propagates unexpected conformance reader failures", () => {
|
||||
const failure = new Error("conformance reader invariant failed");
|
||||
|
||||
@@ -13,7 +13,10 @@ import type {
|
||||
SwiftRelativeValue,
|
||||
} from "./AppleSwiftDispatchFacets.js";
|
||||
import { unresolvedSwiftRelativeReason } from "./AppleSwiftDispatchFacets.js";
|
||||
import { issue, type FacetDecodeFacts } from "./AppleDispatchDecodeFacts.js";
|
||||
import {
|
||||
issue,
|
||||
type FacetDecodeFacts,
|
||||
} from "../domain/apple/appleDispatchDecodeFacts.js";
|
||||
import type {
|
||||
SwiftNominalDescriptor,
|
||||
SwiftNominalRecordFailure,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { projectMachoBinary } from "./MachoBinaryProjection.js";
|
||||
import type { MachoCommandNames } from "./MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "./MachoCommandNames.js";
|
||||
import type { MachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import {
|
||||
machoImage,
|
||||
readerOf,
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
LC,
|
||||
machoLoadCommandName,
|
||||
} from "../domain/apple/machoLoadCommandCodes.js";
|
||||
import type { MachoCommandNames } from "./MachoCommandNames.js";
|
||||
import type { MachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
|
||||
const PLATFORM_NAMES = new Map<number, string>([
|
||||
[1, "MACOS"],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { createHash } from "node:crypto";
|
||||
import { readMachoCommandNames } from "./MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import { projectMachoBinary } from "./MachoBinaryProjection.js";
|
||||
import { machoImage, readerOf } from "../artifacts/apple/MachoImage.fixture.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { readMachoCommandNames } from "./MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import { projectMachoBinary } from "./MachoBinaryProjection.js";
|
||||
|
||||
it.each([0xff, 0x01])(
|
||||
|
||||
@@ -109,7 +109,7 @@ import { createPlistNumberProjection } from "../domain/apple/plistNumbers.js";
|
||||
import type { NativeUiObservationResult } from "../domain/native/nativeUiObservation.js";
|
||||
import { parseXmlPropertyList } from "../domain/propertyListKeys.js";
|
||||
import { plistDuplicateKeyLimitations } from "../domain/apple/plistDuplicateKeys.js";
|
||||
import { machoKnownCodeSignSelector } from "./MachoArchitectureSelection.js";
|
||||
import { machoKnownCodeSignSelector } from "../domain/apple/machoArchitectureSelection.js";
|
||||
import {
|
||||
demangleSwiftSchema,
|
||||
inspectPlistSchema,
|
||||
@@ -160,7 +160,7 @@ import { parseFailureAnalysisError } from "../domain/parseFailureAnalysisError.j
|
||||
import {
|
||||
MachoCommandNamesLimitError,
|
||||
readMachoCommandNames,
|
||||
} from "./MachoCommandNames.js";
|
||||
} from "../domain/apple/machoCommandNames.js";
|
||||
import {
|
||||
assertSelectedMachoSlice,
|
||||
resolveSelectedMachoSlice,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
readerOf,
|
||||
segmentCommand,
|
||||
} from "../artifacts/apple/MachoImage.fixture.js";
|
||||
import { readMachoCommandNames } from "./MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import {
|
||||
assertSelectedMachoSlice,
|
||||
resolveSelectedMachoSlice,
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { err, ok } from "../domain/result.js";
|
||||
import { layoutFor } from "./AppleMachoSelection.fixture.js";
|
||||
import { selectMachoSlice } from "./metadata/MachoSliceSelection.js";
|
||||
import { selectMachoSlice } from "../domain/apple/machoSliceSelection.js";
|
||||
import type { NativeCommandCapture } from "./CommandRunner.js";
|
||||
import type { MachoSliceEncryption } from "../domain/apple/machoEncryption.js";
|
||||
import { inspectMachoSchema } from "../domain/native/nativeInspection.js";
|
||||
|
||||
@@ -15,14 +15,14 @@ import { jsonValueSchema, type JsonValue } from "../domain/jsonValue.js";
|
||||
import { machoRuntimeSymbolName } from "../domain/native/machoSymbolName.js";
|
||||
import { keyedBy, uniqueKeyed } from "../domain/keyedCollection.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import type { MachoSliceSelectionRefusal } from "./metadata/MachoSliceSelection.js";
|
||||
import type { MachoSliceSelectionRefusal } from "../domain/apple/machoSliceSelection.js";
|
||||
import type { NativeCommandCapture } from "./CommandRunner.js";
|
||||
import { chainedImportNames } from "./AppleMachoFixups.js";
|
||||
import { chainedImportNames } from "../domain/apple/appleMachoFixups.js";
|
||||
import {
|
||||
architectureBaseName,
|
||||
selectLipoArchitecture,
|
||||
type SelectedLipoArchitecture,
|
||||
} from "./MachoArchitectureSelection.js";
|
||||
} from "../domain/apple/machoArchitectureSelection.js";
|
||||
import {
|
||||
parseDyldExportAddressRow,
|
||||
parseDyldExports,
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
projectMachoBinary,
|
||||
type BinaryMachoProjection,
|
||||
} from "./MachoBinaryProjection.js";
|
||||
import type { MachoCommandNames } from "./MachoCommandNames.js";
|
||||
import type { MachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import type { ResolvedMachoSlice } from "./NativeMachoSelectedSlice.js";
|
||||
import { reconcileMachoUuid } from "./parsers/machoUuid.js";
|
||||
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
assertSelectedMachoSlice,
|
||||
resolveSelectedMachoSlice,
|
||||
} from "./NativeMachoSelectedSlice.js";
|
||||
import type { MachoCommandNames } from "./MachoCommandNames.js";
|
||||
import type { MachoCommandNames } from "../domain/apple/machoCommandNames.js";
|
||||
import { parseLipoOutputResult } from "../domain/apple/lipo.js";
|
||||
|
||||
it("binds the lipo row to one FAT entry and its selected thin header", async () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { malformedInput } from "../domain/parseFailure.js";
|
||||
import {
|
||||
MachoCommandNamesLimitError,
|
||||
type MachoCommandNames,
|
||||
} from "./MachoCommandNames.js";
|
||||
} from "../domain/apple/machoCommandNames.js";
|
||||
import type { NativeMachoSource } from "./NativeMachoSource.js";
|
||||
import type { LipoArchitecture } from "../domain/apple/lipo.js";
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { NativeCommandFailure, XcrunCommandRunner } from "./CommandRunner.js";
|
||||
import { ProviderProcessSupervisor } from "../process/ProviderProcess.js";
|
||||
import { err } from "../domain/result.js";
|
||||
import { primaryAnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import { MachoCommandNamesLimitError } from "./MachoCommandNames.js";
|
||||
import { MachoCommandNamesLimitError } from "../domain/apple/machoCommandNames.js";
|
||||
import {
|
||||
NativeFixtureRunner,
|
||||
nativeMachoTargetForFile,
|
||||
@@ -198,9 +198,11 @@ it.each(
|
||||
expect((await client.close()).ok).toBe(true);
|
||||
},
|
||||
);
|
||||
vi.mock("./MachoCommandNames.js", async (importOriginal) => {
|
||||
vi.mock("../domain/apple/machoCommandNames.js", async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import("./MachoCommandNames.js")>();
|
||||
await importOriginal<
|
||||
typeof import("../domain/apple/machoCommandNames.js")
|
||||
>();
|
||||
return {
|
||||
...actual,
|
||||
readMachoCommandNames: (
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
} from "../../domain/android/androidJniLibraryFacts.js";
|
||||
import { parseNativeExportsSteps } from "../exports/NativeExportParser.js";
|
||||
import { readElfDirectoryFromBuffer } from "../../domain/native/nativeSectionDirectory.js";
|
||||
import { readElfImage } from "../metadata/ElfImage.js";
|
||||
import { readElfImage } from "../../domain/native/elfImage.js";
|
||||
import {
|
||||
BinaryFormatFailure,
|
||||
BinaryMappingFailure,
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
readElfPointerRelocationsSteps,
|
||||
ElfPointerRelocationFailure,
|
||||
type ElfPointerOverlay,
|
||||
} from "../metadata/ElfPointerRelocations.js";
|
||||
} from "../../domain/native/elfPointerRelocations.js";
|
||||
|
||||
const MAXIMUM_STRING_BYTES = 65_535;
|
||||
const MAXIMUM_STRING_WORK = 64 * 1024 * 1024;
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {
|
||||
ImageSection,
|
||||
BinaryContainer,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { readElfImage } from "../metadata/ElfImage.js";
|
||||
import { readElfImage } from "../../domain/native/elfImage.js";
|
||||
import { kernelCompressionCodecAt } from "./KernelCompressionCodec.js";
|
||||
|
||||
type ElfSection = Extract<ImageSection, { format: "elf" }>;
|
||||
|
||||
@@ -8,14 +8,14 @@ import {
|
||||
imageFileMappings,
|
||||
readMappedCString,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { architectureForElfMachine } from "../metadata/ElfImage.js";
|
||||
import { architectureForElfMachine } from "../../domain/native/elfImage.js";
|
||||
import { readElfStringBytes } from "../../domain/native/elfStringBytes.js";
|
||||
import { readElfSymbol } from "../../domain/elfSymbol.js";
|
||||
import {
|
||||
readElfDirectoryFromBuffer,
|
||||
type NativeSection,
|
||||
} from "../../domain/native/nativeSectionDirectory.js";
|
||||
import { readPeImage } from "../metadata/PeImage.js";
|
||||
import { readPeImage } from "../../domain/native/peImage.js";
|
||||
import {
|
||||
allKeyed,
|
||||
keyedBy,
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
type BinaryHardeningRow,
|
||||
} from "../../domain/native/binaryHardening.js";
|
||||
import { BinaryFormatFailure } from "../../domain/binaryContainer.js";
|
||||
import { readElfImage } from "../metadata/ElfImage.js";
|
||||
import { readMachoImage } from "../metadata/MachoImage.js";
|
||||
import { readElfImage } from "../../domain/native/elfImage.js";
|
||||
import { readMachoImage } from "../../domain/apple/machoImage.js";
|
||||
import {
|
||||
elfHardeningFixture,
|
||||
fatMachoHardeningFixture,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
readMachoSegmentHeader,
|
||||
} from "../../domain/apple/machoSegmentHeader.js";
|
||||
import { machoBinaryArchitecture } from "../../domain/binaryTarget.js";
|
||||
import { decodeMachoFixedName } from "../AppleMachoNames.js";
|
||||
import { decodeMachoFixedName } from "../../domain/apple/appleMachoNames.js";
|
||||
import {
|
||||
elfStringTableText,
|
||||
observeElfStringTableEntry,
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { peSubjectArchitecture } from "../../domain/peMachine.js";
|
||||
import type { PeDataDirectory } from "../../domain/peOptionalHeader.js";
|
||||
import { readPeImage } from "../metadata/PeImage.js";
|
||||
import { readPeImage } from "../../domain/native/peImage.js";
|
||||
import { parsePeLoadConfig } from "../pe/PeLoadConfigParser.js";
|
||||
|
||||
const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
elfCopyRelocationType,
|
||||
elfRelativeRelocationType,
|
||||
elfRelocationWidth,
|
||||
} from "../metadata/ElfPointerRelocations.js";
|
||||
} from "../../domain/native/elfPointerRelocations.js";
|
||||
import type { NativeSection } from "../../domain/native/nativeSectionDirectory.js";
|
||||
import type { InitializerNotes } from "./initializerNotes.js";
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@ import {
|
||||
type NativeInitializerInspection,
|
||||
type NativeInitializerKind,
|
||||
} from "../../domain/native/nativeInitializers.js";
|
||||
import type { ElfPointerWrite } from "../metadata/ElfPointerRelocations.js";
|
||||
import type { ElfPointerWrite } from "../../domain/native/elfPointerRelocations.js";
|
||||
import {
|
||||
ElfPointerRelocationFailure,
|
||||
elfRelativeRelocationType,
|
||||
readElfRelocationWritesSteps,
|
||||
} from "../metadata/ElfPointerRelocations.js";
|
||||
import { readElfImage } from "../metadata/ElfImage.js";
|
||||
} from "../../domain/native/elfPointerRelocations.js";
|
||||
import { readElfImage } from "../../domain/native/elfImage.js";
|
||||
import {
|
||||
BinaryFormatFailure,
|
||||
BinaryMappingFailure,
|
||||
|
||||
@@ -17,17 +17,17 @@ import {
|
||||
import {
|
||||
parsePointerFixupsSteps,
|
||||
type PointerFixups,
|
||||
} from "../AppleMachoFixups.js";
|
||||
import { parseMachoLayout } from "../AppleMachoSelection.js";
|
||||
import { selectMachoSlice } from "../metadata/MachoSliceSelection.js";
|
||||
import { decodeMachoName } from "../AppleMachoNames.js";
|
||||
} from "../../domain/apple/appleMachoFixups.js";
|
||||
import { parseMachoLayout } from "../../domain/apple/appleMachoSelection.js";
|
||||
import { selectMachoSlice } from "../../domain/apple/machoSliceSelection.js";
|
||||
import { decodeMachoName } from "../../domain/apple/appleMachoNames.js";
|
||||
import {
|
||||
BinaryFormatFailure,
|
||||
BinaryMappingFailure,
|
||||
createFileMappingIndex,
|
||||
type ImageSection,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { readMachoImage } from "../metadata/MachoImage.js";
|
||||
import { readMachoImage } from "../../domain/apple/machoImage.js";
|
||||
import {
|
||||
finishInitializerReport,
|
||||
type CollectedInitializer,
|
||||
|
||||
@@ -32,8 +32,8 @@ import {
|
||||
BinaryFormatFailure,
|
||||
BinaryResourceFailure,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { ElfPointerRelocationFailure } from "../metadata/ElfPointerRelocations.js";
|
||||
import { requireSelectedNativeImage } from "../metadata/MachoSliceSelection.js";
|
||||
import { ElfPointerRelocationFailure } from "../../domain/native/elfPointerRelocations.js";
|
||||
import { requireSelectedNativeImage } from "../../domain/apple/machoSliceSelection.js";
|
||||
import { readElfInitializers } from "./ElfInitializers.js";
|
||||
import { readMachoInitializers } from "./MachoInitializers.js";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
FileMapping,
|
||||
ZeroFillMapping,
|
||||
} from "../../domain/virtualFileMapping.js";
|
||||
import { readBinaryContainer } from "./readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../../domain/native/readBinaryContainer.js";
|
||||
import { expect, it } from "vitest";
|
||||
import {
|
||||
BinaryFormatFailure,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { expect, it } from "vitest";
|
||||
import { readGoBinaryImage } from "../../go/GoBinaryImage.js";
|
||||
import { createRustImageWithGoSection } from "../../../tests/fixtures/rust/image.js";
|
||||
import { openImageSteps } from "../../il2cpp/Il2cppBinaryImage.js";
|
||||
import { readBinaryContainer } from "./readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../../domain/native/readBinaryContainer.js";
|
||||
|
||||
it.each(["unmapped", "zero-fill", "duplicate", "out-of-file"] as const)(
|
||||
"keeps IL2CPP admission independent of a Mach-O Go build-info %s failure",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { MachoSliceArchitecture } from "../../domain/apple/machoTargetSelection.js";
|
||||
import { machoArm64Initializers } from "../initializers/NativeInitializers.fixture.js";
|
||||
import { selectMachoSlice } from "./MachoSliceSelection.js";
|
||||
import { selectMachoSlice } from "../../domain/apple/machoSliceSelection.js";
|
||||
|
||||
const selectNativeImage = (
|
||||
bytes: Buffer,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { readGoBinaryImage } from "../../go/GoBinaryImage.js";
|
||||
import { readPeImage } from "./PeImage.js";
|
||||
import { readPeImage } from "../../domain/native/peImage.js";
|
||||
import { pe } from "../../domain/binaryTarget.fixture.js";
|
||||
import { parseMzHeaderEvidence } from "../../domain/dosMz.js";
|
||||
import { BinaryFormatFailure } from "../../domain/binaryContainer.js";
|
||||
import { readBinaryContainer } from "./readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../../domain/native/readBinaryContainer.js";
|
||||
import {
|
||||
createGoBinaryFixture,
|
||||
setGoPeVirtualSize,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
createFileMappingIndex,
|
||||
imageFileMappings,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { readPeImage } from "../metadata/PeImage.js";
|
||||
import { readPeImage } from "../../domain/native/peImage.js";
|
||||
import {
|
||||
MAX_INSPECT_PE_IMPORT_RETAINED_TEXT_BYTES,
|
||||
type InspectPeImportsInput,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
createFileMappingIndex,
|
||||
imageFileMappings,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { readPeImage, type PeImage } from "../metadata/PeImage.js";
|
||||
import { readPeImage, type PeImage } from "../../domain/native/peImage.js";
|
||||
import {
|
||||
guardFlagRecord,
|
||||
loadConfigFieldCovered,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PeImage } from "../metadata/PeImage.js";
|
||||
import type { PeImage } from "../../domain/native/peImage.js";
|
||||
|
||||
/**
|
||||
* Prove that a successful native read sees the same bytes as pefile 2024.8.26.
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from "../domain/binaryContainer.js";
|
||||
import { malformedInput, unsupportedInput } from "../domain/parseFailure.js";
|
||||
import { keyedBy, uniqueKeyed } from "../domain/keyedCollection.js";
|
||||
import { readBinaryContainer } from "../native/metadata/readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../domain/native/readBinaryContainer.js";
|
||||
import type {
|
||||
RustAuditableMetadata,
|
||||
RustBinary,
|
||||
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
readRustBinaryImage,
|
||||
type RustBinaryImage,
|
||||
} from "./RustBinaryImage.js";
|
||||
import { requireSelectedNativeImage } from "../native/metadata/MachoSliceSelection.js";
|
||||
import { requireSelectedNativeImage } from "../domain/apple/machoSliceSelection.js";
|
||||
import { RustAuditableResourceFailure } from "./RustAuditableReader.js";
|
||||
import { parseFailureAnalysisError } from "../domain/parseFailureAnalysisError.js";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { expect, it } from "vitest";
|
||||
|
||||
import { BinaryResourceFailure } from "../../../src/domain/binaryContainer.js";
|
||||
import { readMachoLoadCommandTableHeader } from "../../../src/domain/apple/machoLoadCommands.js";
|
||||
import { readBinaryContainer } from "../../../src/native/metadata/readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../../../src/domain/native/readBinaryContainer.js";
|
||||
import { parseBinaryTarget } from "../../../src/application/BinaryTargetResolver.js";
|
||||
import { thinMach } from "../../../src/domain/binaryTarget.fixture.js";
|
||||
import { parseExecutableHeader } from "../../../src/domain/binaryTarget.js";
|
||||
|
||||
@@ -8,8 +8,8 @@ import {
|
||||
import { readGoBinaryImage } from "../../../src/go/GoBinaryImage.js";
|
||||
import { goBuildInfoSearch } from "../../../src/go/GoBuildInfoSearch.js";
|
||||
import { BinaryResourceFailure } from "../../../src/domain/binaryContainer.js";
|
||||
import { readMachoImage } from "../../../src/native/metadata/MachoImage.js";
|
||||
import { readBinaryContainer } from "../../../src/native/metadata/readBinaryContainer.js";
|
||||
import { readMachoImage } from "../../../src/domain/apple/machoImage.js";
|
||||
import { readBinaryContainer } from "../../../src/domain/native/readBinaryContainer.js";
|
||||
import {
|
||||
createGoBinaryFixture,
|
||||
createGoBinaryByteStringFixture,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { javaClassFile } from "../../fixtures/javaClassFile.js";
|
||||
import { Il2cppBinaryFormatFailure } from "../../../src/il2cpp/Il2cppBinaryFormat.js";
|
||||
import { readBinaryContainer } from "../../../src/native/metadata/readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../../../src/domain/native/readBinaryContainer.js";
|
||||
import {
|
||||
openImageSteps,
|
||||
readUInt32,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { readMachoCommandNames } from "../../../../src/native/MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../../../../src/domain/apple/machoCommandNames.js";
|
||||
import { projectMachoBinary } from "../../../../src/native/MachoBinaryProjection.js";
|
||||
|
||||
it.each([
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { readMachoCommandNames } from "../../../../src/native/MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../../../../src/domain/apple/machoCommandNames.js";
|
||||
import { projectMachoBinary } from "../../../../src/native/MachoBinaryProjection.js";
|
||||
|
||||
it.each([
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { readMachoCommandNames } from "../../../../src/native/MachoCommandNames.js";
|
||||
import { readMachoCommandNames } from "../../../../src/domain/apple/machoCommandNames.js";
|
||||
import { projectMachoBinary } from "../../../../src/native/MachoBinaryProjection.js";
|
||||
|
||||
it.each([
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
rustDependencyPayload,
|
||||
} from "../../fixtures/rust/image.js";
|
||||
import { readRustBinaryImage } from "../../../src/rust/RustBinaryImage.js";
|
||||
import { readBinaryContainer } from "../../../src/native/metadata/readBinaryContainer.js";
|
||||
import { readBinaryContainer } from "../../../src/domain/native/readBinaryContainer.js";
|
||||
import { readGoBinaryImage } from "../../../src/go/GoBinaryImage.js";
|
||||
import { ParseFailureError } from "../../../src/domain/parseFailure.js";
|
||||
|
||||
|
||||
@@ -118,9 +118,9 @@ if (Object.hasOwn(oracle, "conscrypt")) {
|
||||
const fingerprints = {};
|
||||
for (const relative of [
|
||||
".",
|
||||
"../metadata/ElfPointerRelocations",
|
||||
"../../domain/native/elfPointerRelocations",
|
||||
"../exports/NativeExportParser",
|
||||
"../metadata/ElfImage",
|
||||
"../../domain/native/elfImage",
|
||||
"../../domain/native/nativeSectionDirectory",
|
||||
"../../domain/elfRelocation",
|
||||
"../../domain/elfDynamicEntry",
|
||||
|
||||
Reference in new issue
Block a user