diff --git a/scripts/lib/module-layers.baseline.json b/scripts/lib/module-layers.baseline.json index 8cbb4b1e04..72abcdd671 100644 --- a/scripts/lib/module-layers.baseline.json +++ b/scripts/lib/module-layers.baseline.json @@ -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, diff --git a/scripts/verify/baselines/raw-buffer-read.json b/scripts/verify/baselines/raw-buffer-read.json index 10f759551d..0e327c10b1 100644 --- a/scripts/verify/baselines/raw-buffer-read.json +++ b/scripts/verify/baselines/raw-buffer-read.json @@ -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, diff --git a/src/native/AppleDispatchDecodeFacts.ts b/src/domain/apple/appleDispatchDecodeFacts.ts similarity index 100% rename from src/native/AppleDispatchDecodeFacts.ts rename to src/domain/apple/appleDispatchDecodeFacts.ts diff --git a/src/native/AppleMachoFixups.ts b/src/domain/apple/appleMachoFixups.ts similarity index 99% rename from src/native/AppleMachoFixups.ts rename to src/domain/apple/appleMachoFixups.ts index 0a0988f7e2..9592bf9397 100644 --- a/src/native/AppleMachoFixups.ts +++ b/src/domain/apple/appleMachoFixups.ts @@ -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 { diff --git a/src/native/AppleMachoNames.ts b/src/domain/apple/appleMachoNames.ts similarity index 92% rename from src/native/AppleMachoNames.ts rename to src/domain/apple/appleMachoNames.ts index 8ee17eaf20..79f44e7e20 100644 --- a/src/native/AppleMachoNames.ts +++ b/src/domain/apple/appleMachoNames.ts @@ -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 }; diff --git a/src/native/AppleMachoSelection.ts b/src/domain/apple/appleMachoSelection.ts similarity index 94% rename from src/native/AppleMachoSelection.ts rename to src/domain/apple/appleMachoSelection.ts index d0e27c8b90..97033ef455 100644 --- a/src/native/AppleMachoSelection.ts +++ b/src/domain/apple/appleMachoSelection.ts @@ -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 { diff --git a/src/native/MachoArchitectureSelection.test.ts b/src/domain/apple/machoArchitectureSelection.test.ts similarity index 94% rename from src/native/MachoArchitectureSelection.test.ts rename to src/domain/apple/machoArchitectureSelection.test.ts index fa20def7b4..23c9e22145 100644 --- a/src/native/MachoArchitectureSelection.test.ts +++ b/src/domain/apple/machoArchitectureSelection.test.ts @@ -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, diff --git a/src/native/MachoArchitectureSelection.ts b/src/domain/apple/machoArchitectureSelection.ts similarity index 97% rename from src/native/MachoArchitectureSelection.ts rename to src/domain/apple/machoArchitectureSelection.ts index fa3a8d4644..22aef065da 100644 --- a/src/native/MachoArchitectureSelection.ts +++ b/src/domain/apple/machoArchitectureSelection.ts @@ -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 = ( diff --git a/src/native/MachoCommandNames.ts b/src/domain/apple/machoCommandNames.ts similarity index 98% rename from src/native/MachoCommandNames.ts rename to src/domain/apple/machoCommandNames.ts index aa16d4a162..d4e64d5d96 100644 --- a/src/native/MachoCommandNames.ts +++ b/src/domain/apple/machoCommandNames.ts @@ -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; diff --git a/src/native/metadata/MachoImage.ts b/src/domain/apple/machoImage.ts similarity index 94% rename from src/native/metadata/MachoImage.ts rename to src/domain/apple/machoImage.ts index 358310ed07..89dc6f04db 100644 --- a/src/native/metadata/MachoImage.ts +++ b/src/domain/apple/machoImage.ts @@ -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 => { diff --git a/src/native/metadata/MachoSliceSelection.ts b/src/domain/apple/machoSliceSelection.ts similarity index 97% rename from src/native/metadata/MachoSliceSelection.ts rename to src/domain/apple/machoSliceSelection.ts index cdceeae8fc..193ef12a88 100644 --- a/src/native/metadata/MachoSliceSelection.ts +++ b/src/domain/apple/machoSliceSelection.ts @@ -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( diff --git a/src/native/metadata/ElfImage.ts b/src/domain/native/elfImage.ts similarity index 91% rename from src/native/metadata/ElfImage.ts rename to src/domain/native/elfImage.ts index 65de394a4b..7d9c78fce3 100644 --- a/src/native/metadata/ElfImage.ts +++ b/src/domain/native/elfImage.ts @@ -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 = ( diff --git a/src/native/metadata/ElfPointerRelocations.test.ts b/src/domain/native/elfPointerRelocations.test.ts similarity index 99% rename from src/native/metadata/ElfPointerRelocations.test.ts rename to src/domain/native/elfPointerRelocations.test.ts index 23fb8beb08..cb01b6130e 100644 --- a/src/native/metadata/ElfPointerRelocations.test.ts +++ b/src/domain/native/elfPointerRelocations.test.ts @@ -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; diff --git a/src/native/metadata/ElfPointerRelocations.ts b/src/domain/native/elfPointerRelocations.ts similarity index 98% rename from src/native/metadata/ElfPointerRelocations.ts rename to src/domain/native/elfPointerRelocations.ts index 9aa830629a..dabd168d6c 100644 --- a/src/native/metadata/ElfPointerRelocations.ts +++ b/src/domain/native/elfPointerRelocations.ts @@ -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"; diff --git a/src/native/metadata/PeImage.ts b/src/domain/native/peImage.ts similarity index 94% rename from src/native/metadata/PeImage.ts rename to src/domain/native/peImage.ts index 23e12712a1..f423a806ee 100644 --- a/src/native/metadata/PeImage.ts +++ b/src/domain/native/peImage.ts @@ -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); diff --git a/src/native/metadata/readBinaryContainer.ts b/src/domain/native/readBinaryContainer.ts similarity index 88% rename from src/native/metadata/readBinaryContainer.ts rename to src/domain/native/readBinaryContainer.ts index 180ca0376a..b9b0fb670f 100644 --- a/src/native/metadata/readBinaryContainer.ts +++ b/src/domain/native/readBinaryContainer.ts @@ -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 => { diff --git a/src/go/GoBinaryImage.ts b/src/go/GoBinaryImage.ts index 436df999c2..996d5f0da6 100644 --- a/src/go/GoBinaryImage.ts +++ b/src/go/GoBinaryImage.ts @@ -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, diff --git a/src/go/GoBinaryProvider.ts b/src/go/GoBinaryProvider.ts index 9857d6c20f..bc3f6da010 100644 --- a/src/go/GoBinaryProvider.ts +++ b/src/go/GoBinaryProvider.ts @@ -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"; diff --git a/src/il2cpp/Il2cppBinaryImage.ts b/src/il2cpp/Il2cppBinaryImage.ts index fef7278319..d8e97fe54d 100644 --- a/src/il2cpp/Il2cppBinaryImage.ts +++ b/src/il2cpp/Il2cppBinaryImage.ts @@ -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, diff --git a/src/kuna/KunaInventoryPlacement.ts b/src/kuna/KunaInventoryPlacement.ts index 630943b2f9..c9cccb5863 100644 --- a/src/kuna/KunaInventoryPlacement.ts +++ b/src/kuna/KunaInventoryPlacement.ts @@ -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"; diff --git a/src/native/AppleDispatchCoverage.ts b/src/native/AppleDispatchCoverage.ts index 41ec51e926..7da1cbd7a9 100644 --- a/src/native/AppleDispatchCoverage.ts +++ b/src/native/AppleDispatchCoverage.ts @@ -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[] = []; diff --git a/src/native/AppleDispatchMetadata.ts b/src/native/AppleDispatchMetadata.ts index a4ffb34bc9..ade5d8a4aa 100644 --- a/src/native/AppleDispatchMetadata.ts +++ b/src/native/AppleDispatchMetadata.ts @@ -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, diff --git a/src/native/AppleMachoFixups.fixture.ts b/src/native/AppleMachoFixups.fixture.ts index 2480070809..580980339d 100644 --- a/src/native/AppleMachoFixups.fixture.ts +++ b/src/native/AppleMachoFixups.fixture.ts @@ -1,4 +1,4 @@ -import { parsePointerFixupsSteps } from "./AppleMachoFixups.js"; +import { parsePointerFixupsSteps } from "../domain/apple/appleMachoFixups.js"; export const parsePointerFixups = ( ...args: Parameters diff --git a/src/native/AppleMachoFixups.test.ts b/src/native/AppleMachoFixups.test.ts index 00a7101667..f38c37a44f 100644 --- a/src/native/AppleMachoFixups.test.ts +++ b/src/native/AppleMachoFixups.test.ts @@ -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 = [ diff --git a/src/native/AppleMachoSelection.fixture.ts b/src/native/AppleMachoSelection.fixture.ts index 33e1c02424..6155475ee6 100644 --- a/src/native/AppleMachoSelection.fixture.ts +++ b/src/native/AppleMachoSelection.fixture.ts @@ -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 { diff --git a/src/native/AppleMachoSelection.test.ts b/src/native/AppleMachoSelection.test.ts index ffd3cd8053..38a3ea2ba0 100644 --- a/src/native/AppleMachoSelection.test.ts +++ b/src/native/AppleMachoSelection.test.ts @@ -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 = ( diff --git a/src/native/AppleObjcCategories.ts b/src/native/AppleObjcCategories.ts index 11400d024d..dbacab52e0 100644 --- a/src/native/AppleObjcCategories.ts +++ b/src/native/AppleObjcCategories.ts @@ -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"; diff --git a/src/native/AppleObjcClassImportBindings.test.ts b/src/native/AppleObjcClassImportBindings.test.ts index c7e0dfea53..9652b268e3 100644 --- a/src/native/AppleObjcClassImportBindings.test.ts +++ b/src/native/AppleObjcClassImportBindings.test.ts @@ -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 = ( diff --git a/src/native/AppleObjcClassImportBindings.ts b/src/native/AppleObjcClassImportBindings.ts index 922e3b0b43..13e1c68018 100644 --- a/src/native/AppleObjcClassImportBindings.ts +++ b/src/native/AppleObjcClassImportBindings.ts @@ -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 { diff --git a/src/native/AppleObjcDispatchFacets.ts b/src/native/AppleObjcDispatchFacets.ts index cb7ff8bb54..0704ec0aa0 100644 --- a/src/native/AppleObjcDispatchFacets.ts +++ b/src/native/AppleObjcDispatchFacets.ts @@ -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, diff --git a/src/native/AppleObjcProperties.ts b/src/native/AppleObjcProperties.ts index c4ed16b5af..5c41d8c35d 100644 --- a/src/native/AppleObjcProperties.ts +++ b/src/native/AppleObjcProperties.ts @@ -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; diff --git a/src/native/AppleSwiftConformanceTypeReference.ts b/src/native/AppleSwiftConformanceTypeReference.ts index 0acf1a9bac..5ae11560d8 100644 --- a/src/native/AppleSwiftConformanceTypeReference.ts +++ b/src/native/AppleSwiftConformanceTypeReference.ts @@ -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, diff --git a/src/native/AppleSwiftDispatchFacets.ts b/src/native/AppleSwiftDispatchFacets.ts index 70d5586172..1408aa0f21 100644 --- a/src/native/AppleSwiftDispatchFacets.ts +++ b/src/native/AppleSwiftDispatchFacets.ts @@ -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, diff --git a/src/native/AppleSwiftNominalTypes.ts b/src/native/AppleSwiftNominalTypes.ts index 50e80e881d..add13b335e 100644 --- a/src/native/AppleSwiftNominalTypes.ts +++ b/src/native/AppleSwiftNominalTypes.ts @@ -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, diff --git a/src/native/AppleSwiftVtables.test.ts b/src/native/AppleSwiftVtables.test.ts index 20c00f270d..f5f3c61f19 100644 --- a/src/native/AppleSwiftVtables.test.ts +++ b/src/native/AppleSwiftVtables.test.ts @@ -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"); diff --git a/src/native/AppleSwiftVtables.ts b/src/native/AppleSwiftVtables.ts index ec94f46c50..f6e8d703ad 100644 --- a/src/native/AppleSwiftVtables.ts +++ b/src/native/AppleSwiftVtables.ts @@ -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, diff --git a/src/native/MachoBinaryProjection.test.ts b/src/native/MachoBinaryProjection.test.ts index 843f881911..a57979f9b2 100644 --- a/src/native/MachoBinaryProjection.test.ts +++ b/src/native/MachoBinaryProjection.test.ts @@ -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, diff --git a/src/native/MachoBinaryProjection.ts b/src/native/MachoBinaryProjection.ts index f356379f16..8580ba0c2b 100644 --- a/src/native/MachoBinaryProjection.ts +++ b/src/native/MachoBinaryProjection.ts @@ -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([ [1, "MACOS"], diff --git a/src/native/MachoCommandNames.test.ts b/src/native/MachoCommandNames.test.ts index 28eb92a48f..af6d2eef41 100644 --- a/src/native/MachoCommandNames.test.ts +++ b/src/native/MachoCommandNames.test.ts @@ -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"; diff --git a/src/native/MachoProjectionBudget.test.ts b/src/native/MachoProjectionBudget.test.ts index 5fb62b6d92..28c22c0314 100644 --- a/src/native/MachoProjectionBudget.test.ts +++ b/src/native/MachoProjectionBudget.test.ts @@ -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])( diff --git a/src/native/NativeMacOSProvider.ts b/src/native/NativeMacOSProvider.ts index e88ff7d989..543814ea1f 100644 --- a/src/native/NativeMacOSProvider.ts +++ b/src/native/NativeMacOSProvider.ts @@ -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, diff --git a/src/native/NativeMachoInspection.fixture.ts b/src/native/NativeMachoInspection.fixture.ts index 04e8c92f4a..5ff7cc4323 100644 --- a/src/native/NativeMachoInspection.fixture.ts +++ b/src/native/NativeMachoInspection.fixture.ts @@ -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, diff --git a/src/native/NativeMachoInspection.test.ts b/src/native/NativeMachoInspection.test.ts index a252396f9a..5e8ae28747 100644 --- a/src/native/NativeMachoInspection.test.ts +++ b/src/native/NativeMachoInspection.test.ts @@ -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"; diff --git a/src/native/NativeMachoInspection.ts b/src/native/NativeMachoInspection.ts index 06b95f2d65..fcdfad88b7 100644 --- a/src/native/NativeMachoInspection.ts +++ b/src/native/NativeMachoInspection.ts @@ -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"; diff --git a/src/native/NativeMachoSelectedSlice.test.ts b/src/native/NativeMachoSelectedSlice.test.ts index 91f2c12da6..c6b7b97146 100644 --- a/src/native/NativeMachoSelectedSlice.test.ts +++ b/src/native/NativeMachoSelectedSlice.test.ts @@ -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 () => { diff --git a/src/native/NativeMachoSelectedSlice.ts b/src/native/NativeMachoSelectedSlice.ts index df965042f7..6667c73341 100644 --- a/src/native/NativeMachoSelectedSlice.ts +++ b/src/native/NativeMachoSelectedSlice.ts @@ -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"; diff --git a/src/native/NativeMachoSourceProvider.test.ts b/src/native/NativeMachoSourceProvider.test.ts index cff5ef9108..53be001937 100644 --- a/src/native/NativeMachoSourceProvider.test.ts +++ b/src/native/NativeMachoSourceProvider.test.ts @@ -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(); + await importOriginal< + typeof import("../domain/apple/machoCommandNames.js") + >(); return { ...actual, readMachoCommandNames: ( diff --git a/src/native/android/AndroidJniLibrary.ts b/src/native/android/AndroidJniLibrary.ts index 524e90ab13..a4efeb136a 100644 --- a/src/native/android/AndroidJniLibrary.ts +++ b/src/native/android/AndroidJniLibrary.ts @@ -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; diff --git a/src/native/elf/KernelModuleParser.ts b/src/native/elf/KernelModuleParser.ts index 40257097f4..7db853722e 100644 --- a/src/native/elf/KernelModuleParser.ts +++ b/src/native/elf/KernelModuleParser.ts @@ -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; diff --git a/src/native/exports/NativeExportParser.ts b/src/native/exports/NativeExportParser.ts index 8675dce333..ad9e7dda7f 100644 --- a/src/native/exports/NativeExportParser.ts +++ b/src/native/exports/NativeExportParser.ts @@ -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, diff --git a/src/native/hardening/BinaryHardeningParsers.test.ts b/src/native/hardening/BinaryHardeningParsers.test.ts index 5e3a21bbe6..b9bf545d63 100644 --- a/src/native/hardening/BinaryHardeningParsers.test.ts +++ b/src/native/hardening/BinaryHardeningParsers.test.ts @@ -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, diff --git a/src/native/hardening/MachoHardening.ts b/src/native/hardening/MachoHardening.ts index 29531c2f94..673f8222fa 100644 --- a/src/native/hardening/MachoHardening.ts +++ b/src/native/hardening/MachoHardening.ts @@ -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, diff --git a/src/native/hardening/PeHardening.ts b/src/native/hardening/PeHardening.ts index 2eeffbbf10..7e7fa70149 100644 --- a/src/native/hardening/PeHardening.ts +++ b/src/native/hardening/PeHardening.ts @@ -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; diff --git a/src/native/initializers/ElfInitializerSymbols.ts b/src/native/initializers/ElfInitializerSymbols.ts index f2914f09cc..55c5e0a5ba 100644 --- a/src/native/initializers/ElfInitializerSymbols.ts +++ b/src/native/initializers/ElfInitializerSymbols.ts @@ -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"; diff --git a/src/native/initializers/ElfInitializers.ts b/src/native/initializers/ElfInitializers.ts index 28e41ddac5..5f1c2c0ecb 100644 --- a/src/native/initializers/ElfInitializers.ts +++ b/src/native/initializers/ElfInitializers.ts @@ -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, diff --git a/src/native/initializers/MachoInitializers.ts b/src/native/initializers/MachoInitializers.ts index 078da6cd8e..6a4685bd86 100644 --- a/src/native/initializers/MachoInitializers.ts +++ b/src/native/initializers/MachoInitializers.ts @@ -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, diff --git a/src/native/initializers/NativeInitializersProvider.ts b/src/native/initializers/NativeInitializersProvider.ts index 9ffbc72ef7..d322dca971 100644 --- a/src/native/initializers/NativeInitializersProvider.ts +++ b/src/native/initializers/NativeInitializersProvider.ts @@ -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"; diff --git a/src/native/metadata/BinaryContainer.test.ts b/src/native/metadata/BinaryContainer.test.ts index 55b735cb1d..264647dcad 100644 --- a/src/native/metadata/BinaryContainer.test.ts +++ b/src/native/metadata/BinaryContainer.test.ts @@ -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, diff --git a/src/native/metadata/Il2cppContainer.test.ts b/src/native/metadata/Il2cppContainer.test.ts index e14a75db91..25f3045eaa 100644 --- a/src/native/metadata/Il2cppContainer.test.ts +++ b/src/native/metadata/Il2cppContainer.test.ts @@ -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", diff --git a/src/native/metadata/MachoSliceSelection.test.ts b/src/native/metadata/MachoSliceSelection.test.ts index b61341be36..77e0c25879 100644 --- a/src/native/metadata/MachoSliceSelection.test.ts +++ b/src/native/metadata/MachoSliceSelection.test.ts @@ -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, diff --git a/src/native/metadata/PeImage.test.ts b/src/native/metadata/PeImage.test.ts index 086a228127..19a1049337 100644 --- a/src/native/metadata/PeImage.test.ts +++ b/src/native/metadata/PeImage.test.ts @@ -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, diff --git a/src/native/pe/PeImportParser.ts b/src/native/pe/PeImportParser.ts index 0645d0d2c3..5fdcc66931 100644 --- a/src/native/pe/PeImportParser.ts +++ b/src/native/pe/PeImportParser.ts @@ -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, diff --git a/src/native/pe/PeLoadConfigParser.ts b/src/native/pe/PeLoadConfigParser.ts index 12ff5197ed..2662dc2965 100644 --- a/src/native/pe/PeLoadConfigParser.ts +++ b/src/native/pe/PeLoadConfigParser.ts @@ -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, diff --git a/src/native/pe/PefileReadCompatibility.ts b/src/native/pe/PefileReadCompatibility.ts index bf4def80c7..101efb2487 100644 --- a/src/native/pe/PefileReadCompatibility.ts +++ b/src/native/pe/PefileReadCompatibility.ts @@ -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. diff --git a/src/rust/RustBinaryImage.ts b/src/rust/RustBinaryImage.ts index a437ea36ad..7fee4046c6 100644 --- a/src/rust/RustBinaryImage.ts +++ b/src/rust/RustBinaryImage.ts @@ -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, diff --git a/src/rust/RustBinaryProvider.ts b/src/rust/RustBinaryProvider.ts index daef8f1770..8356fc3624 100644 --- a/src/rust/RustBinaryProvider.ts +++ b/src/rust/RustBinaryProvider.ts @@ -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"; diff --git a/tests/boundary/filesystem/machoCommandAdmission.test.ts b/tests/boundary/filesystem/machoCommandAdmission.test.ts index 7d821214a7..7d2d8370d1 100644 --- a/tests/boundary/filesystem/machoCommandAdmission.test.ts +++ b/tests/boundary/filesystem/machoCommandAdmission.test.ts @@ -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"; diff --git a/tests/boundary/go/goBinaryImage.test.ts b/tests/boundary/go/goBinaryImage.test.ts index 3e4ecf6598..cf258de989 100644 --- a/tests/boundary/go/goBinaryImage.test.ts +++ b/tests/boundary/go/goBinaryImage.test.ts @@ -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, diff --git a/tests/boundary/il2cpp/il2cppBinaryFile.test.ts b/tests/boundary/il2cpp/il2cppBinaryFile.test.ts index 566a9837af..e519a23355 100644 --- a/tests/boundary/il2cpp/il2cppBinaryFile.test.ts +++ b/tests/boundary/il2cpp/il2cppBinaryFile.test.ts @@ -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, diff --git a/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts b/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts index db247e0ac2..1e15cee4f5 100644 --- a/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts +++ b/tests/boundary/providers/native/nativeLoadKinds.golden.test.ts @@ -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([ diff --git a/tests/boundary/providers/native/nativeLoadText.golden.test.ts b/tests/boundary/providers/native/nativeLoadText.golden.test.ts index 3abd89b23b..eae6b45ab6 100644 --- a/tests/boundary/providers/native/nativeLoadText.golden.test.ts +++ b/tests/boundary/providers/native/nativeLoadText.golden.test.ts @@ -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([ diff --git a/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts b/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts index 009afdce71..1ee5b7f491 100644 --- a/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts +++ b/tests/boundary/providers/native/nativeMachoHeader.golden.test.ts @@ -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([ diff --git a/tests/boundary/rust/rustBinaryImage.test.ts b/tests/boundary/rust/rustBinaryImage.test.ts index 6134eaf6c8..f80241926b 100644 --- a/tests/boundary/rust/rustBinaryImage.test.ts +++ b/tests/boundary/rust/rustBinaryImage.test.ts @@ -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"; diff --git a/tests/support/analysis-efficiency/android-jni-library.mjs b/tests/support/analysis-efficiency/android-jni-library.mjs index 64bd5aa34f..ba161e0df2 100644 --- a/tests/support/analysis-efficiency/android-jni-library.mjs +++ b/tests/support/analysis-efficiency/android-jni-library.mjs @@ -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",