rea-agents 6.4.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DISCLAIMER.md +136 -0
- package/README.md +76 -16
- package/THIRD_PARTY_NOTICES.md +135 -0
- package/bridge/android/ReaJadxBridge.java +281 -25
- package/bridge/cutter/rea_bridge.py +825 -0
- package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
- package/bridge/ghidra/ReaGhidraBridge.java +1232 -142
- package/bridge/ghidra/ReaGhidraBundleActivator.java +14 -0
- package/bridge/ghidra/ReaGhidraMipsSoftFloat.java +176 -0
- package/bridge/ghidra/ReaGhidraPrepareRaw.java +49 -0
- package/bridge/hopper_bridge.py +111 -69
- package/bridge/mitmproxy/capture.py +189 -13
- package/bridge/native/rea_lldb_tracer.py +88 -10
- package/bridge/process/ProcessRunTokenReader.swift +76 -34
- package/bridge/pwndbg/core_context.py +15 -2
- package/bridge/pwntools/layout_impl.py +5 -0
- package/bridge/pwntools/recorded_crash_impl.py +31 -10
- package/dist/adb/AdbCommand.js +148 -0
- package/dist/adb/AdbConfiguration.js +41 -7
- package/dist/adb/AdbDeviceOutput.js +59 -37
- package/dist/adb/AdbDirectoryListing.js +80 -0
- package/dist/adb/AdbHostFileName.js +34 -0
- package/dist/adb/AdbInputSnapshot.js +126 -0
- package/dist/adb/AdbProvider.js +1106 -346
- package/dist/adb/AdbShellOutput.js +146 -77
- package/dist/android/AndroidTargetSnapshot.js +7 -7
- package/dist/android/JadxAnalysis.js +53 -33
- package/dist/android/JadxConfiguration.js +283 -145
- package/dist/android/JadxDoctor.js +123 -0
- package/dist/android/JadxFailure.js +154 -0
- package/dist/android/JadxInterruption.js +13 -0
- package/dist/android/JadxJavaProbe.js +246 -0
- package/dist/android/JadxMcpTransport.js +53 -18
- package/dist/android/JadxProtocol.js +43 -2
- package/dist/android/JadxProvider.js +183 -102
- package/dist/android/JadxRelease.js +17 -2
- package/dist/android/JadxSession.js +35 -14
- package/dist/android/JadxWorkspaceRoot.js +157 -0
- package/dist/apktool/ApktoolCommandCleanup.js +134 -0
- package/dist/apktool/ApktoolCommandOutput.js +22 -0
- package/dist/apktool/ApktoolConfiguration.js +306 -45
- package/dist/apktool/ApktoolDecodeOutput.js +131 -42
- package/dist/apktool/ApktoolDecodedInventory.js +52 -0
- package/dist/apktool/ApktoolProvider.js +296 -340
- package/dist/apktool/ApktoolStringTables.js +178 -0
- package/dist/apktool/ApktoolWorkspace.js +162 -0
- package/dist/application/AnalysisContextQueries.js +5 -8
- package/dist/application/AnalysisDocument.js +19 -4
- package/dist/application/AnalysisProvider.js +36 -18
- package/dist/application/AppBundleExecutable.js +16 -9
- package/dist/application/BinaryTargetResolver.js +204 -40
- package/dist/application/BrowserEvidence.js +1 -1
- package/dist/application/BrowserObservationService.js +54 -9
- package/dist/application/BrowserScenarioCaptureService.js +26 -7
- package/dist/application/CallPathTracing.js +52 -13
- package/dist/application/CapabilityInventory.js +182 -36
- package/dist/application/ClaudeDesktopConfigLocation.js +152 -0
- package/dist/application/ClientConfigurationCleanup.js +73 -0
- package/dist/application/ClientConfigurationDocument.js +270 -151
- package/dist/application/ClientConfigurationFiles.js +51 -14
- package/dist/application/ClientConfigurationPublication.js +167 -0
- package/dist/application/ClientRegistrationEnvironment.js +40 -4
- package/dist/application/ClientRegistrationIdentity.js +112 -32
- package/dist/application/ClientRegistrationStatus.js +280 -84
- package/dist/application/DirectAnalysis.js +98 -30
- package/dist/application/DirectAnalysisCleanup.js +5 -1
- package/dist/application/DirectAnalysisStatus.js +13 -1
- package/dist/application/Doctor.js +192 -37
- package/dist/application/DoctorDiagnostics.js +59 -16
- package/dist/application/DoctorProviderIds.js +8 -0
- package/dist/application/DoctorScope.js +11 -2
- package/dist/application/DshCordisPatch.js +355 -0
- package/dist/application/DshCordisYaml.js +155 -0
- package/dist/application/EnhancedLiteralTracing.js +30 -16
- package/dist/application/EnhancedToolTypes.js +0 -1
- package/dist/application/EnhancedTools.js +154 -56
- package/dist/application/EvidenceBundleCommands.js +30 -7
- package/dist/application/EvidenceBundleFiles.js +29 -7
- package/dist/application/FunctionAnalysisEvidence.js +3 -0
- package/dist/application/GeminiClientSettings.js +25 -13
- package/dist/application/HermesClientHome.js +20 -0
- package/dist/application/HermesConfigurationYaml.js +312 -0
- package/dist/application/HopperDownload.js +11 -3
- package/dist/application/HopperReleaseFeed.js +71 -0
- package/dist/application/InventoryProjectionEvidence.js +0 -1
- package/dist/application/InvestigationProviders.js +14 -3
- package/dist/application/JsonFiles.js +110 -20
- package/dist/application/JsonInputFile.js +220 -62
- package/dist/application/LinuxHopper.js +218 -115
- package/dist/application/LinuxHopperPublisher.js +656 -0
- package/dist/application/MacHopper.js +203 -83
- package/dist/application/MacHopperPaths.js +40 -0
- package/dist/application/{MipsElfAbiFlags.js → MipsElfMetadata.js} +71 -10
- package/dist/application/MipsElfSharedLoad.js +164 -0
- package/dist/application/MipsGnuAttributes.js +90 -0
- package/dist/application/MsixPackageStorage.js +140 -0
- package/dist/application/ProgressReporter.js +1 -1
- package/dist/application/ProviderOperationExecution.js +15 -14
- package/dist/application/ReconstructionCoverageService.js +0 -1
- package/dist/application/ReconstructionObligationCandidates.js +20 -4
- package/dist/application/ReconstructionObligationLedgerDiagnostics.js +2 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +19 -33
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -72
- package/dist/application/ReconstructionObligationLedgerService.js +6 -2
- package/dist/application/ReconstructionObligationOriginalCases.js +10 -1
- package/dist/application/ReferenceSourceImport.js +24 -8
- package/dist/application/ReferenceSourceImportEntries.js +180 -37
- package/dist/application/ReferenceSourceImportPolicy.js +5 -3
- package/dist/application/ReferenceSourceImportTypes.js +0 -1
- package/dist/application/ReferenceSourceVcsAdapter.js +36 -17
- package/dist/application/RegularFileRead.js +117 -70
- package/dist/application/Setup.js +59 -21
- package/dist/application/SetupClientConfiguration.js +301 -66
- package/dist/application/SetupClients.js +25 -10
- package/dist/application/SetupHost.js +149 -51
- package/dist/application/SetupInstallFailure.js +58 -3
- package/dist/application/SetupPlan.js +94 -55
- package/dist/application/SetupRecoveryBackup.js +93 -0
- package/dist/application/SetupRegistrationEnvironment.js +14 -1
- package/dist/application/SetupSkill.js +303 -76
- package/dist/application/SourceLimitations.js +35 -0
- package/dist/application/SupportedClients.js +166 -32
- package/dist/application/TypeScriptEmittedSourceCandidates.js +26 -0
- package/dist/application/Uninstall.js +356 -110
- package/dist/application/UninstallFailure.js +14 -0
- package/dist/application/Update.js +54 -25
- package/dist/application/UpdateCommandProgress.js +66 -0
- package/dist/application/UpdateFailure.js +17 -0
- package/dist/application/UpdateMaintenance.js +18 -31
- package/dist/application/UpdateRuntime.js +198 -54
- package/dist/application/WebModuleTraceService.js +42 -22
- package/dist/application/WebNetworkCaptureService.js +24 -12
- package/dist/application/WebRuntimeService.js +41 -8
- package/dist/application/WebScriptExportService.js +6 -4
- package/dist/application/WebSourceLocationService.js +23 -8
- package/dist/application/WindowsCapabilities.js +18 -15
- package/dist/application/WorkflowEvidence.js +31 -1
- package/dist/application/analysisView/AnalysisViewService.js +46 -11
- package/dist/application/android/AndroidAnalysisService.js +5 -4
- package/dist/application/android/AndroidPackageInspection.js +25 -0
- package/dist/application/android/AndroidSearchEvidenceSummary.js +98 -0
- package/dist/application/artifacts/ArtifactComparisonEvidence.js +32 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +14 -11
- package/dist/application/binary/AnalysisProviderRegistry.js +365 -60
- package/dist/application/binary/AnalysisSnapshotCache.js +41 -20
- package/dist/application/binary/AnalysisSnapshotFiles.js +75 -9
- package/dist/application/binary/BinarySession.js +308 -117
- package/dist/application/binary/BinarySessionExecution.js +5 -4
- package/dist/application/binary/BinarySessionOpen.js +13 -6
- package/dist/application/binary/BinarySessionRecords.js +36 -7
- package/dist/application/binary/BinarySessionStatus.js +96 -27
- package/dist/application/binary/BinaryTargetSummary.js +9 -0
- package/dist/application/binary/CompositeProvider.js +116 -28
- package/dist/application/binary/LazyAnalysisProvider.js +6 -66
- package/dist/application/binary/SessionProviderRouter.js +16 -4
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +14 -5
- package/dist/application/binaryDiagnostics/PeResourcesService.js +25 -5
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +17 -7
- package/dist/application/captures/PacketCaptureService.js +84 -0
- package/dist/application/closeOwnedWebResources.js +37 -0
- package/dist/application/electron/ElectronFusePort.js +1 -0
- package/dist/application/electron/ElectronFuseService.js +45 -0
- package/dist/application/evm/EvmInterfaceEvidence.js +11 -0
- package/dist/application/evm/EvmInterfaceService.js +5 -15
- package/dist/application/firmware/FirmwareAnalysisService.js +4 -3
- package/dist/application/flutter/DartAotInspection.js +26 -0
- package/dist/application/flutter/FlutterBuildAnalysisPort.js +1 -0
- package/dist/application/flutter/FlutterBuildAnalysisService.js +13 -0
- package/dist/application/frida/FridaInstrumentationPort.js +8 -0
- package/dist/application/frida/FridaInstrumentationService.js +310 -0
- package/dist/application/frida/fridaInputErrors.js +17 -0
- package/dist/application/go/GoBinaryPort.js +1 -0
- package/dist/application/go/GoBinaryService.js +79 -0
- package/dist/application/harmony/HarmonyApplicationService.js +17 -0
- package/dist/application/investigation/EvidenceLedger.js +43 -18
- package/dist/application/investigation/InvestigationRecords.js +12 -21
- package/dist/application/investigation/UnknownEvidence.js +22 -18
- package/dist/application/javascript/ElectronActiveObservationService.js +55 -25
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +17 -3
- package/dist/application/javascript/ElectronBoundaryGraph.js +2 -0
- package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +144 -0
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +26 -7
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +1 -1
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +61 -11
- package/dist/application/javascript/ElectronEvidence.js +1 -2
- package/dist/application/javascript/ElectronObservationService.js +41 -8
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +21 -0
- package/dist/application/javascript/JavaScriptApplicationService.js +29 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +119 -49
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +30 -1
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +51 -21
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +31 -7
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +28 -6
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +25 -14
- package/dist/application/javascript/JavaScriptArtifactGraphEvidence.js +3 -3
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +186 -50
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +173 -14
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +959 -188
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +57 -32
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +2 -0
- package/dist/application/javascript/JavaScriptModuleRelationships.js +34 -12
- package/dist/application/javascript/JavaScriptRecoveryService.js +29 -9
- package/dist/application/javascript/JavaScriptRuntimeObservationEvidence.js +1 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +33 -9
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +0 -1
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +138 -43
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +13 -4
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +23 -3
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +18 -5
- package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +67 -0
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +4 -6
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +5 -8
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +0 -1
- package/dist/application/managed/ManagedApplicationGraphService.js +0 -1
- package/dist/application/managed/ManagedMemberComparisonService.js +72 -54
- package/dist/application/managed/ManagedNativeVerificationService.js +0 -1
- package/dist/application/managed/ManagedReconstructionService.js +0 -1
- package/dist/application/native/NativeCallRoutes.js +78 -41
- package/dist/application/native/NativeDispatchMetadataInspection.js +6 -2
- package/dist/application/native/NativeUiActionTrace.js +43 -22
- package/dist/application/native/NativeValueTrace.js +65 -23
- package/dist/application/pcap/PcapAnalysisPort.js +1 -0
- package/dist/application/pcap/PcapAnalysisService.js +24 -0
- package/dist/application/process/ProcessCli.js +33 -13
- package/dist/application/reverse/ReverseEngineeringCommandPort.js +1 -0
- package/dist/application/reverse/ReverseEngineeringService.js +688 -0
- package/dist/application/rust/RustBinaryPort.js +1 -0
- package/dist/application/rust/RustBinaryService.js +82 -0
- package/dist/application/signals/SignalRecordingService.js +84 -0
- package/dist/application/sqlite/SqliteDatabaseCapability.js +30 -0
- package/dist/application/sqlite/SqliteDatabasePort.js +1 -0
- package/dist/application/sqlite/SqliteDatabaseService.js +76 -0
- package/dist/application/wasm/WasmArtifactPort.js +1 -0
- package/dist/application/wasm/WasmArtifactService.js +76 -0
- package/dist/application/wasm/WasmInterfaceComparisonService.js +188 -0
- package/dist/artifacts/AnalysisCleanupLease.js +119 -0
- package/dist/artifacts/ArtifactFileOperation.js +150 -0
- package/dist/artifacts/ArtifactHash.js +15 -3
- package/dist/artifacts/ArtifactPaths.js +4 -7
- package/dist/artifacts/ArtifactProvider.js +24 -9
- package/dist/artifacts/ArtifactReader.js +63 -5
- package/dist/artifacts/ArtifactResourceScope.js +92 -9
- package/dist/artifacts/AsarArtifactReader.js +186 -120
- package/dist/artifacts/AsarEntryStream.js +49 -17
- package/dist/artifacts/AsarListing.js +78 -0
- package/dist/artifacts/DirectoryArtifactReader.js +119 -28
- package/dist/artifacts/MachOSliceArtifactReader.js +153 -23
- package/dist/artifacts/NativeDmgArtifactReader.js +264 -62
- package/dist/artifacts/OrderedReads.js +57 -0
- package/dist/artifacts/SafeOutputTree.js +24 -7
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +1 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +10 -16
- package/dist/artifacts/ZipArtifactReader.js +150 -25
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +79 -68
- package/dist/artifacts/apple/DylibFileAccess.js +106 -0
- package/dist/artifacts/apple/DylibResolutionReader.js +72 -157
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +108 -29
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +81 -28
- package/dist/artifacts/apple/KeyedArchiveReader.js +23 -13
- package/dist/artifacts/apple/MachoLoadCommandReader.js +77 -61
- package/dist/artifacts/apple/NibArchive.js +11 -4
- package/dist/artifacts/apple/PlistNumberLiterals.js +106 -118
- package/dist/artifacts/extraction/ArtifactExtraction.js +21 -19
- package/dist/artifacts/hostExecutableMarking.js +16 -0
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +139 -41
- package/dist/artifacts/inventory/classify.js +36 -17
- package/dist/artifacts/inventory/hashStableRootArtifact.js +14 -7
- package/dist/artifacts/inventory/reader.js +36 -21
- package/dist/artifacts/inventory/scanCanonical.js +27 -21
- package/dist/artifacts/inventory/scanReader.js +36 -10
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +166 -8
- package/dist/artifacts/readArtifactFileChunks.js +9 -0
- package/dist/artifacts/readStableArtifact.js +13 -11
- package/dist/browser/BrowserProcessStartup.js +20 -9
- package/dist/browser/BrowserScenarioPartialObservation.js +74 -92
- package/dist/browser/BrowserScenarioSecrets.js +176 -46
- package/dist/browser/CdpBrowserProvider.js +124 -102
- package/dist/browser/CdpCaptureDocuments.js +232 -102
- package/dist/browser/CdpCaptureDomSvg.js +80 -76
- package/dist/browser/CdpCaptureEventBodyShapes.js +9 -5
- package/dist/browser/CdpCaptureEventHandlers.js +23 -12
- package/dist/browser/CdpCaptureEvents.js +49 -10
- package/dist/browser/CdpCaptureStorage.js +22 -5
- package/dist/browser/CdpCaptureStorageFingerprints.js +54 -11
- package/dist/browser/CdpCaptureValues.js +12 -1
- package/dist/browser/CdpConnection.js +135 -30
- package/dist/browser/CdpElectronInspection.js +74 -64
- package/dist/browser/CdpElectronProvider.js +63 -6
- package/dist/browser/CdpElectronScriptEvents.js +4 -1
- package/dist/browser/CdpElectronScripts.js +4 -6
- package/dist/browser/CdpElectronWorkers.js +20 -4
- package/dist/browser/CdpEndpoint.js +143 -17
- package/dist/browser/CdpObservationSession.js +24 -8
- package/dist/browser/CdpPageCapture.js +68 -17
- package/dist/browser/CdpPageCaptureScripts.js +18 -13
- package/dist/browser/CdpPageCaptureWorkers.js +46 -11
- package/dist/browser/CdpSafeMetadata.js +32 -24
- package/dist/browser/CdpScreenshot.js +5 -14
- package/dist/browser/CdpSnapshotNodes.js +103 -0
- package/dist/browser/CdpSnapshotStrings.js +15 -0
- package/dist/browser/CdpTargetSession.js +76 -7
- package/dist/browser/CdpTargetSessionOwner.js +198 -0
- package/dist/browser/CdpWebMcpDiscovery.js +23 -6
- package/dist/browser/ElectronCaptureCleanup.js +82 -0
- package/dist/browser/ElectronProcessCleanup.js +91 -0
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +75 -20
- package/dist/browser/PlaywrightElectronActiveActions.js +57 -9
- package/dist/browser/PlaywrightElectronActiveFuses.js +86 -0
- package/dist/browser/PlaywrightElectronActiveProjection.js +21 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +237 -175
- package/dist/browser/PlaywrightExecutionBoundary.js +6 -4
- package/dist/browser/PlaywrightScenarioBrowser.js +240 -91
- package/dist/browser/PlaywrightScenarioEvents.js +287 -38
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +336 -0
- package/dist/browser/PlaywrightScenarioSession.js +151 -46
- package/dist/browser/PlaywrightScenarioStorage.js +15 -7
- package/dist/browser/StructuredFieldToken.js +53 -0
- package/dist/browser/WebArtifactCleanup.js +53 -0
- package/dist/browser/WebSourceMapFetcher.js +181 -89
- package/dist/browser/assets/LocalWebScriptArtifacts.js +24 -3
- package/dist/browser/assets/PublishWebScripts.js +13 -2
- package/dist/browser/assets/ScenarioScriptCapture.js +2 -1
- package/dist/browser/assets/WebArtifactReads.js +15 -3
- package/dist/browser/assets/WebSourceLocationArtifacts.js +47 -3
- package/dist/browser/execution/CdpRuntimeSession.js +36 -7
- package/dist/browser/execution/CdpWebRuntimeProvider.js +22 -4
- package/dist/browser/history/CaptureFailures.js +29 -10
- package/dist/browser/history/CaptureFormatError.js +2 -2
- package/dist/browser/history/{HarJson.js → CaptureJson.js} +14 -4
- package/dist/browser/history/CaptureRedaction.js +16 -3
- package/dist/browser/history/CaptureRelease.js +20 -2
- package/dist/browser/history/HarCapture.js +54 -30
- package/dist/browser/history/HarSchema.js +36 -36
- package/dist/browser/history/HistoricalCaptureDecoder.js +93 -25
- package/dist/browser/history/NodeCaptureAdapter.js +48 -0
- package/dist/browser/history/{HarCaptureProcess.js → NodeCaptureProcess.js} +18 -9
- package/dist/browser/history/QlogCapture.js +385 -0
- package/dist/browser/history/SazCapture.js +130 -0
- package/dist/browser/history/SazHttp.js +61 -0
- package/dist/browser/history/SazMetadata.js +55 -0
- package/dist/browser/history/SazProjection.js +90 -0
- package/dist/browser/modules/NativeModuleResolver.js +248 -131
- package/dist/browser/modules/WebModuleArtifacts.js +49 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +67 -9
- package/dist/browser/network/PlaywrightScenarioNetwork.js +249 -26
- package/dist/captures/TsharkCaptureProvider.js +377 -0
- package/dist/captures/parseFieldDiscovery.js +66 -0
- package/dist/captures/parsePacketOutput.js +21 -0
- package/dist/catalogIdentity.js +58 -42
- package/dist/cli/adbCommands.js +20 -21
- package/dist/cli/analysisViewCommands.js +1 -1
- package/dist/cli/androidCommands.js +13 -16
- package/dist/cli/apktoolCommands.js +14 -25
- package/dist/cli/applicationCommands.js +44 -17
- package/dist/cli/artifactCommands.js +1 -1
- package/dist/cli/binaryDiagnosticsCommands.js +17 -13
- package/dist/cli/browserAdvancedCommands.js +46 -26
- package/dist/cli/browserCommands.js +59 -33
- package/dist/cli/captureCommands.js +72 -0
- package/dist/cli/cliResultOutput.js +274 -0
- package/dist/cli/coreBinaryCommands.js +77 -30
- package/dist/cli/coreNativeCommands.js +53 -31
- package/dist/cli/cutterCommands.js +88 -0
- package/dist/cli/electronCommands.js +76 -13
- package/dist/cli/evmCommands.js +9 -19
- package/dist/cli/finishAnalysisCommand.js +52 -0
- package/dist/cli/firmwareCommands.js +20 -50
- package/dist/cli/flutterCommands.js +53 -0
- package/dist/cli/fridaCommands.js +219 -0
- package/dist/cli/goCommands.js +20 -0
- package/dist/cli/interactiveSetup.js +11 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/javascriptRecoveryCommands.js +18 -23
- package/dist/cli/jebCommands.js +2 -14
- package/dist/cli/jsonOutput.js +2 -2
- package/dist/cli/managedCommands.js +31 -3
- package/dist/cli/options.js +26 -2
- package/dist/cli/pcapCommands.js +29 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/reverseEngineeringCommands.js +268 -0
- package/dist/cli/rustCommands.js +20 -0
- package/dist/cli/setupCommands.js +41 -12
- package/dist/cli/signalCommands.js +72 -0
- package/dist/cli/sqliteCommands.js +52 -0
- package/dist/cli/utilityCommands.js +116 -74
- package/dist/cli/wasmCommands.js +50 -0
- package/dist/cli/webModuleCommands.js +27 -38
- package/dist/cli/webNetworkCaptureCommands.js +10 -9
- package/dist/cli/webRuntimeCommands.js +15 -6
- package/dist/cli/webSourceLocationCommands.js +14 -33
- package/dist/cli-runtime/AnalysisCleanupLease-CWfTGYKd.js +103 -0
- package/dist/cli-runtime/AnalysisProvider-BGrYaMVo.js +38 -0
- package/dist/cli-runtime/AnalysisSnapshotCache-BjRlXeUS.js +711 -0
- package/dist/cli-runtime/ArtifactFileOperation-Dg4BcoEM.js +122 -0
- package/dist/cli-runtime/ArtifactReader-DMwm42bk.js +78 -0
- package/dist/cli-runtime/ArtifactResourceScope-CokZGcII.js +175 -0
- package/dist/cli-runtime/AsarHeader-BxwU17DJ.js +31 -0
- package/dist/cli-runtime/BinarySessionStatus-DRhjr7Vb.js +212 -0
- package/dist/cli-runtime/BinaryTargetResolver-tuCTjBlQ.js +1238 -0
- package/dist/cli-runtime/BoundedFileBytes-DRtiQNAQ.js +43 -0
- package/dist/cli-runtime/CdpTargetSession-CQ08KHbh.js +925 -0
- package/dist/cli-runtime/ClientConfigPath-Dn-V_GUf.js +255 -0
- package/dist/cli-runtime/ClientConfigurationDocument-C9T8MNGc.js +2021 -0
- package/dist/cli-runtime/ClientRegistrationStatus-PnD29RTX.js +585 -0
- package/dist/cli-runtime/CurrentEntrypointPath-m7QCIVN0.js +14 -0
- package/dist/cli-runtime/DirectAnalysis-C5NyUryV.js +581 -0
- package/dist/cli-runtime/DirectoryArtifactReader-CokAJ8vo.js +448 -0
- package/dist/cli-runtime/Doctor-DrkWsav4.js +668 -0
- package/dist/cli-runtime/ElectronFileScope-AP7VoVr7.js +1109 -0
- package/dist/cli-runtime/ElectronFuseFailures-DsjXR7Xp.js +609 -0
- package/dist/cli-runtime/ExecFileOutput-D6KLYTve.js +119 -0
- package/dist/cli-runtime/InterfaceBuilderDecodeBudget-CW1IO3dG.js +298 -0
- package/dist/cli-runtime/InventoryProjectionEvidence-DTH5QAqL.js +49 -0
- package/dist/cli-runtime/InvestigationProviders-CFh4a64d.js +118 -0
- package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-gOmPB2L6.js +160 -0
- package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-WZgtK_Ok.js +75 -0
- package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-B1bwMM1a.js +86 -0
- package/dist/cli-runtime/JebMcpEndpoint-BEalGZh9.js +710 -0
- package/dist/cli-runtime/JsonFiles-uvd6ZyQi.js +600 -0
- package/dist/cli-runtime/KunaInstallation-P0j3x851.js +1781 -0
- package/dist/cli-runtime/MacCodeSignature-MgYbRK_H.js +24 -0
- package/dist/cli-runtime/MacHopperPaths-bGzqjF1Z.js +34 -0
- package/dist/cli-runtime/MachoLoadCommandReader-CZm6N5vF.js +330 -0
- package/dist/cli-runtime/ManagedSnapshot-CPE9C3OD.js +4481 -0
- package/dist/cli-runtime/OwnedCommandCleanup-BN_V6Erc.js +187 -0
- package/dist/cli-runtime/OwnedRegularFile-D1f5nUCx.js +256 -0
- package/dist/cli-runtime/OwnedStagedOutput-D31dOozz.js +126 -0
- package/dist/cli-runtime/PrivateRuntimeRoot-Cd23u6jd.js +296 -0
- package/dist/cli-runtime/ProcessOwnership-CtrNr6ee.js +545 -0
- package/dist/cli-runtime/ProcessOwnershipObservation-C006iCtZ.js +920 -0
- package/dist/cli-runtime/ProviderDeadline-rSuH4Pm8.js +148 -0
- package/dist/cli-runtime/ProviderOperationExecution-CmU-XrQr.js +38 -0
- package/dist/cli-runtime/ProviderProcess-D87A7ctp.js +770 -0
- package/dist/cli-runtime/RegularFileRead-mbgGYtxe.js +125 -0
- package/dist/cli-runtime/SafeOutputTree-i904hd_2.js +525 -0
- package/dist/cli-runtime/SetupHost-CMPmPraB.js +1268 -0
- package/dist/cli-runtime/SharedStartupAttempt-BxKyf3Uv.js +1424 -0
- package/dist/cli-runtime/StableFileHash-Ame_h3lY.js +61 -0
- package/dist/cli-runtime/SupportedClients-DMafjitv.js +1066 -0
- package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
- package/dist/cli-runtime/Update-DAsASWlE.js +143 -0
- package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
- package/dist/cli-runtime/WindowsBatchCommand-Cx9kaVNf.js +97 -0
- package/dist/cli-runtime/WindowsNativeLoader-BqyZO0ZD.js +142 -0
- package/dist/cli-runtime/ZipArtifactReader-Jed69LEL.js +252 -0
- package/dist/cli-runtime/analysisErrorCleanup-COdAmDsb.js +33 -0
- package/dist/cli-runtime/appleArchiveFormat-Bb3G5CCI.js +269 -0
- package/dist/cli-runtime/application__DirectAnalysisStatus-F74bu9oy.js +150 -0
- package/dist/cli-runtime/application__EnhancedTools-Bg51b0Yp.js +1820 -0
- package/dist/cli-runtime/application__FunctionAnalysisEvidence-DBWIaYCh.js +41 -0
- package/dist/cli-runtime/application__ReconstructionCoverageService-AEPNpZqJ.js +32 -0
- package/dist/cli-runtime/application__ReconstructionObligationLedgerService-Cl9cPEZf.js +828 -0
- package/dist/cli-runtime/application__Setup-DwQzEewK.js +526 -0
- package/dist/cli-runtime/application__Uninstall-BOf9oyvQ.js +468 -0
- package/dist/cli-runtime/application__UpdateRuntime-CzWkRJHa.js +435 -0
- package/dist/cli-runtime/application__android__AndroidApplicationService-shW_aKlj.js +31 -0
- package/dist/cli-runtime/application__apple__AppleApplicationService-DIv6d3wB.js +31 -0
- package/dist/cli-runtime/application__harmony__HarmonyApplicationService-OIUFVQFV.js +31 -0
- package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-wvCh72hK.js +118 -0
- package/dist/cli-runtime/application__javascript__ElectronObservationService-SydXPCwM.js +88 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-o0uEsjEc.js +12254 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-BAheG_71.js +2336 -0
- package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-Cnn4GP8q.js +88 -0
- package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-CmvLfV1A.js +299 -0
- package/dist/cli-runtime/artifacts__ArtifactProvider-wx2K0F2I.js +2205 -0
- package/dist/cli-runtime/binary-CWVNJhAC.js +19608 -0
- package/dist/cli-runtime/catalogIdentity-DAEEsOdX.js +1112 -0
- package/dist/cli-runtime/cli.js +44469 -0
- package/dist/cli-runtime/cliOutput-CgSuw782.js +163 -0
- package/dist/cli-runtime/cliOutput.js +5 -0
- package/dist/cli-runtime/cliResultOutput-10sd6xGx.js +1453 -0
- package/dist/cli-runtime/cliResultOutput.js +6 -0
- package/dist/cli-runtime/composition__browserScenario-BtPb1c1y.js +3414 -0
- package/dist/cli-runtime/composition__electronObservation-Bk8R6DJo.js +614 -0
- package/dist/cli-runtime/composition__electronScenario-BVF0qStH.js +916 -0
- package/dist/cli-runtime/cutterToolContracts-BQtG_Nzo.js +5267 -0
- package/dist/cli-runtime/doctorRuntime-B__SIpm-.js +478 -0
- package/dist/cli-runtime/dotnet__ManagedStaticProvider-DO5Yzcp4.js +5 -0
- package/dist/cli-runtime/errorSchemas-Ixz_q7qt.js +655 -0
- package/dist/cli-runtime/homeDirectory-DC_DeJIg.js +18 -0
- package/dist/cli-runtime/javascriptApplicationAnalysis-Dk6yBV8g.js +2088 -0
- package/dist/cli-runtime/javascriptExportReturnShapeProjection-CObOIiQ6.js +78 -0
- package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-DpwuBenh.js +1244 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliation-C6ZgWMys.js +1509 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-D6tZKUQs.js +247 -0
- package/dist/cli-runtime/javascriptSemanticTraceSchemas-C7m0b6_w.js +126 -0
- package/dist/cli-runtime/lipo-DPQ6qurH.js +394 -0
- package/dist/cli-runtime/logger-BuDJ9xxO.js +48 -0
- package/dist/cli-runtime/machoContainer-Cy98bkFm.js +352 -0
- package/dist/cli-runtime/managedApplicationGraph-BazVqpJv.js +1136 -0
- package/dist/cli-runtime/managedToolContracts-BuFkMBH5.js +99 -0
- package/dist/cli-runtime/mcpDoctor.js +361 -0
- package/dist/cli-runtime/mcpStartupPolicy-imCbM3qo.js +28 -0
- package/dist/cli-runtime/native__NativeMacOSProvider-DTcRhuGA.js +5502 -0
- package/dist/cli-runtime/officialToolContracts-CzzVLx8I.js +1522 -0
- package/dist/cli-runtime/peMachine-B9ggfSJJ.js +95 -0
- package/dist/cli-runtime/propertyListKeys-D5dSASEy.js +355 -0
- package/dist/cli-runtime/providerCleanupError-BhsJyAhk.js +25 -0
- package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
- package/dist/cli-runtime/providerStartupTimeout-B2tF2LtZ.js +17 -0
- package/dist/cli-runtime/readArtifactFileChunks-BbTL_PtB.js +129 -0
- package/dist/cli-runtime/reconstructionObligationLedgerSchemas-Bi6sect1.js +22156 -0
- package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
- package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
- package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
- package/dist/cli-runtime/scanCanonical-CcDFUr-w.js +2594 -0
- package/dist/cli-runtime/snapshotEnvironment-Yvx5qwsl.js +196 -0
- package/dist/cli-runtime/toolContracts-CJzEyZ38.js +3795 -0
- package/dist/cli-runtime/toolOutputSchemaGroups-BqdSzySu.js +12249 -0
- package/dist/cli-runtime/workflowInputError-BP8z9Wxl.js +26 -0
- package/dist/cli.js +48 -5
- package/dist/cliBrowserScenarioCommands.js +41 -7
- package/dist/cliCommandNames.js +48 -0
- package/dist/cliEvidenceCommands.js +0 -1
- package/dist/cliJavaScriptRuntimeCommands.js +16 -14
- package/dist/cliJsonInput.js +12 -4
- package/dist/cliLogging.js +66 -15
- package/dist/cliObservationOptions.js +9 -0
- package/dist/cliOutput.js +105 -7
- package/dist/composition/binary.js +19 -2
- package/dist/composition/captures.js +3 -0
- package/dist/composition/directAnalysis.js +36 -11
- package/dist/composition/electronFuses.js +4 -0
- package/dist/composition/evm.js +12 -0
- package/dist/composition/flutter.js +3 -0
- package/dist/composition/go.js +4 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +8 -8
- package/dist/composition/jeb.js +45 -5
- package/dist/composition/pcap.js +3 -0
- package/dist/composition/resolveWindowsProviderExecutable.js +61 -0
- package/dist/composition/reverseEngineering.js +29 -0
- package/dist/composition/rust.js +4 -0
- package/dist/composition/signals.js +3 -0
- package/dist/composition/sqlite.js +4 -0
- package/dist/composition/wasm.js +22 -0
- package/dist/composition/webNetworkCaptures.js +7 -2
- package/dist/config/environment.js +79 -4
- package/dist/config/ghidraDisabledAnalyzers.js +25 -0
- package/dist/config/homeDirectory.js +9 -6
- package/dist/config/mcpInputSchemaProfile.js +5 -1
- package/dist/config/mcpOutputSchemaProfile.js +22 -0
- package/dist/config/parseConfig.js +28 -34
- package/dist/config/parsers.js +4 -3
- package/dist/config/{ghidraStartupTimeout.js → providerStartupTimeout.js} +7 -3
- package/dist/contracts/adb/adbToolContracts.js +8 -8
- package/dist/contracts/analysisDetail.js +6 -3
- package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
- package/dist/contracts/analysisViewToolContracts.js +65 -3
- package/dist/contracts/android/androidToolContracts.js +17 -8
- package/dist/contracts/apktool/apktoolToolContracts.js +5 -1
- package/dist/contracts/applicationToolContracts.js +17 -2
- package/dist/contracts/artifactComparisonExample.js +18 -14
- package/dist/contracts/artifactToolContracts.js +16 -3
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +13 -1
- package/dist/contracts/captures/captureToolContracts.js +42 -0
- package/dist/contracts/compactInputSchema.js +39 -12
- package/dist/contracts/cutterToolContracts.js +84 -0
- package/dist/contracts/enhancedToolContracts.js +2 -2
- package/dist/contracts/evm/evmToolContracts.js +30 -15
- package/dist/contracts/firmware/firmwareToolContracts.js +1 -1
- package/dist/contracts/flutter/flutterToolContracts.js +47 -0
- package/dist/contracts/fridaRemoteAddress.js +23 -0
- package/dist/contracts/fridaToolContracts.js +274 -0
- package/dist/contracts/functionComparisonExample.js +12 -1
- package/dist/contracts/gdbToolContracts.js +102 -0
- package/dist/contracts/go/goToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +15 -0
- package/dist/contracts/inputSchemaPresentation.js +199 -38
- package/dist/contracts/investigationExamples.js +1 -0
- package/dist/contracts/javascript/electronToolContracts.js +27 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +1 -0
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +13 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +1 -0
- package/dist/contracts/jsonSchemaKeywords.js +29 -0
- package/dist/contracts/managed/managedToolContracts.js +43 -4
- package/dist/contracts/managed/managedWorkflowExamples.js +10 -1
- package/dist/contracts/managed/managedWorkflowToolContracts.js +4 -30
- package/dist/contracts/mobileApplicationGraphExamples.js +27 -12
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +3 -2
- package/dist/contracts/native/nativeToolContracts.js +10 -6
- package/dist/contracts/officialToolContracts.js +7 -7
- package/dist/contracts/pcap/pcapToolContracts.js +33 -0
- package/dist/contracts/providerSelection.js +1 -0
- package/dist/contracts/reconstructionReadinessExample.js +126 -119
- package/dist/contracts/reverseEngineeringToolContracts.js +52 -0
- package/dist/contracts/rizinDebugToolContracts.js +97 -0
- package/dist/contracts/rust/rustToolContracts.js +20 -0
- package/dist/contracts/sessionLifecycleInputs.js +34 -2
- package/dist/contracts/sessionToolContracts.js +4 -4
- package/dist/contracts/sessionToolSchemas.js +14 -0
- package/dist/contracts/signals/signalToolContracts.js +40 -0
- package/dist/contracts/sqlite/sqliteToolContracts.js +36 -0
- package/dist/contracts/toolContractExamples.js +29 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +26 -0
- package/dist/contracts/toolEffects.js +252 -9
- package/dist/contracts/toolOutputSchemaGroups.js +78 -32
- package/dist/contracts/toolOutputSchemaPrimitives.js +118 -10
- package/dist/contracts/toolSchemaMetadata.js +102 -16
- package/dist/contracts/unknownContractExamples.js +1 -1
- package/dist/contracts/wasm/wasmComparisonContracts.js +52 -0
- package/dist/contracts/wasm/wasmToolContracts.js +33 -0
- package/dist/contracts/webNetworkCaptureToolContracts.js +15 -4
- package/dist/cutter/CutterBridgeClient.js +760 -0
- package/dist/cutter/CutterBridgeService.js +187 -0
- package/dist/doctorRuntime.js +41 -8
- package/dist/domain/adb/adbDeviceAnalysis.js +45 -5
- package/dist/domain/analysisErrorBase.js +79 -2
- package/dist/domain/analysisErrorCleanup.js +4 -2
- package/dist/domain/analysisErrorCore.js +32 -0
- package/dist/domain/analysisErrorPresentation.js +80 -20
- package/dist/domain/analysisErrorProjection.js +72 -37
- package/dist/domain/analysisProfile.js +7 -3
- package/dist/domain/analysisSearch.js +26 -0
- package/dist/domain/analysisSnapshot.js +312 -185
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +353 -0
- package/dist/domain/analysisView/analysisView.js +391 -44
- package/dist/domain/analysisView/analysisViewCoverage.js +32 -0
- package/dist/domain/analysisView/analysisViewDataAdmission.js +86 -0
- package/dist/domain/analysisView/analysisViewErrors.js +4 -0
- package/dist/domain/analysisView/analysisViewParent.js +12 -0
- package/dist/domain/analysisView/analysisViewText.js +29 -0
- package/dist/domain/analysisView/androidPackageView.js +102 -0
- package/dist/domain/analysisView/artifactInventoryView.js +126 -0
- package/dist/domain/analysisView/binaryLayoutView.js +11 -4
- package/dist/domain/analysisView/dartAotView.js +93 -0
- package/dist/domain/analysisView/evmInterfaceView.js +105 -0
- package/dist/domain/analysisView/interfaceBuilderView.js +182 -0
- package/dist/domain/analysisView/javascriptApplicationCoverage.js +27 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +123 -49
- package/dist/domain/analysisView/javascriptFactsView.js +92 -0
- package/dist/domain/analysisView/javascriptModuleReferences.js +37 -0
- package/dist/domain/analysisView/machoView.js +186 -0
- package/dist/domain/analysisView/managedArtifactView.js +108 -0
- package/dist/domain/analysisView/managedMemberView.js +215 -0
- package/dist/domain/analysisView/nativeFunctionView.js +20 -25
- package/dist/domain/analysisView/pcapCaptureView.js +264 -0
- package/dist/domain/analysisView/qlogCaptureView.js +198 -0
- package/dist/domain/analysisView/wasmArtifactView.js +162 -0
- package/dist/domain/analysisView/webNetworkApiSurfaceView.js +123 -0
- package/dist/domain/analysisView/webNetworkCaptureView.js +388 -0
- package/dist/domain/android/androidAnalysis.js +36 -2
- package/dist/domain/android/androidApplication.js +37 -64
- package/dist/domain/apktool/apktoolResourceAnalysis.js +70 -8
- package/dist/domain/apple/appleApplication.js +70 -87
- package/dist/domain/apple/appleArchiveFormat.js +184 -0
- package/dist/domain/apple/appleAssetCatalog.js +15 -0
- package/dist/domain/apple/appleBundleAnatomy.js +57 -69
- package/dist/domain/apple/dyldPaths.js +9 -2
- package/dist/domain/apple/dylibResolution.js +24 -10
- package/dist/domain/apple/dylibResolutionFindings.js +8 -9
- package/dist/domain/apple/interfaceBuilderGraph.js +78 -33
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +39 -12
- package/dist/domain/apple/jvmClassFile.js +226 -0
- package/dist/domain/apple/keyedArchive.js +39 -17
- package/dist/domain/apple/machoContainer.js +123 -8
- package/dist/domain/apple/machoCpuIdentity.js +4 -0
- package/dist/domain/apple/plistNumbers.js +67 -5
- package/dist/domain/apple/plistValue.js +95 -19
- package/dist/domain/artifactComparison.js +116 -37
- package/dist/domain/artifactDecompressionBudget.js +26 -0
- package/dist/domain/artifactGraph.js +18 -9
- package/dist/domain/artifactIdentity.js +4 -1
- package/dist/domain/artifactInspection.js +34 -3
- package/dist/domain/artifactInventoryEvidence.js +146 -40
- package/dist/domain/binaryTarget.js +251 -109
- package/dist/domain/binaryTargetTypes.js +24 -1
- package/dist/domain/browserNetworkEvidence.js +24 -3
- package/dist/domain/browserObservation.js +92 -56
- package/dist/domain/browserObservationError.js +4 -4
- package/dist/domain/browserObservationSchemas.js +4 -1
- package/dist/domain/browserScenarioCapture.js +11 -1
- package/dist/domain/browserScenarioCaptureLimits.js +34 -0
- package/dist/domain/browserScenarioCaptureValues.js +76 -2
- package/dist/domain/browserScenarioDiff.js +120 -11
- package/dist/domain/browserScenarioDiffEvidence.js +44 -13
- package/dist/domain/browserScenarioDiffValues.js +10 -3
- package/dist/domain/browserScenarioNetworkComparison.js +158 -0
- package/dist/domain/browserScenarioNormalization.js +10 -13
- package/dist/domain/browserScenarioValues.js +7 -13
- package/dist/domain/browserSession.js +2 -2
- package/dist/domain/bundleComparison.js +1 -5
- package/dist/domain/callPath.js +40 -3
- package/dist/domain/captures/packetCapture.js +139 -0
- package/dist/domain/captures/packetFields.js +81 -0
- package/dist/domain/changedBehavior.js +43 -41
- package/dist/domain/comparisonSourceEvidence.js +6 -0
- package/dist/domain/dosCom.js +2 -2
- package/dist/domain/dosMz.js +66 -19
- package/dist/domain/electron/electronFuseEvidence.js +42 -0
- package/dist/domain/electron/electronFuses.js +360 -0
- package/dist/domain/elfFixedHeader.js +66 -0
- package/dist/domain/evidence.js +105 -39
- package/dist/domain/evidenceBundle.js +67 -22
- package/dist/domain/evidenceErrors.js +5 -0
- package/dist/domain/evm/evmInterface.js +18 -4
- package/dist/domain/evm/solidityMetadata.js +70 -0
- package/dist/domain/explicitSensitiveFailure.js +44 -23
- package/dist/domain/fileSnapshotObservation.js +25 -0
- package/dist/domain/firmware/firmwareAnalysis.js +29 -0
- package/dist/domain/fixedTupleSchema.js +9 -0
- package/dist/domain/flutter/flutterBuildAnalysis.js +141 -0
- package/dist/domain/functionCallCoverage.js +60 -0
- package/dist/domain/functionComparisonDimensions.js +136 -18
- package/dist/domain/functionComparisonNormalization.js +83 -19
- package/dist/domain/functionComparisonResults.js +7 -6
- package/dist/domain/functionComparisonSchemas.js +14 -3
- package/dist/domain/functionDossierEvidence.js +4 -0
- package/dist/domain/go/goBinary.js +96 -0
- package/dist/domain/harmony/harmonyApplication.js +156 -0
- package/dist/domain/hopperErrors.js +19 -18
- package/dist/domain/hopperPublisher.js +12 -0
- package/dist/domain/hopperValues.js +135 -34
- package/dist/domain/javascript/electronActiveObservation.js +1 -0
- package/dist/domain/javascript/electronObservation.js +4 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +94 -33
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +3 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +19 -5
- package/dist/domain/javascript/electronStaticAnalysisValues.js +14 -28
- package/dist/domain/javascript/electronStaticOptionObjects.js +45 -0
- package/dist/domain/javascript/electronWrappedCallPaths.js +551 -0
- package/dist/domain/javascript/htmlArtifactReferences.js +94 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +37 -1
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +7 -0
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +10 -2
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +1 -1
- package/dist/domain/javascript/javascriptApplicationGraph.js +17 -1
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +8 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +3 -1
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +49 -21
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +31 -18
- package/dist/domain/javascript/javascriptArtifactFiles.js +2 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +89 -24
- package/dist/domain/javascript/javascriptAstValues.js +132 -5
- package/dist/domain/javascript/javascriptBootstrap.js +94 -0
- package/dist/domain/javascript/javascriptBootstrapIntegrity.js +372 -0
- package/dist/domain/javascript/javascriptBuiltinResourceMethods.js +8 -0
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +278 -0
- package/dist/domain/javascript/javascriptCommonJsExportReceivers.js +231 -0
- package/dist/domain/javascript/javascriptContextBridgeExposure.js +23 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +96 -22
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +6 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +1 -1
- package/dist/domain/javascript/javascriptFeatureSeed.js +34 -17
- package/dist/domain/javascript/javascriptFeatureTrace.js +9 -3
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +42 -11
- package/dist/domain/javascript/javascriptGraphqlOperations.js +382 -0
- package/dist/domain/javascript/javascriptIntrinsicInvocation.js +132 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +48 -0
- package/dist/domain/javascript/javascriptModuleInterop.js +618 -0
- package/dist/domain/javascript/javascriptModuleResolutionMode.js +18 -0
- package/dist/domain/javascript/javascriptModuleSpecifier.js +5 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -12
- package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
- package/dist/domain/javascript/javascriptRecovery.js +12 -5
- package/dist/domain/javascript/javascriptRpcEndpoints.js +7 -93
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +16 -0
- package/dist/domain/javascript/javascriptRuntimeObservation.js +4 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +45 -16
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +65 -47
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +113 -11
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +511 -0
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +706 -204
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +54 -54
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +59 -30
- package/dist/domain/javascript/javascriptSemanticCallableStack.js +52 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +10 -15
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +163 -92
- package/dist/domain/javascript/javascriptSemanticCoverage.js +5 -1
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +435 -45
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +46 -29
- package/dist/domain/javascript/javascriptSemanticDependencies.js +69 -0
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +1 -1
- package/dist/domain/javascript/javascriptSemanticEvaluationOrder.js +126 -0
- package/dist/domain/javascript/javascriptSemanticExpressionShapes.js +111 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +11 -14
- package/dist/domain/javascript/javascriptSemanticGetterQueries.js +147 -0
- package/dist/domain/javascript/javascriptSemanticGetterResults.js +264 -0
- package/dist/domain/javascript/javascriptSemanticGraph.js +22 -1
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +13 -1
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +5 -4
- package/dist/domain/javascript/javascriptSemanticMapOperations.js +51 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +421 -154
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +500 -27
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +377 -174
- package/dist/domain/javascript/javascriptSemanticObjects.js +53 -43
- package/dist/domain/javascript/javascriptSemanticOpaqueEffects.js +163 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +11 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +180 -95
- package/dist/domain/javascript/javascriptSemanticPromises.js +6 -9
- package/dist/domain/javascript/javascriptSemanticProvenance.js +5 -1
- package/dist/domain/javascript/javascriptSemanticQuery.js +7 -2
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +2 -1
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReferenceSources.js +25 -0
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +369 -8
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +3 -19
- package/dist/domain/javascript/javascriptSemanticResources.js +33 -44
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +81 -26
- package/dist/domain/javascript/javascriptSemanticReturns.js +37 -30
- package/dist/domain/javascript/javascriptSemanticState.js +225 -39
- package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -4
- package/dist/domain/javascript/javascriptSemanticValues.js +379 -56
- package/dist/domain/javascript/javascriptSourceMapPaths.js +44 -17
- package/dist/domain/javascript/javascriptSourceParser.js +121 -7
- package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +69 -24
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +97 -23
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +488 -48
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +196 -78
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +4 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +1118 -0
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +44 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +45 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +3 -1
- package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +2 -0
- package/dist/domain/javascript/sourceToBundleSignals.js +50 -13
- package/dist/domain/jsonValue.js +37 -12
- package/dist/domain/localPath.js +6 -3
- package/dist/domain/managed/managedApplicationGraph.js +5 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +6 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +14 -10
- package/dist/domain/managed/managedArtifact.js +77 -1
- package/dist/domain/managed/managedInspectionEvidence.js +5 -6
- package/dist/domain/managed/managedMemberComparison.js +6 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +36 -3
- package/dist/domain/managed/managedMemberComparisonItems.js +135 -59
- package/dist/domain/managed/managedMemberComparisonMatch.js +237 -42
- package/dist/domain/managed/managedMemberSignatureIdentity.js +40 -0
- package/dist/domain/managed/managedNativeVerificationMatch.js +54 -31
- package/dist/domain/managed/managedNativeVerificationSchemas.js +15 -4
- package/dist/domain/managed/managedReconstruction.js +5 -8
- package/dist/domain/mobileApplicationGraphProjection.js +95 -0
- package/dist/domain/native/addressCoordinate.js +11 -0
- package/dist/domain/native/binaryLayout.js +2 -4
- package/dist/domain/native/bytePattern.js +121 -0
- package/dist/domain/native/nativeAotPe.js +31 -4
- package/dist/domain/native/nativeAotSnapshotObservation.js +18 -0
- package/dist/domain/native/nativeCallPartialObservation.js +14 -12
- package/dist/domain/native/nativeInspection.js +38 -4
- package/dist/domain/native/nativeInstruction.js +17 -2
- package/dist/domain/native/nativeInvestigationGraph.js +9 -5
- package/dist/domain/native/nativeLoadImage.js +32 -1
- package/dist/domain/native/nativeUiObservation.js +5 -6
- package/dist/domain/native/objcSwiftMetadata.js +19 -9
- package/dist/domain/native/peResources.js +14 -4
- package/dist/domain/native/recordedCrash.js +79 -10
- package/dist/domain/offsetDateTime.js +60 -0
- package/dist/domain/pcap/pcapAnalysis.js +91 -0
- package/dist/domain/pcap/pcapEvidence.js +15 -0
- package/dist/domain/peMachine.js +38 -0
- package/dist/domain/pngHeader.js +18 -0
- package/dist/domain/process/processCaptureCoverage.js +26 -3
- package/dist/domain/process/processCaptureExample.js +2 -0
- package/dist/domain/process/processCaptureValidation.js +33 -8
- package/dist/domain/process/processComparison.js +41 -13
- package/dist/domain/process/processScenario.js +7 -0
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +119 -74
- package/dist/domain/process/processTraceSpecification.js +243 -89
- package/dist/domain/propertyListKeys.js +238 -23
- package/dist/domain/propertyListXml.js +149 -0
- package/dist/domain/propertyListXmlText.js +20 -4
- package/dist/domain/providerAdapterError.js +2 -5
- package/dist/domain/providerCleanupError.js +2 -4
- package/dist/domain/providerConfigurationRefusal.js +12 -0
- package/dist/domain/providerSelectionError.js +2 -1
- package/dist/domain/qlogCapture.js +62 -0
- package/dist/domain/rawBinary.js +105 -0
- package/dist/domain/reconstructionCoverage.js +40 -24
- package/dist/domain/reconstructionCoverageEvaluation.js +50 -47
- package/dist/domain/reconstructionCoverageEvidence.js +26 -0
- package/dist/domain/reconstructionCoverageVerifierResults.js +35 -0
- package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
- package/dist/domain/reconstructionObligationLedgerSchemas.js +104 -1
- package/dist/domain/reconstructionReadiness.js +4 -8
- package/dist/domain/reconstructionReadinessJourneyFindings.js +4 -1
- package/dist/domain/reconstructionUnknowns.js +9 -1
- package/dist/domain/reconstructionVerification.js +86 -43
- package/dist/domain/recordedTransportUrl.js +59 -0
- package/dist/domain/referenceSourceClassification.js +27 -23
- package/dist/domain/referenceSourceGraph.js +51 -13
- package/dist/domain/referenceSourceImportParsing.js +27 -13
- package/dist/domain/referenceSourcePathIdentity.js +13 -1
- package/dist/domain/referenceSourceRequireBindings.js +40 -108
- package/dist/domain/referenceSourceSummary.js +92 -0
- package/dist/domain/relationshipCoverage.js +43 -0
- package/dist/domain/residualUnknown.js +93 -26
- package/dist/domain/reverseEngineering.js +31 -0
- package/dist/domain/runtimeVersion.js +8 -0
- package/dist/domain/rust/rustBinary.js +200 -0
- package/dist/domain/signals/annotationTextWindow.js +31 -0
- package/dist/domain/signals/signalDecoders.js +69 -0
- package/dist/domain/signals/signalRecording.js +115 -0
- package/dist/domain/sourceMapContents.js +10 -3
- package/dist/domain/sourceMapEnvelope.js +17 -11
- package/dist/domain/sqlite/sqliteDatabase.js +189 -0
- package/dist/domain/staticRuntimeCorrelation.js +7 -9
- package/dist/domain/swiftSymbolClassification.js +17 -0
- package/dist/domain/symbolAnalysis.js +20 -7
- package/dist/domain/urlComponents.js +6 -0
- package/dist/domain/wasm/wasmArtifact.js +119 -0
- package/dist/domain/wasm/wasmInterface.js +89 -0
- package/dist/domain/webBundleAnalysis.js +14 -3
- package/dist/domain/webBundleAnalyzerAst.js +7 -2
- package/dist/domain/webBundleAnalyzerInspection.js +113 -57
- package/dist/domain/webBundleAnalyzerResult.js +18 -6
- package/dist/domain/webCaptureDiff.js +235 -51
- package/dist/domain/webCaptureFrameComparison.js +49 -0
- package/dist/domain/webInventory.js +28 -14
- package/dist/domain/webMcpDiscovery.js +5 -2
- package/dist/domain/webModuleImports.js +22 -27
- package/dist/domain/webModuleTrace.js +25 -8
- package/dist/domain/webNetworkCapture.js +101 -39
- package/dist/domain/webNetworkCaptureCoordinates.js +21 -0
- package/dist/domain/webRuntime.js +0 -1
- package/dist/domain/webScreenshot.js +2 -2
- package/dist/domain/webScriptArtifacts.js +2 -4
- package/dist/domain/webScriptExport.js +6 -8
- package/dist/domain/webScriptExportError.js +2 -3
- package/dist/domain/webScriptExportPlan.js +2 -2
- package/dist/domain/webSourceLocation.js +20 -9
- package/dist/domain/xmlDocument.js +41 -0
- package/dist/domain/zipPackageFormat.js +25 -3
- package/dist/dotnet/ManagedArtifactInspector.js +25 -12
- package/dist/dotnet/ManagedDecodeBudget.js +87 -9
- package/dist/dotnet/ManagedMemberInspector.js +127 -22
- package/dist/dotnet/ManagedMemberInspectorCore.js +408 -141
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +109 -37
- package/dist/dotnet/ManagedMemberOwnership.js +65 -0
- package/dist/dotnet/ManagedMemberPointers.js +69 -0
- package/dist/dotnet/ManagedMemberRows.js +181 -48
- package/dist/dotnet/ManagedMetadataHeaps.js +110 -25
- package/dist/dotnet/ManagedMetadataInventory.js +5 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +36 -52
- package/dist/dotnet/ManagedMetadataLayout.js +26 -16
- package/dist/dotnet/ManagedMetadataRowSizes.js +1 -1
- package/dist/dotnet/ManagedMethodBodyReader.js +29 -11
- package/dist/dotnet/ManagedMethodSpecs.js +78 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +20 -19
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +13 -21
- package/dist/dotnet/ManagedPeReader.js +60 -27
- package/dist/dotnet/ManagedReaderFailure.js +9 -0
- package/dist/dotnet/ManagedSnapshot.js +93 -0
- package/dist/dotnet/ManagedStaticProvider.js +55 -64
- package/dist/dotnet/ManagedTypeMemberLists.js +105 -0
- package/dist/dotnet/ManagedTypeNameDigests.js +177 -0
- package/dist/dotnet/ManagedTypeNames.js +58 -0
- package/dist/dotnet/ManagedTypeNesting.js +25 -0
- package/dist/dotnet/ManagedTypeReferences.js +94 -0
- package/dist/dotnet/ManagedUserStrings.js +75 -0
- package/dist/electron/ElectronFuseFailures.js +105 -0
- package/dist/electron/ElectronFusePath.js +248 -0
- package/dist/electron/ElectronFuseProvider.js +88 -0
- package/dist/electron/ElectronFuseReader.js +333 -0
- package/dist/evaluation/AgentEvaluationFixtures.js +194 -11
- package/dist/evaluation/CodexAgentEval.js +19 -40
- package/dist/evaluation/KnownAnswerEvaluation.js +126 -57
- package/dist/evm/EvmoleFailures.js +20 -14
- package/dist/evm/EvmoleInterfaceAdapter.js +5 -1
- package/dist/evm/EvmoleInterfaceProvider.js +142 -35
- package/dist/evm/EvmoleInterfaceWorker.js +2 -0
- package/dist/evm/SolidityMetadata.js +139 -0
- package/dist/filesystem/OwnedRegularFile.js +116 -0
- package/dist/filesystem/OwnedStagedOutput.js +155 -0
- package/dist/filesystem/RegularFile.js +65 -9
- package/dist/filesystem/StableFileHash.js +56 -38
- package/dist/filesystem/callerPath.js +26 -0
- package/dist/filesystem/readFileHandleChunks.js +72 -13
- package/dist/filesystem/readStableFileBytes.js +85 -0
- package/dist/firmware/FirmwareCommand.js +15 -9
- package/dist/firmware/FirmwareFailures.js +56 -0
- package/dist/firmware/FirmwareFiles.js +136 -110
- package/dist/firmware/FirmwareProvider.js +122 -65
- package/dist/firmware/FirmwarePublication.js +244 -12
- package/dist/firmware/FirmwareReports.js +202 -12
- package/dist/flutter/DartElf.js +445 -0
- package/dist/flutter/ElfBuildId.js +137 -0
- package/dist/flutter/ElfLoadMap.js +91 -0
- package/dist/flutter/FlutterBuildProvider.js +866 -0
- package/dist/flutter/FlutterPayloadScan.js +180 -0
- package/dist/frida/FridaInstrumentationManager.js +1104 -0
- package/dist/gdb/GdbSessionManager.js +1639 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +146 -14
- package/dist/ghidra/GhidraAnalysisSeeds.js +39 -55
- package/dist/ghidra/GhidraBridgeSources.js +12 -0
- package/dist/ghidra/GhidraClient.js +501 -180
- package/dist/ghidra/GhidraClientStartup.js +5 -3
- package/dist/ghidra/GhidraClientWire.js +5 -2
- package/dist/ghidra/GhidraDiagnostics.js +23 -5
- package/dist/ghidra/GhidraDoctor.js +60 -26
- package/dist/ghidra/GhidraDosSnapshot.js +83 -0
- package/dist/ghidra/GhidraExecutableHeader.js +54 -0
- package/dist/ghidra/GhidraFileArtifacts.js +93 -0
- package/dist/ghidra/GhidraFunctionValues.js +50 -2
- package/dist/ghidra/GhidraInstallation.js +305 -108
- package/dist/ghidra/GhidraInstallationPolicy.js +94 -103
- package/dist/ghidra/GhidraInstallationProperties.js +57 -0
- package/dist/ghidra/GhidraInventoryValues.js +52 -6
- package/dist/ghidra/GhidraJavaLaunch.js +99 -11
- package/dist/ghidra/GhidraJavaProbe.js +267 -0
- package/dist/ghidra/GhidraJavaProperties.js +119 -0
- package/dist/ghidra/GhidraLanguageCatalog.js +83 -8
- package/dist/ghidra/GhidraLauncher.js +325 -85
- package/dist/ghidra/GhidraLoadImageAttest.js +82 -65
- package/dist/ghidra/GhidraLoadImageValues.js +109 -27
- package/dist/ghidra/GhidraMipsProfile.js +258 -14
- package/dist/ghidra/GhidraNativeAotSnapshotOwner.js +221 -0
- package/dist/ghidra/GhidraPeProfile.js +91 -0
- package/dist/ghidra/GhidraPowerPcProfile.js +51 -0
- package/dist/ghidra/GhidraProvider.js +267 -42
- package/dist/ghidra/GhidraProviderCapabilities.js +29 -15
- package/dist/ghidra/GhidraProviderClient.js +439 -276
- package/dist/ghidra/GhidraPspExtension.js +210 -0
- package/dist/ghidra/GhidraPspProfile.js +62 -0
- package/dist/ghidra/GhidraRawBinaryLanguage.js +49 -0
- package/dist/ghidra/GhidraReleasePolicy.js +93 -0
- package/dist/ghidra/GhidraRequestQueue.js +64 -40
- package/dist/ghidra/GhidraRiscvProfile.js +100 -0
- package/dist/ghidra/GhidraSessionError.js +301 -24
- package/dist/ghidra/GhidraSessionValues.js +76 -0
- package/dist/ghidra/GhidraSocketConnection.js +25 -11
- package/dist/ghidra/GhidraTargetSnapshot.js +67 -50
- package/dist/ghidra/GhidraTransport.js +86 -62
- package/dist/ghidra/extensions/GhidraExtensions.js +30 -45
- package/dist/go/GoBinaryContainer.js +140 -0
- package/dist/go/GoBinaryImage.js +210 -0
- package/dist/go/GoBinaryProvider.js +180 -0
- package/dist/go/GoElfImage.js +211 -0
- package/dist/go/GoMachoImage.js +164 -0
- package/dist/go/GoModuleText.js +217 -0
- package/dist/go/GoPeImage.js +124 -0
- package/dist/hopper/BridgeLauncher.js +78 -6
- package/dist/hopper/HopperAnalysisProfile.js +23 -11
- package/dist/hopper/HopperCleanup.js +29 -4
- package/dist/hopper/HopperClient.js +317 -93
- package/dist/hopper/HopperMacPublisher.js +29 -0
- package/dist/hopper/HopperMachOImage.js +61 -29
- package/dist/hopper/HopperProcessDiagnostic.js +27 -0
- package/dist/hopper/HopperProvider.js +57 -29
- package/dist/hopper/HopperProviderCapabilities.js +9 -4
- package/dist/hopper/HopperRegexSearch.js +21 -60
- package/dist/hopper/HopperRequestQueue.js +17 -5
- package/dist/hopper/HopperSessionValues.js +10 -1
- package/dist/ida/IdaBusyHealth.js +78 -0
- package/dist/ida/IdaCallGraph.js +134 -0
- package/dist/ida/IdaConfiguration.js +7 -2
- package/dist/ida/IdaDiagnosticRedactor.js +199 -0
- package/dist/ida/IdaDiagnosticWriter.js +62 -0
- package/dist/ida/IdaDoctor.js +7 -5
- package/dist/ida/IdaJsonDiagnostic.js +138 -0
- package/dist/ida/IdaMcpConnection.js +308 -32
- package/dist/ida/IdaNativeProtocol.js +85 -0
- package/dist/ida/IdaOperationRunner.js +246 -61
- package/dist/ida/IdaProtocolValues.js +88 -5
- package/dist/ida/IdaProvider.js +45 -10
- package/dist/ida/IdaProviderCapabilities.js +37 -8
- package/dist/ida/IdaSessionClient.js +379 -60
- package/dist/ida/IdaWorkspace.js +54 -6
- package/dist/inspector/V8InspectorCaptureProjection.js +14 -2
- package/dist/inspector/V8InspectorEndpoint.js +15 -13
- package/dist/inspector/V8InspectorProvider.js +43 -7
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +44 -12
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +107 -32
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +7 -4
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +85 -10
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +16 -6
- package/dist/javascript/recovery/RecoveryFiles.js +107 -13
- package/dist/javascript/recovery/WakaruExecution.js +19 -11
- package/dist/javascript/recovery/WakaruProvider.js +12 -9
- package/dist/javascript/recovery/WakaruPublication.js +24 -10
- package/dist/javascript/recovery/WakaruRelease.js +1 -1
- package/dist/javascript/recovery/WakaruReport.js +3 -2
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +2 -16
- package/dist/javascript/sourceMaps/SourceMapCommand.js +22 -4
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +22 -4
- package/dist/javascript/sourceMaps/SourceMapFormat.js +25 -38
- package/dist/javascript/sourceMaps/TraceSourceMap.js +34 -6
- package/dist/jeb/JebMcpConnection.js +148 -82
- package/dist/jeb/JebMcpConnectionOwner.js +116 -0
- package/dist/jeb/JebMcpDeadline.js +46 -0
- package/dist/jeb/JebMcpEndpoint.js +6 -1
- package/dist/jeb/JebProvider.js +82 -58
- package/dist/kuna/KunaAddress.js +11 -0
- package/dist/kuna/KunaCommand.js +217 -0
- package/dist/kuna/KunaConfiguration.js +90 -0
- package/dist/kuna/KunaDoctor.js +198 -0
- package/dist/kuna/KunaInstallation.js +137 -0
- package/dist/kuna/KunaJson.js +23 -0
- package/dist/kuna/KunaJsonStream.js +433 -0
- package/dist/kuna/KunaLimits.js +5 -0
- package/dist/kuna/KunaProjectCache.js +804 -0
- package/dist/kuna/KunaProjectExport.js +202 -0
- package/dist/kuna/KunaProjectFiles.js +191 -0
- package/dist/kuna/KunaProjectReader.js +115 -0
- package/dist/kuna/KunaProvider.js +217 -0
- package/dist/kuna/KunaProviderCapabilities.js +102 -0
- package/dist/kuna/KunaQueryErrors.js +12 -0
- package/dist/kuna/KunaQueryWork.js +113 -0
- package/dist/kuna/KunaReferenceFiles.js +258 -0
- package/dist/kuna/KunaReferenceQueries.js +211 -0
- package/dist/kuna/KunaRelease.js +10 -0
- package/dist/kuna/KunaRunSlots.js +56 -0
- package/dist/kuna/KunaSessionClient.js +1162 -0
- package/dist/kuna/KunaStringInventory.js +145 -0
- package/dist/kuna/KunaStringQueries.js +133 -0
- package/dist/kuna/KunaTargetCommands.js +205 -0
- package/dist/kuna/KunaUnavailable.js +11 -0
- package/dist/logger.js +14 -1
- package/dist/main/processShutdown.js +17 -0
- package/dist/main/shutdown.js +3 -0
- package/dist/main/transport.js +68 -4
- package/dist/main.js +16 -15
- package/dist/mcp/AnalysisProvider-BABWbLoM.js +38 -0
- package/dist/mcp/AnalysisSnapshotFiles-BXz0c37-.js +1423 -0
- package/dist/mcp/ArtifactFileOperation-64cQKI7B.js +1704 -0
- package/dist/mcp/ArtifactProvider-Dx6pmil1.js +2200 -0
- package/dist/mcp/ArtifactProviderMetadata-UCJr2oZW.js +167 -0
- package/dist/mcp/ArtifactReader-BrnwNaKY.js +78 -0
- package/dist/mcp/ArtifactResourceScope-zi3Dkqzy.js +175 -0
- package/dist/mcp/AsarHeader-B_IbppTz.js +31 -0
- package/dist/mcp/BinarySessionStatus-CZ9nnXMt.js +213 -0
- package/dist/mcp/BinaryTargetResolver-BUncASDP.js +1358 -0
- package/dist/mcp/BoundedFileBytes-DYt5q9G2.js +43 -0
- package/dist/mcp/CdpCaptureDocuments-Y2uFcBpl.js +795 -0
- package/dist/mcp/CdpCaptureValues-tNIg-gQK.js +97 -0
- package/dist/mcp/CdpEndpoint-BrhMhpSi.js +641 -0
- package/dist/mcp/CdpOptionalCommand-PZZhlqxv.js +120 -0
- package/dist/mcp/CdpTargetSession-BmmDC3XO.js +290 -0
- package/dist/mcp/DirectAnalysis-B9KuCHTG.js +417 -0
- package/dist/mcp/DirectAnalysisStatus-BgzopkIt.js +44 -0
- package/dist/mcp/ElectronFileScope-FXtK0d6I.js +110 -0
- package/dist/mcp/ElectronFuseFailures-uZ_wOV6T.js +610 -0
- package/dist/mcp/MachoLoadCommandReader-C2VGgHA3.js +330 -0
- package/dist/mcp/ManagedStaticProvider-CZuoPme2.js +5326 -0
- package/dist/mcp/NativeMacOSProvider-CMguKrvN.js +5495 -0
- package/dist/mcp/NativeMacOSProviderMetadata-B_RH4KXF.js +397 -0
- package/dist/mcp/OwnedCommand-BW1jBSt9.js +1241 -0
- package/dist/mcp/ProcedureAddressResolution-H6Qwpb_Y.js +59 -0
- package/dist/mcp/WorkflowEvidence-CO4C7ALz.js +118 -0
- package/dist/mcp/analysisErrorCleanup-Q344SnTO.js +34 -0
- package/dist/mcp/analysisErrorCore-BIEP7tvF.js +509 -0
- package/dist/mcp/analysisErrorProjection-B8teQwwD.js +942 -0
- package/dist/mcp/artifactToolContracts-C9dRDo-D.js +74 -0
- package/dist/mcp/browserObservation-DUraZs62.js +4633 -0
- package/dist/mcp/browserObservationError-C5okJ5el.js +63 -0
- package/dist/mcp/browserObservationSchemas-DwGGxBpu.js +573 -0
- package/dist/mcp/browserScenario-BRUz7yN0.js +3415 -0
- package/dist/mcp/browserScenarioCapture-CiMAsMx8.js +595 -0
- package/dist/mcp/callerPath-CpPnMZyN.js +678 -0
- package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
- package/dist/mcp/electronActiveObservation-DV0Ffy9X.js +227 -0
- package/dist/mcp/electronFuses-D5SS7XXw.js +367 -0
- package/dist/mcp/electronObservation-DsN-NqY1.js +621 -0
- package/dist/mcp/electronObservation-wOYWwqgF.js +112 -0
- package/dist/mcp/electronScenario-CYrt2zBK.js +913 -0
- package/dist/mcp/emptyArraySchema-C0o2Sxwp.js +140 -0
- package/dist/mcp/enhancedInputs-6CCgB3VB.js +56 -0
- package/dist/mcp/javascriptRuntimeObservation-BVbhkO2-.js +693 -0
- package/dist/mcp/javascriptRuntimeObservation-Cu0Yedqq.js +121 -0
- package/dist/mcp/jsonSerialization-V-wWiFRE.js +152 -0
- package/dist/mcp/lipo-DSTgUqL1.js +395 -0
- package/dist/mcp/localPath-AxvW9aPe.js +19 -0
- package/dist/mcp/logger-BGdGHadX.js +48 -0
- package/dist/mcp/machoContainer-CMSxUBlK.js +605 -0
- package/dist/mcp/main-Cx-Z7m_n.js +80276 -0
- package/dist/mcp/main.js +6 -0
- package/dist/mcp/managedToolContracts-CSlbKJP-.js +101 -0
- package/dist/mcp/nativeValueTrace-BEZbDieM.js +3601 -0
- package/dist/mcp/officialToolContracts-CauCcSsc.js +1432 -0
- package/dist/mcp/peMachine-aP1iYnHq.js +95 -0
- package/dist/mcp/pngHeader-DQ-ObyY2.js +147 -0
- package/dist/mcp/propertyListKeys-BfCo0k4w.js +356 -0
- package/dist/mcp/providerCleanupError-DIRHxzWo.js +125 -0
- package/dist/mcp/providerIdentities--ptAh481.js +31 -0
- package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
- package/dist/mcp/providerOperationHealth-9DRSGM8N.js +71 -0
- package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
- package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
- package/dist/mcp/scanCanonical-CF3ATd1V.js +3788 -0
- package/dist/mcp/serverIdentity-BK0Ejd_Y.js +1507 -0
- package/dist/mcp/sourceMapEnvelope-DAaRUIGj.js +94 -0
- package/dist/mcp/toolContracts-BPoHQdlC.js +12414 -0
- package/dist/mcp/toolOutputSchemaGroups-MJ_f-PMK.js +17730 -0
- package/dist/mcp/webContentArtifact-DfGkgDcI.js +269 -0
- package/dist/mcp/webRuntime-ccyhkRru.js +74 -0
- package/dist/mcp/webSourceLocation-DKIum0vJ.js +13167 -0
- package/dist/mcpDoctor.js +95 -70
- package/dist/mcpStartupPolicy.js +20 -2
- package/dist/native/AppleDispatchCoverage.js +57 -17
- package/dist/native/AppleDispatchMetadata.js +82 -29
- package/dist/native/AppleMachoFixups.js +208 -35
- package/dist/native/AppleMachoSelection.js +30 -23
- package/dist/native/AppleObjcCategories.js +13 -3
- package/dist/native/AppleObjcDispatchFacets.js +95 -17
- package/dist/native/AppleObjcProperties.js +61 -17
- package/dist/native/AppleObjcProtocols.js +25 -7
- package/dist/native/AppleSwiftVtables.js +2 -0
- package/dist/native/CommandRunner.js +146 -32
- package/dist/native/LldbCallTracer.js +235 -179
- package/dist/native/LldbReadbackFiles.js +70 -0
- package/dist/native/LldbRetainedObservations.js +28 -56
- package/dist/native/MachoArchitectureSelection.js +50 -0
- package/dist/native/NativeCallObservation.js +55 -53
- package/dist/native/NativeCallTarget.js +95 -0
- package/dist/native/NativeMacOSProvider.js +318 -188
- package/dist/native/NativeMachoInspection.js +155 -81
- package/dist/native/NativePlistSource.js +179 -0
- package/dist/native/NativeUiCleanupError.js +30 -0
- package/dist/native/NativeUiHelperRuntime.js +48 -35
- package/dist/native/NativeUiObservation.js +69 -47
- package/dist/native/SignatureTargetBinding.js +147 -65
- package/dist/native/parsers/codesign.js +27 -10
- package/dist/native/parsers/demangle.js +22 -12
- package/dist/native/parsers/dyldInfo.js +73 -4
- package/dist/native/parsers/lipo.js +53 -19
- package/dist/native/parsers/machoUuid.js +150 -0
- package/dist/native/parsers/otool.js +275 -32
- package/dist/native/parsers/plist.js +40 -25
- package/dist/native/pe/PeResourceLayout.js +22 -7
- package/dist/native/pe/PeResourceParser.js +10 -9
- package/dist/native/pe/PeResourcesProvider.js +76 -15
- package/dist/native/pwndbg/CoreFileMappingAuthority.js +51 -0
- package/dist/native/pwndbg/PwndbgCoreContext.js +39 -28
- package/dist/native/pwntools/PwntoolsDecoder.js +339 -52
- package/dist/native/pwntools/PwntoolsFailures.js +19 -4
- package/dist/native/pwntools/PwntoolsInputLimit.js +27 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +38 -16
- package/dist/native/pwntools/PwntoolsResourceLimits.js +3 -3
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +12 -8
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +3 -1
- package/dist/objdump/ObjdumpCommand.js +24 -0
- package/dist/pcap/PcapCommand.js +146 -0
- package/dist/pcap/PcapConfiguration.js +93 -0
- package/dist/pcap/PcapNativeBound.js +58 -0
- package/dist/pcap/PcapOutput.js +276 -0
- package/dist/pcap/PcapProvider.js +454 -0
- package/dist/pcap/PcapSnapshot.js +191 -0
- package/dist/process/ArtifactAnalysisResources.js +306 -0
- package/dist/process/BoundedFileBytes.js +8 -3
- package/dist/process/CurrentEntrypointPath.js +8 -0
- package/dist/process/DarwinProcessRunTokenReader.js +276 -61
- package/dist/process/DetachedPgpSignature.js +57 -0
- package/dist/process/ExecFileBoundedOutput.js +44 -0
- package/dist/process/ExecFileOutput.js +44 -17
- package/dist/{hopper/HopperTargetLease.js → process/HopperLease.js} +76 -19
- package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
- package/dist/process/LinuxResourceLimits.js +60 -0
- package/dist/process/MacCodeSignature.js +3 -0
- package/dist/process/OwnedCommand.js +144 -25
- package/dist/process/PrivateRuntimeRoot.js +9 -19
- package/dist/process/PrivateRuntimeRootUnavailableError.js +10 -0
- package/dist/process/ProcessOwnership.js +70 -17
- package/dist/process/ProcessOwnershipObservation.js +35 -4
- package/dist/process/ProviderDeadline.js +58 -12
- package/dist/process/ProviderProcess.js +233 -17
- package/dist/process/RegexMatcher.js +96 -0
- package/dist/process/SharedStartupAttempt.js +59 -0
- package/dist/process/WindowsAuthority.js +48 -39
- package/dist/process/WindowsBatchCommand.js +46 -0
- package/dist/process/boundedUtf8Text.js +13 -0
- package/dist/process/capture/FilesystemSnapshot.js +63 -11
- package/dist/process/capture/ProcessCaptureClock.js +2 -0
- package/dist/process/capture/ProcessCaptureError.js +64 -7
- package/dist/process/capture/ProcessCaptureJournal.js +2 -1
- package/dist/process/capture/ProcessCaptureLifecycle.js +104 -56
- package/dist/process/capture/ProcessCaptureProgress.js +7 -4
- package/dist/process/capture/ProcessHarness.js +34 -17
- package/dist/process/capture/ProcessNormalization.js +278 -36
- package/dist/process/capture/ProcessSampling.js +3 -2
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +13 -13
- package/dist/process/capture/TerminalRenderer.js +31 -10
- package/dist/process/ownedDebuggerSession.js +203 -0
- package/dist/process/snapshotEnvironment.js +8 -8
- package/dist/{application/binary → providers}/AnalysisClientCleanup.js +3 -3
- package/dist/providers/AnalysisClientCreation.js +193 -0
- package/dist/providers/AnalysisClientFailure.js +191 -0
- package/dist/providers/DeferredAnalysisClient.js +48 -0
- package/dist/providers/OwnedCommandCleanup.js +65 -0
- package/dist/providers/ProviderInspectionScope.js +10 -0
- package/dist/recordedCatalogDigests.js +2 -0
- package/dist/reference/ReferenceSourceReader.js +64 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +79 -56
- package/dist/reference/ReferenceSourceReaderErrors.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +2 -2
- package/dist/reference/ReferenceSourceReaderTypes.js +1 -2
- package/dist/reference/ReferenceSourceReaderValidate.js +0 -1
- package/dist/rizin/RizinCommand.js +14 -0
- package/dist/rizin/RizinDebugSessionManager.js +1111 -0
- package/dist/rust/RustAuditableReader.js +309 -0
- package/dist/rust/RustBinaryImage.js +116 -0
- package/dist/rust/RustBinaryProvider.js +194 -0
- package/dist/server/EvidenceMcpServer.js +160 -37
- package/dist/server/admittedToolOperation.js +7 -2
- package/dist/server/contractToolHandler.js +17 -4
- package/dist/server/createServer.js +179 -30
- package/dist/server/externalMutationAdmission.js +50 -0
- package/dist/server/mcpProgress.js +4 -2
- package/dist/server/promptCompletion.js +43 -28
- package/dist/server/providerEnvironment.js +3 -0
- package/dist/server/registerAnalysisViewTool.js +6 -2
- package/dist/server/registerAndroidTools.js +22 -4
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +8 -1
- package/dist/server/registerArtifactComparisonTool.js +13 -2
- package/dist/server/registerArtifactTools.js +21 -1
- package/dist/server/registerBrowserScenarioTool.js +7 -5
- package/dist/server/registerBrowserTools.js +4 -8
- package/dist/server/registerBundleComparisonTool.js +4 -4
- package/dist/server/registerCaptureTools.js +12 -0
- package/dist/server/registerCutterTools.js +32 -0
- package/dist/server/registerElectronTools.js +13 -21
- package/dist/server/registerEnhancedTools.js +7 -6
- package/dist/server/registerEvidenceTools.js +14 -10
- package/dist/server/registerEvmTools.js +22 -4
- package/dist/server/registerFlutterTools.js +17 -0
- package/dist/server/registerFridaTools.js +201 -0
- package/dist/server/registerFunctionComparisonTool.js +29 -9
- package/dist/server/registerGdbTools.js +64 -0
- package/dist/server/registerGoTools.js +9 -0
- package/dist/server/registerInvestigationTools/helpers.js +2 -2
- package/dist/server/registerInvestigationTools.js +31 -27
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +3 -9
- package/dist/server/registerManagedTools.js +11 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +14 -7
- package/dist/server/registerNativeTools.js +14 -0
- package/dist/server/registerOfficialTools.js +5 -0
- package/dist/server/registerPcapTools.js +35 -0
- package/dist/server/registerProcessComparisonTool.js +12 -2
- package/dist/server/registerReverseEngineeringTools.js +86 -0
- package/dist/server/registerRizinDebugTools.js +53 -0
- package/dist/server/registerRustTools.js +9 -0
- package/dist/server/registerSessionRecordTools.js +19 -13
- package/dist/server/registerSessionStatusTool.js +33 -8
- package/dist/server/registerSessionTools.js +31 -31
- package/dist/server/registerSignalTools.js +12 -0
- package/dist/server/registerSqliteTools.js +9 -0
- package/dist/server/registerWasmTools.js +46 -0
- package/dist/server/registerWebNetworkCaptureTool.js +24 -10
- package/dist/server/retainedSummaryDelivery.js +28 -0
- package/dist/server/runDerivedOperation.js +2 -0
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/toolRegistrationOptions.js +8 -0
- package/dist/server/toolResult.js +52 -19
- package/dist/server/toolResultEncoding.js +36 -3
- package/dist/serverIdentity.js +17 -8
- package/dist/signals/SigrokRecordingProvider.js +346 -0
- package/dist/signals/parseDecoderDiscovery.js +65 -0
- package/dist/sqlite/SqliteDatabaseFailures.js +147 -0
- package/dist/sqlite/SqliteDatabaseInspection.js +436 -0
- package/dist/sqlite/SqliteDatabaseLimits.js +16 -0
- package/dist/sqlite/SqliteDatabaseProvider.js +295 -0
- package/dist/sqlite/SqliteDatabaseSnapshot.js +182 -0
- package/dist/sqlite/SqliteDatabaseWorker.js +46 -0
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +127 -0
- package/dist/wasm/WabtArtifactProvider.js +358 -0
- package/dist/wasm/WabtFailures.js +119 -0
- package/dist/wasm/WabtInterface.js +309 -0
- package/dist/wasm/WabtOutput.js +60 -0
- package/dist/wasm/WabtRelease.js +12 -0
- package/dist/wasm/WabtRuntime.js +58 -0
- package/dist/wasm/WabtString.js +48 -0
- package/dist/wasm/WabtWat.js +147 -0
- package/dist/wasm/WasmGlueAdapter.js +66 -0
- package/dist/wasm/WasmInterfaceBudget.js +11 -0
- package/dist/windows/WindowsNativeLoader.js +53 -9
- package/dist/windows/WindowsOwnedProcess.js +150 -17
- package/dist/windows/WindowsPrivateRuntime.js +66 -2
- package/install.sh +157 -98
- package/licenses/Apache-2.0.txt +202 -0
- package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
- package/licenses/GPL-3.0.txt +674 -0
- package/licenses/LGPL-2.0.txt +480 -0
- package/licenses/MIT-template.txt +18 -0
- package/licenses/MinGW-w64-runtime.txt +240 -0
- package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
- package/licenses/README.md +68 -0
- package/licenses/cfworker-MIT.txt +21 -0
- package/licenses/dotnet-runtime-MIT.txt +23 -0
- package/licenses/frida-17.23.2-COPYING.txt +50 -0
- package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
- package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
- package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
- package/licenses/npm-dependencies.txt +3757 -0
- package/licenses/npm-runtime-notices.txt +8722 -0
- package/licenses/upstream-sources.json +72 -0
- package/licenses/xterm-MIT.txt +21 -0
- package/native/windows/README.md +130 -12
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +97 -22
- package/scripts/electron-active-hook-boundaries.cjs +15 -2
- package/scripts/electron-active-hook.cjs +412 -47
- package/scripts/hopper-demo-x11.py +65 -13
- package/scripts/prepack.mjs +5 -0
- package/scripts/rea-android-workspace-guardian.mjs +46 -0
- package/scripts/rea.mjs +89 -26
- package/scripts/verify-windows-native-artifact.mjs +2 -2
- package/skills/reverse-engineer-anything/SKILL.md +146 -11
- package/skills/reverse-engineer-anything/references/android-applications.md +3 -1
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +10 -10
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +23 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +72 -3
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +149 -19
- package/skills/reverse-engineer-anything/references/runtime-observation.md +57 -7
- package/third_party/README.md +1 -1
- package/third_party/wabt/README.md +24 -0
- package/dist/browser/history/HarCaptureAdapter.js +0 -20
- package/dist/cli/streamedJsonOutput.js +0 -135
- package/dist/hopper/HopperRegexWorker.js +0 -27
- /package/dist/{application/binary → process}/AbortablePromise.js +0 -0
|
@@ -0,0 +1,2200 @@
|
|
|
1
|
+
import { t as __esmMin } from "./rolldown-runtime-BjeaiXFo.js";
|
|
2
|
+
import { b as init_snapshotEnvironment, x as snapshotEnvironment } from "./OwnedCommand-BW1jBSt9.js";
|
|
3
|
+
import { A as err, C as freezeJsonSnapshot, M as ok, T as init_immutableJson, a as AnalysisCapabilityUnavailableError, b as jsonValueSchema, d as AnalysisUnsupportedTargetError, f as init_analysisErrorCore, i as AnalysisCancelledError, j as init_result, o as AnalysisInputError, v as init_jsonValue } from "./analysisErrorCore-BIEP7tvF.js";
|
|
4
|
+
import { f as ArtifactOperationError, p as init_artifactOperationError } from "./analysisErrorProjection-B8teQwwD.js";
|
|
5
|
+
import { $ as isZipPackageFormat, Q as init_zipPackageFormat, S as createPlistNumberProjection, Wt as init_evidence, _ as init_interfaceBuilderKeyedArchive, a as init_interfaceBuilderGraph, c as interfaceBuilderLimitsSchema, fn as isMachOFormat, i as buildInterfaceBuilderAnalysis, un as init_binaryTargetTypes, v as interfaceBuilderConnectionFieldNames, w as init_plistNumbers, x as createPlistNumberCollector, y as isUIKitRuntimeConnectionClass, zt as createEvidence } from "./nativeValueTrace-BEZbDieM.js";
|
|
6
|
+
import { I as init_ExecFileOutput, P as execFileOutput, a as assertArtifactReadActive, c as mapArtifactFileFailure, o as bindArtifactFileCleanup, r as artifactFileCancellationCause, s as init_ArtifactFileOperation, u as withArtifactRegularFile } from "./ArtifactFileOperation-64cQKI7B.js";
|
|
7
|
+
import { i as init_ArtifactReader, o as sameArtifactSourceIdentity, t as ArtifactReaderFailure } from "./ArtifactReader-BrnwNaKY.js";
|
|
8
|
+
import { b as sameRegularFileState, p as NonRegularFileReadError, v as init_RegularFile } from "./machoContainer-CMSxUBlK.js";
|
|
9
|
+
import { n as init_providerCleanupError, t as ProviderCleanupError } from "./providerCleanupError-DIRHxzWo.js";
|
|
10
|
+
import { n as ArtifactResourceScope, r as init_ArtifactResourceScope } from "./ArtifactResourceScope-zi3Dkqzy.js";
|
|
11
|
+
import { n as init_canonicalDigest, t as digestCanonicalValue } from "./canonicalDigest-Bi_0_zGi.js";
|
|
12
|
+
import { l as init_unicodeCodePointOrder, s as compareUnicodeCodePoints } from "./providerOperationHealth-9DRSGM8N.js";
|
|
13
|
+
import { r as init_AnalysisProvider, t as createAnalysisExecution } from "./AnalysisProvider-BABWbLoM.js";
|
|
14
|
+
import { I as decodeXmlPlistText, L as init_propertyListXmlText, P as init_InvestigationProviders, a as estimateBinaryPlistExpansion, d as hasNibArchiveSignature, i as InterfaceBuilderDecodeBudgetExceeded, o as init_InterfaceBuilderDecodeBudget, p as init_appleArchiveFormat, r as InterfaceBuilderDecodeBudget, s as preflightPropertyListDecode, u as hasBinaryPlistSignature, v as ARTIFACT_GRAPH_PROVIDER } from "./callerPath-CpPnMZyN.js";
|
|
15
|
+
import { i as readArtifactFileChunks, n as init_ArtifactProviderMetadata, r as init_readArtifactFileChunks, t as artifactCapabilities } from "./ArtifactProviderMetadata-UCJr2oZW.js";
|
|
16
|
+
import { At as traceDylibLoading, Ct as nonFiniteRealLimitation, Dt as dylibResolutionInputSchema, Et as unknownRealLimitation, Mt as resolveTreePath, Ot as dylibResolutionResultSchema, St as negativeZeroRealLimitation, Tt as unknownDateLimitation, _i as init_artifactInspection, _t as keyedArchiveInputSchema, ba as projectInputIssues, bi as init_artifactGraph, bt as init_plistValue, dt as appleResourceKeyFields, ft as init_appleAssetCatalog, gi as createArtifactInspection, gt as init_keyedArchive, ht as KeyedArchiveKindError, jt as init_dyldPaths, kt as init_dylibResolution, mt as projectAppleAssetCatalogPage, pt as parseAppleAssetCatalogRecords, ut as appleAssetCatalogInputSchema, vi as artifactExtractionResultSchema, vt as keyedArchiveResultSchema, wt as projectPlistValue, ya as init_inputIssueProjection, yi as artifactInventoryResultSchema, yt as projectKeyedArchive } from "./toolOutputSchemaGroups-MJ_f-PMK.js";
|
|
17
|
+
import { i as parseXmlPropertyList, r as omittedPrototypeKeysLimitation, t as init_propertyListKeys } from "./propertyListKeys-BfCo0k4w.js";
|
|
18
|
+
import { a as artifactInventoryInputSchema, o as init_artifactToolContracts, r as artifactExtractionExecutionSchema, t as ARTIFACT_ANALYSIS_OPERATIONS } from "./artifactToolContracts-C9dRDo-D.js";
|
|
19
|
+
import { C as init_ArtifactPaths, E as init_ZipArtifactReader, T as ZipArtifactReader, _ as SafeOutputTreeCreationFailure, f as init_DirectoryArtifactReader, g as init_SafeOutputTree, h as SafeOutputTree, i as init_MachOSliceArtifactReader, l as init_ArtifactHash, m as init_AsarArtifactReader, n as scanCanonicalArtifactInventoryInScope, p as AsarArtifactReader, r as MachOSliceArtifactReader, s as abortIfNeeded, t as init_scanCanonical, u as DirectoryArtifactReader, v as init_SafeOutputTreeCreationFailure, w as normalizeArtifactPath, x as ArtifactPathRegistry } from "./scanCanonical-CF3ATd1V.js";
|
|
20
|
+
import { n as init_MachoLoadCommandReader, r as readMachoImage, t as hasMachoMagic } from "./MachoLoadCommandReader-C2VGgHA3.js";
|
|
21
|
+
import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
import { lstat, readlink, realpath } from "node:fs/promises";
|
|
24
|
+
import { createHash } from "node:crypto";
|
|
25
|
+
import { TextDecoder } from "node:util";
|
|
26
|
+
import { parseBinary } from "plist";
|
|
27
|
+
|
|
28
|
+
//#region dist/artifacts/apple/PlistNumberLiterals.js
|
|
29
|
+
var binaryObjectEnd, scanBinaryPlistNumberLiterals, decodeBinaryPlistNumbers;
|
|
30
|
+
function init_PlistNumberLiterals() {
|
|
31
|
+
return (init_PlistNumberLiterals = __esmMin((() => {
|
|
32
|
+
init_plistNumbers();
|
|
33
|
+
init_appleArchiveFormat();
|
|
34
|
+
binaryObjectEnd = (bytes, offset, objectEnd, referenceWidth) => {
|
|
35
|
+
const marker = bytes[offset];
|
|
36
|
+
if (marker === undefined) return undefined;
|
|
37
|
+
const type = marker >> 4;
|
|
38
|
+
let length = marker & 15;
|
|
39
|
+
let cursor = offset + 1;
|
|
40
|
+
if (length === 15 && type !== 0 && type !== 8) {
|
|
41
|
+
const extendedMarker = bytes[cursor];
|
|
42
|
+
if (extendedMarker === undefined || extendedMarker >> 4 !== 1) return undefined;
|
|
43
|
+
const width = 1 << (extendedMarker & 15);
|
|
44
|
+
if (width > 8 || cursor + 1 + width > objectEnd) return undefined;
|
|
45
|
+
cursor += 1;
|
|
46
|
+
let extendedLength = 0n;
|
|
47
|
+
for (let index = 0; index < width; index += 1) extendedLength = extendedLength << 8n | BigInt(bytes[cursor + index] ?? 0);
|
|
48
|
+
if (extendedLength > BigInt(Number.MAX_SAFE_INTEGER)) return undefined;
|
|
49
|
+
length = Number(extendedLength);
|
|
50
|
+
cursor += width;
|
|
51
|
+
}
|
|
52
|
+
let payloadLength;
|
|
53
|
+
if (type === 0) payloadLength = 0;
|
|
54
|
+
else if (type === 1 || type === 2) {
|
|
55
|
+
if ((marker & 15) > 4) return undefined;
|
|
56
|
+
payloadLength = 1 << (marker & 15);
|
|
57
|
+
} else if (type === 3) {
|
|
58
|
+
if (marker !== 51) return undefined;
|
|
59
|
+
payloadLength = 8;
|
|
60
|
+
} else if (type === 4 || type === 5 || type === 7) {
|
|
61
|
+
payloadLength = length;
|
|
62
|
+
} else if (type === 6) {
|
|
63
|
+
payloadLength = length * 2;
|
|
64
|
+
} else if (type === 8) {
|
|
65
|
+
payloadLength = (marker & 15) + 1;
|
|
66
|
+
} else if (type === 10 || type === 11 || type === 12) {
|
|
67
|
+
payloadLength = length * referenceWidth;
|
|
68
|
+
} else if (type === 13) {
|
|
69
|
+
payloadLength = length * 2 * referenceWidth;
|
|
70
|
+
} else return undefined;
|
|
71
|
+
const end = cursor + payloadLength;
|
|
72
|
+
return Number.isSafeInteger(end) && end <= objectEnd ? end : undefined;
|
|
73
|
+
};
|
|
74
|
+
scanBinaryPlistNumberLiterals = (bytes) => {
|
|
75
|
+
const output = createPlistNumberCollector();
|
|
76
|
+
const wideIntegers = [];
|
|
77
|
+
if (bytes.length < 40 || !hasBinaryPlistSignature(bytes)) return {
|
|
78
|
+
literals: output.result(true),
|
|
79
|
+
wideIntegers
|
|
80
|
+
};
|
|
81
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
82
|
+
const trailer = bytes.length - 32;
|
|
83
|
+
const offsetWidth = bytes[trailer + 6] ?? 0;
|
|
84
|
+
if (![
|
|
85
|
+
1,
|
|
86
|
+
2,
|
|
87
|
+
4,
|
|
88
|
+
8
|
|
89
|
+
].includes(offsetWidth)) return {
|
|
90
|
+
literals: output.result(true),
|
|
91
|
+
wideIntegers
|
|
92
|
+
};
|
|
93
|
+
const countRaw = view.getBigUint64(trailer + 8);
|
|
94
|
+
const tableRaw = view.getBigUint64(trailer + 24);
|
|
95
|
+
const safeMaximum = BigInt(Number.MAX_SAFE_INTEGER);
|
|
96
|
+
if (countRaw === 0n || countRaw > safeMaximum || tableRaw > safeMaximum) return {
|
|
97
|
+
literals: output.result(true),
|
|
98
|
+
wideIntegers
|
|
99
|
+
};
|
|
100
|
+
if (tableRaw < 8n || tableRaw >= BigInt(trailer)) return {
|
|
101
|
+
literals: output.result(true),
|
|
102
|
+
wideIntegers
|
|
103
|
+
};
|
|
104
|
+
const offsetTable = Number(tableRaw);
|
|
105
|
+
const capacity = Math.floor((trailer - offsetTable) / offsetWidth);
|
|
106
|
+
if (countRaw > BigInt(capacity)) return {
|
|
107
|
+
literals: output.result(true),
|
|
108
|
+
wideIntegers
|
|
109
|
+
};
|
|
110
|
+
const count = Number(countRaw);
|
|
111
|
+
const referenceWidth = bytes[trailer + 7] ?? 0;
|
|
112
|
+
if (![
|
|
113
|
+
1,
|
|
114
|
+
2,
|
|
115
|
+
4,
|
|
116
|
+
8
|
|
117
|
+
].includes(referenceWidth)) return {
|
|
118
|
+
literals: output.result(true),
|
|
119
|
+
wideIntegers
|
|
120
|
+
};
|
|
121
|
+
const unsigned = (offset) => {
|
|
122
|
+
if (offset < offsetTable || offset + offsetWidth > trailer) return undefined;
|
|
123
|
+
if (offsetWidth === 1) return view.getUint8(offset);
|
|
124
|
+
if (offsetWidth === 2) return view.getUint16(offset);
|
|
125
|
+
if (offsetWidth === 4) return view.getUint32(offset);
|
|
126
|
+
const value = view.getBigUint64(offset);
|
|
127
|
+
return value > safeMaximum ? undefined : Number(value);
|
|
128
|
+
};
|
|
129
|
+
const objectOffsets = [];
|
|
130
|
+
for (let index = 0; index < count; index += 1) {
|
|
131
|
+
const offset = unsigned(offsetTable + index * offsetWidth);
|
|
132
|
+
if (offset === undefined || offset < 8 || offset >= offsetTable) return {
|
|
133
|
+
literals: output.result(true),
|
|
134
|
+
wideIntegers
|
|
135
|
+
};
|
|
136
|
+
objectOffsets.push(offset);
|
|
137
|
+
}
|
|
138
|
+
const sortedOffsets = [...new Set(objectOffsets)].sort((a, b) => a - b);
|
|
139
|
+
for (let index = 0; index < sortedOffsets.length; index += 1) {
|
|
140
|
+
const offset = sortedOffsets[index];
|
|
141
|
+
if (offset === undefined) continue;
|
|
142
|
+
const nextOffset = sortedOffsets[index + 1] ?? offsetTable;
|
|
143
|
+
if (binaryObjectEnd(bytes, offset, nextOffset, referenceWidth) === undefined) return {
|
|
144
|
+
literals: output.result(true),
|
|
145
|
+
wideIntegers: []
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
for (const offset of objectOffsets) {
|
|
149
|
+
const marker = bytes[offset] ?? 0;
|
|
150
|
+
const type = marker >> 4;
|
|
151
|
+
if (type !== 1 && type !== 2) continue;
|
|
152
|
+
const width = 2 ** (marker & 15);
|
|
153
|
+
if (offset + 1 + width > offsetTable) return {
|
|
154
|
+
literals: output.result(true),
|
|
155
|
+
wideIntegers
|
|
156
|
+
};
|
|
157
|
+
if (type === 1 && width === 8) output.integer(view.getBigInt64(offset + 1));
|
|
158
|
+
else if (type === 1 && width === 16) {
|
|
159
|
+
const value = BigInt.asIntN(128, view.getBigUint64(offset + 1) << 64n | view.getBigUint64(offset + 9));
|
|
160
|
+
output.integer(value);
|
|
161
|
+
wideIntegers.push({
|
|
162
|
+
offset,
|
|
163
|
+
value
|
|
164
|
+
});
|
|
165
|
+
} else if (type === 1 && width > 4) return {
|
|
166
|
+
literals: output.result(true),
|
|
167
|
+
wideIntegers
|
|
168
|
+
};
|
|
169
|
+
else if (type === 2 && width === 4) output.real(view.getFloat32(offset + 1));
|
|
170
|
+
else if (type === 2 && width === 8) output.real(view.getFloat64(offset + 1));
|
|
171
|
+
else if (type === 2) return {
|
|
172
|
+
literals: output.result(true),
|
|
173
|
+
wideIntegers
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
literals: output.result(),
|
|
178
|
+
wideIntegers
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
decodeBinaryPlistNumbers = (bytes, metadata) => {
|
|
182
|
+
if (metadata.wideIntegers.length === 0) return bytes;
|
|
183
|
+
const compatible = Buffer.from(bytes);
|
|
184
|
+
for (const { offset, value } of metadata.wideIntegers) {
|
|
185
|
+
compatible[offset] = 35;
|
|
186
|
+
compatible.writeDoubleBE(Number(value), offset + 1);
|
|
187
|
+
}
|
|
188
|
+
return compatible;
|
|
189
|
+
};
|
|
190
|
+
})))();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region dist/artifacts/apple/KeyedArchiveReader.js
|
|
195
|
+
var MAX_BYTES, MAX_DECODE_BYTES, decodeKeyedArchiveBytes, keyedArchiveKindRemediation, inspectBundleKeyedArchive, archivePathError;
|
|
196
|
+
function init_KeyedArchiveReader() {
|
|
197
|
+
return (init_KeyedArchiveReader = __esmMin((() => {
|
|
198
|
+
init_analysisErrorCore();
|
|
199
|
+
init_plistValue();
|
|
200
|
+
init_plistNumbers();
|
|
201
|
+
init_PlistNumberLiterals();
|
|
202
|
+
init_propertyListKeys();
|
|
203
|
+
init_keyedArchive();
|
|
204
|
+
init_DirectoryArtifactReader();
|
|
205
|
+
init_ArtifactReader();
|
|
206
|
+
init_propertyListXmlText();
|
|
207
|
+
init_appleArchiveFormat();
|
|
208
|
+
init_InterfaceBuilderDecodeBudget();
|
|
209
|
+
MAX_BYTES = 64 * 1024 * 1024;
|
|
210
|
+
MAX_DECODE_BYTES = 8 * MAX_BYTES;
|
|
211
|
+
decodeKeyedArchiveBytes = (bytes, selection) => {
|
|
212
|
+
if (bytes.length > MAX_BYTES) throw new RangeError("Keyed archive exceeds 64 MiB");
|
|
213
|
+
if (hasNibArchiveSignature(bytes)) throw new KeyedArchiveKindError("Selected file is a compiled NIBArchive, not a Foundation plist archive; decode it with decode_interface_builder", "nib-archive");
|
|
214
|
+
const binary = hasBinaryPlistSignature(bytes);
|
|
215
|
+
const xmlText = binary ? undefined : decodeXmlPlistText(bytes);
|
|
216
|
+
const binaryExpansion = binary ? estimateBinaryPlistExpansion(bytes, MAX_DECODE_BYTES, {
|
|
217
|
+
budget: "the keyed archive decode budget",
|
|
218
|
+
fail: (kind, message) => kind === "cycle" ? new TypeError("binary plist object references form a cycle, which a property list cannot represent") : new RangeError(message),
|
|
219
|
+
bounds: "decoder",
|
|
220
|
+
numberProjection: true
|
|
221
|
+
}) : undefined;
|
|
222
|
+
const binaryNumberMetadata = binary ? scanBinaryPlistNumberLiterals(bytes) : undefined;
|
|
223
|
+
const parsed = binaryExpansion !== undefined ? {
|
|
224
|
+
value: parseBinary(decodeBinaryPlistNumbers(bytes, binaryNumberMetadata)),
|
|
225
|
+
numberLiterals: binaryNumberMetadata.literals,
|
|
226
|
+
omittedPrototypeKeys: binaryExpansion.binaryPrototypeKeyObserved ? null : 0
|
|
227
|
+
} : parseXmlPropertyList(xmlText ?? "");
|
|
228
|
+
const { nonFiniteRealCount, unknownRealCount, negativeZeroRealCount, unknownDateCount, ...graph } = projectKeyedArchive(parsed.value, selection);
|
|
229
|
+
const numbers = createPlistNumberProjection(parsed.numberLiterals);
|
|
230
|
+
const roots = Object.fromEntries(Object.entries(graph.roots).map(([name, value]) => [name, numbers.project(value)]));
|
|
231
|
+
const objects = graph.objects.map((object) => ({
|
|
232
|
+
...object,
|
|
233
|
+
value: numbers.project(object.value)
|
|
234
|
+
}));
|
|
235
|
+
return {
|
|
236
|
+
archive_format: binary ? "binary-plist" : "xml-plist",
|
|
237
|
+
...graph,
|
|
238
|
+
roots,
|
|
239
|
+
objects,
|
|
240
|
+
limitations: [
|
|
241
|
+
...graph.limitations,
|
|
242
|
+
...numbers.limitations(),
|
|
243
|
+
...parsed.omittedPrototypeKeys === 0 ? [] : [omittedPrototypeKeysLimitation(parsed.omittedPrototypeKeys)],
|
|
244
|
+
...nonFiniteRealCount === 0 ? [] : [nonFiniteRealLimitation(nonFiniteRealCount)],
|
|
245
|
+
...unknownRealCount === 0 ? [] : [unknownRealLimitation(unknownRealCount)],
|
|
246
|
+
...negativeZeroRealCount === 0 ? [] : [negativeZeroRealLimitation(negativeZeroRealCount)],
|
|
247
|
+
...unknownDateCount === 0 ? [] : [unknownDateLimitation(unknownDateCount)]
|
|
248
|
+
]
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
keyedArchiveKindRemediation = (kind, platform) => {
|
|
252
|
+
if (kind === "nib-archive") return "Decode compiled NIBArchive files with decode_interface_builder on the app bundle.";
|
|
253
|
+
return platform === "darwin" ? "Inspect an ordinary property list with inspect_plist; inspect_keyed_archive decodes NSKeyedArchiver archives only." : "Select an NSKeyedArchiver archive; inspect_keyed_archive decodes only those. inspect_plist, which reads ordinary property lists, requires a macOS host.";
|
|
254
|
+
};
|
|
255
|
+
inspectBundleKeyedArchive = async (input) => {
|
|
256
|
+
const selected = keyedArchiveInputSchema.parse(input.parameters);
|
|
257
|
+
if (selected.path.startsWith("/") || selected.path.split("/").some((part) => part === ".." || part === "." || part.length === 0)) throw archivePathError("invalid_format", selected.path === "." ? "Select a keyed archive path relative to the active app bundle." : `Archive path must be a canonical relative bundle path without empty, '.', or '..' segments: ${selected.path}`);
|
|
258
|
+
const reader = new DirectoryArtifactReader(input.bundlePath);
|
|
259
|
+
try {
|
|
260
|
+
const wanted = selected.path.normalize("NFC");
|
|
261
|
+
let entry;
|
|
262
|
+
for await (const candidate of reader.entries(input.signal, (directory) => wanted.startsWith(`${directory.normalize("NFC")}/`))) {
|
|
263
|
+
if (candidate.path.normalize("NFC") !== wanted) continue;
|
|
264
|
+
if (candidate.kind !== "file") throw archivePathError("invalid_value", `Archive path selects a ${candidate.kind}, not a regular file: ${selected.path}`);
|
|
265
|
+
if ((candidate.declaredSize ?? 0) > MAX_BYTES) throw new ArtifactReaderFailure("limit", "Keyed archive exceeds 64 MiB");
|
|
266
|
+
if (entry !== undefined) throw archivePathError("invalid_value", `Archive path matches multiple Unicode-equivalent bundle entries; selection is ambiguous: ${selected.path}`);
|
|
267
|
+
entry = candidate;
|
|
268
|
+
}
|
|
269
|
+
if (entry === undefined) throw archivePathError("invalid_value", `No regular file exists at ${selected.path} in the active app bundle.`);
|
|
270
|
+
const stream = await reader.open(entry, input.signal);
|
|
271
|
+
const chunks = [];
|
|
272
|
+
let size = 0;
|
|
273
|
+
for await (const chunk of stream) {
|
|
274
|
+
if (input.signal?.aborted) {
|
|
275
|
+
stream.destroy();
|
|
276
|
+
throw new ArtifactReaderFailure("cancelled", "Archive inspection cancelled");
|
|
277
|
+
}
|
|
278
|
+
const bytes = z.instanceof(Buffer).parse(chunk);
|
|
279
|
+
size += bytes.length;
|
|
280
|
+
if (size > MAX_BYTES) {
|
|
281
|
+
stream.destroy();
|
|
282
|
+
throw new ArtifactReaderFailure("limit", "Keyed archive exceeds 64 MiB");
|
|
283
|
+
}
|
|
284
|
+
chunks.push(bytes);
|
|
285
|
+
}
|
|
286
|
+
const bytes = Buffer.concat(chunks, size);
|
|
287
|
+
try {
|
|
288
|
+
return keyedArchiveResultSchema.parse({
|
|
289
|
+
target_sha256: input.targetSha256,
|
|
290
|
+
archive_path: entry.path,
|
|
291
|
+
archive_sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
292
|
+
...decodeKeyedArchiveBytes(bytes, selected)
|
|
293
|
+
});
|
|
294
|
+
} catch (cause) {
|
|
295
|
+
if (cause instanceof AnalysisInputError) throw cause;
|
|
296
|
+
if (cause instanceof KeyedArchiveKindError) throw new AnalysisUnsupportedTargetError("inspect_keyed_archive", join(input.bundlePath, entry.path), cause.message, {
|
|
297
|
+
cause,
|
|
298
|
+
remediationAction: keyedArchiveKindRemediation(cause.kind, input.platform ?? process.platform)
|
|
299
|
+
});
|
|
300
|
+
throw new ArtifactReaderFailure(cause instanceof RangeError ? "limit" : "format", `Cannot decode selected Foundation keyed archive: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
301
|
+
}
|
|
302
|
+
} finally {
|
|
303
|
+
await reader.close();
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
archivePathError = (reason, message) => new AnalysisInputError("inspect_keyed_archive", undefined, [{
|
|
307
|
+
path: ["path"],
|
|
308
|
+
reason,
|
|
309
|
+
message
|
|
310
|
+
}]);
|
|
311
|
+
})))();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region dist/artifacts/OrderedReads.js
|
|
316
|
+
var consumeWithOrderedReads;
|
|
317
|
+
function init_OrderedReads() {
|
|
318
|
+
return (init_OrderedReads = __esmMin((() => {
|
|
319
|
+
consumeWithOrderedReads = async (items, width, read, consume) => {
|
|
320
|
+
const pending = [];
|
|
321
|
+
const consumeNext = async () => {
|
|
322
|
+
const next = pending.shift();
|
|
323
|
+
if (next === undefined) return;
|
|
324
|
+
const result = await next.result;
|
|
325
|
+
if (!result.ok) throw result.error;
|
|
326
|
+
await consume(next.item, result.value);
|
|
327
|
+
};
|
|
328
|
+
const iterator = items[Symbol.asyncIterator]();
|
|
329
|
+
let iterating = true;
|
|
330
|
+
try {
|
|
331
|
+
while (iterating) {
|
|
332
|
+
let step;
|
|
333
|
+
try {
|
|
334
|
+
step = await iterator.next();
|
|
335
|
+
} catch (cause) {
|
|
336
|
+
iterating = false;
|
|
337
|
+
while (pending.length > 0) await consumeNext();
|
|
338
|
+
throw cause;
|
|
339
|
+
}
|
|
340
|
+
if (step.done === true) {
|
|
341
|
+
iterating = false;
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
const started = read(step.value);
|
|
345
|
+
if (started === undefined) continue;
|
|
346
|
+
pending.push({
|
|
347
|
+
item: step.value,
|
|
348
|
+
result: started.then((value) => ({
|
|
349
|
+
ok: true,
|
|
350
|
+
value
|
|
351
|
+
}), (error) => ({
|
|
352
|
+
ok: false,
|
|
353
|
+
error
|
|
354
|
+
}))
|
|
355
|
+
});
|
|
356
|
+
if (pending.length >= width) await consumeNext();
|
|
357
|
+
}
|
|
358
|
+
while (pending.length > 0) await consumeNext();
|
|
359
|
+
} finally {
|
|
360
|
+
if (iterating) await iterator.return?.().catch(() => undefined);
|
|
361
|
+
await Promise.all(pending.map(({ result }) => result));
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
})))();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region dist/artifacts/apple/DylibFileAccess.js
|
|
369
|
+
var DylibFileAccess, classifyDylibReadFailure, deniedDisplayPath, changed;
|
|
370
|
+
function init_DylibFileAccess() {
|
|
371
|
+
return (init_DylibFileAccess = __esmMin((() => {
|
|
372
|
+
init_RegularFile();
|
|
373
|
+
init_ArtifactReader();
|
|
374
|
+
init_ArtifactFileOperation();
|
|
375
|
+
init_readArtifactFileChunks();
|
|
376
|
+
init_MachoLoadCommandReader();
|
|
377
|
+
DylibFileAccess = class {
|
|
378
|
+
resources;
|
|
379
|
+
root;
|
|
380
|
+
signal;
|
|
381
|
+
constructor(resources, root, signal) {
|
|
382
|
+
this.resources = resources;
|
|
383
|
+
this.root = root;
|
|
384
|
+
this.signal = signal;
|
|
385
|
+
}
|
|
386
|
+
startsWithMachoMagic(entry) {
|
|
387
|
+
return this.#read(entry.adapterKey, async (file, initial) => {
|
|
388
|
+
if (!sameArtifactSourceIdentity(entry.sourceIdentity, initial)) throw changed(entry.adapterKey);
|
|
389
|
+
const bytes = new Uint8Array(4);
|
|
390
|
+
const { bytesRead } = await file.read(bytes, 0, bytes.length, 0);
|
|
391
|
+
return hasMachoMagic(bytes.subarray(0, bytesRead));
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
image(path) {
|
|
395
|
+
return this.#read(path, async (file, identity) => {
|
|
396
|
+
const size = Number(identity.size);
|
|
397
|
+
if (!Number.isSafeInteger(size)) throw new ArtifactReaderFailure("limit", `Mach-O file extent is not safely addressable: ${path}`);
|
|
398
|
+
const facts = await readMachoImage(async (offset, length) => {
|
|
399
|
+
assertArtifactReadActive(this.signal);
|
|
400
|
+
const bytes = new Uint8Array(Math.max(0, Math.min(length, size - offset)));
|
|
401
|
+
const { bytesRead } = await file.read(bytes, 0, bytes.length, offset);
|
|
402
|
+
assertArtifactReadActive(this.signal);
|
|
403
|
+
return bytes.subarray(0, bytesRead);
|
|
404
|
+
}, size);
|
|
405
|
+
return {
|
|
406
|
+
facts,
|
|
407
|
+
identity
|
|
408
|
+
};
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
sha256(path, expected) {
|
|
412
|
+
return this.#read(path, async (file, initial) => {
|
|
413
|
+
if (expected !== undefined && !sameRegularFileState(expected, initial)) throw changed(path);
|
|
414
|
+
const hash = createHash("sha256");
|
|
415
|
+
const source = readArtifactFileChunks(file, {
|
|
416
|
+
end: initial.size,
|
|
417
|
+
signal: this.signal
|
|
418
|
+
});
|
|
419
|
+
for await (const chunk of source) hash.update(chunk);
|
|
420
|
+
const coverage = source.readCoverage();
|
|
421
|
+
if (coverage.kind !== "complete" || coverage.bytes !== initial.size) throw changed(path);
|
|
422
|
+
return hash.digest("hex");
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
async #read(path, operation) {
|
|
426
|
+
try {
|
|
427
|
+
return await withArtifactRegularFile(path, this.resources, this.signal, async (file) => {
|
|
428
|
+
const initial = await file.stat({ bigint: true });
|
|
429
|
+
assertArtifactReadActive(this.signal);
|
|
430
|
+
const result = await operation(file, initial);
|
|
431
|
+
const opened = await file.stat({ bigint: true });
|
|
432
|
+
const named = await lstat(path, { bigint: true });
|
|
433
|
+
if (!sameRegularFileState(initial, opened) || !sameRegularFileState(initial, named)) throw changed(path);
|
|
434
|
+
assertArtifactReadActive(this.signal);
|
|
435
|
+
return result;
|
|
436
|
+
});
|
|
437
|
+
} catch (cause) {
|
|
438
|
+
throw classifyDylibReadFailure(this.root, cause);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
classifyDylibReadFailure = (root, cause) => mapArtifactFileFailure(cause, (primary) => {
|
|
443
|
+
if (primary instanceof NonRegularFileReadError) return new ArtifactReaderFailure("format", `Dyld input is not a regular file: ${primary.path}`, { cause: primary });
|
|
444
|
+
if (primary instanceof Error && "code" in primary && (primary.code === "EACCES" || primary.code === "EPERM")) {
|
|
445
|
+
const path = "path" in primary && typeof primary.path === "string" ? primary.path : undefined;
|
|
446
|
+
const display = path === undefined ? "a file in the analyzed root" : deniedDisplayPath(root, path);
|
|
447
|
+
return new ArtifactReaderFailure("unavailable", `Permission denied (${primary.code}) reading ${display}`, { cause: primary });
|
|
448
|
+
}
|
|
449
|
+
return primary;
|
|
450
|
+
});
|
|
451
|
+
deniedDisplayPath = (root, path) => {
|
|
452
|
+
const inside = relative(root, path);
|
|
453
|
+
const outside = isAbsolute(inside) || inside === ".." || inside.startsWith(`..${sep}`);
|
|
454
|
+
return inside === "" || outside ? path : inside;
|
|
455
|
+
};
|
|
456
|
+
changed = (path) => new ArtifactReaderFailure("integrity", `${path} changed while its dyld load commands were traced`);
|
|
457
|
+
})))();
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region dist/artifacts/apple/DylibResolutionReader.js
|
|
462
|
+
var OPERATION, MAGIC_READ_CONCURRENCY, FilesystemTreeView, traceDylibResolution, executableRoots, compare, requireMachoRoots, missing;
|
|
463
|
+
function init_DylibResolutionReader() {
|
|
464
|
+
return (init_DylibResolutionReader = __esmMin((() => {
|
|
465
|
+
init_analysisErrorCore();
|
|
466
|
+
init_dyldPaths();
|
|
467
|
+
init_dylibResolution();
|
|
468
|
+
init_inputIssueProjection();
|
|
469
|
+
init_ArtifactReader();
|
|
470
|
+
init_DirectoryArtifactReader();
|
|
471
|
+
init_OrderedReads();
|
|
472
|
+
init_DylibFileAccess();
|
|
473
|
+
init_ArtifactResourceScope();
|
|
474
|
+
init_ArtifactFileOperation();
|
|
475
|
+
OPERATION = "trace_dylib_resolution";
|
|
476
|
+
MAGIC_READ_CONCURRENCY = 8;
|
|
477
|
+
FilesystemTreeView = class {
|
|
478
|
+
root;
|
|
479
|
+
files;
|
|
480
|
+
signal;
|
|
481
|
+
#entries = new Map();
|
|
482
|
+
#images = new Map();
|
|
483
|
+
#identities = new Map();
|
|
484
|
+
constructor(root, files, signal) {
|
|
485
|
+
this.root = root;
|
|
486
|
+
this.files = files;
|
|
487
|
+
this.signal = signal;
|
|
488
|
+
}
|
|
489
|
+
entry(path) {
|
|
490
|
+
const cached = this.#entries.get(path);
|
|
491
|
+
if (cached !== undefined) return cached;
|
|
492
|
+
const pending = this.#readEntry(path);
|
|
493
|
+
this.#entries.set(path, pending);
|
|
494
|
+
return pending;
|
|
495
|
+
}
|
|
496
|
+
image(path) {
|
|
497
|
+
const cached = this.#images.get(path);
|
|
498
|
+
if (cached !== undefined) return cached;
|
|
499
|
+
const pending = this.files.image(join(this.root, path)).then(({ facts, identity }) => {
|
|
500
|
+
this.#identities.set(path, identity);
|
|
501
|
+
return facts;
|
|
502
|
+
});
|
|
503
|
+
this.#images.set(path, pending);
|
|
504
|
+
return pending;
|
|
505
|
+
}
|
|
506
|
+
/** Identity of the file whose header bytes `image()` parsed. */
|
|
507
|
+
identity(path) {
|
|
508
|
+
return this.#identities.get(path);
|
|
509
|
+
}
|
|
510
|
+
async #readEntry(path) {
|
|
511
|
+
assertArtifactReadActive(this.signal);
|
|
512
|
+
const absolute = join(this.root, path);
|
|
513
|
+
try {
|
|
514
|
+
const metadata = await lstat(absolute);
|
|
515
|
+
if (metadata.isSymbolicLink()) return {
|
|
516
|
+
kind: "symlink",
|
|
517
|
+
target: await readlink(absolute)
|
|
518
|
+
};
|
|
519
|
+
if (metadata.isDirectory()) return { kind: "directory" };
|
|
520
|
+
return metadata.isFile() ? { kind: "file" } : undefined;
|
|
521
|
+
} catch (cause) {
|
|
522
|
+
if (missing(cause)) return undefined;
|
|
523
|
+
throw cause;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
traceDylibResolution = async (options) => {
|
|
528
|
+
const parsed = dylibResolutionInputSchema.safeParse(options.parameters);
|
|
529
|
+
if (!parsed.success) throw new AnalysisInputError(OPERATION, { cause: parsed.error }, projectInputIssues(parsed.error.issues, options.parameters));
|
|
530
|
+
const resources = options.resourceScope ?? new ArtifactResourceScope();
|
|
531
|
+
return await resources.run(async () => {
|
|
532
|
+
let root = options.rootPath;
|
|
533
|
+
try {
|
|
534
|
+
assertArtifactReadActive(options.signal);
|
|
535
|
+
root = await realpath(options.rootPath);
|
|
536
|
+
assertArtifactReadActive(options.signal);
|
|
537
|
+
const files = new DylibFileAccess(resources, root, options.signal);
|
|
538
|
+
const target = relative(root, await realpath(options.targetPath)).split(sep).join("/");
|
|
539
|
+
assertArtifactReadActive(options.signal);
|
|
540
|
+
const view = new FilesystemTreeView(root, files, options.signal);
|
|
541
|
+
const { roots: requested, unclassified } = parsed.data.roots !== undefined ? {
|
|
542
|
+
roots: parsed.data.roots,
|
|
543
|
+
unclassified: []
|
|
544
|
+
} : options.enumerateRoots ? await executableRoots(root, view, files, options.signal) : {
|
|
545
|
+
roots: [target],
|
|
546
|
+
unclassified: []
|
|
547
|
+
};
|
|
548
|
+
const roots = await requireMachoRoots(view, requested, parsed.data.roots !== undefined);
|
|
549
|
+
const trace = await traceDylibLoading(view, {
|
|
550
|
+
roots,
|
|
551
|
+
unclassified,
|
|
552
|
+
...parsed.data.architecture === undefined ? {} : { architecture: parsed.data.architecture },
|
|
553
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
554
|
+
});
|
|
555
|
+
const digests = new Map();
|
|
556
|
+
for (const { path } of trace.images) digests.set(path, await files.sha256(join(root, path), view.identity(path)));
|
|
557
|
+
const targetDigest = digests.get(target) ?? await files.sha256(join(root, target), undefined);
|
|
558
|
+
if (targetDigest !== options.targetSha256) throw new ArtifactReaderFailure("integrity", `Active target digest changed: expected ${options.targetSha256}, observed ${targetDigest}`);
|
|
559
|
+
assertArtifactReadActive(options.signal);
|
|
560
|
+
return dylibResolutionResultSchema.parse({
|
|
561
|
+
...trace,
|
|
562
|
+
root_path: options.rootPath,
|
|
563
|
+
target_sha256: options.targetSha256,
|
|
564
|
+
images: trace.images.map((image) => ({
|
|
565
|
+
...image,
|
|
566
|
+
sha256: digests.get(image.path)
|
|
567
|
+
}))
|
|
568
|
+
});
|
|
569
|
+
} catch (cause) {
|
|
570
|
+
throw classifyDylibReadFailure(root, cause);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
};
|
|
574
|
+
executableRoots = async (root, view, files, signal) => {
|
|
575
|
+
const roots = [];
|
|
576
|
+
const unclassified = [];
|
|
577
|
+
await consumeWithOrderedReads(new DirectoryArtifactReader(root).entries(signal), MAGIC_READ_CONCURRENCY, (entry) => entry.kind === "file" ? files.startsWithMachoMagic(entry) : undefined, async (entry, macho) => {
|
|
578
|
+
if (!macho) return;
|
|
579
|
+
const facts = await view.image(entry.path);
|
|
580
|
+
if (facts.status === "malformed" || facts.status === "unsupported") unclassified.push(entry.path);
|
|
581
|
+
else if (facts.status === "parsed" && facts.slices.some(({ file_type: type }) => type === "execute")) roots.push(entry.path);
|
|
582
|
+
});
|
|
583
|
+
return {
|
|
584
|
+
roots: roots.sort(compare),
|
|
585
|
+
unclassified: unclassified.sort(compare)
|
|
586
|
+
};
|
|
587
|
+
};
|
|
588
|
+
compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
589
|
+
requireMachoRoots = async (view, roots, callerSelected) => {
|
|
590
|
+
const resolved = [];
|
|
591
|
+
for (const [index, path] of roots.entries()) {
|
|
592
|
+
const reject = (reason, message) => callerSelected ? new AnalysisInputError(OPERATION, undefined, [{
|
|
593
|
+
path: ["roots", index],
|
|
594
|
+
reason: "invalid_value",
|
|
595
|
+
message
|
|
596
|
+
}]) : new ArtifactReaderFailure(reason, message);
|
|
597
|
+
const lookup = await resolveTreePath(view, path);
|
|
598
|
+
if (lookup.kind === "escapes") throw reject("path", `Root ${path} resolves outside the analyzed root`);
|
|
599
|
+
if (lookup.kind !== "file") throw reject("path", `Root ${path} is not a regular file in the analyzed root`);
|
|
600
|
+
if ((await view.image(lookup.path)).status === "not-mach-o") throw reject("format", `Root ${path} is not a Mach-O image`);
|
|
601
|
+
if (!resolved.includes(lookup.path)) resolved.push(lookup.path);
|
|
602
|
+
}
|
|
603
|
+
return resolved;
|
|
604
|
+
};
|
|
605
|
+
missing = (cause) => cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR");
|
|
606
|
+
})))();
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region dist/artifacts/inventory/ArtifactInventory.js
|
|
611
|
+
var inventoryArtifact, scanArtifactInventory, scanArtifactInventoryInScope;
|
|
612
|
+
function init_ArtifactInventory() {
|
|
613
|
+
return (init_ArtifactInventory = __esmMin((() => {
|
|
614
|
+
init_artifactGraph();
|
|
615
|
+
init_ArtifactHash();
|
|
616
|
+
init_scanCanonical();
|
|
617
|
+
inventoryArtifact = async (inputPath, options) => {
|
|
618
|
+
const snapshot = await scanArtifactInventory(inputPath, options);
|
|
619
|
+
return artifactInventoryResultSchema.parse(snapshot);
|
|
620
|
+
};
|
|
621
|
+
scanArtifactInventory = async (inputPath, options) => options.resourceScope.run(() => scanArtifactInventoryInScope(inputPath, options));
|
|
622
|
+
scanArtifactInventoryInScope = async (inputPath, options) => {
|
|
623
|
+
abortIfNeeded(options.signal);
|
|
624
|
+
const path = await realpath(inputPath);
|
|
625
|
+
return scanCanonicalArtifactInventoryInScope(path, options);
|
|
626
|
+
};
|
|
627
|
+
})))();
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region dist/artifacts/extraction/ArtifactExtraction.js
|
|
632
|
+
var extractArtifact, extractArtifactInScope, materializeArtifactInventory, materializeArtifactInventoryInScope, materializeSelection, writeSelectedEntries, releaseExtractionOwners, createExtractionResult, requireExtractableFormat, createReader, preflight;
|
|
633
|
+
function init_ArtifactExtraction() {
|
|
634
|
+
return (init_ArtifactExtraction = __esmMin((() => {
|
|
635
|
+
init_unicodeCodePointOrder();
|
|
636
|
+
init_canonicalDigest();
|
|
637
|
+
init_AsarArtifactReader();
|
|
638
|
+
init_ArtifactPaths();
|
|
639
|
+
init_ArtifactReader();
|
|
640
|
+
init_ArtifactHash();
|
|
641
|
+
init_DirectoryArtifactReader();
|
|
642
|
+
init_SafeOutputTree();
|
|
643
|
+
init_SafeOutputTreeCreationFailure();
|
|
644
|
+
init_ZipArtifactReader();
|
|
645
|
+
init_zipPackageFormat();
|
|
646
|
+
init_MachOSliceArtifactReader();
|
|
647
|
+
init_artifactGraph();
|
|
648
|
+
init_analysisErrorCore();
|
|
649
|
+
init_binaryTargetTypes();
|
|
650
|
+
init_ArtifactInventory();
|
|
651
|
+
extractArtifact = async (input, signal) => input.resourceScope.run(() => extractArtifactInScope(input, signal));
|
|
652
|
+
extractArtifactInScope = async (input, signal) => {
|
|
653
|
+
abortIfNeeded(signal);
|
|
654
|
+
const sourcePath = await realpath(input.inputPath);
|
|
655
|
+
await requireExtractableFormat(sourcePath, input);
|
|
656
|
+
const snapshot = await scanArtifactInventoryInScope(sourcePath, {
|
|
657
|
+
resourceScope: input.resourceScope,
|
|
658
|
+
signal,
|
|
659
|
+
environment: input.environment,
|
|
660
|
+
integrity: { mode: input.integrityPolicy }
|
|
661
|
+
});
|
|
662
|
+
return materializeArtifactInventoryInScope(input, sourcePath, snapshot, signal);
|
|
663
|
+
};
|
|
664
|
+
materializeArtifactInventory = async (input, sourcePath, snapshot, signal) => {
|
|
665
|
+
return input.resourceScope.run(() => materializeArtifactInventoryInScope(input, sourcePath, snapshot, signal));
|
|
666
|
+
};
|
|
667
|
+
materializeArtifactInventoryInScope = async (input, sourcePath, snapshot, signal) => {
|
|
668
|
+
abortIfNeeded(signal);
|
|
669
|
+
const selectedOccurrences = snapshot.occurrences.filter((occurrence) => (occurrence.entry_kind === "file" || occurrence.entry_kind === "slice") && occurrence.logical_path !== ".");
|
|
670
|
+
const regularPaths = new Set(selectedOccurrences.map(({ logical_path: path }) => path));
|
|
671
|
+
const activeOccurrences = selectedOccurrences.filter(({ logical_path }) => {
|
|
672
|
+
let path = logical_path;
|
|
673
|
+
for (let slash = path.lastIndexOf("/"); slash >= 0; slash = path.lastIndexOf("/")) {
|
|
674
|
+
path = path.slice(0, slash);
|
|
675
|
+
if (regularPaths.has(path)) return false;
|
|
676
|
+
}
|
|
677
|
+
return true;
|
|
678
|
+
});
|
|
679
|
+
const selectedIds = new Set(activeOccurrences.map(({ occurrence_id: id }) => id));
|
|
680
|
+
const neededNodes = new Set(activeOccurrences.map(({ artifact_id: id }) => id));
|
|
681
|
+
const nodes = new Map();
|
|
682
|
+
for (const node of snapshot.nodes) if (neededNodes.has(node.artifact_id)) nodes.set(node.artifact_id, node);
|
|
683
|
+
const inventory = {
|
|
684
|
+
manifest: snapshot.manifest,
|
|
685
|
+
integrityContradictions: snapshot.integrity_contradictions.filter(({ occurrence_id: id }) => selectedIds.has(id))
|
|
686
|
+
};
|
|
687
|
+
const selected = activeOccurrences.map((occurrence) => {
|
|
688
|
+
if (occurrence.encrypted) throw new AnalysisUnsupportedTargetError("extract_artifact", input.inputPath, `Archive entry ${occurrence.logical_path} is encrypted; REA does not decrypt archive entries, so the archive cannot be extracted completely`);
|
|
689
|
+
if (occurrence.entry_kind === "file" && occurrence.artifact_id === null && occurrence.hash_status === "unavailable") throw new ArtifactReaderFailure("unavailable", `ASAR unpacked companion bytes are unavailable for ${occurrence.logical_path}`, undefined, {
|
|
690
|
+
logicalPath: occurrence.logical_path,
|
|
691
|
+
declaredSha256: null,
|
|
692
|
+
calculatedSha256: null,
|
|
693
|
+
unpacked: true
|
|
694
|
+
});
|
|
695
|
+
if (occurrence.entry_kind !== "file" && occurrence.entry_kind !== "slice" || occurrence.artifact_id === null || occurrence.logical_path === ".") throw new ArtifactReaderFailure("format", `Selected occurrence is not an extractable regular child file: ${occurrence.logical_path} (${occurrence.occurrence_id})`);
|
|
696
|
+
const node = nodes.get(occurrence.artifact_id);
|
|
697
|
+
if (node === undefined) throw new ArtifactReaderFailure("integrity", `Selected occurrence has no inventory node: ${occurrence.occurrence_id}`);
|
|
698
|
+
return {
|
|
699
|
+
occurrence,
|
|
700
|
+
node
|
|
701
|
+
};
|
|
702
|
+
});
|
|
703
|
+
return materializeSelection({
|
|
704
|
+
input,
|
|
705
|
+
sourcePath,
|
|
706
|
+
inventory,
|
|
707
|
+
selected,
|
|
708
|
+
signal
|
|
709
|
+
});
|
|
710
|
+
};
|
|
711
|
+
materializeSelection = async ({ input, sourcePath, inventory, selected, signal }) => {
|
|
712
|
+
const byPath = new Map();
|
|
713
|
+
for (const item of selected) {
|
|
714
|
+
const path = item.occurrence.logical_path;
|
|
715
|
+
if (byPath.has(path)) throw new ArtifactReaderFailure("path", `Artifact extraction path collision: ${JSON.stringify(path)}. Multiple selected occurrences share this normalized logical path; they cannot be materialized at the same destination path, even when the archive is valid. Inventory retains each occurrence.`);
|
|
716
|
+
byPath.set(path, item);
|
|
717
|
+
}
|
|
718
|
+
const reader = await createReader(sourcePath, input);
|
|
719
|
+
const readerOwner = {
|
|
720
|
+
kind: "reader",
|
|
721
|
+
reader,
|
|
722
|
+
resource: `artifact reader for ${sourcePath}`
|
|
723
|
+
};
|
|
724
|
+
let localReaderOwner = readerOwner;
|
|
725
|
+
let output;
|
|
726
|
+
let completed;
|
|
727
|
+
const extracted = [];
|
|
728
|
+
try {
|
|
729
|
+
try {
|
|
730
|
+
output = await SafeOutputTree.create(input.outputRoot);
|
|
731
|
+
} catch (cause) {
|
|
732
|
+
if (cause instanceof SafeOutputTreeCreationFailure) output = cause.tree;
|
|
733
|
+
throw cause;
|
|
734
|
+
}
|
|
735
|
+
await writeSelectedEntries({
|
|
736
|
+
reader,
|
|
737
|
+
output,
|
|
738
|
+
byPath,
|
|
739
|
+
extracted,
|
|
740
|
+
signal
|
|
741
|
+
});
|
|
742
|
+
localReaderOwner = undefined;
|
|
743
|
+
const closeAttempt = await input.resourceScope.release(readerOwner);
|
|
744
|
+
if (closeAttempt.kind === "failed") throw input.resourceScope.cleanupFailure({ kind: "completed" }, [closeAttempt]);
|
|
745
|
+
extracted.sort((left, right) => compareUnicodeCodePoints(left.relative_path, right.relative_path));
|
|
746
|
+
completed = createExtractionResult(input, inventory, selected, extracted);
|
|
747
|
+
await output.commit(signal);
|
|
748
|
+
return completed;
|
|
749
|
+
} catch (cause) {
|
|
750
|
+
const cleanupFailures = await releaseExtractionOwners(input.resourceScope, localReaderOwner, output, input.outputRoot);
|
|
751
|
+
const [firstCleanup, ...remainingCleanup] = cleanupFailures;
|
|
752
|
+
if (firstCleanup !== undefined) {
|
|
753
|
+
throw input.resourceScope.cleanupFailure({
|
|
754
|
+
kind: "failed",
|
|
755
|
+
cause
|
|
756
|
+
}, [firstCleanup, ...remainingCleanup], output?.published === true && completed !== undefined ? {
|
|
757
|
+
kind: "artifact-extraction",
|
|
758
|
+
extraction: completed
|
|
759
|
+
} : undefined);
|
|
760
|
+
}
|
|
761
|
+
if (output?.published === true && completed !== undefined) return completed;
|
|
762
|
+
throw cause;
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
writeSelectedEntries = async ({ reader, output, byPath, extracted, signal }) => {
|
|
766
|
+
const registry = new ArtifactPathRegistry();
|
|
767
|
+
for await (const entry of reader.entries(signal)) {
|
|
768
|
+
const path = normalizeArtifactPath(entry.path);
|
|
769
|
+
registry.add(path, entry.kind);
|
|
770
|
+
const selectedItem = byPath.get(path);
|
|
771
|
+
if (selectedItem === undefined) {
|
|
772
|
+
if (entry.kind === "file" || entry.kind === "slice") throw new ArtifactReaderFailure("integrity", `Regular artifact entry is missing from inventory: ${path}`);
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
preflight(entry);
|
|
776
|
+
const stream = await reader.open(entry, signal);
|
|
777
|
+
const written = await output.write(path, stream, {
|
|
778
|
+
sha256: selectedItem.node.sha256,
|
|
779
|
+
bytes: selectedItem.node.size
|
|
780
|
+
}, signal);
|
|
781
|
+
extracted.push({
|
|
782
|
+
artifact_id: selectedItem.node.artifact_id,
|
|
783
|
+
relative_path: written.relativePath,
|
|
784
|
+
sha256: written.sha256,
|
|
785
|
+
bytes_written: written.bytesWritten,
|
|
786
|
+
created: true
|
|
787
|
+
});
|
|
788
|
+
byPath.delete(path);
|
|
789
|
+
}
|
|
790
|
+
if (byPath.size > 0) throw new ArtifactReaderFailure("integrity", `Inventoried regular artifact entries were not materialized: ${[...byPath.keys()].sort(compareUnicodeCodePoints).join(", ")}`);
|
|
791
|
+
};
|
|
792
|
+
releaseExtractionOwners = async (resourceScope, readerOwner, output, outputRoot) => {
|
|
793
|
+
const failures = [];
|
|
794
|
+
if (readerOwner !== undefined) {
|
|
795
|
+
const attempt = await resourceScope.release(readerOwner);
|
|
796
|
+
if (attempt.kind === "failed") failures.push(attempt);
|
|
797
|
+
}
|
|
798
|
+
if (output !== undefined) {
|
|
799
|
+
const owner = {
|
|
800
|
+
kind: "output-tree",
|
|
801
|
+
tree: output,
|
|
802
|
+
resource: outputRoot
|
|
803
|
+
};
|
|
804
|
+
const attempt = await resourceScope.release(owner);
|
|
805
|
+
if (attempt.kind === "failed") failures.push(attempt);
|
|
806
|
+
}
|
|
807
|
+
return failures;
|
|
808
|
+
};
|
|
809
|
+
createExtractionResult = (input, inventory, selected, extracted) => {
|
|
810
|
+
const extractionSemantic = {
|
|
811
|
+
source_manifest_id: inventory.manifest.manifest_id,
|
|
812
|
+
selected_occurrence_ids: selected.map(({ occurrence }) => occurrence.occurrence_id).sort(compareUnicodeCodePoints),
|
|
813
|
+
files_sha256: digestCanonicalValue(extracted, "Artifact"),
|
|
814
|
+
output_root_alias: "$OUTPUT_ROOT"
|
|
815
|
+
};
|
|
816
|
+
return artifactExtractionResultSchema.parse({
|
|
817
|
+
manifest: inventory.manifest,
|
|
818
|
+
extraction_manifest: {
|
|
819
|
+
...extractionSemantic,
|
|
820
|
+
extraction_id: `aex_${digestCanonicalValue(extractionSemantic, "Artifact")}`
|
|
821
|
+
},
|
|
822
|
+
output_root: input.outputRoot,
|
|
823
|
+
artifacts: extracted,
|
|
824
|
+
containment_verified: true,
|
|
825
|
+
cleanup: {
|
|
826
|
+
attempted: false,
|
|
827
|
+
verified: true,
|
|
828
|
+
residual_paths: []
|
|
829
|
+
},
|
|
830
|
+
provenance: [],
|
|
831
|
+
integrity_contradictions: inventory.integrityContradictions,
|
|
832
|
+
limitations: ["All regular files in the active artifact were materialized; nested archive contents remain represented by their containing file.", ...inventory.integrityContradictions.length === 0 ? [] : [`${String(inventory.integrityContradictions.length)} extracted file(s) contradict declared integrity metadata; their bytes are observed-untrusted.`]]
|
|
833
|
+
});
|
|
834
|
+
};
|
|
835
|
+
requireExtractableFormat = async (path, input) => {
|
|
836
|
+
const format = input.inputFormat;
|
|
837
|
+
const directory = (await lstat(path)).isDirectory();
|
|
838
|
+
if (!directory && format !== "asar" && !isMachOFormat(format) && !isZipPackageFormat(format)) throw new AnalysisUnsupportedTargetError("extract_artifact", input.inputPath, `Artifact format has no extraction reader: ${format}`);
|
|
839
|
+
return directory;
|
|
840
|
+
};
|
|
841
|
+
createReader = async (path, input) => {
|
|
842
|
+
const format = input.inputFormat;
|
|
843
|
+
if (await requireExtractableFormat(path, input)) return new DirectoryArtifactReader(path);
|
|
844
|
+
if (format === "asar") return new AsarArtifactReader(path);
|
|
845
|
+
if (isZipPackageFormat(format)) return new ZipArtifactReader(path, format);
|
|
846
|
+
return new MachOSliceArtifactReader(path, input.environment);
|
|
847
|
+
};
|
|
848
|
+
preflight = (entry) => {
|
|
849
|
+
if (entry.kind !== "file" && entry.kind !== "slice" || entry.encrypted) throw new ArtifactReaderFailure("format", `Selected artifact entry cannot be read: ${entry.path}`);
|
|
850
|
+
};
|
|
851
|
+
})))();
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region dist/artifacts/apple/NibArchive.js
|
|
856
|
+
var DEFAULT_DECODE_BUDGET_BYTES, decodeNibArchive, parseObjects, preflightProjectedFieldCount, parseStrings, parseClasses, parseValues, readValue, skipValue, valueIndexes, readCount, readOffset, readU32, decodeUtf8, readVarint, checkedEnd, ensureRange, assertOrderedOffsets;
|
|
857
|
+
function init_NibArchive() {
|
|
858
|
+
return (init_NibArchive = __esmMin((() => {
|
|
859
|
+
init_appleArchiveFormat();
|
|
860
|
+
init_InterfaceBuilderDecodeBudget();
|
|
861
|
+
DEFAULT_DECODE_BUDGET_BYTES = 128 * 1024 * 1024;
|
|
862
|
+
decodeNibArchive = (bytes, budget = new InterfaceBuilderDecodeBudget(DEFAULT_DECODE_BUDGET_BYTES)) => {
|
|
863
|
+
if (bytes.length < 50 || !hasNibArchiveSignature(bytes)) throw new TypeError("NIBArchive magic or header is invalid");
|
|
864
|
+
const formatVersion = readU32(bytes, 10);
|
|
865
|
+
const coderVersion = readU32(bytes, 14);
|
|
866
|
+
if (formatVersion !== 1) throw new TypeError(`Unsupported NIBArchive format version ${formatVersion}`);
|
|
867
|
+
const objectCount = readCount(bytes, 18, "object");
|
|
868
|
+
const objectsOffset = readOffset(bytes, 22, bytes.length, "object");
|
|
869
|
+
const keyCount = readCount(bytes, 26, "key");
|
|
870
|
+
const keysOffset = readOffset(bytes, 30, bytes.length, "key");
|
|
871
|
+
const valueCount = readCount(bytes, 34, "value");
|
|
872
|
+
const valuesOffset = readOffset(bytes, 38, bytes.length, "value");
|
|
873
|
+
const classCount = readCount(bytes, 42, "class");
|
|
874
|
+
const classesOffset = readOffset(bytes, 46, bytes.length, "class");
|
|
875
|
+
assertOrderedOffsets(bytes.length, [
|
|
876
|
+
objectsOffset,
|
|
877
|
+
keysOffset,
|
|
878
|
+
valuesOffset,
|
|
879
|
+
classesOffset
|
|
880
|
+
]);
|
|
881
|
+
const projectedFieldCount = preflightProjectedFieldCount(bytes, objectsOffset, keysOffset, objectCount, valueCount, classCount, budget.remainingBytes);
|
|
882
|
+
budget.reserve(objectCount * 96 + projectedFieldCount * 96, "NIBArchive object and projected field counts exceed the aggregate Interface Builder decode budget");
|
|
883
|
+
const objectRecords = parseObjects(bytes, objectsOffset, keysOffset, objectCount, valueCount, classCount);
|
|
884
|
+
const keys = parseStrings(bytes, keysOffset, valuesOffset, keyCount, "key", budget);
|
|
885
|
+
const classes = parseClasses(bytes, classesOffset, bytes.length, classCount, budget);
|
|
886
|
+
const neededValues = valueIndexes(objectRecords, valueCount);
|
|
887
|
+
const values = parseValues(bytes, valuesOffset, classesOffset, valueCount, keyCount, neededValues, budget);
|
|
888
|
+
for (const { value } of values.values()) {
|
|
889
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value) && typeof value.$nib_object_ref === "number" && value.$nib_object_ref >= objectCount) throw new TypeError("NIBArchive object reference is outside the object table");
|
|
890
|
+
}
|
|
891
|
+
const objects = objectRecords.flatMap((object, id) => {
|
|
892
|
+
const className = classes[object.class_index];
|
|
893
|
+
if (className === undefined) return [];
|
|
894
|
+
const fields = {};
|
|
895
|
+
for (let index = object.value_start; index < object.value_start + object.value_count; index += 1) {
|
|
896
|
+
const value = values.get(index);
|
|
897
|
+
if (value === undefined) continue;
|
|
898
|
+
const key = keys[value.key_index];
|
|
899
|
+
if (key !== undefined) Object.defineProperty(fields, key, {
|
|
900
|
+
value: value.value,
|
|
901
|
+
enumerable: true,
|
|
902
|
+
configurable: true,
|
|
903
|
+
writable: true
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
return [{
|
|
907
|
+
id,
|
|
908
|
+
class_name: className,
|
|
909
|
+
values: fields
|
|
910
|
+
}];
|
|
911
|
+
});
|
|
912
|
+
let connectionObjectCount = 0;
|
|
913
|
+
for (const object of objects) if (/(?:Outlet|Connection|Segue|ActionConnection)/iu.test(object.class_name)) connectionObjectCount += 1;
|
|
914
|
+
return {
|
|
915
|
+
format_version: formatVersion,
|
|
916
|
+
coder_version: coderVersion,
|
|
917
|
+
object_count: objectCount,
|
|
918
|
+
connection_object_count: connectionObjectCount,
|
|
919
|
+
objects,
|
|
920
|
+
classes,
|
|
921
|
+
limitations: ["NIBArchive class extensions and unsupported value encodings are retained as unavailable fields.", "NIBArchive object relationships are decoded from serialized references; runtime object creation and execution are not performed."]
|
|
922
|
+
};
|
|
923
|
+
};
|
|
924
|
+
parseObjects = (bytes, start, end, count, valueCount, classCount) => {
|
|
925
|
+
const cursor = { offset: start };
|
|
926
|
+
const output = [];
|
|
927
|
+
for (let index = 0; index < count; index += 1) {
|
|
928
|
+
const classIndex = readVarint(bytes, cursor, end);
|
|
929
|
+
const valueStart = readVarint(bytes, cursor, end);
|
|
930
|
+
const countForObject = readVarint(bytes, cursor, end);
|
|
931
|
+
if (classIndex >= classCount || valueStart > valueCount || countForObject > valueCount - valueStart) throw new TypeError(`NIBArchive object ${index} references an invalid table range`);
|
|
932
|
+
output.push({
|
|
933
|
+
class_index: classIndex,
|
|
934
|
+
value_start: valueStart,
|
|
935
|
+
value_count: countForObject
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
if (cursor.offset > end) throw new TypeError("NIBArchive object table overlaps the next table");
|
|
939
|
+
return output;
|
|
940
|
+
};
|
|
941
|
+
preflightProjectedFieldCount = (bytes, start, end, objectCount, valueCount, classCount, maxBytes) => {
|
|
942
|
+
if (objectCount * 96 > maxBytes) throw new InterfaceBuilderDecodeBudgetExceeded("aggregate_decode_budget_exhausted", "NIBArchive object count exceeds the aggregate Interface Builder decode budget");
|
|
943
|
+
const cursor = { offset: start };
|
|
944
|
+
let projectedFields = 0;
|
|
945
|
+
for (let index = 0; index < objectCount; index += 1) {
|
|
946
|
+
const classIndex = readVarint(bytes, cursor, end);
|
|
947
|
+
const valueStart = readVarint(bytes, cursor, end);
|
|
948
|
+
const fieldCount = readVarint(bytes, cursor, end);
|
|
949
|
+
if (classIndex >= classCount || valueStart > valueCount || fieldCount > valueCount - valueStart) throw new TypeError(`NIBArchive object ${index} references an invalid table range`);
|
|
950
|
+
projectedFields += fieldCount;
|
|
951
|
+
if (!Number.isSafeInteger(projectedFields) || projectedFields * 96 > maxBytes - objectCount * 96) throw new InterfaceBuilderDecodeBudgetExceeded("aggregate_decode_budget_exhausted", "NIBArchive projected field ranges exceed the aggregate Interface Builder decode budget");
|
|
952
|
+
}
|
|
953
|
+
return projectedFields;
|
|
954
|
+
};
|
|
955
|
+
parseStrings = (bytes, start, end, count, label, budget) => {
|
|
956
|
+
const cursor = { offset: start };
|
|
957
|
+
const output = [];
|
|
958
|
+
for (let index = 0; index < count; index += 1) {
|
|
959
|
+
const length = readVarint(bytes, cursor, end);
|
|
960
|
+
const next = checkedEnd(cursor.offset, length, end, `${label} ${index}`);
|
|
961
|
+
budget.reserve(32 + length * 2, `NIBArchive ${label} strings exceed the aggregate Interface Builder decode budget`);
|
|
962
|
+
const value = decodeUtf8(bytes, cursor.offset, next, `${label} ${index}`);
|
|
963
|
+
cursor.offset = next;
|
|
964
|
+
output.push(value);
|
|
965
|
+
}
|
|
966
|
+
return output;
|
|
967
|
+
};
|
|
968
|
+
parseClasses = (bytes, start, end, count, budget) => {
|
|
969
|
+
const cursor = { offset: start };
|
|
970
|
+
const output = [];
|
|
971
|
+
for (let index = 0; index < count; index += 1) {
|
|
972
|
+
const length = readVarint(bytes, cursor, end);
|
|
973
|
+
const extraCount = readVarint(bytes, cursor, end);
|
|
974
|
+
if (extraCount > 16) throw new TypeError(`NIBArchive class ${index} has too many extension values`);
|
|
975
|
+
ensureRange(cursor.offset, extraCount * 4, end, `class ${index} extensions`);
|
|
976
|
+
cursor.offset += extraCount * 4;
|
|
977
|
+
const next = checkedEnd(cursor.offset, length, end, `class ${index}`);
|
|
978
|
+
budget.reserve(32 + length * 2, "NIBArchive class names exceed the aggregate Interface Builder decode budget");
|
|
979
|
+
const name = decodeUtf8(bytes, cursor.offset, next, `class ${index}`).replace(/\0+$/u, "");
|
|
980
|
+
cursor.offset = next;
|
|
981
|
+
output.push(name);
|
|
982
|
+
}
|
|
983
|
+
return output;
|
|
984
|
+
};
|
|
985
|
+
parseValues = (bytes, start, end, count, keyCount, needed, budget) => {
|
|
986
|
+
const cursor = { offset: start };
|
|
987
|
+
const output = new Map();
|
|
988
|
+
for (let index = 0; index < count; index += 1) {
|
|
989
|
+
const keyIndex = readVarint(bytes, cursor, end);
|
|
990
|
+
if (keyIndex >= keyCount) throw new TypeError(`NIBArchive value ${index} references an invalid key`);
|
|
991
|
+
ensureRange(cursor.offset, 1, end, `value ${index} type`);
|
|
992
|
+
const type = bytes[cursor.offset++] ?? -1;
|
|
993
|
+
if (!needed.has(index)) {
|
|
994
|
+
skipValue(bytes, cursor, end, type, index);
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
997
|
+
budget.reserve(64, "NIBArchive decoded values exceed the aggregate Interface Builder decode budget");
|
|
998
|
+
const value = readValue(bytes, cursor, end, type, index, budget);
|
|
999
|
+
output.set(index, {
|
|
1000
|
+
key_index: keyIndex,
|
|
1001
|
+
value
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
if (cursor.offset > end) throw new TypeError("NIBArchive value table overlaps the next table");
|
|
1005
|
+
return output;
|
|
1006
|
+
};
|
|
1007
|
+
readValue = (bytes, cursor, end, type, index, budget) => {
|
|
1008
|
+
switch (type) {
|
|
1009
|
+
case 0:
|
|
1010
|
+
ensureRange(cursor.offset, 1, end, `value ${index}`);
|
|
1011
|
+
return bytes.readInt8(cursor.offset++);
|
|
1012
|
+
case 1:
|
|
1013
|
+
ensureRange(cursor.offset, 2, end, `value ${index}`);
|
|
1014
|
+
{
|
|
1015
|
+
const value = bytes.readInt16LE(cursor.offset);
|
|
1016
|
+
cursor.offset += 2;
|
|
1017
|
+
return value;
|
|
1018
|
+
}
|
|
1019
|
+
case 2:
|
|
1020
|
+
ensureRange(cursor.offset, 4, end, `value ${index}`);
|
|
1021
|
+
{
|
|
1022
|
+
const value = bytes.readInt32LE(cursor.offset);
|
|
1023
|
+
cursor.offset += 4;
|
|
1024
|
+
return value;
|
|
1025
|
+
}
|
|
1026
|
+
case 3:
|
|
1027
|
+
ensureRange(cursor.offset, 8, end, `value ${index}`);
|
|
1028
|
+
{
|
|
1029
|
+
const value = bytes.readBigInt64LE(cursor.offset);
|
|
1030
|
+
cursor.offset += 8;
|
|
1031
|
+
return value <= BigInt(Number.MAX_SAFE_INTEGER) && value >= BigInt(Number.MIN_SAFE_INTEGER) ? Number(value) : value.toString();
|
|
1032
|
+
}
|
|
1033
|
+
case 4: return true;
|
|
1034
|
+
case 5: return false;
|
|
1035
|
+
case 6:
|
|
1036
|
+
ensureRange(cursor.offset, 4, end, `value ${index}`);
|
|
1037
|
+
{
|
|
1038
|
+
const value = bytes.readFloatLE(cursor.offset);
|
|
1039
|
+
cursor.offset += 4;
|
|
1040
|
+
return Number.isFinite(value) ? value : null;
|
|
1041
|
+
}
|
|
1042
|
+
case 7:
|
|
1043
|
+
ensureRange(cursor.offset, 8, end, `value ${index}`);
|
|
1044
|
+
{
|
|
1045
|
+
const value = bytes.readDoubleLE(cursor.offset);
|
|
1046
|
+
cursor.offset += 8;
|
|
1047
|
+
return Number.isFinite(value) ? value : null;
|
|
1048
|
+
}
|
|
1049
|
+
case 8: {
|
|
1050
|
+
const length = readVarint(bytes, cursor, end);
|
|
1051
|
+
const next = checkedEnd(cursor.offset, length, end, `value ${index} data`);
|
|
1052
|
+
budget.reserve(32 + 4 * Math.ceil(length / 3), `NIBArchive data value ${index} exceeds the aggregate Interface Builder decode budget`);
|
|
1053
|
+
const encoded = bytes.subarray(cursor.offset, next).toString("base64");
|
|
1054
|
+
cursor.offset = next;
|
|
1055
|
+
return { $nib_data_base64: encoded };
|
|
1056
|
+
}
|
|
1057
|
+
case 9: return null;
|
|
1058
|
+
case 10:
|
|
1059
|
+
ensureRange(cursor.offset, 4, end, `value ${index} reference`);
|
|
1060
|
+
{
|
|
1061
|
+
const objectIndex = bytes.readUInt32LE(cursor.offset);
|
|
1062
|
+
cursor.offset += 4;
|
|
1063
|
+
return { $nib_object_ref: objectIndex };
|
|
1064
|
+
}
|
|
1065
|
+
default: throw new TypeError(`NIBArchive value ${index} has unsupported type ${type}`);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
skipValue = (bytes, cursor, end, type, index) => {
|
|
1069
|
+
switch (type) {
|
|
1070
|
+
case 0:
|
|
1071
|
+
ensureRange(cursor.offset, 1, end, `value ${index}`);
|
|
1072
|
+
cursor.offset += 1;
|
|
1073
|
+
return;
|
|
1074
|
+
case 1:
|
|
1075
|
+
ensureRange(cursor.offset, 2, end, `value ${index}`);
|
|
1076
|
+
cursor.offset += 2;
|
|
1077
|
+
return;
|
|
1078
|
+
case 2:
|
|
1079
|
+
case 10:
|
|
1080
|
+
ensureRange(cursor.offset, 4, end, `value ${index}`);
|
|
1081
|
+
cursor.offset += 4;
|
|
1082
|
+
return;
|
|
1083
|
+
case 3:
|
|
1084
|
+
case 7:
|
|
1085
|
+
ensureRange(cursor.offset, 8, end, `value ${index}`);
|
|
1086
|
+
cursor.offset += 8;
|
|
1087
|
+
return;
|
|
1088
|
+
case 6:
|
|
1089
|
+
ensureRange(cursor.offset, 4, end, `value ${index}`);
|
|
1090
|
+
cursor.offset += 4;
|
|
1091
|
+
return;
|
|
1092
|
+
case 4:
|
|
1093
|
+
case 5:
|
|
1094
|
+
case 9: return;
|
|
1095
|
+
case 8: {
|
|
1096
|
+
const length = readVarint(bytes, cursor, end);
|
|
1097
|
+
cursor.offset = checkedEnd(cursor.offset, length, end, `value ${index} data`);
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
default: throw new TypeError(`NIBArchive value ${index} has unsupported type ${type}`);
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
valueIndexes = (objects, total) => {
|
|
1104
|
+
const indexes = new Set();
|
|
1105
|
+
for (const object of objects) for (let index = object.value_start; index < object.value_start + object.value_count; index += 1) indexes.add(index);
|
|
1106
|
+
if (indexes.size > total) throw new TypeError("NIBArchive object value ranges exceed the value table");
|
|
1107
|
+
return indexes;
|
|
1108
|
+
};
|
|
1109
|
+
readCount = (bytes, offset, label) => {
|
|
1110
|
+
const count = readU32(bytes, offset);
|
|
1111
|
+
if (count > bytes.length) throw new TypeError(`NIBArchive ${label} count exceeds the archive length`);
|
|
1112
|
+
return count;
|
|
1113
|
+
};
|
|
1114
|
+
readOffset = (bytes, offset, fileLength, label) => {
|
|
1115
|
+
const value = readU32(bytes, offset);
|
|
1116
|
+
if (value < 50 || value > fileLength) throw new TypeError(`NIBArchive ${label} table offset is invalid`);
|
|
1117
|
+
return value;
|
|
1118
|
+
};
|
|
1119
|
+
readU32 = (bytes, offset) => {
|
|
1120
|
+
ensureRange(offset, 4, bytes.length, "header");
|
|
1121
|
+
return bytes.readUInt32LE(offset);
|
|
1122
|
+
};
|
|
1123
|
+
decodeUtf8 = (bytes, start, end, label) => {
|
|
1124
|
+
try {
|
|
1125
|
+
return new TextDecoder("utf-8", {
|
|
1126
|
+
fatal: true,
|
|
1127
|
+
ignoreBOM: true
|
|
1128
|
+
}).decode(bytes.subarray(start, end));
|
|
1129
|
+
} catch (cause) {
|
|
1130
|
+
throw new TypeError(`NIBArchive ${label} is not valid UTF-8`, { cause });
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
readVarint = (bytes, cursor, end) => {
|
|
1134
|
+
let value = 0;
|
|
1135
|
+
let shift = 0;
|
|
1136
|
+
for (let index = 0; index < 5; index += 1) {
|
|
1137
|
+
ensureRange(cursor.offset, 1, end, "variable integer");
|
|
1138
|
+
const byte = bytes[cursor.offset++] ?? 0;
|
|
1139
|
+
value += (byte & 127) * 2 ** shift;
|
|
1140
|
+
if ((byte & 128) !== 0) {
|
|
1141
|
+
if (value > 2147483647) throw new TypeError("NIBArchive variable integer is out of range");
|
|
1142
|
+
return value;
|
|
1143
|
+
}
|
|
1144
|
+
shift += 7;
|
|
1145
|
+
}
|
|
1146
|
+
throw new TypeError("NIBArchive variable integer is too long");
|
|
1147
|
+
};
|
|
1148
|
+
checkedEnd = (start, length, limit, label) => {
|
|
1149
|
+
if (!Number.isSafeInteger(length) || length < 0 || start + length > limit) throw new TypeError(`NIBArchive ${label} exceeds its table`);
|
|
1150
|
+
return start + length;
|
|
1151
|
+
};
|
|
1152
|
+
ensureRange = (start, length, limit, label) => {
|
|
1153
|
+
checkedEnd(start, length, limit, label);
|
|
1154
|
+
};
|
|
1155
|
+
assertOrderedOffsets = (length, offsets) => {
|
|
1156
|
+
let previous = 50;
|
|
1157
|
+
for (const offset of offsets) {
|
|
1158
|
+
if (offset < previous || offset > length) throw new TypeError("NIBArchive table offsets are out of order");
|
|
1159
|
+
previous = offset;
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
})))();
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region dist/artifacts/apple/NibViewHierarchy.js
|
|
1167
|
+
var projectNibViewHierarchy, mergeNibHierarchies, wouldCycle, reference, collectNibParents, invalidReference;
|
|
1168
|
+
function init_NibViewHierarchy() {
|
|
1169
|
+
return (init_NibViewHierarchy = __esmMin((() => {
|
|
1170
|
+
projectNibViewHierarchy = (objects, retainedIds, reserveNode = () => true, maxNodes = 2e4) => {
|
|
1171
|
+
const { parents, involved, invalid } = collectNibParents(objects, retainedIds);
|
|
1172
|
+
if (parents.size === 0) return {
|
|
1173
|
+
hierarchy: null,
|
|
1174
|
+
omitted: invalid
|
|
1175
|
+
};
|
|
1176
|
+
const children = new Map();
|
|
1177
|
+
for (const [child, parent] of parents) {
|
|
1178
|
+
if (!retainedIds.has(parent) || !retainedIds.has(child)) continue;
|
|
1179
|
+
const siblings = children.get(parent) ?? [];
|
|
1180
|
+
siblings.push(child);
|
|
1181
|
+
children.set(parent, siblings);
|
|
1182
|
+
}
|
|
1183
|
+
const roots = [];
|
|
1184
|
+
const pending = [];
|
|
1185
|
+
for (const id of involved) if (!parents.has(id)) pending.push({
|
|
1186
|
+
id,
|
|
1187
|
+
depth: 0,
|
|
1188
|
+
output: roots
|
|
1189
|
+
});
|
|
1190
|
+
const visited = new Set();
|
|
1191
|
+
while (pending.length > 0) {
|
|
1192
|
+
const item = pending.pop();
|
|
1193
|
+
if (item === undefined) break;
|
|
1194
|
+
if (visited.has(item.id) || item.depth > 128 || visited.size >= maxNodes || !reserveNode()) continue;
|
|
1195
|
+
visited.add(item.id);
|
|
1196
|
+
const node = {
|
|
1197
|
+
objectID: String(item.id),
|
|
1198
|
+
children: []
|
|
1199
|
+
};
|
|
1200
|
+
item.output.push(node);
|
|
1201
|
+
for (const child of [...children.get(item.id) ?? []].reverse()) pending.push({
|
|
1202
|
+
id: child,
|
|
1203
|
+
depth: item.depth + 1,
|
|
1204
|
+
output: node.children
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
return {
|
|
1208
|
+
hierarchy: roots,
|
|
1209
|
+
omitted: involved.size - visited.size + invalid
|
|
1210
|
+
};
|
|
1211
|
+
};
|
|
1212
|
+
mergeNibHierarchies = (legacy, recovered, reserveNode = () => true, maxNodes = 2e4) => {
|
|
1213
|
+
const existing = new Map();
|
|
1214
|
+
const owners = new Map();
|
|
1215
|
+
const parents = new Map();
|
|
1216
|
+
const pending = legacy.map((node) => ({
|
|
1217
|
+
node,
|
|
1218
|
+
output: legacy,
|
|
1219
|
+
parent: null
|
|
1220
|
+
}));
|
|
1221
|
+
while (pending.length > 0) {
|
|
1222
|
+
const entry = pending.pop();
|
|
1223
|
+
if (entry === undefined || existing.has(entry.node.objectID)) continue;
|
|
1224
|
+
existing.set(entry.node.objectID, entry.node);
|
|
1225
|
+
owners.set(entry.node.objectID, entry.output);
|
|
1226
|
+
if (entry.parent !== null) parents.set(entry.node.objectID, entry.parent);
|
|
1227
|
+
pending.push(...entry.node.children.map((node) => ({
|
|
1228
|
+
node,
|
|
1229
|
+
output: entry.node.children,
|
|
1230
|
+
parent: entry.node.objectID
|
|
1231
|
+
})));
|
|
1232
|
+
}
|
|
1233
|
+
let omitted = 0;
|
|
1234
|
+
const additions = recovered.map((node) => ({
|
|
1235
|
+
node,
|
|
1236
|
+
output: legacy,
|
|
1237
|
+
parent: null
|
|
1238
|
+
}));
|
|
1239
|
+
while (additions.length > 0) {
|
|
1240
|
+
const entry = additions.pop();
|
|
1241
|
+
if (entry === undefined) break;
|
|
1242
|
+
let target = existing.get(entry.node.objectID);
|
|
1243
|
+
if (target === undefined) {
|
|
1244
|
+
if (existing.size >= maxNodes || !reserveNode()) {
|
|
1245
|
+
omitted += 1;
|
|
1246
|
+
continue;
|
|
1247
|
+
}
|
|
1248
|
+
target = {
|
|
1249
|
+
objectID: entry.node.objectID,
|
|
1250
|
+
children: []
|
|
1251
|
+
};
|
|
1252
|
+
existing.set(target.objectID, target);
|
|
1253
|
+
entry.output.push(target);
|
|
1254
|
+
owners.set(target.objectID, entry.output);
|
|
1255
|
+
if (entry.parent !== null) parents.set(target.objectID, entry.parent);
|
|
1256
|
+
} else if (entry.parent !== null && owners.get(target.objectID) !== entry.output) {
|
|
1257
|
+
const owner = owners.get(target.objectID);
|
|
1258
|
+
if (owner !== legacy || wouldCycle(target.objectID, entry.parent, parents)) {
|
|
1259
|
+
omitted += 1;
|
|
1260
|
+
} else {
|
|
1261
|
+
owner.splice(owner.indexOf(target), 1);
|
|
1262
|
+
entry.output.push(target);
|
|
1263
|
+
owners.set(target.objectID, entry.output);
|
|
1264
|
+
parents.set(target.objectID, entry.parent);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
for (const node of [...entry.node.children].reverse()) additions.push({
|
|
1268
|
+
node,
|
|
1269
|
+
output: target.children,
|
|
1270
|
+
parent: target.objectID
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
return {
|
|
1274
|
+
hierarchy: legacy,
|
|
1275
|
+
omitted
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
wouldCycle = (child, parent, parents) => {
|
|
1279
|
+
const seen = new Set();
|
|
1280
|
+
let current = parent;
|
|
1281
|
+
while (current !== undefined && !seen.has(current)) {
|
|
1282
|
+
if (current === child) return true;
|
|
1283
|
+
seen.add(current);
|
|
1284
|
+
current = parents.get(current);
|
|
1285
|
+
}
|
|
1286
|
+
return false;
|
|
1287
|
+
};
|
|
1288
|
+
reference = (value) => {
|
|
1289
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1290
|
+
return typeof value.$nib_object_ref === "number" ? value.$nib_object_ref : null;
|
|
1291
|
+
};
|
|
1292
|
+
collectNibParents = (objects, retainedIds) => {
|
|
1293
|
+
const parents = new Map();
|
|
1294
|
+
const involved = new Set();
|
|
1295
|
+
let invalid = 0;
|
|
1296
|
+
for (const object of objects) {
|
|
1297
|
+
if (!retainedIds.has(object.id)) continue;
|
|
1298
|
+
const child = reference(object.values.NSWindowView);
|
|
1299
|
+
if (object.class_name.replace(/\0+$/u, "") === "NSWindowTemplate" && invalidReference(object.values.NSWindowView)) invalid += 1;
|
|
1300
|
+
if (object.class_name.replace(/\0+$/u, "") === "NSWindowTemplate" && child !== null) {
|
|
1301
|
+
parents.set(child, object.id);
|
|
1302
|
+
involved.add(object.id);
|
|
1303
|
+
involved.add(child);
|
|
1304
|
+
}
|
|
1305
|
+
const parent = reference(object.values.NSSuperview);
|
|
1306
|
+
if (invalidReference(object.values.NSSuperview)) invalid += 1;
|
|
1307
|
+
if (parent === null) continue;
|
|
1308
|
+
parents.set(object.id, parent);
|
|
1309
|
+
involved.add(object.id);
|
|
1310
|
+
if (retainedIds.has(parent)) involved.add(parent);
|
|
1311
|
+
}
|
|
1312
|
+
return {
|
|
1313
|
+
parents,
|
|
1314
|
+
involved,
|
|
1315
|
+
invalid
|
|
1316
|
+
};
|
|
1317
|
+
};
|
|
1318
|
+
invalidReference = (value) => value !== undefined && value !== null && reference(value) === null;
|
|
1319
|
+
})))();
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region dist/artifacts/apple/InterfaceBuilderAnalysis.js
|
|
1324
|
+
var MAX_AGGREGATE_INPUT_BYTES, MAX_AGGREGATE_DECODE_BYTES, MAX_REPORTED_OMITTED_ARCHIVES, analyzeInterfaceBuilderBundle, selectInterfaceBuilderCandidates, retainCandidate, finalizeHierarchyCoverage, projectNibArchive, isInterfaceBuilderArchive, readEntry, parseXmlWithinDecodeBudget, decodePlist;
|
|
1325
|
+
function init_InterfaceBuilderAnalysis() {
|
|
1326
|
+
return (init_InterfaceBuilderAnalysis = __esmMin((() => {
|
|
1327
|
+
init_appleAssetCatalog();
|
|
1328
|
+
init_interfaceBuilderKeyedArchive();
|
|
1329
|
+
init_DirectoryArtifactReader();
|
|
1330
|
+
init_plistValue();
|
|
1331
|
+
init_propertyListKeys();
|
|
1332
|
+
init_NibArchive();
|
|
1333
|
+
init_InterfaceBuilderDecodeBudget();
|
|
1334
|
+
init_interfaceBuilderGraph();
|
|
1335
|
+
init_NibViewHierarchy();
|
|
1336
|
+
init_jsonValue();
|
|
1337
|
+
init_unicodeCodePointOrder();
|
|
1338
|
+
init_propertyListXmlText();
|
|
1339
|
+
init_PlistNumberLiterals();
|
|
1340
|
+
init_appleArchiveFormat();
|
|
1341
|
+
MAX_AGGREGATE_INPUT_BYTES = 32 * 1024 * 1024;
|
|
1342
|
+
MAX_AGGREGATE_DECODE_BYTES = 256 * 1024 * 1024;
|
|
1343
|
+
MAX_REPORTED_OMITTED_ARCHIVES = 64;
|
|
1344
|
+
analyzeInterfaceBuilderBundle = async (input) => {
|
|
1345
|
+
const limits = interfaceBuilderLimitsSchema.parse(input.limits ?? {});
|
|
1346
|
+
const reader = new DirectoryArtifactReader(input.bundlePath);
|
|
1347
|
+
const documents = [];
|
|
1348
|
+
const invalid = [];
|
|
1349
|
+
const omittedArchives = [];
|
|
1350
|
+
let unreportedOmittedArchives = 0;
|
|
1351
|
+
const incompleteHierarchies = new Map();
|
|
1352
|
+
const unresolvedConnections = new Map();
|
|
1353
|
+
const prototypeKeyOmissions = new Map();
|
|
1354
|
+
const unknownDates = new Map();
|
|
1355
|
+
let omitted = 0;
|
|
1356
|
+
let attempted = 0;
|
|
1357
|
+
let aggregateInputBytes = 0;
|
|
1358
|
+
const decodeBudget = new InterfaceBuilderDecodeBudget(MAX_AGGREGATE_DECODE_BYTES);
|
|
1359
|
+
const recordOmittedArchive = (path, reason) => {
|
|
1360
|
+
if (omittedArchives.length < MAX_REPORTED_OMITTED_ARCHIVES) omittedArchives.push({
|
|
1361
|
+
path,
|
|
1362
|
+
reason
|
|
1363
|
+
});
|
|
1364
|
+
else unreportedOmittedArchives += 1;
|
|
1365
|
+
};
|
|
1366
|
+
try {
|
|
1367
|
+
const selection = await selectInterfaceBuilderCandidates(reader, input.signal, limits.max_documents);
|
|
1368
|
+
omitted = selection.omitted;
|
|
1369
|
+
for (const entry of selection.omittedSamples) recordOmittedArchive(entry.path, "max_documents");
|
|
1370
|
+
unreportedOmittedArchives += selection.unreportedOmitted;
|
|
1371
|
+
for (const entry of selection.selected) {
|
|
1372
|
+
let plistReservation = 0;
|
|
1373
|
+
try {
|
|
1374
|
+
const remainingInputBytes = MAX_AGGREGATE_INPUT_BYTES - aggregateInputBytes;
|
|
1375
|
+
if (entry.declaredSize !== null && entry.declaredSize > remainingInputBytes) {
|
|
1376
|
+
omitted += 1;
|
|
1377
|
+
recordOmittedArchive(entry.path, "aggregate_decode_budget_exhausted");
|
|
1378
|
+
continue;
|
|
1379
|
+
}
|
|
1380
|
+
attempted += 1;
|
|
1381
|
+
const bytes = await readEntry(reader, entry, input.signal, remainingInputBytes);
|
|
1382
|
+
aggregateInputBytes += bytes.length;
|
|
1383
|
+
const isNibArchive = hasNibArchiveSignature(bytes);
|
|
1384
|
+
let nib = null;
|
|
1385
|
+
let xmlText;
|
|
1386
|
+
let binaryPrototypeKeyObserved = false;
|
|
1387
|
+
if (isNibArchive) {
|
|
1388
|
+
const documentBudget = new InterfaceBuilderDecodeBudget(decodeBudget.remainingBytes);
|
|
1389
|
+
nib = projectNibArchive(decodeNibArchive(bytes, documentBudget), documentBudget, limits.max_objects);
|
|
1390
|
+
decodeBudget.reserve(documentBudget.usedBytes, "NIBArchive representation exceeds the aggregate Interface Builder decode budget");
|
|
1391
|
+
} else {
|
|
1392
|
+
if (!hasBinaryPlistSignature(bytes)) xmlText = decodeXmlPlistText(bytes);
|
|
1393
|
+
const decodedReservation = preflightPropertyListDecode(bytes, decodeBudget.remainingBytes, xmlText, { numberProjection: true });
|
|
1394
|
+
decodeBudget.reserve(decodedReservation.estimatedBytes, "plist representation exceeds the aggregate Interface Builder decode budget");
|
|
1395
|
+
plistReservation = decodedReservation.estimatedBytes;
|
|
1396
|
+
binaryPrototypeKeyObserved = decodedReservation.binaryPrototypeKeyObserved;
|
|
1397
|
+
}
|
|
1398
|
+
const { value: raw, omittedPrototypeKeys, unknownDateCount, numberLiterals } = nib === null ? decodePlist(bytes, xmlText, binaryPrototypeKeyObserved) : {
|
|
1399
|
+
value: nib.raw,
|
|
1400
|
+
omittedPrototypeKeys: 0,
|
|
1401
|
+
unknownDateCount: 0,
|
|
1402
|
+
numberLiterals: undefined
|
|
1403
|
+
};
|
|
1404
|
+
if (nib !== null && nib.omitted > 0) incompleteHierarchies.set(entry.path, nib.omitted);
|
|
1405
|
+
if (nib !== null && nib.unresolvedConnections > 0) unresolvedConnections.set(entry.path, nib.unresolvedConnections);
|
|
1406
|
+
if (omittedPrototypeKeys !== 0) prototypeKeyOmissions.set(entry.path, omittedPrototypeKeys);
|
|
1407
|
+
if (unknownDateCount !== 0) unknownDates.set(entry.path, unknownDateCount);
|
|
1408
|
+
const documentHash = createHash("sha256").update(bytes).digest("hex");
|
|
1409
|
+
documents.push({
|
|
1410
|
+
relativePath: entry.path,
|
|
1411
|
+
archiveSha256: documentHash,
|
|
1412
|
+
documentKind: entry.path.includes(".storyboardc/") ? "storyboard_scene" : "nib",
|
|
1413
|
+
raw,
|
|
1414
|
+
...numberLiterals === undefined ? {} : { numberLiterals },
|
|
1415
|
+
...nib === null || nib.omitted === 0 ? {} : { omittedSerializedHierarchyReferences: nib.omitted }
|
|
1416
|
+
});
|
|
1417
|
+
} catch (cause) {
|
|
1418
|
+
if (input.signal?.aborted === true) throw cause;
|
|
1419
|
+
if (cause instanceof InterfaceBuilderDecodeBudgetExceeded) {
|
|
1420
|
+
decodeBudget.release(plistReservation);
|
|
1421
|
+
omitted += 1;
|
|
1422
|
+
recordOmittedArchive(entry.path, cause.reason);
|
|
1423
|
+
continue;
|
|
1424
|
+
}
|
|
1425
|
+
invalid.push(`${entry.path}: ${cause instanceof Error ? cause.message : "archive decode failed"}`);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
} finally {
|
|
1429
|
+
await reader.close();
|
|
1430
|
+
}
|
|
1431
|
+
const result = buildInterfaceBuilderAnalysis({
|
|
1432
|
+
targetSha256: input.targetSha256,
|
|
1433
|
+
toolVersion: "rea-interface-builder/1",
|
|
1434
|
+
documents,
|
|
1435
|
+
limits
|
|
1436
|
+
});
|
|
1437
|
+
return finalizeHierarchyCoverage(result, {
|
|
1438
|
+
incompleteHierarchies,
|
|
1439
|
+
unresolvedConnections,
|
|
1440
|
+
prototypeKeyOmissions,
|
|
1441
|
+
unknownDates,
|
|
1442
|
+
invalid,
|
|
1443
|
+
omittedArchives,
|
|
1444
|
+
unreportedOmittedArchives,
|
|
1445
|
+
attempted,
|
|
1446
|
+
omitted
|
|
1447
|
+
});
|
|
1448
|
+
};
|
|
1449
|
+
selectInterfaceBuilderCandidates = async (reader, signal, maximumDocuments) => {
|
|
1450
|
+
const capacity = maximumDocuments + MAX_REPORTED_OMITTED_ARCHIVES;
|
|
1451
|
+
const candidates = [];
|
|
1452
|
+
let total = 0;
|
|
1453
|
+
for await (const entry of reader.entries(signal)) {
|
|
1454
|
+
if (entry.kind !== "file" || !isInterfaceBuilderArchive(entry.path)) continue;
|
|
1455
|
+
total += 1;
|
|
1456
|
+
retainCandidate(candidates, entry, capacity);
|
|
1457
|
+
}
|
|
1458
|
+
const omittedSamples = candidates.slice(maximumDocuments, capacity);
|
|
1459
|
+
return {
|
|
1460
|
+
selected: candidates.slice(0, maximumDocuments),
|
|
1461
|
+
omittedSamples,
|
|
1462
|
+
omitted: Math.max(0, total - maximumDocuments),
|
|
1463
|
+
unreportedOmitted: Math.max(0, total - maximumDocuments - omittedSamples.length)
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
retainCandidate = (candidates, entry, maximum) => {
|
|
1467
|
+
let low = 0;
|
|
1468
|
+
let high = candidates.length;
|
|
1469
|
+
while (low < high) {
|
|
1470
|
+
const middle = Math.floor((low + high) / 2);
|
|
1471
|
+
const existing = candidates[middle];
|
|
1472
|
+
if (existing !== undefined && compareUnicodeCodePoints(existing.path, entry.path) < 0) low = middle + 1;
|
|
1473
|
+
else high = middle;
|
|
1474
|
+
}
|
|
1475
|
+
candidates.splice(low, 0, entry);
|
|
1476
|
+
if (candidates.length > maximum) candidates.pop();
|
|
1477
|
+
};
|
|
1478
|
+
finalizeHierarchyCoverage = (result, counts) => {
|
|
1479
|
+
const { incompleteHierarchies, unresolvedConnections, prototypeKeyOmissions, unknownDates, invalid, omittedArchives, unreportedOmittedArchives } = counts;
|
|
1480
|
+
const archiveDecodePartial = invalid.length > 0 || prototypeKeyOmissions.size > 0 || omittedArchives.length > 0;
|
|
1481
|
+
return {
|
|
1482
|
+
...result,
|
|
1483
|
+
documents: result.documents.map((document) => ({
|
|
1484
|
+
...document,
|
|
1485
|
+
connection_count: document.connection_count + (unresolvedConnections.get(document.relative_path) ?? 0)
|
|
1486
|
+
})),
|
|
1487
|
+
graph: {
|
|
1488
|
+
...result.graph,
|
|
1489
|
+
coverage: [...result.graph.coverage.map((facet) => {
|
|
1490
|
+
const omittedConnection = unresolvedConnections.get(facet.facet.replace(/^connections:/u, ""));
|
|
1491
|
+
return facet.facet.startsWith("connections:") && omittedConnection !== undefined ? {
|
|
1492
|
+
...facet,
|
|
1493
|
+
status: "partial",
|
|
1494
|
+
reason: facet.reason ?? "connection_unresolved",
|
|
1495
|
+
omitted: facet.omitted + omittedConnection
|
|
1496
|
+
} : facet;
|
|
1497
|
+
}), {
|
|
1498
|
+
facet: "archive_decode",
|
|
1499
|
+
status: archiveDecodePartial ? "partial" : "complete",
|
|
1500
|
+
reason: omittedArchives.some(({ reason }) => reason === "aggregate_decode_budget_exhausted") ? "aggregate_decode_budget_exhausted" : omittedArchives.some(({ reason }) => reason === "max_documents") ? "document_limit_reached" : omittedArchives.length > 0 ? "archive_decode_budget_exhausted" : invalid.length > 0 ? "one_or_more_archives_invalid" : prototypeKeyOmissions.size > 0 ? "dictionary_entries_omitted" : null,
|
|
1501
|
+
examined: counts.attempted,
|
|
1502
|
+
omitted: counts.omitted
|
|
1503
|
+
}],
|
|
1504
|
+
truncated: result.graph.truncated || counts.omitted > 0 || archiveDecodePartial || unresolvedConnections.size > 0
|
|
1505
|
+
},
|
|
1506
|
+
limitations: [
|
|
1507
|
+
...result.limitations,
|
|
1508
|
+
"Compiled Interface Builder archives are private serialized object graphs. The decoder reports only recognized keyed-archive objects and connections; unrecognized object classes and fields remain unknown.",
|
|
1509
|
+
...incompleteHierarchies.size === 0 ? [] : ["Some serialized hierarchy links could not be projected within the bounded hierarchy; their parentage remains unknown."],
|
|
1510
|
+
...unresolvedConnections.size === 0 ? [] : ["Some recognized NIBArchive connectors declare no resolvable owner; they carry no connection evidence and are reported as omissions."],
|
|
1511
|
+
...invalid.length === 0 ? [] : [`Some Interface Builder archives could not be decoded: ${invalid.slice(0, 16).join("; ")}`],
|
|
1512
|
+
...[...prototypeKeyOmissions].map(([path, count]) => `${path}: ${omittedPrototypeKeysLimitation(count)}`),
|
|
1513
|
+
...[...unknownDates].map(([path, count]) => `${path}: ${unknownDateLimitation(count)}`),
|
|
1514
|
+
...omittedArchives.map(({ path, reason }) => `${path}: omitted because ${reason.replaceAll("_", " ")}.`),
|
|
1515
|
+
...unreportedOmittedArchives === 0 ? [] : [`${unreportedOmittedArchives} additional omitted archive path(s) and their reasons were not retained; reporting is bounded to ${MAX_REPORTED_OMITTED_ARCHIVES} paths.`]
|
|
1516
|
+
]
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
projectNibArchive = (archive, budget, maxHierarchyNodes) => {
|
|
1520
|
+
const byId = new Map(archive.objects.map((object) => [object.id, object]));
|
|
1521
|
+
const normalizedClassNames = new Map();
|
|
1522
|
+
const normalizeClassName = (value) => {
|
|
1523
|
+
const known = normalizedClassNames.get(value);
|
|
1524
|
+
if (known !== undefined) return known;
|
|
1525
|
+
const normalized = value.replace(/\0+$/u, "");
|
|
1526
|
+
normalizedClassNames.set(value, normalized);
|
|
1527
|
+
return normalized;
|
|
1528
|
+
};
|
|
1529
|
+
const decodedStrings = new Map();
|
|
1530
|
+
const decodedString = (objectId, object) => {
|
|
1531
|
+
if (decodedStrings.has(objectId)) return decodedStrings.get(objectId) ?? null;
|
|
1532
|
+
const data = object.values["NS.bytes"];
|
|
1533
|
+
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
1534
|
+
decodedStrings.set(objectId, null);
|
|
1535
|
+
return null;
|
|
1536
|
+
}
|
|
1537
|
+
const encoded = data.$nib_data_base64;
|
|
1538
|
+
if (typeof encoded !== "string") {
|
|
1539
|
+
decodedStrings.set(objectId, null);
|
|
1540
|
+
return null;
|
|
1541
|
+
}
|
|
1542
|
+
budget.reserve(64 + encoded.length * 2, "NIBArchive string projection exceeds the aggregate Interface Builder decode budget");
|
|
1543
|
+
const value = Buffer.from(encoded, "base64").toString("utf8");
|
|
1544
|
+
decodedStrings.set(objectId, value);
|
|
1545
|
+
return value;
|
|
1546
|
+
};
|
|
1547
|
+
let projectedFields = 0;
|
|
1548
|
+
for (const object of archive.objects) projectedFields += Object.keys(object.values).length;
|
|
1549
|
+
budget.reserve(archive.objects.length * 128 + projectedFields * 128, "NIBArchive graph projection exceeds the aggregate Interface Builder decode budget");
|
|
1550
|
+
budget.reserve(archive.classes.length * 96, "NIBArchive class projection exceeds the aggregate Interface Builder decode budget");
|
|
1551
|
+
const dereference = (value) => {
|
|
1552
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return value;
|
|
1553
|
+
const encodedData = value.$nib_data_base64;
|
|
1554
|
+
if (typeof encodedData === "string") {
|
|
1555
|
+
budget.reserveBase64JsonStringOccurrence(encodedData);
|
|
1556
|
+
return value;
|
|
1557
|
+
}
|
|
1558
|
+
const ref = value.$nib_object_ref;
|
|
1559
|
+
if (typeof ref !== "number") return value;
|
|
1560
|
+
const target = byId.get(ref);
|
|
1561
|
+
if (target === undefined) return undefined;
|
|
1562
|
+
if (normalizeClassName(target.class_name) === "NSString") {
|
|
1563
|
+
const string = decodedString(ref, target);
|
|
1564
|
+
if (string !== null) {
|
|
1565
|
+
budget.reserveJsonStringOccurrence(string);
|
|
1566
|
+
return string;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
return { objectID: String(ref) };
|
|
1570
|
+
};
|
|
1571
|
+
const referencedString = (value) => {
|
|
1572
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1573
|
+
const ref = value.$nib_object_ref;
|
|
1574
|
+
if (typeof ref !== "number") return null;
|
|
1575
|
+
const target = byId.get(ref);
|
|
1576
|
+
if (target === undefined || normalizeClassName(target.class_name) !== "NSString") return null;
|
|
1577
|
+
const string = decodedString(ref, target);
|
|
1578
|
+
if (string === null) return null;
|
|
1579
|
+
budget.reserveJsonStringOccurrence(string);
|
|
1580
|
+
return string;
|
|
1581
|
+
};
|
|
1582
|
+
const runtimeClasses = new Map();
|
|
1583
|
+
const runtimeClass = (objectId) => {
|
|
1584
|
+
if (runtimeClasses.has(objectId)) return runtimeClasses.get(objectId) ?? null;
|
|
1585
|
+
const object = byId.get(objectId);
|
|
1586
|
+
if (object === undefined) return null;
|
|
1587
|
+
const storedClass = normalizeClassName(object.class_name);
|
|
1588
|
+
const resolvedClass = storedClass === "NSClassSwapper" ? referencedString(object.values.NSClassName) ?? storedClass : storedClass === "UIClassSwapper" ? referencedString(object.values.UIClassName) ?? storedClass : storedClass;
|
|
1589
|
+
runtimeClasses.set(objectId, resolvedClass);
|
|
1590
|
+
return resolvedClass;
|
|
1591
|
+
};
|
|
1592
|
+
const objects = Object.fromEntries(archive.objects.filter((object) => {
|
|
1593
|
+
const name = runtimeClass(object.id) ?? "";
|
|
1594
|
+
return !/^(?:NSObject|NSIBObjectData|NSString|NSMutableString|NSNumber|NSArray|NSMutableArray|NSSet|NSMutableSet|NSDictionary|NSMutableDictionary|NSApplication|NSNib.*Connector)$/u.test(name) && !isUIKitRuntimeConnectionClass(name);
|
|
1595
|
+
}).map((object) => {
|
|
1596
|
+
const className = runtimeClass(object.id) ?? normalizeClassName(object.class_name);
|
|
1597
|
+
budget.reserveJsonStringOccurrence(className);
|
|
1598
|
+
let name = className;
|
|
1599
|
+
for (const [key, value] of Object.entries(object.values)) {
|
|
1600
|
+
if (!/(?:title|label|identifier|accessibility|name|contents)/iu.test(key)) continue;
|
|
1601
|
+
const resolved = dereference(value);
|
|
1602
|
+
if (typeof resolved !== "string") continue;
|
|
1603
|
+
name = resolved;
|
|
1604
|
+
break;
|
|
1605
|
+
}
|
|
1606
|
+
budget.reserveJsonStringOccurrence(name);
|
|
1607
|
+
const nibValues = Object.fromEntries(Object.entries(object.values).map(([key, value]) => {
|
|
1608
|
+
budget.reserveJsonPropertyNameOccurrence(key);
|
|
1609
|
+
return [key, dereference(value) ?? null];
|
|
1610
|
+
}));
|
|
1611
|
+
const resourceFields = appleResourceKeyFields(nibValues);
|
|
1612
|
+
for (const [field, value] of resourceFields) {
|
|
1613
|
+
budget.reserveJsonPropertyNameOccurrence(field);
|
|
1614
|
+
budget.reserveJsonStringOccurrence(value);
|
|
1615
|
+
}
|
|
1616
|
+
return [String(object.id), {
|
|
1617
|
+
customClass: className,
|
|
1618
|
+
label: name,
|
|
1619
|
+
objectID: String(object.id),
|
|
1620
|
+
nibValues,
|
|
1621
|
+
...Object.fromEntries(resourceFields)
|
|
1622
|
+
}];
|
|
1623
|
+
}));
|
|
1624
|
+
const connections = {};
|
|
1625
|
+
const hierarchy = [];
|
|
1626
|
+
let unresolvedConnections = 0;
|
|
1627
|
+
const reference = (value) => {
|
|
1628
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1629
|
+
return typeof value.$nib_object_ref === "number" ? value.$nib_object_ref : null;
|
|
1630
|
+
};
|
|
1631
|
+
for (const object of archive.objects) {
|
|
1632
|
+
const className = normalizeClassName(object.class_name);
|
|
1633
|
+
const uiKit = isUIKitRuntimeConnectionClass(className);
|
|
1634
|
+
if (!uiKit && !className.includes("Connector")) continue;
|
|
1635
|
+
const values = object.values;
|
|
1636
|
+
const connectionFields = interfaceBuilderConnectionFieldNames(className);
|
|
1637
|
+
const source = reference(values[connectionFields.source]);
|
|
1638
|
+
if (source === null) {
|
|
1639
|
+
unresolvedConnections += 1;
|
|
1640
|
+
continue;
|
|
1641
|
+
}
|
|
1642
|
+
const destination = reference(values[connectionFields.destination]);
|
|
1643
|
+
const label = referencedString(values[connectionFields.label]);
|
|
1644
|
+
const type = className.includes("Outlet") ? "outlet" : className.includes("Control") || className.includes("Event") ? "action" : className;
|
|
1645
|
+
budget.reserveJsonStringOccurrence(type);
|
|
1646
|
+
const eventMask = values.UIEventMask;
|
|
1647
|
+
(connections[String(source)] ??= []).push({
|
|
1648
|
+
type,
|
|
1649
|
+
"destination-id": destination === null ? null : String(destination),
|
|
1650
|
+
label,
|
|
1651
|
+
source_id: String(source),
|
|
1652
|
+
archive_object_id: String(object.id),
|
|
1653
|
+
...typeof eventMask === "number" ? { ui_event_mask: eventMask } : {}
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
let hierarchyOmitted = 0;
|
|
1657
|
+
let hierarchyNodeCount = 0;
|
|
1658
|
+
const hierarchyFor = (objectId, seen, depth) => {
|
|
1659
|
+
if (depth > 32 || seen.has(objectId)) {
|
|
1660
|
+
hierarchyOmitted += 1;
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1663
|
+
if (hierarchyNodeCount >= maxHierarchyNodes) {
|
|
1664
|
+
hierarchyOmitted += 1;
|
|
1665
|
+
return null;
|
|
1666
|
+
}
|
|
1667
|
+
if (!budget.tryReserve(128)) {
|
|
1668
|
+
hierarchyOmitted += 1;
|
|
1669
|
+
return null;
|
|
1670
|
+
}
|
|
1671
|
+
const object = byId.get(objectId);
|
|
1672
|
+
if (object === undefined) {
|
|
1673
|
+
hierarchyOmitted += 1;
|
|
1674
|
+
return null;
|
|
1675
|
+
}
|
|
1676
|
+
hierarchyNodeCount += 1;
|
|
1677
|
+
const nextSeen = new Set(seen).add(objectId);
|
|
1678
|
+
const children = [];
|
|
1679
|
+
for (const [key, value] of Object.entries(object.values)) {
|
|
1680
|
+
if (!/(?:subviews|contentview|childviewcontrollers|view)$/iu.test(key)) continue;
|
|
1681
|
+
const direct = reference(value);
|
|
1682
|
+
if (direct === null) continue;
|
|
1683
|
+
const target = byId.get(direct);
|
|
1684
|
+
if (target === undefined) {
|
|
1685
|
+
hierarchyOmitted += 1;
|
|
1686
|
+
continue;
|
|
1687
|
+
}
|
|
1688
|
+
if (/array|set/iu.test(target.class_name)) {
|
|
1689
|
+
for (const candidate of Object.values(target.values)) {
|
|
1690
|
+
const child = reference(candidate);
|
|
1691
|
+
const nested = child === null ? null : hierarchyFor(child, nextSeen, depth + 1);
|
|
1692
|
+
if (nested !== null) children.push(nested);
|
|
1693
|
+
}
|
|
1694
|
+
} else {
|
|
1695
|
+
const nested = hierarchyFor(direct, nextSeen, depth + 1);
|
|
1696
|
+
if (nested !== null) children.push(nested);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
return {
|
|
1700
|
+
objectID: String(objectId),
|
|
1701
|
+
children
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1704
|
+
const ibData = archive.objects.find(({ class_name }) => normalizeClassName(class_name) === "NSIBObjectData");
|
|
1705
|
+
const rootId = reference(ibData?.values.NSRoot);
|
|
1706
|
+
const hierarchyRoots = rootId === null ? [] : [rootId];
|
|
1707
|
+
for (const hierarchyRoot of hierarchyRoots) {
|
|
1708
|
+
const root = hierarchyFor(hierarchyRoot, new Set(), 0);
|
|
1709
|
+
if (root !== null) hierarchy.push(root);
|
|
1710
|
+
}
|
|
1711
|
+
const viewHierarchy = projectNibViewHierarchy(archive.objects, new Set(Object.keys(objects).map(Number)), () => budget.tryReserve(128), maxHierarchyNodes);
|
|
1712
|
+
const merged = mergeNibHierarchies(hierarchy, viewHierarchy.hierarchy ?? [], () => budget.tryReserve(96), maxHierarchyNodes);
|
|
1713
|
+
return {
|
|
1714
|
+
omitted: viewHierarchy.omitted + hierarchyOmitted + merged.omitted,
|
|
1715
|
+
unresolvedConnections,
|
|
1716
|
+
raw: jsonValueSchema.parse({
|
|
1717
|
+
"com.apple.ibtool.document.objects": objects,
|
|
1718
|
+
"com.apple.ibtool.document.connections": connections,
|
|
1719
|
+
"com.apple.ibtool.document.hierarchy": merged.hierarchy,
|
|
1720
|
+
"com.apple.ibtool.document.classes": Object.fromEntries(archive.classes.map((name) => {
|
|
1721
|
+
const className = normalizeClassName(name);
|
|
1722
|
+
budget.reserveJsonPropertyNameOccurrence(className);
|
|
1723
|
+
return [className, {}];
|
|
1724
|
+
}))
|
|
1725
|
+
})
|
|
1726
|
+
};
|
|
1727
|
+
};
|
|
1728
|
+
isInterfaceBuilderArchive = (path) => {
|
|
1729
|
+
const lower = path.toLowerCase();
|
|
1730
|
+
return lower.endsWith(".nib") || lower.endsWith("/objects.nib");
|
|
1731
|
+
};
|
|
1732
|
+
readEntry = async (reader, entry, signal, maxInputBytes = MAX_AGGREGATE_INPUT_BYTES) => {
|
|
1733
|
+
if (entry.declaredSize !== null && entry.declaredSize > maxInputBytes) throw new InterfaceBuilderDecodeBudgetExceeded("aggregate_decode_budget_exhausted", "archive exceeds the aggregate Interface Builder decode budget");
|
|
1734
|
+
const stream = await reader.open(entry, signal);
|
|
1735
|
+
const chunks = [];
|
|
1736
|
+
let length = 0;
|
|
1737
|
+
for await (const chunk of stream) {
|
|
1738
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
1739
|
+
length += bytes.length;
|
|
1740
|
+
if (length > maxInputBytes) {
|
|
1741
|
+
stream.destroy();
|
|
1742
|
+
throw new InterfaceBuilderDecodeBudgetExceeded("aggregate_decode_budget_exhausted", "archive exceeded the aggregate Interface Builder decode budget");
|
|
1743
|
+
}
|
|
1744
|
+
chunks.push(bytes);
|
|
1745
|
+
}
|
|
1746
|
+
return Buffer.concat(chunks, length);
|
|
1747
|
+
};
|
|
1748
|
+
parseXmlWithinDecodeBudget = (text) => {
|
|
1749
|
+
try {
|
|
1750
|
+
return parseXmlPropertyList(text);
|
|
1751
|
+
} catch (cause) {
|
|
1752
|
+
if (cause instanceof RangeError) throw new InterfaceBuilderDecodeBudgetExceeded("aggregate_decode_budget_exhausted", cause.message);
|
|
1753
|
+
throw cause;
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
decodePlist = (bytes, xmlText, binaryPrototypeKeyObserved) => {
|
|
1757
|
+
const binary = hasBinaryPlistSignature(bytes);
|
|
1758
|
+
const binaryNumberMetadata = binary ? scanBinaryPlistNumberLiterals(bytes) : undefined;
|
|
1759
|
+
const { value, omittedPrototypeKeys, numberLiterals } = binary ? {
|
|
1760
|
+
value: parseBinary(decodeBinaryPlistNumbers(bytes, binaryNumberMetadata)),
|
|
1761
|
+
omittedPrototypeKeys: binaryPrototypeKeyObserved ? null : 0,
|
|
1762
|
+
numberLiterals: binaryNumberMetadata.literals
|
|
1763
|
+
} : parseXmlWithinDecodeBudget(xmlText ?? decodeXmlPlistText(bytes));
|
|
1764
|
+
const projected = projectPlistValue(value);
|
|
1765
|
+
return {
|
|
1766
|
+
value: projected.value,
|
|
1767
|
+
omittedPrototypeKeys,
|
|
1768
|
+
unknownDateCount: projected.unknownDateCount,
|
|
1769
|
+
numberLiterals
|
|
1770
|
+
};
|
|
1771
|
+
};
|
|
1772
|
+
})))();
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
//#endregion
|
|
1776
|
+
//#region dist/artifacts/apple/AppleAssetCatalogAnalysis.js
|
|
1777
|
+
var ASSETUTIL, MAX_CATALOG_BYTES, MAX_TOTAL_METADATA_BYTES, analyzeAppleAssetCatalogs, collectAssetCatalogs, inspectAssetCatalogEntry, collectInterfaceBuilderResourceKeys, runAssetUtil, digestBounded;
|
|
1778
|
+
function init_AppleAssetCatalogAnalysis() {
|
|
1779
|
+
return (init_AppleAssetCatalogAnalysis = __esmMin((() => {
|
|
1780
|
+
init_DirectoryArtifactReader();
|
|
1781
|
+
init_ArtifactReader();
|
|
1782
|
+
init_InterfaceBuilderAnalysis();
|
|
1783
|
+
init_appleAssetCatalog();
|
|
1784
|
+
init_ExecFileOutput();
|
|
1785
|
+
ASSETUTIL = "/usr/bin/assetutil";
|
|
1786
|
+
MAX_CATALOG_BYTES = 64 * 1024 * 1024;
|
|
1787
|
+
MAX_TOTAL_METADATA_BYTES = 64 * 1024 * 1024;
|
|
1788
|
+
analyzeAppleAssetCatalogs = async (input) => {
|
|
1789
|
+
if (process.platform !== "darwin" && input.runAssetUtil === undefined) throw new ArtifactReaderFailure("unavailable", "Apple asset catalog inspection requires macOS assetutil");
|
|
1790
|
+
const page = appleAssetCatalogInputSchema.parse(input.page ?? {});
|
|
1791
|
+
const interfaceBuilderCancel = new AbortController();
|
|
1792
|
+
const interfaceBuilderAnalysis = (input.analyzeInterfaceBuilder ?? analyzeInterfaceBuilderBundle)({
|
|
1793
|
+
bundlePath: input.bundlePath,
|
|
1794
|
+
targetSha256: input.targetSha256,
|
|
1795
|
+
signal: input.signal === undefined ? interfaceBuilderCancel.signal : AbortSignal.any([input.signal, interfaceBuilderCancel.signal])
|
|
1796
|
+
}).then((value) => ({
|
|
1797
|
+
ok: true,
|
|
1798
|
+
value
|
|
1799
|
+
}), (error) => ({
|
|
1800
|
+
ok: false,
|
|
1801
|
+
error
|
|
1802
|
+
}));
|
|
1803
|
+
let catalogs;
|
|
1804
|
+
let uninspected;
|
|
1805
|
+
try {
|
|
1806
|
+
({catalogs, uninspected} = await collectAssetCatalogs(input));
|
|
1807
|
+
} catch (cause) {
|
|
1808
|
+
interfaceBuilderCancel.abort();
|
|
1809
|
+
await interfaceBuilderAnalysis;
|
|
1810
|
+
throw cause;
|
|
1811
|
+
}
|
|
1812
|
+
const analyzed = await interfaceBuilderAnalysis;
|
|
1813
|
+
if (!analyzed.ok) throw analyzed.error;
|
|
1814
|
+
const interfaceBuilder = analyzed.value;
|
|
1815
|
+
const resourceReferences = collectInterfaceBuilderResourceKeys(interfaceBuilder.graph.nodes);
|
|
1816
|
+
const result = projectAppleAssetCatalogPage({
|
|
1817
|
+
targetSha256: input.targetSha256,
|
|
1818
|
+
catalogs,
|
|
1819
|
+
offset: page.offset,
|
|
1820
|
+
limit: page.limit,
|
|
1821
|
+
resourceReferences
|
|
1822
|
+
});
|
|
1823
|
+
return {
|
|
1824
|
+
...result,
|
|
1825
|
+
limitations: [
|
|
1826
|
+
...result.limitations,
|
|
1827
|
+
...catalogs.length === 0 ? ["No compiled Assets.car catalog was found among the app bundle's regular files (symlinks are not followed); any resource keys are reported as unmatched."] : [],
|
|
1828
|
+
...uninspected.length === 0 ? [] : [`Asset catalog entries that are not regular files were not inspected, so resource keys reported as unmatched may resolve there: ${uninspected.join(", ")}`],
|
|
1829
|
+
"Exact resource-key joins use only recognized image or asset key fields on decoded Interface Builder resource objects; other archive resource references are not inferred.",
|
|
1830
|
+
...interfaceBuilder.graph.truncated ? ["Interface Builder resource-key joins may be incomplete because the decoded UI graph was truncated."] : []
|
|
1831
|
+
]
|
|
1832
|
+
};
|
|
1833
|
+
};
|
|
1834
|
+
collectAssetCatalogs = async (input) => {
|
|
1835
|
+
const reader = new DirectoryArtifactReader(input.bundlePath);
|
|
1836
|
+
const catalogs = [];
|
|
1837
|
+
const uninspected = [];
|
|
1838
|
+
let totalMetadataBytes = 0;
|
|
1839
|
+
try {
|
|
1840
|
+
for await (const entry of reader.entries(input.signal)) {
|
|
1841
|
+
if (entry.path.split("/").at(-1) !== "Assets.car") continue;
|
|
1842
|
+
if (entry.kind !== "file") {
|
|
1843
|
+
uninspected.push(`${entry.path} (${entry.kind})`);
|
|
1844
|
+
continue;
|
|
1845
|
+
}
|
|
1846
|
+
const inspected = await inspectAssetCatalogEntry({
|
|
1847
|
+
reader,
|
|
1848
|
+
entry,
|
|
1849
|
+
runAssetUtil: input.runAssetUtil ?? ((path, signal) => runAssetUtil(path, input.environment, signal)),
|
|
1850
|
+
...input.signal === undefined ? {} : { signal: input.signal }
|
|
1851
|
+
});
|
|
1852
|
+
totalMetadataBytes += inspected.metadataBytes;
|
|
1853
|
+
if (totalMetadataBytes > MAX_TOTAL_METADATA_BYTES) throw new ArtifactReaderFailure("limit", `Combined asset catalog metadata exceeds ${MAX_TOTAL_METADATA_BYTES} bytes`);
|
|
1854
|
+
catalogs.push(inspected.catalog);
|
|
1855
|
+
}
|
|
1856
|
+
} finally {
|
|
1857
|
+
await reader.close();
|
|
1858
|
+
}
|
|
1859
|
+
if (catalogs.length === 0 && uninspected.length > 0) throw new ArtifactReaderFailure("path", `Asset catalog entries are not regular files and were not inspected: ${uninspected.join(", ")}`);
|
|
1860
|
+
return {
|
|
1861
|
+
catalogs,
|
|
1862
|
+
uninspected
|
|
1863
|
+
};
|
|
1864
|
+
};
|
|
1865
|
+
inspectAssetCatalogEntry = async (input) => {
|
|
1866
|
+
const { entry, reader, signal } = input;
|
|
1867
|
+
const sha256 = await digestBounded(reader, entry, signal);
|
|
1868
|
+
const before = await lstat(entry.adapterKey, { bigint: true });
|
|
1869
|
+
if (!before.isFile() || !sameArtifactSourceIdentity(entry.sourceIdentity, before)) throw new ArtifactReaderFailure("integrity", `Asset catalog changed before inspection: ${entry.path}`);
|
|
1870
|
+
const output = await input.runAssetUtil(entry.adapterKey, signal);
|
|
1871
|
+
const after = await lstat(entry.adapterKey, { bigint: true });
|
|
1872
|
+
if (!after.isFile() || !sameArtifactSourceIdentity(entry.sourceIdentity, after) || await digestBounded(reader, entry, signal) !== sha256) throw new ArtifactReaderFailure("integrity", `Asset catalog changed during inspection: ${entry.path}`);
|
|
1873
|
+
let parsed;
|
|
1874
|
+
try {
|
|
1875
|
+
parsed = JSON.parse(output);
|
|
1876
|
+
} catch (cause) {
|
|
1877
|
+
throw new ArtifactReaderFailure("format", `assetutil returned invalid JSON for ${entry.path}`, { cause });
|
|
1878
|
+
}
|
|
1879
|
+
try {
|
|
1880
|
+
return {
|
|
1881
|
+
catalog: {
|
|
1882
|
+
path: entry.path,
|
|
1883
|
+
sha256,
|
|
1884
|
+
records: parseAppleAssetCatalogRecords(parsed)
|
|
1885
|
+
},
|
|
1886
|
+
metadataBytes: Buffer.byteLength(output, "utf8")
|
|
1887
|
+
};
|
|
1888
|
+
} catch (cause) {
|
|
1889
|
+
throw new ArtifactReaderFailure("format", `assetutil returned an unsupported record for ${entry.path}`, { cause });
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
collectInterfaceBuilderResourceKeys = (nodes) => nodes.flatMap((node) => {
|
|
1893
|
+
if (node.kind !== "resource") return [];
|
|
1894
|
+
const source = node.evidence.find((item) => item.artifact_path !== null && item.artifact_sha256 !== null);
|
|
1895
|
+
const sourcePath = source?.artifact_path;
|
|
1896
|
+
const sourceArchiveSha256 = source?.artifact_sha256;
|
|
1897
|
+
if (sourcePath == null || sourceArchiveSha256 == null) return [];
|
|
1898
|
+
return appleResourceKeyFields(node.attributes).flatMap(([field, value]) => [{
|
|
1899
|
+
sourceNodeId: node.id,
|
|
1900
|
+
sourcePath,
|
|
1901
|
+
sourceArchiveSha256,
|
|
1902
|
+
field,
|
|
1903
|
+
key: value
|
|
1904
|
+
}]);
|
|
1905
|
+
});
|
|
1906
|
+
runAssetUtil = async (path, environment, signal) => {
|
|
1907
|
+
try {
|
|
1908
|
+
return (await execFileOutput(ASSETUTIL, ["--info", path], {
|
|
1909
|
+
env: environment,
|
|
1910
|
+
timeout: 6e4,
|
|
1911
|
+
maxBuffer: MAX_CATALOG_BYTES,
|
|
1912
|
+
...signal === undefined ? {} : { signal }
|
|
1913
|
+
})).stdout;
|
|
1914
|
+
} catch (cause) {
|
|
1915
|
+
if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Asset catalog inspection cancelled");
|
|
1916
|
+
const code = typeof cause === "object" && cause !== null && "code" in cause ? cause.code : undefined;
|
|
1917
|
+
throw new ArtifactReaderFailure(code === "ENOENT" ? "unavailable" : code === "ETIMEDOUT" || code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" ? "limit" : "io", `assetutil failed${code === undefined ? "" : ` (${String(code)})`}`, { cause });
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
digestBounded = async (reader, entry, signal) => {
|
|
1921
|
+
if (entry.declaredSize === null || entry.declaredSize > MAX_CATALOG_BYTES) throw new ArtifactReaderFailure("limit", `Asset catalog exceeds ${MAX_CATALOG_BYTES} bytes: ${entry.path}`);
|
|
1922
|
+
const stream = await reader.open(entry, signal);
|
|
1923
|
+
const hash = createHash("sha256");
|
|
1924
|
+
let length = 0;
|
|
1925
|
+
for await (const chunk of stream) {
|
|
1926
|
+
if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Asset catalog inspection cancelled");
|
|
1927
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
1928
|
+
length += bytes.length;
|
|
1929
|
+
if (length > MAX_CATALOG_BYTES) throw new ArtifactReaderFailure("limit", `Asset catalog exceeds byte limit: ${entry.path}`);
|
|
1930
|
+
hash.update(bytes);
|
|
1931
|
+
}
|
|
1932
|
+
return hash.digest("hex");
|
|
1933
|
+
};
|
|
1934
|
+
})))();
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
//#endregion
|
|
1938
|
+
//#region dist/artifacts/ArtifactProvider.js
|
|
1939
|
+
var ArtifactProvider, ArtifactClient, isArtifactOperation, translateArtifactFailure, subjectFor;
|
|
1940
|
+
function init_ArtifactProvider() {
|
|
1941
|
+
return (init_ArtifactProvider = __esmMin((() => {
|
|
1942
|
+
init_snapshotEnvironment();
|
|
1943
|
+
init_AnalysisProvider();
|
|
1944
|
+
init_KeyedArchiveReader();
|
|
1945
|
+
init_DylibResolutionReader();
|
|
1946
|
+
init_ArtifactInventory();
|
|
1947
|
+
init_ArtifactExtraction();
|
|
1948
|
+
init_InterfaceBuilderAnalysis();
|
|
1949
|
+
init_AppleAssetCatalogAnalysis();
|
|
1950
|
+
init_artifactToolContracts();
|
|
1951
|
+
init_binaryTargetTypes();
|
|
1952
|
+
init_analysisErrorCore();
|
|
1953
|
+
init_artifactOperationError();
|
|
1954
|
+
init_interfaceBuilderGraph();
|
|
1955
|
+
init_result();
|
|
1956
|
+
init_ArtifactReader();
|
|
1957
|
+
init_ArtifactResourceScope();
|
|
1958
|
+
init_ArtifactFileOperation();
|
|
1959
|
+
init_ArtifactProviderMetadata();
|
|
1960
|
+
init_InvestigationProviders();
|
|
1961
|
+
init_evidence();
|
|
1962
|
+
init_immutableJson();
|
|
1963
|
+
init_artifactInspection();
|
|
1964
|
+
init_providerCleanupError();
|
|
1965
|
+
ArtifactProvider = class {
|
|
1966
|
+
#capabilities;
|
|
1967
|
+
#platform;
|
|
1968
|
+
environment;
|
|
1969
|
+
constructor(environment, platform = process.platform) {
|
|
1970
|
+
this.environment = snapshotEnvironment(environment, platform);
|
|
1971
|
+
this.#capabilities = artifactCapabilities(platform);
|
|
1972
|
+
this.#platform = platform;
|
|
1973
|
+
}
|
|
1974
|
+
identity() {
|
|
1975
|
+
return ARTIFACT_GRAPH_PROVIDER;
|
|
1976
|
+
}
|
|
1977
|
+
capabilities() {
|
|
1978
|
+
return this.#capabilities;
|
|
1979
|
+
}
|
|
1980
|
+
createClient(target) {
|
|
1981
|
+
return new ArtifactClient(target, this.environment, this.#platform);
|
|
1982
|
+
}
|
|
1983
|
+
};
|
|
1984
|
+
ArtifactClient = class {
|
|
1985
|
+
target;
|
|
1986
|
+
environment;
|
|
1987
|
+
platform;
|
|
1988
|
+
#resourceScope = new ArtifactResourceScope();
|
|
1989
|
+
constructor(target, environment, platform) {
|
|
1990
|
+
this.target = target;
|
|
1991
|
+
this.environment = environment;
|
|
1992
|
+
this.platform = platform;
|
|
1993
|
+
}
|
|
1994
|
+
async execute(operation, parameters, options) {
|
|
1995
|
+
if (operation === "health") return ok(createAnalysisExecution(null, ARTIFACT_GRAPH_PROVIDER));
|
|
1996
|
+
if (!isArtifactOperation(operation)) return err(new AnalysisCapabilityUnavailableError(ARTIFACT_GRAPH_PROVIDER.id, operation, "Operation is not implemented by artifact graph provider."));
|
|
1997
|
+
try {
|
|
1998
|
+
if (operation === "inspect_artifact") {
|
|
1999
|
+
const inspected = await this.inspectArtifact(parameters, options);
|
|
2000
|
+
return inspected;
|
|
2001
|
+
}
|
|
2002
|
+
if (operation === "decode_interface_builder") {
|
|
2003
|
+
if (this.target.kind !== "executable" || this.target.sourcePath === undefined || !this.target.sourcePath.toLowerCase().endsWith(".app")) throw this.unsupportedTarget(operation, "decode_interface_builder requires an active .app bundle target");
|
|
2004
|
+
const limits = interfaceBuilderLimitsSchema.parse(parameters);
|
|
2005
|
+
const result = await analyzeInterfaceBuilderBundle({
|
|
2006
|
+
bundlePath: this.target.sourcePath,
|
|
2007
|
+
targetSha256: this.target.sha256,
|
|
2008
|
+
limits,
|
|
2009
|
+
...options?.signal === undefined ? {} : { signal: options.signal }
|
|
2010
|
+
});
|
|
2011
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2012
|
+
limitations: result.limitations,
|
|
2013
|
+
locations: result.documents.map(({ relative_path: path }) => ({
|
|
2014
|
+
kind: "artifact-path",
|
|
2015
|
+
path
|
|
2016
|
+
}))
|
|
2017
|
+
}));
|
|
2018
|
+
}
|
|
2019
|
+
if (operation === "inspect_keyed_archive") {
|
|
2020
|
+
const standalone = this.target.kind === "artifact" && this.target.format === "plist";
|
|
2021
|
+
if (standalone && parameters.path !== undefined && parameters.path !== "." && parameters.path !== basename(this.target.path)) throw new AnalysisInputError(operation, undefined, [{
|
|
2022
|
+
path: ["path"],
|
|
2023
|
+
reason: "invalid_value",
|
|
2024
|
+
message: "For an active plist, path must select that archive (omit path or use its basename).",
|
|
2025
|
+
expected: basename(this.target.path)
|
|
2026
|
+
}]);
|
|
2027
|
+
const bundlePath = standalone ? dirname(this.target.path) : this.target.sourcePath;
|
|
2028
|
+
if (bundlePath === undefined || !standalone && !bundlePath.toLowerCase().endsWith(".app")) throw this.unsupportedTarget(operation, "inspect_keyed_archive requires an active plist or .app bundle");
|
|
2029
|
+
const result = await inspectBundleKeyedArchive({
|
|
2030
|
+
bundlePath,
|
|
2031
|
+
targetSha256: this.target.sha256,
|
|
2032
|
+
parameters: standalone ? {
|
|
2033
|
+
...parameters,
|
|
2034
|
+
path: basename(this.target.path)
|
|
2035
|
+
} : parameters,
|
|
2036
|
+
platform: this.platform,
|
|
2037
|
+
...options?.signal === undefined ? {} : { signal: options.signal }
|
|
2038
|
+
});
|
|
2039
|
+
if (standalone && result.archive_sha256 !== this.target.sha256) throw new ArtifactReaderFailure("integrity", `Active archive digest changed: expected ${this.target.sha256}, observed ${result.archive_sha256}`);
|
|
2040
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2041
|
+
limitations: result.limitations,
|
|
2042
|
+
locations: [{
|
|
2043
|
+
kind: "artifact-path",
|
|
2044
|
+
path: result.archive_path
|
|
2045
|
+
}]
|
|
2046
|
+
}));
|
|
2047
|
+
}
|
|
2048
|
+
if (operation === "inspect_asset_catalog") {
|
|
2049
|
+
return await this.inspectAssetCatalog(parameters, options);
|
|
2050
|
+
}
|
|
2051
|
+
if (operation === "trace_dylib_resolution") return await this.traceDylibResolution(parameters, options);
|
|
2052
|
+
if (operation === "extract_artifact") {
|
|
2053
|
+
const parsed = artifactExtractionExecutionSchema.parse(parameters);
|
|
2054
|
+
const result = await extractArtifact({
|
|
2055
|
+
inputPath: this.target.sourcePath ?? this.target.path,
|
|
2056
|
+
inputFormat: this.target.format,
|
|
2057
|
+
outputRoot: parsed.output_root,
|
|
2058
|
+
environment: this.environment,
|
|
2059
|
+
integrityPolicy: parsed.integrity_policy,
|
|
2060
|
+
resourceScope: this.#resourceScope
|
|
2061
|
+
}, options?.signal);
|
|
2062
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2063
|
+
rawResult: null,
|
|
2064
|
+
limitations: result.limitations,
|
|
2065
|
+
subject: subjectFor(this.target.sourcePath ?? this.target.path, result.manifest),
|
|
2066
|
+
locations: []
|
|
2067
|
+
}));
|
|
2068
|
+
}
|
|
2069
|
+
const parsed = artifactInventoryInputSchema.parse(parameters);
|
|
2070
|
+
const result = await this.inventory(parsed, options);
|
|
2071
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2072
|
+
rawResult: null,
|
|
2073
|
+
limitations: result.limitations,
|
|
2074
|
+
subject: subjectFor(this.target.sourcePath ?? this.target.path, result.manifest),
|
|
2075
|
+
locations: []
|
|
2076
|
+
}));
|
|
2077
|
+
} catch (cause) {
|
|
2078
|
+
return err(translateArtifactFailure(operation, cause));
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
close() {
|
|
2082
|
+
return this.#resourceScope.close().then(() => ok(null), (cause) => {
|
|
2083
|
+
const failure = cause instanceof ArtifactReaderFailure ? cause : undefined;
|
|
2084
|
+
const error = new ProviderCleanupError(ARTIFACT_GRAPH_PROVIDER.id, failure?.cleanup?.resources ?? ["artifact resources"], { reason: failure?.cleanup?.reason ?? (cause instanceof Error ? cause.message : String(cause)) }, {
|
|
2085
|
+
cause,
|
|
2086
|
+
operation: "close_binary"
|
|
2087
|
+
});
|
|
2088
|
+
bindArtifactFileCleanup(cause, error);
|
|
2089
|
+
return err(error);
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
/** The active target's kind is outside this operation's supported targets. */
|
|
2093
|
+
unsupportedTarget(operation, reason) {
|
|
2094
|
+
return new AnalysisUnsupportedTargetError(operation, this.target.sourcePath ?? this.target.path, reason);
|
|
2095
|
+
}
|
|
2096
|
+
async inspectAssetCatalog(parameters, options) {
|
|
2097
|
+
const bundlePath = this.target.sourcePath;
|
|
2098
|
+
if (this.target.kind !== "executable" || bundlePath === undefined || !bundlePath.toLowerCase().endsWith(".app")) throw this.unsupportedTarget("inspect_asset_catalog", "inspect_asset_catalog requires an active .app bundle target");
|
|
2099
|
+
const result = await analyzeAppleAssetCatalogs({
|
|
2100
|
+
environment: this.environment,
|
|
2101
|
+
bundlePath,
|
|
2102
|
+
targetSha256: this.target.sha256,
|
|
2103
|
+
page: parameters,
|
|
2104
|
+
...options?.signal === undefined ? {} : { signal: options.signal }
|
|
2105
|
+
});
|
|
2106
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2107
|
+
limitations: result.limitations,
|
|
2108
|
+
locations: result.catalogs.map(({ path }) => ({
|
|
2109
|
+
kind: "artifact-path",
|
|
2110
|
+
path
|
|
2111
|
+
}))
|
|
2112
|
+
}));
|
|
2113
|
+
}
|
|
2114
|
+
async traceDylibResolution(parameters, options) {
|
|
2115
|
+
if (this.target.kind !== "executable" || !isMachOFormat(this.target.format)) throw this.unsupportedTarget("trace_dylib_resolution", "trace_dylib_resolution requires an active Mach-O or .app bundle target");
|
|
2116
|
+
const bundle = this.target.bundleInfoPlist === undefined ? undefined : this.target.sourcePath;
|
|
2117
|
+
const result = await traceDylibResolution({
|
|
2118
|
+
rootPath: bundle ?? dirname(this.target.path),
|
|
2119
|
+
targetPath: this.target.path,
|
|
2120
|
+
targetSha256: this.target.sha256,
|
|
2121
|
+
enumerateRoots: bundle !== undefined,
|
|
2122
|
+
parameters,
|
|
2123
|
+
resourceScope: this.#resourceScope,
|
|
2124
|
+
...options?.signal === undefined ? {} : { signal: options.signal }
|
|
2125
|
+
});
|
|
2126
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2127
|
+
limitations: result.limitations,
|
|
2128
|
+
locations: result.images.map(({ path }) => ({
|
|
2129
|
+
kind: "artifact-path",
|
|
2130
|
+
path
|
|
2131
|
+
}))
|
|
2132
|
+
}));
|
|
2133
|
+
}
|
|
2134
|
+
async inspectArtifact(parameters, options) {
|
|
2135
|
+
const parsed = artifactInventoryInputSchema.parse(parameters);
|
|
2136
|
+
const inventoryParameters = { integrity_policy: parsed.integrity_policy };
|
|
2137
|
+
await options?.progress?.report({
|
|
2138
|
+
phase: "inspect_artifact.inventory",
|
|
2139
|
+
completed: 0,
|
|
2140
|
+
total: 1,
|
|
2141
|
+
message: "inventory substep started"
|
|
2142
|
+
});
|
|
2143
|
+
const inventory = freezeJsonSnapshot(await this.inventory(inventoryParameters, options));
|
|
2144
|
+
const subject = subjectFor(this.target.sourcePath ?? this.target.path, inventory.manifest);
|
|
2145
|
+
const inventoryEvidence = createEvidence(subject, ARTIFACT_GRAPH_PROVIDER, {
|
|
2146
|
+
operation: "inventory_artifact",
|
|
2147
|
+
parameters: inventoryParameters,
|
|
2148
|
+
result: inventory,
|
|
2149
|
+
rawResult: null,
|
|
2150
|
+
limitations: inventory.limitations,
|
|
2151
|
+
locations: []
|
|
2152
|
+
});
|
|
2153
|
+
const result = freezeJsonSnapshot(createArtifactInspection(inventoryEvidence));
|
|
2154
|
+
await options?.progress?.report({
|
|
2155
|
+
phase: "inspect_artifact.inventory",
|
|
2156
|
+
completed: 1,
|
|
2157
|
+
total: 1,
|
|
2158
|
+
message: "inventory substep completed"
|
|
2159
|
+
});
|
|
2160
|
+
return ok(createAnalysisExecution(result, ARTIFACT_GRAPH_PROVIDER, {
|
|
2161
|
+
rawResult: null,
|
|
2162
|
+
limitations: result.limitations,
|
|
2163
|
+
subject,
|
|
2164
|
+
locations: []
|
|
2165
|
+
}));
|
|
2166
|
+
}
|
|
2167
|
+
inventory(parsed, options) {
|
|
2168
|
+
return inventoryArtifact(this.target.sourcePath ?? this.target.path, {
|
|
2169
|
+
resourceScope: this.#resourceScope,
|
|
2170
|
+
environment: this.environment,
|
|
2171
|
+
...options?.signal === undefined ? {} : { signal: options.signal },
|
|
2172
|
+
integrity: { mode: parsed.integrity_policy }
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
};
|
|
2176
|
+
isArtifactOperation = (operation) => ARTIFACT_ANALYSIS_OPERATIONS.includes(operation);
|
|
2177
|
+
translateArtifactFailure = (operation, cause) => {
|
|
2178
|
+
if (cause instanceof ArtifactReaderFailure) {
|
|
2179
|
+
const error = new ArtifactOperationError(operation, cause.reason, cause.details, cause.message, {
|
|
2180
|
+
cause: cause.reason === "cancelled" ? artifactFileCancellationCause(cause) : cause,
|
|
2181
|
+
...cause.cleanup === undefined ? {} : { cleanup: cause.cleanup },
|
|
2182
|
+
...cause.partialObservation === undefined ? {} : { partialObservation: cause.partialObservation }
|
|
2183
|
+
});
|
|
2184
|
+
bindArtifactFileCleanup(cause, error);
|
|
2185
|
+
return error;
|
|
2186
|
+
}
|
|
2187
|
+
if (cause instanceof AnalysisInputError || cause instanceof AnalysisCancelledError || cause instanceof AnalysisUnsupportedTargetError) return cause;
|
|
2188
|
+
return new ArtifactOperationError(operation, "io");
|
|
2189
|
+
};
|
|
2190
|
+
subjectFor = (path, manifest) => ({
|
|
2191
|
+
path,
|
|
2192
|
+
sha256: manifest.root_sha256,
|
|
2193
|
+
format: manifest.root_format
|
|
2194
|
+
});
|
|
2195
|
+
})))();
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
//#endregion
|
|
2199
|
+
init_ArtifactProvider();
|
|
2200
|
+
export { ArtifactProvider };
|