rea-agents 6.5.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/README.md +12 -3
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/bridge/android/ReaJadxBridge.java +167 -23
- package/bridge/cutter/rea_bridge.py +19 -10
- package/bridge/ghidra/ReaGhidraBridge.java +98 -66
- package/bridge/hopper_bridge.py +9 -1
- package/bridge/native/rea_lldb_tracer.py +48 -4
- package/bridge/pwndbg/core_context.py +15 -2
- package/dist/adb/AdbCommand.js +148 -0
- package/dist/adb/AdbConfiguration.js +26 -4
- package/dist/adb/AdbInputSnapshot.js +126 -0
- package/dist/adb/AdbProvider.js +765 -248
- package/dist/adb/AdbShellOutput.js +92 -21
- package/dist/android/AndroidTargetSnapshot.js +7 -7
- package/dist/android/JadxAnalysis.js +27 -32
- package/dist/android/JadxConfiguration.js +173 -125
- package/dist/android/JadxDoctor.js +11 -3
- 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 +48 -15
- package/dist/android/JadxProtocol.js +29 -2
- package/dist/android/JadxProvider.js +171 -96
- package/dist/android/JadxRelease.js +5 -1
- package/dist/android/JadxSession.js +35 -14
- package/dist/apktool/ApktoolCommandCleanup.js +134 -0
- package/dist/apktool/ApktoolCommandOutput.js +22 -0
- package/dist/apktool/ApktoolConfiguration.js +162 -44
- package/dist/apktool/ApktoolDecodeOutput.js +29 -23
- package/dist/apktool/ApktoolDecodedInventory.js +52 -0
- package/dist/apktool/ApktoolProvider.js +254 -335
- package/dist/apktool/ApktoolStringTables.js +178 -0
- package/dist/apktool/ApktoolWorkspace.js +162 -0
- package/dist/application/AnalysisDocument.js +19 -4
- package/dist/application/AnalysisProvider.js +15 -1
- package/dist/application/AppBundleExecutable.js +11 -4
- package/dist/application/BinaryTargetResolver.js +9 -2
- package/dist/application/BrowserObservationService.js +54 -20
- package/dist/application/BrowserScenarioCaptureService.js +26 -6
- package/dist/application/CapabilityInventory.js +14 -8
- package/dist/application/ClaudeDesktopConfigLocation.js +5 -5
- package/dist/application/ClientConfigurationCleanup.js +73 -0
- package/dist/application/ClientConfigurationDocument.js +170 -128
- package/dist/application/ClientConfigurationPublication.js +167 -0
- package/dist/application/ClientRegistrationEnvironment.js +31 -1
- package/dist/application/ClientRegistrationIdentity.js +54 -39
- package/dist/application/ClientRegistrationStatus.js +123 -48
- package/dist/application/DirectAnalysis.js +15 -2
- package/dist/application/DirectAnalysisCleanup.js +5 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +83 -9
- package/dist/application/DoctorDiagnostics.js +25 -4
- package/dist/application/DoctorProviderIds.js +7 -1
- package/dist/application/DshCordisPatch.js +1 -1
- package/dist/application/EnhancedTools.js +9 -21
- package/dist/application/HermesClientHome.js +20 -0
- package/dist/application/HermesConfigurationYaml.js +43 -3
- package/dist/application/HopperDownload.js +11 -3
- package/dist/application/HopperReleaseFeed.js +71 -0
- package/dist/application/InvestigationProviders.js +4 -3
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LinuxHopper.js +96 -71
- package/dist/application/LinuxHopperPublisher.js +656 -0
- package/dist/application/MacHopper.js +182 -66
- package/dist/application/MipsElfMetadata.js +1 -1
- package/dist/application/MsixPackageStorage.js +13 -6
- package/dist/application/ProviderOperationExecution.js +13 -20
- package/dist/application/ReconstructionObligationCandidates.js +17 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +4 -0
- package/dist/application/ReconstructionObligationLedgerService.js +5 -3
- package/dist/application/ReconstructionObligationOriginalCases.js +8 -0
- package/dist/application/ReferenceSourceImportEntries.js +160 -18
- package/dist/application/ReferenceSourceImportPolicy.js +5 -3
- package/dist/application/ReferenceSourceVcsAdapter.js +3 -1
- package/dist/application/RegularFileRead.js +107 -88
- package/dist/application/Setup.js +23 -11
- package/dist/application/SetupClientConfiguration.js +155 -89
- package/dist/application/SetupClients.js +22 -13
- package/dist/application/SetupHost.js +90 -34
- package/dist/application/SetupInstallFailure.js +18 -3
- package/dist/application/SetupPlan.js +15 -5
- package/dist/application/SetupRecoveryBackup.js +40 -13
- package/dist/application/SetupRegistrationEnvironment.js +12 -0
- package/dist/application/SetupSkill.js +10 -30
- package/dist/application/SourceLimitations.js +35 -0
- package/dist/application/SupportedClients.js +4 -4
- package/dist/application/Uninstall.js +91 -36
- package/dist/application/UpdateCommandProgress.js +66 -0
- package/dist/application/UpdateMaintenance.js +7 -2
- package/dist/application/UpdateRuntime.js +60 -30
- package/dist/application/WebModuleTraceService.js +35 -22
- package/dist/application/WebNetworkCaptureService.js +8 -5
- package/dist/application/WebRuntimeService.js +41 -8
- package/dist/application/WebScriptExportService.js +6 -4
- package/dist/application/WebSourceLocationService.js +3 -4
- package/dist/application/WorkflowEvidence.js +11 -4
- package/dist/application/analysisView/AnalysisViewService.js +9 -52
- package/dist/application/android/AndroidAnalysisService.js +5 -4
- package/dist/application/android/AndroidSearchEvidenceSummary.js +6 -8
- package/dist/application/artifacts/ArtifactComparisonEvidence.js +32 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +14 -11
- package/dist/application/binary/AnalysisProviderRegistry.js +340 -50
- package/dist/application/binary/BinarySession.js +73 -34
- package/dist/application/binary/BinarySessionRecords.js +3 -0
- package/dist/application/binary/BinarySessionStatus.js +3 -4
- package/dist/application/binary/CompositeProvider.js +75 -30
- package/dist/application/binary/LazyAnalysisProvider.js +6 -68
- package/dist/application/binary/SessionProviderRouter.js +11 -2
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +3 -4
- package/dist/application/binaryDiagnostics/PeResourcesService.js +22 -5
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +3 -4
- package/dist/application/captures/PacketCaptureService.js +3 -2
- package/dist/application/closeOwnedWebResources.js +32 -2
- package/dist/application/electron/ElectronFuseService.js +8 -43
- package/dist/application/evm/EvmInterfaceEvidence.js +11 -0
- package/dist/application/evm/EvmInterfaceService.js +4 -15
- package/dist/application/firmware/FirmwareAnalysisService.js +4 -3
- package/dist/application/go/GoBinaryService.js +4 -5
- package/dist/application/investigation/EvidenceLedger.js +3 -4
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +14 -2
- package/dist/application/javascript/ElectronEvidence.js +1 -2
- package/dist/application/javascript/ElectronObservationService.js +41 -7
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +6 -0
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +35 -17
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +30 -1
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +3 -2
- package/dist/application/javascript/JavaScriptArtifactGraphEvidence.js +3 -3
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +41 -11
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +18 -8
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +84 -24
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +15 -3
- package/dist/application/javascript/JavaScriptModuleRelationships.js +1 -1
- package/dist/application/javascript/JavaScriptRuntimeObservationEvidence.js +1 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +33 -10
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +103 -24
- 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/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/native/NativeCallRoutes.js +40 -23
- package/dist/application/native/NativeUiActionTrace.js +8 -0
- package/dist/application/native/NativeValueTrace.js +8 -0
- package/dist/application/reverse/ReverseEngineeringService.js +2 -2
- package/dist/application/rust/RustBinaryService.js +6 -4
- package/dist/application/signals/SignalRecordingService.js +3 -2
- package/dist/application/wasm/WasmArtifactService.js +4 -5
- package/dist/artifacts/AnalysisCleanupLease.js +119 -0
- package/dist/artifacts/ArtifactFileOperation.js +150 -0
- package/dist/artifacts/ArtifactHash.js +2 -1
- package/dist/artifacts/ArtifactProvider.js +16 -5
- package/dist/artifacts/ArtifactReader.js +50 -4
- package/dist/artifacts/ArtifactResourceScope.js +80 -6
- package/dist/artifacts/AsarArtifactReader.js +12 -11
- package/dist/artifacts/AsarEntryStream.js +49 -17
- package/dist/artifacts/DirectoryArtifactReader.js +28 -7
- package/dist/artifacts/MachOSliceArtifactReader.js +70 -13
- package/dist/artifacts/NativeDmgArtifactReader.js +112 -13
- package/dist/artifacts/SafeOutputTree.js +5 -3
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +1 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +10 -16
- package/dist/artifacts/ZipArtifactReader.js +34 -14
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +3 -1
- package/dist/artifacts/apple/DylibFileAccess.js +106 -0
- package/dist/artifacts/apple/DylibResolutionReader.js +64 -155
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +52 -9
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +25 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +20 -11
- package/dist/artifacts/apple/MachoLoadCommandReader.js +17 -2
- package/dist/artifacts/apple/PlistNumberLiterals.js +104 -116
- package/dist/artifacts/extraction/ArtifactExtraction.js +15 -12
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +9 -11
- package/dist/artifacts/inventory/ArtifactInventory.js +2 -2
- package/dist/artifacts/inventory/classify.js +4 -2
- package/dist/artifacts/inventory/hashStableRootArtifact.js +14 -7
- package/dist/artifacts/inventory/scanCanonical.js +3 -4
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +3 -1
- package/dist/artifacts/readArtifactFileChunks.js +9 -0
- package/dist/artifacts/readStableArtifact.js +12 -34
- package/dist/browser/BrowserScenarioPartialObservation.js +14 -48
- package/dist/browser/CdpBrowserProvider.js +81 -30
- package/dist/browser/CdpCaptureDocuments.js +99 -131
- package/dist/browser/CdpCaptureDomSvg.js +31 -60
- package/dist/browser/CdpCaptureValues.js +12 -0
- package/dist/browser/CdpConnection.js +133 -27
- package/dist/browser/CdpElectronInspection.js +60 -60
- package/dist/browser/CdpElectronProvider.js +56 -4
- package/dist/browser/CdpElectronScriptEvents.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -5
- package/dist/browser/CdpElectronWorkers.js +13 -2
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpPageCaptureScripts.js +14 -10
- package/dist/browser/CdpPageCaptureWorkers.js +45 -14
- package/dist/browser/CdpSafeMetadata.js +23 -19
- package/dist/browser/CdpSnapshotNodes.js +103 -0
- package/dist/browser/CdpSnapshotStrings.js +0 -6
- package/dist/browser/CdpTargetSession.js +52 -10
- package/dist/browser/CdpTargetSessionOwner.js +198 -0
- package/dist/browser/ElectronCaptureCleanup.js +82 -0
- package/dist/browser/ElectronProcessCleanup.js +91 -0
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +71 -16
- package/dist/browser/PlaywrightElectronActiveActions.js +53 -5
- package/dist/browser/PlaywrightElectronActiveFuses.js +86 -0
- package/dist/browser/PlaywrightElectronActiveProjection.js +5 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +140 -151
- package/dist/browser/PlaywrightExecutionBoundary.js +4 -2
- package/dist/browser/PlaywrightScenarioBrowser.js +236 -90
- package/dist/browser/PlaywrightScenarioEvents.js +135 -48
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +121 -34
- package/dist/browser/PlaywrightScenarioSession.js +95 -22
- 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 +19 -10
- package/dist/browser/assets/WebArtifactReads.js +6 -2
- package/dist/browser/assets/WebSourceLocationArtifacts.js +12 -3
- package/dist/browser/execution/CdpRuntimeSession.js +36 -7
- package/dist/browser/execution/CdpWebRuntimeProvider.js +22 -4
- package/dist/browser/history/CaptureFailures.js +7 -2
- package/dist/browser/history/HarCapture.js +42 -11
- package/dist/browser/history/SazMetadata.js +10 -47
- package/dist/browser/modules/NativeModuleResolver.js +108 -58
- package/dist/browser/modules/WebModuleArtifacts.js +12 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +40 -17
- package/dist/browser/network/PlaywrightScenarioNetwork.js +182 -73
- package/dist/captures/TsharkCaptureProvider.js +13 -6
- package/dist/catalogIdentity.js +19 -14
- package/dist/cli/adbCommands.js +18 -19
- package/dist/cli/androidCommands.js +2 -14
- package/dist/cli/apktoolCommands.js +4 -14
- package/dist/cli/binaryDiagnosticsCommands.js +5 -5
- package/dist/cli/browserAdvancedCommands.js +11 -4
- package/dist/cli/browserCommands.js +21 -12
- package/dist/cli/captureCommands.js +4 -4
- package/dist/cli/cliResultOutput.js +175 -89
- package/dist/cli/coreBinaryCommands.js +4 -3
- package/dist/cli/cutterCommands.js +51 -13
- package/dist/cli/electronCommands.js +34 -13
- package/dist/cli/evmCommands.js +6 -15
- package/dist/cli/finishAnalysisCommand.js +10 -2
- package/dist/cli/firmwareCommands.js +6 -14
- package/dist/cli/flutterCommands.js +2 -18
- package/dist/cli/fridaCommands.js +8 -0
- package/dist/cli/goCommands.js +2 -2
- package/dist/cli/javascriptRecoveryCommands.js +14 -26
- package/dist/cli/jebCommands.js +2 -14
- package/dist/cli/options.js +6 -0
- package/dist/cli/pcapCommands.js +2 -20
- package/dist/cli/rustCommands.js +6 -7
- package/dist/cli/setupCommands.js +4 -3
- package/dist/cli/signalCommands.js +4 -4
- package/dist/cli/sqliteCommands.js +17 -44
- package/dist/cli/wasmCommands.js +7 -18
- package/dist/cli/webModuleCommands.js +19 -34
- package/dist/cli/webNetworkCaptureCommands.js +3 -2
- 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-D0Us2OTk.js → AnalysisProvider-BGrYaMVo.js} +14 -3
- package/dist/cli-runtime/{AnalysisSnapshotCache-BXS0wRd2.js → AnalysisSnapshotCache-BjRlXeUS.js} +14 -13
- package/dist/cli-runtime/ArtifactFileOperation-Dg4BcoEM.js +122 -0
- package/dist/cli-runtime/{ArtifactReader-BXkffc1D.js → ArtifactReader-DMwm42bk.js} +29 -6
- package/dist/cli-runtime/ArtifactResourceScope-CokZGcII.js +175 -0
- package/dist/cli-runtime/{AsarHeader-CnzOzYEH.js → AsarHeader-BxwU17DJ.js} +1 -1
- package/dist/cli-runtime/{BinarySessionStatus-DnMxMk-r.js → BinarySessionStatus-DRhjr7Vb.js} +4 -3
- package/dist/cli-runtime/{BinaryTargetResolver-CVIJ_s1A.js → BinaryTargetResolver-tuCTjBlQ.js} +38 -108
- package/dist/cli-runtime/{BoundedFileBytes-BU30odTm.js → BoundedFileBytes-DRtiQNAQ.js} +7 -3
- package/dist/cli-runtime/{CdpTargetSession-DGX5pV9w.js → CdpTargetSession-CQ08KHbh.js} +318 -43
- package/dist/cli-runtime/ClientConfigPath-Dn-V_GUf.js +255 -0
- package/dist/cli-runtime/{ClientConfigurationDocument-ffQ9X0Se.js → ClientConfigurationDocument-C9T8MNGc.js} +206 -142
- package/dist/cli-runtime/{ClientRegistrationStatus-DszCyPEU.js → ClientRegistrationStatus-PnD29RTX.js} +112 -36
- package/dist/cli-runtime/{CurrentEntrypointPath-D5FRNdkq.js → CurrentEntrypointPath-m7QCIVN0.js} +1 -1
- package/dist/cli-runtime/{DirectAnalysis-BgvAtpN3.js → DirectAnalysis-C5NyUryV.js} +76 -23
- package/dist/cli-runtime/DirectoryArtifactReader-CokAJ8vo.js +448 -0
- package/dist/cli-runtime/{Doctor-DIpf_I7N.js → Doctor-DrkWsav4.js} +105 -25
- package/dist/cli-runtime/{ElectronFileScope-dpHm2nrS.js → ElectronFileScope-AP7VoVr7.js} +204 -149
- package/dist/cli-runtime/ElectronFuseFailures-DsjXR7Xp.js +609 -0
- package/dist/cli-runtime/{ExecFileOutput-BEQs-lDD.js → ExecFileOutput-D6KLYTve.js} +11 -9
- package/dist/cli-runtime/{InterfaceBuilderDecodeBudget-D4omRUe4.js → InterfaceBuilderDecodeBudget-CW1IO3dG.js} +40 -21
- package/dist/cli-runtime/{InventoryProjectionEvidence-DIsI4DJ6.js → InventoryProjectionEvidence-DTH5QAqL.js} +3 -3
- package/dist/cli-runtime/{InvestigationProviders-DoQRIHii.js → InvestigationProviders-CFh4a64d.js} +3 -2
- package/dist/cli-runtime/{JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js → JavaScriptApplicationEvidenceGraph-gOmPB2L6.js} +6 -6
- package/dist/cli-runtime/{JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js → JavaScriptApplicationWorkflowEvidence-WZgtK_Ok.js} +2 -2
- package/dist/cli-runtime/JebMcpEndpoint-BEalGZh9.js +710 -0
- package/dist/cli-runtime/{JsonFiles-DQa1PRKy.js → JsonFiles-uvd6ZyQi.js} +10 -118
- package/dist/cli-runtime/KunaInstallation-P0j3x851.js +1781 -0
- package/dist/cli-runtime/MacHopperPaths-bGzqjF1Z.js +34 -0
- package/dist/cli-runtime/{MachoLoadCommandReader-C7e074Ze.js → MachoLoadCommandReader-CZm6N5vF.js} +12 -192
- package/dist/cli-runtime/{ManagedSnapshot-rqyBHcdL.js → ManagedSnapshot-CPE9C3OD.js} +406 -110
- 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-DAy0PiBM.js → PrivateRuntimeRoot-Cd23u6jd.js} +39 -6
- package/dist/cli-runtime/ProcessOwnership-CtrNr6ee.js +545 -0
- package/dist/cli-runtime/{ProcessOwnership-DXC5-UWt.js → ProcessOwnershipObservation-C006iCtZ.js} +149 -607
- package/dist/cli-runtime/{ProviderDeadline-8m2pFRDc.js → ProviderDeadline-rSuH4Pm8.js} +27 -1
- package/dist/cli-runtime/ProviderOperationExecution-CmU-XrQr.js +38 -0
- package/dist/cli-runtime/{snapshotEnvironment-D_tWyOub.js → ProviderProcess-D87A7ctp.js} +117 -160
- package/dist/cli-runtime/RegularFileRead-mbgGYtxe.js +125 -0
- package/dist/cli-runtime/{SafeOutputTree-D6U15GXd.js → SafeOutputTree-i904hd_2.js} +21 -20
- package/dist/cli-runtime/{SetupHost-FkYWswsq.js → SetupHost-CMPmPraB.js} +365 -195
- package/dist/cli-runtime/SharedStartupAttempt-BxKyf3Uv.js +1424 -0
- package/dist/cli-runtime/StableFileHash-Ame_h3lY.js +61 -0
- package/dist/cli-runtime/{SupportedClients-DaX6Lt2d.js → SupportedClients-DMafjitv.js} +89 -72
- package/dist/cli-runtime/{Update-CbTC_eg1.js → Update-DAsASWlE.js} +1 -1
- package/dist/cli-runtime/{AbortablePromise-BVBemxbD.js → WindowsBatchCommand-Cx9kaVNf.js} +2 -28
- package/dist/cli-runtime/WindowsNativeLoader-BqyZO0ZD.js +142 -0
- package/dist/cli-runtime/{ZipArtifactReader-B8ZgNe4D.js → ZipArtifactReader-Jed69LEL.js} +20 -16
- package/dist/cli-runtime/{analysisErrorCleanup-Do6YeeoD.js → analysisErrorCleanup-COdAmDsb.js} +4 -3
- package/dist/cli-runtime/{appleArchiveFormat-tVoI2ykA.js → appleArchiveFormat-Bb3G5CCI.js} +13 -7
- package/dist/cli-runtime/{application__DirectAnalysisStatus-DpOejOf0.js → application__DirectAnalysisStatus-F74bu9oy.js} +10 -10
- package/dist/cli-runtime/{application__EnhancedTools-oFE2bOjs.js → application__EnhancedTools-Bg51b0Yp.js} +84 -51
- package/dist/cli-runtime/{application__FunctionAnalysisEvidence-B6osuhvW.js → application__FunctionAnalysisEvidence-DBWIaYCh.js} +3 -3
- package/dist/cli-runtime/{application__ReconstructionCoverageService-DN3wTFQj.js → application__ReconstructionCoverageService-AEPNpZqJ.js} +3 -3
- package/dist/cli-runtime/{application__ReconstructionObligationLedgerService-CKcTppX9.js → application__ReconstructionObligationLedgerService-Cl9cPEZf.js} +22 -9
- package/dist/cli-runtime/{application__Setup-XpMaRNjy.js → application__Setup-DwQzEewK.js} +30 -18
- package/dist/cli-runtime/{application__Uninstall-_23pU2yB.js → application__Uninstall-BOf9oyvQ.js} +78 -37
- package/dist/cli-runtime/{application__UpdateRuntime-DPvY8ohd.js → application__UpdateRuntime-CzWkRJHa.js} +119 -29
- package/dist/cli-runtime/{application__android__AndroidApplicationService-CFgIFPM4.js → application__android__AndroidApplicationService-shW_aKlj.js} +3 -3
- package/dist/cli-runtime/{application__apple__AppleApplicationService-Db6QCsun.js → application__apple__AppleApplicationService-DIv6d3wB.js} +3 -3
- package/dist/cli-runtime/{application__harmony__HarmonyApplicationService-CFjocHoK.js → application__harmony__HarmonyApplicationService-OIUFVQFV.js} +3 -3
- package/dist/cli-runtime/{application__javascript__ElectronActiveObservationService-CmVDUI_Z.js → application__javascript__ElectronActiveObservationService-wvCh72hK.js} +3 -3
- package/dist/cli-runtime/application__javascript__ElectronObservationService-SydXPCwM.js +88 -0
- package/dist/cli-runtime/{application__javascript__JavaScriptApplicationService-CCkp8KBh.js → application__javascript__JavaScriptApplicationService-o0uEsjEc.js} +1120 -316
- package/dist/cli-runtime/{application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js → application__javascript__JavaScriptApplicationWorkflowService-BAheG_71.js} +51 -44
- package/dist/cli-runtime/{application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js → application__javascript__JavaScriptRuntimeReconciliationService-Cnn4GP8q.js} +5 -5
- package/dist/cli-runtime/{application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js → application__javascript__JavaScriptSemanticTraceService-CmvLfV1A.js} +6 -6
- package/dist/cli-runtime/{artifacts__ArtifactProvider-zXI0QjSL.js → artifacts__ArtifactProvider-wx2K0F2I.js} +377 -359
- package/dist/cli-runtime/{binary-BVOr2mgE.js → binary-CWVNJhAC.js} +8561 -3159
- package/dist/cli-runtime/{catalogIdentity-DLoXgfIR.js → catalogIdentity-DAEEsOdX.js} +260 -81
- package/dist/cli-runtime/cli.js +6177 -3556
- package/dist/cli-runtime/{cliOutput-BC1BdAcB.js → cliOutput-CgSuw782.js} +47 -6
- package/dist/cli-runtime/cliOutput.js +2 -2
- package/dist/cli-runtime/cliResultOutput-10sd6xGx.js +1453 -0
- package/dist/cli-runtime/cliResultOutput.js +2 -1
- package/dist/cli-runtime/{composition__browserScenario-DHXC1a8n.js → composition__browserScenario-BtPb1c1y.js} +843 -356
- package/dist/cli-runtime/{composition__electronObservation-GecK2EID.js → composition__electronObservation-Bk8R6DJo.js} +128 -69
- package/dist/cli-runtime/{composition__electronScenario-CEZnVrAL.js → composition__electronScenario-BVF0qStH.js} +398 -135
- package/dist/cli-runtime/{cutterToolContracts-TZH9EHr5.js → cutterToolContracts-BQtG_Nzo.js} +195 -62
- package/dist/cli-runtime/{doctorRuntime-BE5ZX8it.js → doctorRuntime-B__SIpm-.js} +241 -21
- package/dist/cli-runtime/{dotnet__ManagedStaticProvider-C8_yZCDc.js → dotnet__ManagedStaticProvider-DO5Yzcp4.js} +1 -1
- package/dist/cli-runtime/{errorSchemas-CTRmvMl3.js → errorSchemas-Ixz_q7qt.js} +58 -4
- package/dist/cli-runtime/homeDirectory-DC_DeJIg.js +18 -0
- package/dist/cli-runtime/{javascriptApplicationAnalysis-HgMzVMQw.js → javascriptApplicationAnalysis-Dk6yBV8g.js} +688 -668
- package/dist/cli-runtime/{javascriptExportReturnShapeProjection-Dg00g35t.js → javascriptExportReturnShapeProjection-CObOIiQ6.js} +3 -3
- package/dist/cli-runtime/{javascriptExportShapeComparisonSchemas-BYnoIqIk.js → javascriptExportShapeComparisonSchemas-DpwuBenh.js} +5 -3
- package/dist/cli-runtime/{javascriptRuntimeReconciliation-DNjDoL3S.js → javascriptRuntimeReconciliation-C6ZgWMys.js} +61 -59
- package/dist/cli-runtime/{javascriptRuntimeReconciliationSchemas-BWpGWNcI.js → javascriptRuntimeReconciliationSchemas-D6tZKUQs.js} +2 -2
- package/dist/cli-runtime/{javascriptSemanticTraceSchemas-BTCNcvbc.js → javascriptSemanticTraceSchemas-C7m0b6_w.js} +3 -3
- package/dist/cli-runtime/{lipo-DSWP6fv-.js → lipo-DPQ6qurH.js} +9 -11
- package/dist/cli-runtime/{logger-CQQCI4a2.js → logger-BuDJ9xxO.js} +2 -2
- package/dist/cli-runtime/{machoContainer-C8BIkkq3.js → machoContainer-Cy98bkFm.js} +180 -0
- package/dist/cli-runtime/{managedApplicationGraph-B08jb3jq.js → managedApplicationGraph-BazVqpJv.js} +16 -10
- package/dist/cli-runtime/{managedToolContracts-D60QmIYj.js → managedToolContracts-BuFkMBH5.js} +2 -2
- package/dist/cli-runtime/mcpDoctor.js +8 -6
- package/dist/cli-runtime/mcpStartupPolicy-imCbM3qo.js +28 -0
- package/dist/cli-runtime/{native__NativeMacOSProvider-YBTvUeJO.js → native__NativeMacOSProvider-DTcRhuGA.js} +1384 -757
- package/dist/cli-runtime/{officialToolContracts-CCFF0an9.js → officialToolContracts-CzzVLx8I.js} +74 -53
- package/dist/cli-runtime/peMachine-B9ggfSJJ.js +95 -0
- package/dist/cli-runtime/propertyListKeys-D5dSASEy.js +355 -0
- package/dist/cli-runtime/{providerCleanupError-Ceq8f0wK.js → providerCleanupError-BhsJyAhk.js} +3 -5
- package/dist/cli-runtime/readArtifactFileChunks-BbTL_PtB.js +129 -0
- package/dist/cli-runtime/{reconstructionObligationLedgerSchemas-Bao0xMr-.js → reconstructionObligationLedgerSchemas-Bi6sect1.js} +6329 -3651
- package/dist/cli-runtime/{scanCanonical-KP4T9jSl.js → scanCanonical-CcDFUr-w.js} +233 -363
- package/dist/cli-runtime/snapshotEnvironment-Yvx5qwsl.js +196 -0
- package/dist/cli-runtime/{toolContracts-D2FOG_Nb.js → toolContracts-CJzEyZ38.js} +126 -52
- package/dist/cli-runtime/{toolOutputSchemaGroups-DRiYs1je.js → toolOutputSchemaGroups-BqdSzySu.js} +768 -589
- package/dist/cli-runtime/{workflowInputError-n8Oo-bLA.js → workflowInputError-BP8z9Wxl.js} +2 -2
- package/dist/cli.js +10 -0
- package/dist/cliBrowserScenarioCommands.js +2 -3
- package/dist/cliLogging.js +22 -7
- package/dist/cliObservationOptions.js +3 -0
- package/dist/cliOutput.js +68 -3
- package/dist/composition/binary.js +15 -2
- package/dist/composition/directAnalysis.js +8 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +4 -5
- package/dist/composition/jeb.js +32 -21
- package/dist/config/environment.js +36 -2
- package/dist/config/mcpInputSchemaProfile.js +1 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/contracts/adb/adbToolContracts.js +2 -2
- package/dist/contracts/analysisViewApiSurfaceExample.js +4 -4
- package/dist/contracts/analysisViewToolContracts.js +42 -1
- package/dist/contracts/android/androidToolContracts.js +1 -1
- package/dist/contracts/apktool/apktoolToolContracts.js +5 -1
- package/dist/contracts/artifactComparisonExample.js +18 -14
- package/dist/contracts/artifactToolContracts.js +2 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +12 -1
- package/dist/contracts/compactInputSchema.js +13 -6
- package/dist/contracts/fridaToolContracts.js +5 -4
- package/dist/contracts/gdbToolContracts.js +2 -3
- package/dist/contracts/inputSchemaPresentation.js +173 -79
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +1 -0
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +1 -0
- package/dist/contracts/jsonSchemaKeywords.js +29 -0
- package/dist/contracts/managed/managedWorkflowExamples.js +3 -0
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +15 -12
- package/dist/contracts/officialToolContracts.js +2 -2
- package/dist/contracts/rizinDebugToolContracts.js +3 -2
- package/dist/contracts/sessionToolContracts.js +3 -3
- package/dist/contracts/toolEffects.js +6 -2
- package/dist/contracts/toolOutputSchemaGroups.js +7 -4
- package/dist/contracts/toolOutputSchemaPrimitives.js +7 -0
- package/dist/contracts/toolSchemaMetadata.js +99 -27
- package/dist/cutter/CutterBridgeClient.js +206 -67
- package/dist/cutter/CutterBridgeService.js +52 -4
- package/dist/doctorRuntime.js +25 -4
- package/dist/domain/adb/adbDeviceAnalysis.js +19 -1
- package/dist/domain/analysisErrorBase.js +59 -2
- package/dist/domain/analysisErrorCleanup.js +3 -1
- package/dist/domain/analysisErrorCore.js +13 -0
- package/dist/domain/analysisErrorPresentation.js +23 -4
- package/dist/domain/analysisErrorProjection.js +44 -28
- package/dist/domain/analysisSearch.js +26 -0
- package/dist/domain/analysisSnapshot.js +11 -11
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +4 -65
- package/dist/domain/analysisView/analysisView.js +25 -0
- package/dist/domain/analysisView/analysisViewDataAdmission.js +86 -0
- package/dist/domain/analysisView/artifactInventoryView.js +4 -18
- package/dist/domain/analysisView/javascriptApplicationCoverage.js +27 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +100 -27
- package/dist/domain/analysisView/javascriptFactsView.js +92 -0
- package/dist/domain/analysisView/javascriptModuleReferences.js +37 -0
- package/dist/domain/analysisView/managedMemberView.js +6 -0
- package/dist/domain/android/androidApplication.js +8 -7
- package/dist/domain/apktool/apktoolResourceAnalysis.js +52 -2
- package/dist/domain/apple/appleApplication.js +41 -60
- package/dist/domain/apple/appleBundleAnatomy.js +56 -68
- package/dist/domain/apple/dylibResolution.js +5 -1
- package/dist/domain/apple/interfaceBuilderGraph.js +29 -8
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +11 -4
- package/dist/domain/apple/jvmClassFile.js +226 -0
- package/dist/domain/apple/keyedArchive.js +39 -17
- package/dist/domain/apple/machoContainer.js +3 -0
- package/dist/domain/apple/plistNumbers.js +67 -5
- package/dist/domain/apple/plistValue.js +89 -18
- package/dist/domain/artifactComparison.js +7 -5
- package/dist/domain/artifactGraph.js +4 -12
- package/dist/domain/artifactInspection.js +6 -17
- package/dist/domain/artifactInventoryEvidence.js +68 -60
- package/dist/domain/binaryTarget.js +11 -26
- package/dist/domain/binaryTargetTypes.js +10 -0
- package/dist/domain/browserNetworkEvidence.js +20 -3
- package/dist/domain/browserObservation.js +5 -28
- package/dist/domain/browserObservationError.js +4 -4
- package/dist/domain/browserScenarioCapture.js +11 -2
- package/dist/domain/browserScenarioCaptureLimits.js +34 -0
- package/dist/domain/browserScenarioCaptureValues.js +50 -0
- package/dist/domain/browserScenarioDiffEvidence.js +1 -3
- package/dist/domain/browserScenarioValues.js +5 -1
- package/dist/domain/captures/packetCapture.js +2 -1
- package/dist/domain/dosMz.js +14 -5
- package/dist/domain/electron/electronFuseEvidence.js +42 -0
- package/dist/domain/elfFixedHeader.js +24 -0
- package/dist/domain/evidence.js +7 -6
- package/dist/domain/evidenceBundle.js +9 -2
- package/dist/domain/explicitSensitiveFailure.js +3 -0
- package/dist/domain/fileSnapshotObservation.js +25 -0
- package/dist/domain/fixedTupleSchema.js +9 -0
- package/dist/domain/functionCallCoverage.js +6 -6
- package/dist/domain/functionComparisonDimensions.js +38 -11
- package/dist/domain/functionComparisonNormalization.js +17 -9
- package/dist/domain/functionDossierEvidence.js +4 -3
- package/dist/domain/harmony/harmonyApplication.js +8 -8
- package/dist/domain/hopperErrors.js +4 -2
- package/dist/domain/hopperValues.js +27 -4
- package/dist/domain/javascript/electronActiveObservation.js +1 -0
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +80 -20
- package/dist/domain/javascript/electronStaticAnalysisValues.js +0 -20
- package/dist/domain/javascript/electronStaticOptionObjects.js +45 -0
- package/dist/domain/javascript/electronWrappedCallPaths.js +70 -17
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +20 -4
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -0
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +3 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +3 -1
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +49 -21
- package/dist/domain/javascript/javascriptAstFingerprint.js +41 -10
- package/dist/domain/javascript/javascriptAstValues.js +83 -5
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +23 -36
- package/dist/domain/javascript/javascriptCommonJsExportReceivers.js +231 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +14 -4
- package/dist/domain/javascript/javascriptFeatureSeed.js +1 -1
- package/dist/domain/javascript/javascriptGraphqlOperations.js +382 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +20 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -11
- package/dist/domain/javascript/javascriptRpcEndpoints.js +7 -171
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +9 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +35 -12
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +50 -45
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +284 -24
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +452 -182
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +37 -20
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +55 -27
- package/dist/domain/javascript/javascriptSemanticCalls.js +4 -4
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +134 -50
- package/dist/domain/javascript/javascriptSemanticCoverage.js +5 -1
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -13
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +33 -10
- 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/javascriptSemanticGetterQueries.js +147 -0
- package/dist/domain/javascript/javascriptSemanticGetterResults.js +264 -0
- package/dist/domain/javascript/javascriptSemanticGraph.js +18 -1
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +13 -0
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +3 -2
- package/dist/domain/javascript/javascriptSemanticMapOperations.js +51 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +215 -81
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +395 -118
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +241 -328
- package/dist/domain/javascript/javascriptSemanticObjects.js +33 -27
- package/dist/domain/javascript/javascriptSemanticOpaqueEffects.js +163 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +11 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +44 -67
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +2 -1
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +1 -1
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +45 -7
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +3 -19
- package/dist/domain/javascript/javascriptSemanticResources.js +27 -4
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +78 -37
- package/dist/domain/javascript/javascriptSemanticReturns.js +2 -2
- package/dist/domain/javascript/javascriptSemanticState.js +191 -42
- package/dist/domain/javascript/javascriptSemanticValues.js +167 -41
- package/dist/domain/javascript/javascriptSourceParser.js +54 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +24 -13
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +276 -16
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +33 -25
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +1 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +424 -142
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +4 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +12 -1
- package/dist/domain/javascript/sourceToBundleSignals.js +3 -0
- package/dist/domain/managed/managedApplicationGraphNodes.js +14 -9
- package/dist/domain/managed/managedArtifact.js +26 -0
- package/dist/domain/managed/managedMemberComparison.js +3 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +14 -1
- package/dist/domain/managed/managedMemberComparisonItems.js +124 -52
- package/dist/domain/managed/managedMemberComparisonMatch.js +76 -72
- package/dist/domain/managed/managedMemberSignatureIdentity.js +40 -0
- package/dist/domain/managed/managedNativeVerificationMatch.js +5 -5
- package/dist/domain/managed/managedNativeVerificationSchemas.js +2 -2
- package/dist/domain/mobileApplicationGraphProjection.js +33 -18
- package/dist/domain/native/bytePattern.js +21 -0
- package/dist/domain/native/nativeAotPe.js +29 -2
- package/dist/domain/native/nativeAotSnapshotObservation.js +18 -0
- package/dist/domain/native/nativeCallPartialObservation.js +14 -12
- package/dist/domain/native/nativeLoadImage.js +13 -0
- package/dist/domain/native/objcSwiftMetadata.js +15 -8
- package/dist/domain/native/peResources.js +6 -2
- package/dist/domain/peMachine.js +2 -0
- package/dist/domain/process/processComparison.js +3 -3
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +65 -24
- package/dist/domain/propertyListKeys.js +84 -69
- package/dist/domain/propertyListXml.js +149 -0
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/providerCleanupError.js +2 -4
- package/dist/domain/rawBinary.js +11 -2
- package/dist/domain/reconstructionCoverage.js +35 -23
- package/dist/domain/reconstructionCoverageEvaluation.js +36 -36
- package/dist/domain/reconstructionCoverageEvidence.js +26 -0
- package/dist/domain/reconstructionVerification.js +40 -26
- package/dist/domain/referenceSourceImportParsing.js +4 -0
- package/dist/domain/referenceSourcePathIdentity.js +2 -0
- package/dist/domain/referenceSourceRequireBindings.js +40 -101
- package/dist/domain/relationshipCoverage.js +4 -5
- package/dist/domain/sqlite/sqliteDatabase.js +2 -1
- package/dist/domain/symbolAnalysis.js +9 -8
- package/dist/domain/webBundleAnalyzerInspection.js +65 -25
- package/dist/domain/webCaptureDiff.js +124 -41
- package/dist/domain/webInventory.js +28 -14
- package/dist/domain/webModuleTrace.js +22 -0
- package/dist/domain/webScriptExportError.js +2 -3
- package/dist/domain/xmlDocument.js +41 -0
- package/dist/domain/zipPackageFormat.js +0 -4
- package/dist/dotnet/ManagedArtifactInspector.js +2 -4
- package/dist/dotnet/ManagedDecodeBudget.js +21 -1
- package/dist/dotnet/ManagedMemberInspector.js +31 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +63 -12
- package/dist/dotnet/ManagedMemberRows.js +8 -8
- package/dist/dotnet/ManagedMetadataHeaps.js +0 -1
- package/dist/dotnet/ManagedMetadataLayout.js +17 -15
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +20 -19
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +7 -8
- package/dist/dotnet/ManagedPeReader.js +5 -0
- package/dist/dotnet/ManagedSnapshot.js +25 -20
- package/dist/dotnet/ManagedTypeNameDigests.js +177 -0
- package/dist/dotnet/ManagedTypeNames.js +6 -46
- package/dist/dotnet/ManagedTypeNesting.js +25 -0
- package/dist/dotnet/ManagedTypeReferences.js +94 -0
- package/dist/electron/ElectronFuseFailures.js +105 -0
- package/dist/electron/ElectronFusePath.js +4 -3
- package/dist/electron/ElectronFuseProvider.js +67 -92
- package/dist/electron/ElectronFuseReader.js +46 -30
- package/dist/evm/EvmoleFailures.js +1 -0
- package/dist/evm/EvmoleInterfaceProvider.js +13 -16
- package/dist/filesystem/OwnedRegularFile.js +116 -0
- package/dist/filesystem/OwnedStagedOutput.js +28 -11
- package/dist/filesystem/RegularFile.js +20 -8
- package/dist/filesystem/StableFileHash.js +56 -38
- package/dist/filesystem/callerPath.js +26 -0
- package/dist/filesystem/readFileHandleChunks.js +55 -5
- package/dist/filesystem/readStableFileBytes.js +85 -0
- package/dist/firmware/FirmwareCommand.js +13 -7
- package/dist/firmware/FirmwareFailures.js +56 -0
- package/dist/firmware/FirmwareFiles.js +128 -98
- package/dist/firmware/FirmwareProvider.js +120 -65
- package/dist/firmware/FirmwarePublication.js +26 -11
- package/dist/flutter/DartElf.js +27 -0
- package/dist/flutter/FlutterBuildProvider.js +44 -4
- package/dist/gdb/GdbSessionManager.js +202 -14
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraAnalysisProfile.js +24 -10
- package/dist/ghidra/GhidraAnalysisSeeds.js +39 -55
- package/dist/ghidra/GhidraBridgeSources.js +12 -0
- package/dist/ghidra/GhidraClient.js +362 -148
- package/dist/ghidra/GhidraClientStartup.js +5 -3
- package/dist/ghidra/GhidraClientWire.js +5 -2
- package/dist/ghidra/GhidraDiagnostics.js +16 -5
- package/dist/ghidra/GhidraDoctor.js +45 -14
- 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 +1 -0
- package/dist/ghidra/GhidraInstallation.js +143 -142
- package/dist/ghidra/GhidraInstallationPolicy.js +20 -79
- package/dist/ghidra/GhidraInstallationProperties.js +57 -0
- package/dist/ghidra/GhidraInventoryValues.js +22 -6
- package/dist/ghidra/GhidraJavaLaunch.js +11 -4
- package/dist/ghidra/GhidraJavaProbe.js +267 -0
- package/dist/ghidra/GhidraJavaProperties.js +9 -7
- package/dist/ghidra/GhidraLanguageCatalog.js +12 -7
- package/dist/ghidra/GhidraLauncher.js +128 -65
- package/dist/ghidra/GhidraLoadImageAttest.js +75 -78
- package/dist/ghidra/GhidraLoadImageValues.js +39 -29
- package/dist/ghidra/GhidraMipsProfile.js +13 -5
- package/dist/ghidra/GhidraNativeAotSnapshotOwner.js +221 -0
- package/dist/ghidra/GhidraPeProfile.js +88 -18
- package/dist/ghidra/GhidraProvider.js +219 -32
- package/dist/ghidra/GhidraProviderCapabilities.js +17 -4
- package/dist/ghidra/GhidraProviderClient.js +199 -239
- package/dist/ghidra/GhidraPspExtension.js +104 -34
- package/dist/ghidra/GhidraPspProfile.js +4 -1
- package/dist/ghidra/GhidraRawBinaryLanguage.js +13 -4
- package/dist/ghidra/GhidraReleasePolicy.js +93 -0
- package/dist/ghidra/GhidraRequestQueue.js +64 -40
- package/dist/ghidra/GhidraSessionError.js +152 -19
- package/dist/ghidra/GhidraSessionValues.js +13 -3
- package/dist/ghidra/GhidraSocketConnection.js +25 -11
- package/dist/ghidra/GhidraTargetSnapshot.js +67 -50
- package/dist/ghidra/GhidraTransport.js +86 -63
- package/dist/ghidra/extensions/GhidraExtensions.js +30 -45
- package/dist/go/GoBinaryProvider.js +89 -60
- package/dist/go/GoElfImage.js +3 -3
- package/dist/hopper/BridgeLauncher.js +43 -4
- package/dist/hopper/HopperAnalysisProfile.js +4 -2
- package/dist/hopper/HopperCleanup.js +14 -1
- package/dist/hopper/HopperClient.js +135 -63
- package/dist/hopper/HopperProvider.js +4 -7
- package/dist/hopper/HopperProviderCapabilities.js +2 -1
- package/dist/hopper/HopperRegexSearch.js +21 -60
- package/dist/ida/IdaBusyHealth.js +36 -2
- package/dist/ida/IdaMcpConnection.js +17 -11
- package/dist/ida/IdaNativeProtocol.js +1 -9
- package/dist/ida/IdaOperationRunner.js +8 -26
- package/dist/ida/IdaProtocolValues.js +2 -1
- package/dist/ida/IdaProvider.js +18 -2
- package/dist/ida/IdaSessionClient.js +54 -12
- package/dist/inspector/V8InspectorCaptureProjection.js +7 -0
- package/dist/inspector/V8InspectorProvider.js +2 -0
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +25 -4
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +4 -3
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +3 -2
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +7 -1
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +1 -1
- package/dist/javascript/recovery/RecoveryFiles.js +57 -8
- package/dist/jeb/JebMcpConnection.js +129 -70
- package/dist/jeb/JebMcpConnectionOwner.js +116 -0
- package/dist/jeb/JebMcpDeadline.js +46 -0
- package/dist/jeb/JebProvider.js +77 -51
- 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/main/processShutdown.js +17 -0
- package/dist/main/transport.js +21 -1
- package/dist/main.js +2 -12
- package/dist/mcp/AnalysisProvider-BABWbLoM.js +38 -0
- package/dist/mcp/{AnalysisSnapshotFiles-BAbiJQOc.js → AnalysisSnapshotFiles-BXz0c37-.js} +39 -28
- package/dist/mcp/{ProcessOwnership-Bl_3ejLe.js → ArtifactFileOperation-64cQKI7B.js} +274 -72
- package/dist/mcp/{ArtifactProvider-DViCU_rn.js → ArtifactProvider-Dx6pmil1.js} +371 -354
- package/dist/mcp/ArtifactProviderMetadata-UCJr2oZW.js +167 -0
- package/dist/mcp/{ArtifactReader-OyM03Gjn.js → ArtifactReader-BrnwNaKY.js} +29 -6
- package/dist/mcp/ArtifactResourceScope-zi3Dkqzy.js +175 -0
- package/dist/mcp/{AsarHeader-WsPgoooH.js → AsarHeader-B_IbppTz.js} +1 -1
- package/dist/mcp/{BinarySessionStatus-B4P9gf-S.js → BinarySessionStatus-CZ9nnXMt.js} +5 -4
- package/dist/mcp/{BinaryTargetResolver-BMaE_0H1.js → BinaryTargetResolver-BUncASDP.js} +146 -215
- package/dist/mcp/BoundedFileBytes-DYt5q9G2.js +43 -0
- package/dist/mcp/{CdpCaptureDocuments-HDiF2O7k.js → CdpCaptureDocuments-Y2uFcBpl.js} +194 -145
- package/dist/mcp/{CdpCaptureValues-M-j6CIh1.js → CdpCaptureValues-tNIg-gQK.js} +12 -5
- package/dist/mcp/{CdpConnection-BpDfz4MK.js → CdpEndpoint-BrhMhpSi.js} +352 -281
- package/dist/mcp/{CdpOptionalCommand-BPjRD9Kz.js → CdpOptionalCommand-PZZhlqxv.js} +2 -2
- package/dist/mcp/CdpTargetSession-BmmDC3XO.js +290 -0
- package/dist/mcp/{DirectAnalysis-DrafbXke.js → DirectAnalysis-B9KuCHTG.js} +29 -21
- package/dist/mcp/{DirectAnalysisStatus-CjjeDLzW.js → DirectAnalysisStatus-BgzopkIt.js} +7 -7
- package/dist/mcp/{ElectronFileScope-BPG_YoyU.js → ElectronFileScope-FXtK0d6I.js} +1 -1
- package/dist/mcp/ElectronFuseFailures-uZ_wOV6T.js +610 -0
- package/dist/mcp/MachoLoadCommandReader-C2VGgHA3.js +330 -0
- package/dist/mcp/{ManagedStaticProvider-BthZbKyZ.js → ManagedStaticProvider-CZuoPme2.js} +429 -131
- package/dist/mcp/{NativeMacOSProvider-Bh79k8dI.js → NativeMacOSProvider-CMguKrvN.js} +1376 -748
- package/dist/mcp/{NativeMacOSProviderMetadata-N1lPOaY_.js → NativeMacOSProviderMetadata-B_RH4KXF.js} +97 -7
- package/dist/mcp/{ProviderDeadline-DskQ94YD.js → OwnedCommand-BW1jBSt9.js} +436 -127
- package/dist/mcp/ProcedureAddressResolution-H6Qwpb_Y.js +59 -0
- package/dist/mcp/{WorkflowEvidence-umWrB_wm.js → WorkflowEvidence-CO4C7ALz.js} +16 -9
- package/dist/mcp/analysisErrorCleanup-Q344SnTO.js +34 -0
- package/dist/mcp/analysisErrorCore-BIEP7tvF.js +509 -0
- package/dist/mcp/{analysisErrorProjection-BN0EPM-3.js → analysisErrorProjection-B8teQwwD.js} +80 -30
- package/dist/mcp/{artifactToolContracts-Di4qZlEt.js → artifactToolContracts-C9dRDo-D.js} +6 -4
- package/dist/mcp/{browserObservation-C0s4i8UI.js → browserObservation-DUraZs62.js} +272 -107
- package/dist/mcp/{browserObservationError-CyLugqX4.js → browserObservationError-C5okJ5el.js} +27 -4
- package/dist/mcp/{browserObservationSchemas-tgqjH7aA.js → browserObservationSchemas-DwGGxBpu.js} +3 -3
- package/dist/mcp/{browserScenario-CAQ8Fns9.js → browserScenario-BRUz7yN0.js} +844 -358
- package/dist/mcp/{browserScenarioCapture-CTNFN-FI.js → browserScenarioCapture-CiMAsMx8.js} +127 -11
- package/dist/mcp/{InterfaceBuilderDecodeBudget-5F2AkxJT.js → callerPath-CpPnMZyN.js} +91 -65
- package/dist/mcp/{electronActiveObservation-lDvQTMR0.js → electronActiveObservation-DV0Ffy9X.js} +1 -0
- package/dist/mcp/electronFuses-D5SS7XXw.js +367 -0
- package/dist/mcp/{electronObservation-i7LcILQ-.js → electronObservation-DsN-NqY1.js} +134 -75
- package/dist/mcp/{electronObservation-DFOFEood.js → electronObservation-wOYWwqgF.js} +3 -3
- package/dist/mcp/{electronScenario-nCzE6IfJ.js → electronScenario-CYrt2zBK.js} +395 -135
- package/dist/mcp/{emptyArraySchema-tL6Qymyd.js → emptyArraySchema-C0o2Sxwp.js} +2 -2
- package/dist/mcp/{enhancedInputs-DgdEnzHy.js → enhancedInputs-6CCgB3VB.js} +1 -1
- package/dist/mcp/{javascriptRuntimeObservation-61NhCf7H.js → javascriptRuntimeObservation-BVbhkO2-.js} +12 -9
- package/dist/mcp/{javascriptRuntimeObservation-PIUoLfX6.js → javascriptRuntimeObservation-Cu0Yedqq.js} +2 -2
- package/dist/mcp/{lipo-Bnkoq_6W.js → lipo-DSTgUqL1.js} +11 -118
- package/dist/mcp/{logger-BQY5ulYv.js → logger-BGdGHadX.js} +2 -2
- package/dist/mcp/machoContainer-CMSxUBlK.js +605 -0
- package/dist/mcp/{main-kBXHZ8S5.js → main-Cx-Z7m_n.js} +16788 -5902
- package/dist/mcp/main.js +1 -1
- package/dist/mcp/{managedToolContracts-CK--I_s7.js → managedToolContracts-CSlbKJP-.js} +3 -3
- package/dist/mcp/{nativeValueTrace-DR9UE62L.js → nativeValueTrace-BEZbDieM.js} +2630 -2468
- package/dist/mcp/{officialToolContracts-B67NJ2tC.js → officialToolContracts-CauCcSsc.js} +74 -55
- package/dist/mcp/peMachine-aP1iYnHq.js +95 -0
- package/dist/mcp/propertyListKeys-BfCo0k4w.js +356 -0
- package/dist/mcp/providerCleanupError-DIRHxzWo.js +125 -0
- package/dist/mcp/{providerOperationHealth-CTYa3iLf.js → providerOperationHealth-9DRSGM8N.js} +24 -1
- package/dist/mcp/{scanCanonical-CRXSpule.js → scanCanonical-CF3ATd1V.js} +269 -463
- package/dist/mcp/{serverIdentity-Cio4iFV3.js → serverIdentity-BK0Ejd_Y.js} +262 -83
- package/dist/mcp/{sourceMapEnvelope-C0uJlrOh.js → sourceMapEnvelope-DAaRUIGj.js} +4 -4
- package/dist/mcp/{toolContracts-BW05wpcr.js → toolContracts-BPoHQdlC.js} +541 -327
- package/dist/mcp/{toolOutputSchemaGroups-ColvNZ1r.js → toolOutputSchemaGroups-MJ_f-PMK.js} +2551 -2354
- package/dist/mcp/{webContentArtifact-Dzjc1z-R.js → webContentArtifact-DfGkgDcI.js} +2 -17
- package/dist/mcp/{webRuntime-K__NYzXm.js → webRuntime-ccyhkRru.js} +2 -2
- package/dist/mcp/{webSourceLocation-DbMAT2J9.js → webSourceLocation-DKIum0vJ.js} +6451 -4414
- package/dist/mcpDoctor.js +4 -2
- package/dist/mcpStartupPolicy.js +18 -3
- package/dist/native/AppleDispatchMetadata.js +76 -27
- package/dist/native/AppleMachoFixups.js +20 -10
- package/dist/native/AppleObjcCategories.js +12 -1
- package/dist/native/AppleObjcDispatchFacets.js +21 -12
- 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 +13 -9
- package/dist/native/LldbCallTracer.js +232 -178
- package/dist/native/LldbReadbackFiles.js +70 -0
- package/dist/native/LldbRetainedObservations.js +28 -56
- package/dist/native/NativeCallObservation.js +53 -52
- package/dist/native/NativeCallTarget.js +95 -0
- package/dist/native/NativeMacOSProvider.js +240 -171
- package/dist/native/NativeMachoInspection.js +21 -7
- 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 +67 -45
- package/dist/native/SignatureTargetBinding.js +72 -53
- package/dist/native/parsers/demangle.js +16 -12
- package/dist/native/parsers/machoUuid.js +4 -4
- package/dist/native/parsers/otool.js +57 -17
- 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 +63 -16
- package/dist/native/pwndbg/CoreFileMappingAuthority.js +51 -0
- package/dist/native/pwndbg/PwndbgCoreContext.js +26 -15
- package/dist/native/pwntools/PwntoolsDecoder.js +116 -53
- package/dist/native/pwntools/PwntoolsFailures.js +17 -3
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +11 -1
- package/dist/objdump/ObjdumpCommand.js +5 -2
- package/dist/pcap/PcapOutput.js +38 -2
- package/dist/pcap/PcapProvider.js +45 -15
- package/dist/pcap/PcapSnapshot.js +24 -4
- package/dist/process/ArtifactAnalysisResources.js +145 -52
- package/dist/process/BoundedFileBytes.js +8 -3
- package/dist/process/CurrentEntrypointPath.js +3 -1
- package/dist/process/DarwinProcessRunTokenReader.js +174 -63
- package/dist/process/DetachedPgpSignature.js +57 -0
- package/dist/process/ExecFileOutput.js +14 -11
- package/dist/{hopper/HopperTargetLease.js → process/HopperLease.js} +10 -0
- package/dist/process/LinuxResourceLimits.js +4 -24
- package/dist/process/OwnedCommand.js +109 -14
- package/dist/process/ProviderProcess.js +129 -10
- package/dist/process/RegexMatcher.js +96 -0
- package/dist/process/SharedStartupAttempt.js +59 -0
- package/dist/process/WindowsAuthority.js +1 -1
- package/dist/process/capture/FilesystemSnapshot.js +3 -2
- package/dist/process/capture/ProcessCaptureError.js +55 -17
- package/dist/process/capture/ProcessCaptureLifecycle.js +17 -20
- package/dist/process/capture/ProcessCaptureProgress.js +5 -3
- package/dist/process/capture/ProcessHarness.js +17 -3
- 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 -0
- package/dist/reference/ReferenceSourceReaderEntries.js +12 -3
- package/dist/reference/ReferenceSourceReaderFile.js +2 -1
- package/dist/rizin/RizinCommand.js +2 -2
- package/dist/rizin/RizinDebugSessionManager.js +249 -210
- package/dist/rust/RustBinaryProvider.js +55 -23
- package/dist/server/EvidenceMcpServer.js +2 -2
- package/dist/server/contractToolHandler.js +17 -11
- package/dist/server/createServer.js +27 -8
- package/dist/server/promptCompletion.js +24 -22
- package/dist/server/registerArtifactComparisonTool.js +13 -2
- package/dist/server/registerBrowserScenarioTool.js +7 -5
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerCutterTools.js +2 -3
- package/dist/server/registerElectronTools.js +2 -13
- package/dist/server/registerFridaTools.js +8 -12
- package/dist/server/registerInvestigationTools.js +20 -20
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/evidence.js +14 -7
- package/dist/server/registerProcessComparisonTool.js +3 -0
- package/dist/server/registerSessionStatusTool.js +13 -6
- package/dist/server/registerSessionTools.js +16 -29
- package/dist/server/runDerivedOperation.js +2 -0
- package/dist/signals/SigrokRecordingProvider.js +13 -6
- package/dist/sqlite/SqliteDatabaseFailures.js +25 -12
- package/dist/sqlite/SqliteDatabaseInspection.js +27 -12
- package/dist/sqlite/SqliteDatabaseSnapshot.js +58 -32
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +18 -3
- package/dist/wasm/WabtArtifactProvider.js +64 -42
- package/dist/wasm/WabtFailures.js +19 -1
- package/dist/wasm/WabtRuntime.js +58 -0
- package/dist/wasm/WasmGlueAdapter.js +20 -7
- package/dist/windows/WindowsNativeLoader.js +16 -2
- package/dist/windows/WindowsPrivateRuntime.js +44 -1
- package/licenses/npm-dependencies.txt +146 -1
- package/licenses/npm-runtime-notices.txt +175 -1
- package/native/windows/README.md +44 -7
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +11 -3
- package/scripts/electron-active-hook-boundaries.cjs +15 -2
- package/scripts/electron-active-hook.cjs +408 -46
- package/scripts/hopper-demo-x11.py +12 -10
- package/scripts/rea.mjs +62 -15
- package/skills/reverse-engineer-anything/SKILL.md +21 -7
- package/skills/reverse-engineer-anything/references/android-applications.md +3 -1
- package/skills/reverse-engineer-anything/references/javascript-applications.md +44 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +30 -10
- package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +0 -114
- package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +0 -36
- package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +0 -1094
- package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +0 -428
- package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +0 -434
- package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +0 -112
- package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +0 -139
- package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +0 -125
- package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +0 -497
- package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +0 -63
- package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +0 -27
- package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +0 -40
- package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +0 -780
- package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +0 -21
- package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +0 -248
- package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +0 -25
- package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +0 -38
- package/dist/hopper/HopperRegexWorker.js +0 -27
- package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +0 -76
- package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +0 -162
- package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +0 -68
- package/dist/mcp/CdpTargetSession-BsPoKhEU.js +0 -86
- package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +0 -19
- package/dist/mcp/analysisErrorCore-DXRTvF_m.js +0 -235
- package/dist/mcp/artifactOperationError-CkHMMaf7.js +0 -27
- package/dist/mcp/digests-BFoWUT_-.js +0 -223
- package/dist/mcp/propertyListKeys-DD25WsjI.js +0 -553
- package/dist/mcp/providerAdapterError-sDxToNal.js +0 -25
- package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +0 -26
|
@@ -1,29 +1,181 @@
|
|
|
1
1
|
import { t as __esmMin } from "./rolldown-runtime-BjeaiXFo.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { C as
|
|
6
|
-
import { C as
|
|
2
|
+
import { b as init_snapshotEnvironment, d as spawnOwnedProviderProcess, f as ProviderStartupDeadline, l as ProviderProcessSupervisor, m as waitForAbortableDelay, p as init_ProviderDeadline, u as init_ProviderProcess, x as snapshotEnvironment } from "./OwnedCommand-BW1jBSt9.js";
|
|
3
|
+
import { A as err, D as AnalysisError, M as ok, O as init_analysisErrorBase, a as AnalysisCapabilityUnavailableError, b as jsonValueSchema, f as init_analysisErrorCore, i as AnalysisCancelledError, j as init_result, k as resolvedAnalysisError, l as AnalysisResourceConstraintError, n as AnalysisAccessDeniedError, o as AnalysisInputError, r as AnalysisArtifactChangedError, s as AnalysisOutputError, u as AnalysisTimeoutError, v as init_jsonValue } from "./analysisErrorCore-BIEP7tvF.js";
|
|
4
|
+
import { O as init_configurationErrors, T as BinaryTargetError, d as init_evidenceErrors, l as EvidenceIntegrityError, n as projectAnalysisError, t as init_analysisErrorProjection } from "./analysisErrorProjection-B8teQwwD.js";
|
|
5
|
+
import { C as incompletePlistNumberLimitation, Ft as objcSwiftMetadataSchema, Lt as init_swiftSymbolClassification, Nt as isAppleDispatchMetadataTarget, Pt as nativeDispatchMetadataResultSchema, Rt as isSwiftMangledSymbolName, S as createPlistNumberProjection, fn as isMachOFormat, jt as init_objcSwiftMetadata, un as init_binaryTargetTypes, w as init_plistNumbers } from "./nativeValueTrace-BEZbDieM.js";
|
|
6
|
+
import { C as signalProcessWithStartIdentity, D as init_DarwinProcessRunTokenReader, E as SWIFTC_INTERRUPT, I as init_ExecFileOutput, M as ExecFileOutputCancelledError, P as execFileOutput, d as cleanupOwnedProcessGroup, g as init_ProcessOwnershipObservation, i as artifactFilePrimaryFailure, n as ArtifactFileCleanupFailure, o as bindArtifactFileCleanup, p as init_ProcessOwnership, r as artifactFileCancellationCause, s as init_ArtifactFileOperation, u as withArtifactRegularFile, y as observeProcessStartIdentity } from "./ArtifactFileOperation-64cQKI7B.js";
|
|
7
7
|
import { n as safeParseJson, t as init_safeJson } from "./safeJson-NeGfpkrI.js";
|
|
8
|
-
import {
|
|
9
|
-
import { a as
|
|
10
|
-
import { r as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { n as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
8
|
+
import { i as init_ArtifactReader, t as ArtifactReaderFailure } from "./ArtifactReader-BrnwNaKY.js";
|
|
9
|
+
import { S as init_OwnedFileHandle, _ as assertRegularFileActive, a as validateFatSlice, c as RegularFileCleanupFailure, g as RegularFileOperationCancelled, h as RegularFileChangedError, i as readFatSliceDeclarations, l as init_OwnedRegularFile, n as init_machoContainer, s as RegularFileCancelled, u as regularFileCancellation, v as init_RegularFile, x as OwnedFileHandle } from "./machoContainer-CMSxUBlK.js";
|
|
10
|
+
import { a as init_AnalysisCleanupLease, i as AnalysisCleanupLeaseGroup, n as init_providerCleanupError, r as AnalysisCleanupLease, t as ProviderCleanupError } from "./providerCleanupError-DIRHxzWo.js";
|
|
11
|
+
import { n as ArtifactResourceScope, r as init_ArtifactResourceScope, t as ArtifactResourceRetryFailure } from "./ArtifactResourceScope-zi3Dkqzy.js";
|
|
12
|
+
import { _ as hashStableFile, a as init_PrivateRuntimeRoot, i as PrivateRuntimeRoot, n as init_NativeMacOSProviderMetadata, r as nativeMacOSCapabilities, t as NATIVE_MACOS_PROVIDER_IDENTITY, v as init_StableFileHash, y as stableFileHashCause } from "./NativeMacOSProviderMetadata-B_RH4KXF.js";
|
|
13
|
+
import { n as readBoundedFileBytes, t as init_BoundedFileBytes } from "./BoundedFileBytes-DYt5q9G2.js";
|
|
14
|
+
import { l as init_unicodeCodePointOrder, s as compareUnicodeCodePoints } from "./providerOperationHealth-9DRSGM8N.js";
|
|
15
|
+
import { r as init_AnalysisProvider, t as createAnalysisExecution } from "./AnalysisProvider-BABWbLoM.js";
|
|
16
|
+
import { i as init_providerAdapterError, r as ProviderAdapterError } from "./browserObservationError-C5okJ5el.js";
|
|
17
|
+
import { n as init_analysisErrorCleanup, t as analysisErrorWithCleanupFailure } from "./analysisErrorCleanup-Q344SnTO.js";
|
|
18
|
+
import { c as init_machoCpuIdentity, l as machoCpuSubtypeBase } from "./electronFuses-D5SS7XXw.js";
|
|
19
|
+
import { Cn as nativeCallObservationResultSchema, Ct as nonFiniteRealLimitation, Et as unknownRealLimitation, Sn as nativeCallObservationInputSchema, St as negativeZeroRealLimitation, Tn as nativeCodeLocationSchema, Tt as unknownDateLimitation, _n as nativeUiResultSchema, ar as listArchitecturesSchema, bn as init_nativeCallObservation, bt as init_plistValue, er as demangleSwiftSchema, gn as nativeUiObservationInputSchema, hn as init_nativeUiObservation, ir as inspectSignatureSchema, nr as inspectMachoSchema, rr as inspectPlistSchema, tr as init_nativeInspection, va as analysisInputErrorFromIssues, vn as nativeUiScenarioInputSchema, wn as nativeCapturedOutputSchema, wt as projectPlistValue, xn as nativeCallEventSchema, xt as negativeZeroReal, ya as init_inputIssueProjection, yn as nativeUiSnapshotSchema } from "./toolOutputSchemaGroups-MJ_f-PMK.js";
|
|
20
|
+
import { i as parseXmlPropertyList, n as omitPrototypeKeys, r as omittedPrototypeKeysLimitation, t as init_propertyListKeys } from "./propertyListKeys-BfCo0k4w.js";
|
|
21
|
+
import { in as init_nativeToolContracts, n as init_toolContracts, r as toolContract, rn as NATIVE_TOOL_CONTRACTS } from "./toolContracts-BPoHQdlC.js";
|
|
22
|
+
import { a as NativeCommandFailure, c as init_CommandRunner, i as NATIVE_COMMAND_TIMEOUT_MS, l as resolveXcrunTool, n as parseLipoOutput, o as XcrunCommandRunner, r as NATIVE_COMMAND_OUTPUT_BUDGET_BYTES, s as failureCapture, t as init_lipo } from "./lipo-DSTgUqL1.js";
|
|
19
23
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
20
24
|
import { fileURLToPath } from "node:url";
|
|
21
25
|
import { constants } from "node:fs";
|
|
22
26
|
import { z } from "zod";
|
|
23
27
|
import { tmpdir } from "node:os";
|
|
28
|
+
import { lstat, mkdir, mkdtemp, open, realpath, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
24
29
|
import { createHash, randomUUID } from "node:crypto";
|
|
25
|
-
import { lstat, mkdir, mkdtemp, open, readFile, realpath, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
26
30
|
|
|
31
|
+
//#region dist/native/NativePlistSource.js
|
|
32
|
+
var resolveNativePlistSelection, macOSBundleRoot, unreadablePlist, nativePlistFailure, readPlistFile, requireRegularPlist, PLIST_MARKUP_PROBE_BYTES, plistSourceFormat;
|
|
33
|
+
function init_NativePlistSource() {
|
|
34
|
+
return (init_NativePlistSource = __esmMin((() => {
|
|
35
|
+
init_analysisErrorCore();
|
|
36
|
+
init_configurationErrors();
|
|
37
|
+
init_providerAdapterError();
|
|
38
|
+
init_providerCleanupError();
|
|
39
|
+
init_analysisErrorProjection();
|
|
40
|
+
init_result();
|
|
41
|
+
init_ArtifactReader();
|
|
42
|
+
init_ArtifactFileOperation();
|
|
43
|
+
init_NativeMacOSProviderMetadata();
|
|
44
|
+
resolveNativePlistSelection = async (target, requested) => {
|
|
45
|
+
try {
|
|
46
|
+
if (requested !== undefined && isAbsolute(requested)) return ok({
|
|
47
|
+
path: resolve(requested),
|
|
48
|
+
origin: "selected"
|
|
49
|
+
});
|
|
50
|
+
if (requested === undefined && target.kind === "artifact" && target.format === "plist") return ok({
|
|
51
|
+
path: target.path,
|
|
52
|
+
origin: "selected"
|
|
53
|
+
});
|
|
54
|
+
const source = target.sourcePath ?? target.path;
|
|
55
|
+
const sourceMetadata = await stat(source);
|
|
56
|
+
const root = sourceMetadata.isDirectory() ? source : macOSBundleRoot(target.path) ?? dirname(target.path);
|
|
57
|
+
if (requested !== undefined) return ok({
|
|
58
|
+
path: resolve(root, requested),
|
|
59
|
+
origin: "selected"
|
|
60
|
+
});
|
|
61
|
+
return ok({
|
|
62
|
+
path: target.bundleInfoPlist ?? resolve(root, "Contents/Info.plist"),
|
|
63
|
+
origin: "default"
|
|
64
|
+
});
|
|
65
|
+
} catch (cause) {
|
|
66
|
+
return err(new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", { cause }));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
macOSBundleRoot = (path) => {
|
|
70
|
+
const programs = dirname(path);
|
|
71
|
+
const contents = dirname(programs);
|
|
72
|
+
return basename(programs) === "MacOS" && basename(contents) === "Contents" ? dirname(contents) : undefined;
|
|
73
|
+
};
|
|
74
|
+
unreadablePlist = (selection, reason, options) => {
|
|
75
|
+
const { path } = selection;
|
|
76
|
+
const sentence = reason.endsWith(".") ? reason : `${reason}.`;
|
|
77
|
+
const missingDefault = `The target has no readable default plist at ${path}: ${sentence} Select another plist in the target with the path input (CLI: --relative-path).`;
|
|
78
|
+
return selection.origin === "default" ? new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", missingDefault, {
|
|
79
|
+
...options,
|
|
80
|
+
userMessage: missingDefault
|
|
81
|
+
}) : new AnalysisInputError("inspect_plist", options, [{
|
|
82
|
+
path: ["path"],
|
|
83
|
+
reason: "invalid_value",
|
|
84
|
+
message: `Cannot inspect ${path}: ${sentence}`
|
|
85
|
+
}]);
|
|
86
|
+
};
|
|
87
|
+
nativePlistFailure = (cause, selection, capturedOutput) => {
|
|
88
|
+
if (cause instanceof ArtifactReaderFailure && cause.cleanup !== undefined) {
|
|
89
|
+
const physical = cause instanceof ArtifactFileCleanupFailure ? cause.fileCleanupFailure : undefined;
|
|
90
|
+
const previous = physical?.outcome.kind === "failed" ? nativePlistFailure(artifactFilePrimaryFailure(cause), selection, capturedOutput) : physical?.completionCancellation === undefined ? undefined : new AnalysisCancelledError("inspect_plist", {
|
|
91
|
+
cause: physical.completionCancellation.reason,
|
|
92
|
+
capturedOutput
|
|
93
|
+
});
|
|
94
|
+
const previousProjection = previous === undefined ? null : projectAnalysisError(previous);
|
|
95
|
+
const previousDetails = previousProjection?.details;
|
|
96
|
+
const { captured_output: _capture, ...reasonDetails } = previousDetails ?? {};
|
|
97
|
+
const previousError = previousProjection === null ? null : {
|
|
98
|
+
...previousProjection,
|
|
99
|
+
...previousDetails === undefined ? {} : { details: reasonDetails }
|
|
100
|
+
};
|
|
101
|
+
const failure = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, cause.cleanup.resources, {
|
|
102
|
+
reason: cause.cleanup.reason,
|
|
103
|
+
previous_error: previousError
|
|
104
|
+
}, {
|
|
105
|
+
operation: "inspect_plist",
|
|
106
|
+
cause,
|
|
107
|
+
cleanupPrimary: previous,
|
|
108
|
+
capturedOutput
|
|
109
|
+
});
|
|
110
|
+
bindArtifactFileCleanup(cause, failure);
|
|
111
|
+
return failure;
|
|
112
|
+
}
|
|
113
|
+
if (cause instanceof ArtifactReaderFailure && cause.reason === "cancelled") return new AnalysisCancelledError("inspect_plist", {
|
|
114
|
+
cause: artifactFileCancellationCause(cause),
|
|
115
|
+
capturedOutput
|
|
116
|
+
});
|
|
117
|
+
if (cause instanceof ArtifactReaderFailure && cause.reason === "unavailable") return new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", cause.message, {
|
|
118
|
+
cause,
|
|
119
|
+
capturedOutput
|
|
120
|
+
});
|
|
121
|
+
if (selection === undefined) return new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", {
|
|
122
|
+
cause,
|
|
123
|
+
capturedOutput,
|
|
124
|
+
diagnostics: {
|
|
125
|
+
phase: "plist-scope",
|
|
126
|
+
reason: cause instanceof Error ? cause.message : String(cause)
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const { path } = selection;
|
|
130
|
+
const code = cause instanceof Error && "code" in cause ? cause.code : undefined;
|
|
131
|
+
if (code === "ENOENT" || code === "ENOTDIR") return unreadablePlist(selection, "no file exists there", {
|
|
132
|
+
cause,
|
|
133
|
+
capturedOutput
|
|
134
|
+
});
|
|
135
|
+
if (code === "EISDIR" || code === "ENOTFILE") return unreadablePlist(selection, "it is not a regular file", {
|
|
136
|
+
cause,
|
|
137
|
+
capturedOutput
|
|
138
|
+
});
|
|
139
|
+
if (code === "EACCES" || code === "EPERM") return new BinaryTargetError(path, `permission denied while reading plist (${code})`, {
|
|
140
|
+
cause,
|
|
141
|
+
capturedOutput
|
|
142
|
+
});
|
|
143
|
+
return new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", {
|
|
144
|
+
cause,
|
|
145
|
+
capturedOutput,
|
|
146
|
+
diagnostics: {
|
|
147
|
+
path,
|
|
148
|
+
phase: "plist-file",
|
|
149
|
+
reason: cause instanceof Error ? cause.message : String(cause)
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
readPlistFile = async (input, read) => {
|
|
154
|
+
try {
|
|
155
|
+
return ok(await withArtifactRegularFile(input.selection.path, input.resources, input.signal, read, "follow"));
|
|
156
|
+
} catch (cause) {
|
|
157
|
+
return err(nativePlistFailure(cause, input.selection, input.capturedOutput));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
requireRegularPlist = (input) => readPlistFile(input, async () => null);
|
|
161
|
+
PLIST_MARKUP_PROBE_BYTES = 4096;
|
|
162
|
+
plistSourceFormat = async (description, input) => {
|
|
163
|
+
if (/binary property list/iu.test(description)) return ok("binary");
|
|
164
|
+
if (/\bXML\b/iu.test(description)) return ok("xml");
|
|
165
|
+
if (/\bJSON\b/iu.test(description)) return ok("json");
|
|
166
|
+
if (!/\btext\b/iu.test(description)) return ok("unknown");
|
|
167
|
+
return readPlistFile(input, async (file) => {
|
|
168
|
+
const head = Buffer.alloc(PLIST_MARKUP_PROBE_BYTES);
|
|
169
|
+
const { bytesRead } = await file.read(head, 0, head.length, 0);
|
|
170
|
+
const encoding = head[0] === 255 && head[1] === 254 ? "utf-16le" : head[0] === 254 && head[1] === 255 ? "utf-16be" : "utf-8";
|
|
171
|
+
const text = new TextDecoder(encoding).decode(head.subarray(0, bytesRead)).trimStart();
|
|
172
|
+
return /^<(?:[!?]|(?:plist|dict|array|string|integer|real|data|date|true|false)[\s/>])/u.test(text) ? "xml" : "unknown";
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
})))();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//#endregion
|
|
27
179
|
//#region dist/native/AppleDispatchCoverage.js
|
|
28
180
|
var describeFixups, pushDispatchCoverage, formatIssue;
|
|
29
181
|
function init_AppleDispatchCoverage() {
|
|
@@ -410,27 +562,30 @@ function init_AppleMachoFixups() {
|
|
|
410
562
|
};
|
|
411
563
|
uleb = (bytes, cursor, end) => {
|
|
412
564
|
let value = 0n;
|
|
413
|
-
let shift =
|
|
565
|
+
let shift = 0;
|
|
414
566
|
for (;;) {
|
|
415
567
|
if (cursor.at >= end) throw new RangeError("Truncated bind opcode operand");
|
|
416
568
|
const byte = bytes[cursor.at++] ?? 0;
|
|
417
|
-
|
|
418
|
-
shift
|
|
569
|
+
const slice = byte & 127;
|
|
570
|
+
if (shift === 63 && slice > 1 || shift === 64 && slice !== 0) throw new RangeError("Oversized bind opcode operand");
|
|
571
|
+
if (shift < 64) value |= BigInt(slice) << BigInt(shift);
|
|
572
|
+
shift = Math.min(64, shift + 7);
|
|
419
573
|
if ((byte & 128) === 0) return value;
|
|
420
|
-
if (shift > 63n) throw new RangeError("Oversized bind opcode operand");
|
|
421
574
|
}
|
|
422
575
|
};
|
|
423
576
|
sleb = (bytes, cursor, end) => {
|
|
424
577
|
let value = 0n;
|
|
425
|
-
let shift =
|
|
578
|
+
let shift = 0;
|
|
426
579
|
let byte = 0;
|
|
427
580
|
do {
|
|
428
581
|
if (cursor.at >= end) throw new RangeError("Truncated bind opcode operand");
|
|
429
582
|
byte = bytes[cursor.at++] ?? 0;
|
|
430
|
-
|
|
431
|
-
shift
|
|
432
|
-
|
|
433
|
-
|
|
583
|
+
const slice = byte & 127;
|
|
584
|
+
if (shift === 63 && slice !== 0 && slice !== 127 || shift === 64 && slice !== (value < 0n ? 127 : 0)) throw new RangeError("Oversized bind opcode operand");
|
|
585
|
+
if (shift < 64) value = BigInt.asIntN(64, value | BigInt(slice) << BigInt(shift));
|
|
586
|
+
shift = Math.min(64, shift + 7);
|
|
587
|
+
} while ((byte & 128) !== 0);
|
|
588
|
+
return shift < 64 && (byte & 64) !== 0 ? value - (1n << BigInt(shift)) : value;
|
|
434
589
|
};
|
|
435
590
|
setBindRegister = (image, stream, state, byte) => {
|
|
436
591
|
const { bytes } = image;
|
|
@@ -906,28 +1061,37 @@ function init_AppleMachoSelection() {
|
|
|
906
1061
|
|
|
907
1062
|
//#endregion
|
|
908
1063
|
//#region dist/native/AppleObjcProperties.js
|
|
909
|
-
var parsePropertyAttributes, splitAttributes, readObjcPropertyList, readObjcPropertiesOf;
|
|
1064
|
+
var parsePropertyAttributes, decodePropertyAttributes, splitAttributes, readObjcPropertyList, readObjcPropertiesOf;
|
|
910
1065
|
function init_AppleObjcProperties() {
|
|
911
1066
|
return (init_AppleObjcProperties = __esmMin((() => {
|
|
912
1067
|
init_AppleDispatchDecodeFacts();
|
|
913
|
-
parsePropertyAttributes = (name, attributes) =>
|
|
914
|
-
|
|
1068
|
+
parsePropertyAttributes = (name, attributes) => decodePropertyAttributes(name, attributes).property;
|
|
1069
|
+
decodePropertyAttributes = (name, attributes) => {
|
|
1070
|
+
const { tokens, complete } = attributes.length === 0 ? {
|
|
1071
|
+
tokens: [],
|
|
1072
|
+
complete: true
|
|
1073
|
+
} : splitAttributes(attributes);
|
|
915
1074
|
const typeAttributes = tokens.filter((token) => token[0] === "T");
|
|
916
1075
|
const typeAttribute = typeAttributes.length === 1 ? typeAttributes[0] : undefined;
|
|
917
1076
|
const typeEncoding = typeAttribute !== undefined && typeAttribute.length > 1 ? typeAttribute.slice(1) : null;
|
|
918
1077
|
const value = (code) => tokens.find((token) => token[0] === code)?.slice(1) ?? null;
|
|
919
|
-
|
|
1078
|
+
const defaultsEstablished = typeEncoding !== null && complete;
|
|
1079
|
+
const property = {
|
|
920
1080
|
name,
|
|
921
1081
|
type_encoding: typeEncoding,
|
|
922
1082
|
attributes: tokens.map((token) => ({
|
|
923
1083
|
name: token.slice(0, 1),
|
|
924
1084
|
value: token.slice(1)
|
|
925
1085
|
})),
|
|
926
|
-
atomicity: tokens.includes("N") ? "nonatomic" :
|
|
927
|
-
is_readonly: tokens.includes("R") ? true :
|
|
1086
|
+
atomicity: tokens.includes("N") ? "nonatomic" : defaultsEstablished ? "atomic" : null,
|
|
1087
|
+
is_readonly: tokens.includes("R") ? true : defaultsEstablished ? false : null,
|
|
928
1088
|
getter: value("G"),
|
|
929
1089
|
setter: value("S")
|
|
930
1090
|
};
|
|
1091
|
+
return {
|
|
1092
|
+
property,
|
|
1093
|
+
complete
|
|
1094
|
+
};
|
|
931
1095
|
};
|
|
932
1096
|
splitAttributes = (attributes) => {
|
|
933
1097
|
const tokens = [];
|
|
@@ -941,24 +1105,53 @@ function init_AppleObjcProperties() {
|
|
|
941
1105
|
} else current += character;
|
|
942
1106
|
}
|
|
943
1107
|
tokens.push(current);
|
|
944
|
-
return
|
|
1108
|
+
return {
|
|
1109
|
+
tokens: tokens.filter((token) => token.length > 0),
|
|
1110
|
+
complete: !quoted
|
|
1111
|
+
};
|
|
945
1112
|
};
|
|
946
1113
|
readObjcPropertyList = (read, list, admit) => {
|
|
947
|
-
|
|
1114
|
+
const properties = [];
|
|
1115
|
+
const issues = [];
|
|
1116
|
+
if (list === 0n) return {
|
|
1117
|
+
properties,
|
|
1118
|
+
issues
|
|
1119
|
+
};
|
|
948
1120
|
const entrySize = read.u32(list) & ~3;
|
|
949
1121
|
const count = read.u32(list + 4n);
|
|
950
1122
|
if (entrySize !== 16) throw new TypeError(`Unsupported Objective-C property entry size ${entrySize}`);
|
|
951
|
-
const properties = [];
|
|
952
1123
|
for (let index = 0; index < count; index++) {
|
|
953
1124
|
if (!admit()) break;
|
|
954
1125
|
const entry = list + 8n + BigInt(index * entrySize);
|
|
955
|
-
|
|
1126
|
+
const location = `0x${entry.toString(16)}`;
|
|
1127
|
+
try {
|
|
1128
|
+
const name = read.string(read.pointer(entry));
|
|
1129
|
+
if (name.length === 0) throw new TypeError("the property name is empty");
|
|
1130
|
+
const decoded = decodePropertyAttributes(name, read.string(read.pointer(entry + 8n)));
|
|
1131
|
+
properties.push(decoded.property);
|
|
1132
|
+
if (!decoded.complete) issues.push({
|
|
1133
|
+
code: "property_attributes_incomplete",
|
|
1134
|
+
message: `property ${name} has an unterminated quoted class name in its type attribute, so atomicity and unestablished read-only state are unknown`,
|
|
1135
|
+
location
|
|
1136
|
+
});
|
|
1137
|
+
} catch (cause) {
|
|
1138
|
+
issues.push({
|
|
1139
|
+
code: "property_decode_failed",
|
|
1140
|
+
message: `property ${String(index)} could not be decoded: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
1141
|
+
location
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
956
1144
|
}
|
|
957
|
-
return
|
|
1145
|
+
return {
|
|
1146
|
+
properties,
|
|
1147
|
+
issues
|
|
1148
|
+
};
|
|
958
1149
|
};
|
|
959
1150
|
readObjcPropertiesOf = (read, list, context) => {
|
|
960
1151
|
try {
|
|
961
|
-
|
|
1152
|
+
const { properties, issues } = readObjcPropertyList(read, list, context.admit);
|
|
1153
|
+
for (const item of issues) context.issues.push(issue("objc_properties_categories", item.code, `${context.owner}: ${item.message}`, item.location));
|
|
1154
|
+
return properties;
|
|
962
1155
|
} catch (cause) {
|
|
963
1156
|
context.issues.push(issue("objc_properties_categories", "property_decode_failed", `${context.owner}: ${cause instanceof Error ? cause.message : String(cause)}`, context.location));
|
|
964
1157
|
return [];
|
|
@@ -991,9 +1184,15 @@ function init_AppleObjcCategories() {
|
|
|
991
1184
|
try {
|
|
992
1185
|
const category = read.pointer(field);
|
|
993
1186
|
const name = read.string(read.pointer(category));
|
|
1187
|
+
if (name.length === 0) throw new TypeError("Objective-C category has an empty name");
|
|
994
1188
|
const external = boundClassName(read, category + 8n);
|
|
995
1189
|
const local = read.pointer(category + 8n);
|
|
996
|
-
|
|
1190
|
+
let className = external ?? null;
|
|
1191
|
+
if (external === undefined && local !== 0n) try {
|
|
1192
|
+
className = input.localClassName(local);
|
|
1193
|
+
} catch (cause) {
|
|
1194
|
+
input.issues.push(issue("objc_properties_categories", "category_class_unresolved", `Category ${name} class reference 0x${local.toString(16)}: ${cause instanceof Error ? cause.message : String(cause)}`, `0x${(category + 8n).toString(16)}`));
|
|
1195
|
+
}
|
|
997
1196
|
const owner = className ?? `(${name})`;
|
|
998
1197
|
result.objc_categories.push({
|
|
999
1198
|
name,
|
|
@@ -1051,7 +1250,7 @@ function init_AppleObjcProtocols() {
|
|
|
1051
1250
|
}
|
|
1052
1251
|
return names;
|
|
1053
1252
|
};
|
|
1054
|
-
const methods = (address, required, instance) => {
|
|
1253
|
+
const methods = (address, required, instance, emptySelectors) => {
|
|
1055
1254
|
const output = [];
|
|
1056
1255
|
if (address === 0n) return output;
|
|
1057
1256
|
const flags = read.u32(address), count = read.u32(address + 4n);
|
|
@@ -1063,8 +1262,13 @@ function init_AppleObjcProtocols() {
|
|
|
1063
1262
|
const entry = address + 8n + BigInt(index * stride);
|
|
1064
1263
|
let selector = relative ? entry + BigInt(read.i32(entry)) : read.pointer(entry);
|
|
1065
1264
|
if (relative && (flags & 1073741824) === 0) selector = read.pointer(selector);
|
|
1265
|
+
const selectorName = read.string(selector);
|
|
1266
|
+
if (selectorName.length === 0) {
|
|
1267
|
+
emptySelectors.push(`${required ? "required" : "optional"} ${instance ? "instance" : "class"} method ${String(index)} at 0x${entry.toString(16)} has an empty selector`);
|
|
1268
|
+
continue;
|
|
1269
|
+
}
|
|
1066
1270
|
output.push({
|
|
1067
|
-
selector:
|
|
1271
|
+
selector: selectorName,
|
|
1068
1272
|
method_type: instance ? "instance" : "class",
|
|
1069
1273
|
address: null,
|
|
1070
1274
|
is_required: required,
|
|
@@ -1080,8 +1284,11 @@ function init_AppleObjcProtocols() {
|
|
|
1080
1284
|
if (read.u32(address + 64n) < 72) throw new RangeError("Truncated Objective-C protocol declaration");
|
|
1081
1285
|
const protocolName = name(address);
|
|
1082
1286
|
const adopted = list(read.pointer(address + 16n));
|
|
1083
|
-
|
|
1084
|
-
const
|
|
1287
|
+
if (protocolName.length === 0) throw new TypeError("Objective-C protocol has an empty name");
|
|
1288
|
+
const skipped = [];
|
|
1289
|
+
const required = [...methods(read.pointer(address + 24n), true, true, skipped), ...methods(read.pointer(address + 32n), true, false, skipped)];
|
|
1290
|
+
const optional = [...methods(read.pointer(address + 40n), false, true, skipped), ...methods(read.pointer(address + 48n), false, false, skipped)];
|
|
1291
|
+
for (const message of skipped) failures.push(`Protocol 0x${address.toString(16)}: Objective-C protocol ${protocolName} ${message}`);
|
|
1085
1292
|
result.objc_protocols.push({
|
|
1086
1293
|
name: protocolName,
|
|
1087
1294
|
methods: required,
|
|
@@ -1094,9 +1301,12 @@ function init_AppleObjcProtocols() {
|
|
|
1094
1301
|
methods: required,
|
|
1095
1302
|
optional_methods: optional,
|
|
1096
1303
|
location: read.location(address),
|
|
1097
|
-
decode: {
|
|
1304
|
+
decode: skipped.length === 0 ? {
|
|
1098
1305
|
status: "decoded",
|
|
1099
1306
|
reason: null
|
|
1307
|
+
} : {
|
|
1308
|
+
status: "partial",
|
|
1309
|
+
reason: "protocol_method_selector_empty"
|
|
1100
1310
|
},
|
|
1101
1311
|
evidence: read.evidence(address, "Objective-C protocol declaration and encoded method lists; IMP fields are not handler targets")
|
|
1102
1312
|
});
|
|
@@ -1114,7 +1324,7 @@ function init_AppleObjcProtocols() {
|
|
|
1114
1324
|
|
|
1115
1325
|
//#endregion
|
|
1116
1326
|
//#region dist/native/AppleObjcDispatchFacets.js
|
|
1117
|
-
var hex$1, decoded$1,
|
|
1327
|
+
var hex$1, decoded$1, readLocalClass, resolveSuperclass, decodeObjcDispatchFacets;
|
|
1118
1328
|
function init_AppleObjcDispatchFacets() {
|
|
1119
1329
|
return (init_AppleObjcDispatchFacets = __esmMin((() => {
|
|
1120
1330
|
init_result();
|
|
@@ -1126,7 +1336,15 @@ function init_AppleObjcDispatchFacets() {
|
|
|
1126
1336
|
status: "decoded",
|
|
1127
1337
|
reason: null
|
|
1128
1338
|
};
|
|
1129
|
-
|
|
1339
|
+
readLocalClass = (read, address) => {
|
|
1340
|
+
const ro = read.pointer(address + 32n) & ~7n;
|
|
1341
|
+
const name = read.string(read.pointer(ro + 24n));
|
|
1342
|
+
if (name.length === 0) throw new TypeError(`Objective-C class at ${hex$1(address)} has an empty name`);
|
|
1343
|
+
return {
|
|
1344
|
+
ro,
|
|
1345
|
+
name
|
|
1346
|
+
};
|
|
1347
|
+
};
|
|
1130
1348
|
resolveSuperclass = (read, address, className, failures) => {
|
|
1131
1349
|
const external = boundClassName(read, address + 8n);
|
|
1132
1350
|
if (external !== undefined) return {
|
|
@@ -1140,12 +1358,11 @@ function init_AppleObjcDispatchFacets() {
|
|
|
1140
1358
|
};
|
|
1141
1359
|
try {
|
|
1142
1360
|
return {
|
|
1143
|
-
name:
|
|
1361
|
+
name: readLocalClass(read, superclass).name,
|
|
1144
1362
|
address: hex$1(superclass)
|
|
1145
1363
|
};
|
|
1146
1364
|
} catch (cause) {
|
|
1147
|
-
|
|
1148
|
-
failures.push(`Superclass pointer ${hex$1(superclass)} of ${className} requires unsupported binding/fixup resolution`);
|
|
1365
|
+
failures.push(`Superclass pointer ${hex$1(superclass)} of ${className} could not be decoded: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
1149
1366
|
return {
|
|
1150
1367
|
name: null,
|
|
1151
1368
|
address: hex$1(superclass)
|
|
@@ -1203,6 +1420,7 @@ function init_AppleObjcDispatchFacets() {
|
|
|
1203
1420
|
void cause;
|
|
1204
1421
|
}
|
|
1205
1422
|
const selector = read.string(selectorAddress);
|
|
1423
|
+
if (selector.length === 0) throw new TypeError("Objective-C method has an empty selector");
|
|
1206
1424
|
selectors.push(selector);
|
|
1207
1425
|
result.objc_dispatch_implementations.push({
|
|
1208
1426
|
class_name: className,
|
|
@@ -1279,9 +1497,7 @@ function init_AppleObjcDispatchFacets() {
|
|
|
1279
1497
|
const readClass = (address, meta = false) => {
|
|
1280
1498
|
if (address === 0n || visited.has(hex$1(address)) || !budget.admit()) return;
|
|
1281
1499
|
visited.add(hex$1(address));
|
|
1282
|
-
const ro = read
|
|
1283
|
-
const name = read.string(read.pointer(ro + 24n));
|
|
1284
|
-
if (name.length === 0) throw new TypeError(`Objective-C class at ${hex$1(address)} has an empty name`);
|
|
1500
|
+
const { ro, name } = readLocalClass(read, address);
|
|
1285
1501
|
const root = (read.u32(ro) & 2) !== 0;
|
|
1286
1502
|
const superclass = resolveSuperclass(read, address, name, failures);
|
|
1287
1503
|
if (superclass.name === null && superclass.address === null && !root) failures.push(`Superclass of ${name} requires external binding resolution`);
|
|
@@ -1302,10 +1518,12 @@ function init_AppleObjcDispatchFacets() {
|
|
|
1302
1518
|
void cause;
|
|
1303
1519
|
failures.push(`Unresolved ivar offset pointer ${hex$1(encodedOffset)}`);
|
|
1304
1520
|
}
|
|
1521
|
+
const ivarName = read.string(read.pointer(entry + 8n));
|
|
1522
|
+
if (ivarName.length === 0) throw new TypeError("Objective-C ivar has an empty name");
|
|
1305
1523
|
const alignment = read.u32(entry + 24n);
|
|
1306
1524
|
result.objc_ivars.push({
|
|
1307
1525
|
class_name: name,
|
|
1308
|
-
name:
|
|
1526
|
+
name: ivarName,
|
|
1309
1527
|
type_encoding: read.string(read.pointer(entry + 16n)),
|
|
1310
1528
|
offset: value,
|
|
1311
1529
|
size: read.u32(entry + 28n),
|
|
@@ -1390,7 +1608,7 @@ function init_AppleObjcDispatchFacets() {
|
|
|
1390
1608
|
admit: () => budget.admit(),
|
|
1391
1609
|
methods,
|
|
1392
1610
|
protocols: (list) => protocolReader.list(list),
|
|
1393
|
-
localClassName: (address) =>
|
|
1611
|
+
localClassName: (address) => readLocalClass(read, address).name
|
|
1394
1612
|
});
|
|
1395
1613
|
return {
|
|
1396
1614
|
failures,
|
|
@@ -1589,6 +1807,7 @@ function init_AppleSwiftVtables() {
|
|
|
1589
1807
|
const positiveWords = read.u32(descriptor + 28n);
|
|
1590
1808
|
if (count > 2e4 || tableOffset + count > positiveWords) throw new RangeError("Swift vtable count or offset exceeds declared metadata bounds");
|
|
1591
1809
|
const owner = read.string(read.relative(descriptor + 8n));
|
|
1810
|
+
if (owner.length === 0) throw new RangeError("Swift class vtable descriptor class name is empty");
|
|
1592
1811
|
for (let index = 0; index < count; index++) {
|
|
1593
1812
|
const entry = header + 8n + BigInt(index * 8);
|
|
1594
1813
|
if (!read.admit()) {
|
|
@@ -1644,13 +1863,19 @@ function init_AppleSwiftVtables() {
|
|
|
1644
1863
|
|
|
1645
1864
|
//#endregion
|
|
1646
1865
|
//#region dist/native/AppleDispatchMetadata.js
|
|
1647
|
-
var decodeAppleDispatchMetadata, inspectAppleDispatchMetadata;
|
|
1866
|
+
var decodeAppleDispatchMetadata, inspectAppleDispatchMetadata, OPERATION$3, appleDispatchMetadataFailure;
|
|
1648
1867
|
function init_AppleDispatchMetadata() {
|
|
1649
1868
|
return (init_AppleDispatchMetadata = __esmMin((() => {
|
|
1650
1869
|
init_objcSwiftMetadata();
|
|
1651
1870
|
init_binaryTargetTypes();
|
|
1652
1871
|
init_analysisErrorCore();
|
|
1653
|
-
|
|
1872
|
+
init_ArtifactFileOperation();
|
|
1873
|
+
init_ArtifactReader();
|
|
1874
|
+
init_analysisErrorBase();
|
|
1875
|
+
init_analysisErrorProjection();
|
|
1876
|
+
init_providerAdapterError();
|
|
1877
|
+
init_providerCleanupError();
|
|
1878
|
+
init_NativeMacOSProviderMetadata();
|
|
1654
1879
|
init_BoundedFileBytes();
|
|
1655
1880
|
init_evidenceErrors();
|
|
1656
1881
|
init_AppleDispatchCoverage();
|
|
@@ -1691,7 +1916,10 @@ function init_AppleDispatchMetadata() {
|
|
|
1691
1916
|
while (end < bytes.length && end - start < 4096 && bytes[end] !== 0) end++;
|
|
1692
1917
|
if (end === bytes.length || end - start >= 4096) throw new RangeError("Unterminated or oversized metadata string");
|
|
1693
1918
|
offset(address, end - start + 1);
|
|
1694
|
-
return new TextDecoder("utf-8", {
|
|
1919
|
+
return new TextDecoder("utf-8", {
|
|
1920
|
+
fatal: true,
|
|
1921
|
+
ignoreBOM: true
|
|
1922
|
+
}).decode(bytes.subarray(start, end));
|
|
1695
1923
|
};
|
|
1696
1924
|
const result = objcSwiftMetadataSchema.parse({ db_save_result: null });
|
|
1697
1925
|
let records = 0;
|
|
@@ -1778,37 +2006,99 @@ function init_AppleDispatchMetadata() {
|
|
|
1778
2006
|
});
|
|
1779
2007
|
return objcSwiftMetadataSchema.parse(result);
|
|
1780
2008
|
};
|
|
1781
|
-
inspectAppleDispatchMetadata = async (target, maxRecords, signal) => {
|
|
2009
|
+
inspectAppleDispatchMetadata = async (target, maxRecords, resources, signal) => {
|
|
1782
2010
|
if (target.kind !== "executable" || !isMachOFormat(target.format)) throw new TypeError("Apple dispatch metadata requires a Mach-O target");
|
|
1783
2011
|
const maximumBytes = 64 * 1024 * 1024;
|
|
1784
2012
|
const capacityError = () => new AnalysisResourceConstraintError("inspect_native_dispatch_metadata", "memory", "Apple static metadata input exceeds its 64 MiB snapshot budget", { input_bytes: maximumBytes });
|
|
1785
|
-
const
|
|
1786
|
-
|
|
1787
|
-
signal
|
|
1788
|
-
});
|
|
1789
|
-
try {
|
|
2013
|
+
const cancelled = () => new AnalysisCancelledError("inspect_native_dispatch_metadata", { cause: signal?.reason });
|
|
2014
|
+
const { bytes, digest } = await withArtifactRegularFile(target.path, resources, signal, async (handle) => {
|
|
1790
2015
|
const before = await handle.stat();
|
|
1791
2016
|
if (before.size > maximumBytes) throw capacityError();
|
|
1792
|
-
if (signal?.aborted) throw
|
|
1793
|
-
const
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
if (digest !== target.sha256) throw new EvidenceIntegrityError("Apple metadata target digest changed after session binding");
|
|
1797
|
-
return nativeDispatchMetadataResultSchema.parse({
|
|
1798
|
-
target_sha256: target.sha256,
|
|
1799
|
-
provider: {
|
|
1800
|
-
id: "native-macos",
|
|
1801
|
-
name: "macOS native inspection utilities",
|
|
1802
|
-
version: "apple-metadata-reader-1"
|
|
1803
|
-
},
|
|
1804
|
-
analysis_profile_digest: null,
|
|
1805
|
-
result: decodeAppleDispatchMetadata(bytes, maxRecords, {
|
|
1806
|
-
path: target.path,
|
|
1807
|
-
sha256: digest
|
|
1808
|
-
}, target.architecture)
|
|
2017
|
+
if (signal?.aborted) throw cancelled();
|
|
2018
|
+
const read = await readBoundedFileBytes(handle, maximumBytes, signal).catch((cause) => {
|
|
2019
|
+
if (signal?.aborted === true && cause === signal.reason) throw cancelled();
|
|
2020
|
+
throw cause;
|
|
1809
2021
|
});
|
|
1810
|
-
|
|
1811
|
-
|
|
2022
|
+
if (read === undefined) throw capacityError();
|
|
2023
|
+
const sha256 = createHash("sha256").update(read).digest("hex");
|
|
2024
|
+
if (sha256 !== target.sha256) throw new EvidenceIntegrityError("Apple metadata target digest changed after session binding");
|
|
2025
|
+
return {
|
|
2026
|
+
bytes: read,
|
|
2027
|
+
digest: sha256
|
|
2028
|
+
};
|
|
2029
|
+
}, "reject");
|
|
2030
|
+
return nativeDispatchMetadataResultSchema.parse({
|
|
2031
|
+
target_sha256: target.sha256,
|
|
2032
|
+
provider: {
|
|
2033
|
+
id: "native-macos",
|
|
2034
|
+
name: "macOS native inspection utilities",
|
|
2035
|
+
version: "apple-metadata-reader-1"
|
|
2036
|
+
},
|
|
2037
|
+
analysis_profile_digest: null,
|
|
2038
|
+
result: decodeAppleDispatchMetadata(bytes, maxRecords, {
|
|
2039
|
+
path: target.path,
|
|
2040
|
+
sha256: digest
|
|
2041
|
+
}, target.architecture)
|
|
2042
|
+
});
|
|
2043
|
+
};
|
|
2044
|
+
OPERATION$3 = "inspect_native_dispatch_metadata";
|
|
2045
|
+
appleDispatchMetadataFailure = (cause, path) => {
|
|
2046
|
+
if (cause instanceof ArtifactReaderFailure && cause.cleanup !== undefined) {
|
|
2047
|
+
const physical = cause instanceof ArtifactFileCleanupFailure ? cause.fileCleanupFailure : undefined;
|
|
2048
|
+
const previous = physical?.outcome.kind === "failed" ? appleDispatchMetadataFailure(artifactFilePrimaryFailure(cause), path) : physical?.completionCancellation === undefined ? undefined : new AnalysisCancelledError(OPERATION$3, { cause: physical.completionCancellation.reason });
|
|
2049
|
+
const failure = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, cause.cleanup.resources, {
|
|
2050
|
+
reason: cause.cleanup.reason,
|
|
2051
|
+
previous_error: previous === undefined ? null : projectAnalysisError(previous)
|
|
2052
|
+
}, {
|
|
2053
|
+
operation: OPERATION$3,
|
|
2054
|
+
cause,
|
|
2055
|
+
cleanupPrimary: previous
|
|
2056
|
+
});
|
|
2057
|
+
bindArtifactFileCleanup(cause, failure);
|
|
2058
|
+
return failure;
|
|
2059
|
+
}
|
|
2060
|
+
if (cause instanceof AnalysisError) return cause;
|
|
2061
|
+
if (cause instanceof ArtifactReaderFailure && cause.reason === "cancelled") return new AnalysisCancelledError(OPERATION$3, { cause: artifactFileCancellationCause(cause) });
|
|
2062
|
+
if (cause instanceof ArtifactReaderFailure && cause.reason === "unavailable") return new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, OPERATION$3, cause.message, { cause });
|
|
2063
|
+
return new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, OPERATION$3, {
|
|
2064
|
+
cause,
|
|
2065
|
+
diagnostics: {
|
|
2066
|
+
target_path: path,
|
|
2067
|
+
reason: cause instanceof Error ? cause.message : String(cause)
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
};
|
|
2071
|
+
})))();
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
//#endregion
|
|
2075
|
+
//#region dist/native/NativeUiCleanupError.js
|
|
2076
|
+
var NativeUiCleanupError;
|
|
2077
|
+
function init_NativeUiCleanupError() {
|
|
2078
|
+
return (init_NativeUiCleanupError = __esmMin((() => {
|
|
2079
|
+
init_AnalysisCleanupLease();
|
|
2080
|
+
init_providerCleanupError();
|
|
2081
|
+
NativeUiCleanupError = class extends ProviderCleanupError {
|
|
2082
|
+
runtimes;
|
|
2083
|
+
constructor(failures, operation, partialObservation) {
|
|
2084
|
+
const runtimes = failures.map(({ runtime }) => runtime);
|
|
2085
|
+
const resources = () => runtimes.filter((runtime) => !runtime.cleanupLease.released).flatMap((runtime) => runtime.resources());
|
|
2086
|
+
super("native-macos", resources(), {
|
|
2087
|
+
reason: "Native UI runtime cleanup remains incomplete",
|
|
2088
|
+
failures: failures.map(({ runtime, cause }) => ({
|
|
2089
|
+
resources: [...runtime.resources()],
|
|
2090
|
+
reason: cause instanceof Error ? cause.message : String(cause)
|
|
2091
|
+
}))
|
|
2092
|
+
}, {
|
|
2093
|
+
operation,
|
|
2094
|
+
cause: new AggregateError(failures.map(({ cause }) => cause), "Native UI runtime cleanup failed"),
|
|
2095
|
+
partialObservation
|
|
2096
|
+
});
|
|
2097
|
+
this.runtimes = runtimes;
|
|
2098
|
+
new AnalysisCleanupLeaseGroup(this, runtimes.map((runtime) => runtime.cleanupLease));
|
|
2099
|
+
this.bindCleanupResourceOwner({ get cleanupResources() {
|
|
2100
|
+
return resources();
|
|
2101
|
+
} });
|
|
1812
2102
|
}
|
|
1813
2103
|
};
|
|
1814
2104
|
})))();
|
|
@@ -1835,6 +2125,8 @@ function init_NativeUiOutputBudget() {
|
|
|
1835
2125
|
var createNativeUiHelperRuntime;
|
|
1836
2126
|
function init_NativeUiHelperRuntime() {
|
|
1837
2127
|
return (init_NativeUiHelperRuntime = __esmMin((() => {
|
|
2128
|
+
init_ArtifactResourceScope();
|
|
2129
|
+
init_AnalysisCleanupLease();
|
|
1838
2130
|
init_snapshotEnvironment();
|
|
1839
2131
|
init_DarwinProcessRunTokenReader();
|
|
1840
2132
|
init_ExecFileOutput();
|
|
@@ -1842,59 +2134,68 @@ function init_NativeUiHelperRuntime() {
|
|
|
1842
2134
|
init_NativeUiOutputBudget();
|
|
1843
2135
|
createNativeUiHelperRuntime = (environment) => {
|
|
1844
2136
|
const selectedEnvironment = snapshotEnvironment(environment);
|
|
2137
|
+
const deadlineSignal = AbortSignal.timeout(18e4);
|
|
2138
|
+
const operations = new ArtifactResourceScope();
|
|
1845
2139
|
let root;
|
|
1846
|
-
let
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
const compilerTemporary = join(root, "tmp");
|
|
1854
|
-
await mkdir(compilerTemporary);
|
|
1855
|
-
await execFileOutput("/usr/bin/xcrun", [
|
|
1856
|
-
"swiftc",
|
|
1857
|
-
"-module-cache-path",
|
|
1858
|
-
join(root, "modules"),
|
|
1859
|
-
fileURLToPath(new URL("../../bridge/native/NativeUIChildren.swift", new URL("../native/NativeUiHelperRuntime.js", import.meta.url).href)),
|
|
1860
|
-
main,
|
|
1861
|
-
"-o",
|
|
1862
|
-
output
|
|
1863
|
-
], {
|
|
1864
|
-
timeout: 6e4,
|
|
1865
|
-
maxBuffer: 1024 * 1024,
|
|
1866
|
-
stopSignal: SWIFTC_INTERRUPT,
|
|
1867
|
-
env: {
|
|
1868
|
-
...selectedEnvironment,
|
|
1869
|
-
TMPDIR: compilerTemporary
|
|
1870
|
-
},
|
|
1871
|
-
...signal === undefined ? {} : { signal }
|
|
2140
|
+
let preparation;
|
|
2141
|
+
const cleanupLease = new AnalysisCleanupLease(async () => {
|
|
2142
|
+
await operations.close();
|
|
2143
|
+
if (root !== undefined) {
|
|
2144
|
+
await rm(root, {
|
|
2145
|
+
recursive: true,
|
|
2146
|
+
force: true
|
|
1872
2147
|
});
|
|
1873
|
-
|
|
2148
|
+
root = undefined;
|
|
2149
|
+
preparation = undefined;
|
|
1874
2150
|
}
|
|
2151
|
+
});
|
|
2152
|
+
const prepare = async (signal) => {
|
|
2153
|
+
root = await mkdtemp(join(tmpdir(), "rea-native-ui-"));
|
|
2154
|
+
const output = join(root, "observer");
|
|
2155
|
+
const main = join(root, "main.swift");
|
|
2156
|
+
await symlink(fileURLToPath(new URL("../../bridge/native/ReaNativeUI.swift", new URL("../native/NativeUiHelperRuntime.js", import.meta.url).href)), main);
|
|
2157
|
+
const compilerTemporary = join(root, "tmp");
|
|
2158
|
+
await mkdir(compilerTemporary);
|
|
2159
|
+
await execFileOutput("/usr/bin/xcrun", [
|
|
2160
|
+
"swiftc",
|
|
2161
|
+
"-module-cache-path",
|
|
2162
|
+
join(root, "modules"),
|
|
2163
|
+
fileURLToPath(new URL("../../bridge/native/NativeUIChildren.swift", new URL("../native/NativeUiHelperRuntime.js", import.meta.url).href)),
|
|
2164
|
+
main,
|
|
2165
|
+
"-o",
|
|
2166
|
+
output
|
|
2167
|
+
], {
|
|
2168
|
+
timeout: 6e4,
|
|
2169
|
+
maxBuffer: 1024 * 1024,
|
|
2170
|
+
stopSignal: SWIFTC_INTERRUPT,
|
|
2171
|
+
env: {
|
|
2172
|
+
...selectedEnvironment,
|
|
2173
|
+
TMPDIR: compilerTemporary
|
|
2174
|
+
},
|
|
2175
|
+
signal
|
|
2176
|
+
});
|
|
2177
|
+
return output;
|
|
2178
|
+
};
|
|
2179
|
+
const invoke = (parameters, callerSignal) => operations.run(async () => {
|
|
2180
|
+
const signal = callerSignal === undefined ? deadlineSignal : AbortSignal.any([callerSignal, deadlineSignal]);
|
|
2181
|
+
preparation ??= prepare(signal);
|
|
2182
|
+
const executable = await preparation;
|
|
1875
2183
|
const output = await execFileOutput(executable, [JSON.stringify(parameters)], {
|
|
1876
2184
|
timeout: 3e4,
|
|
1877
2185
|
maxBuffer: NATIVE_UI_HELPER_MAX_BUFFER,
|
|
1878
2186
|
stopSignal: "SIGTERM",
|
|
1879
2187
|
env: selectedEnvironment,
|
|
1880
|
-
|
|
2188
|
+
signal
|
|
1881
2189
|
});
|
|
1882
2190
|
const parsed = safeParseJson(output.stdout);
|
|
1883
2191
|
if (!parsed.ok) throw new Error(`Native helper returned invalid JSON: ${parsed.error}`, { cause: parsed.cause });
|
|
1884
2192
|
return parsed.value;
|
|
1885
|
-
};
|
|
2193
|
+
});
|
|
1886
2194
|
return {
|
|
1887
2195
|
invoke,
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
recursive: true,
|
|
1892
|
-
force: true
|
|
1893
|
-
});
|
|
1894
|
-
root = undefined;
|
|
1895
|
-
executable = undefined;
|
|
1896
|
-
}
|
|
1897
|
-
},
|
|
2196
|
+
cleanupLease,
|
|
2197
|
+
signal: deadlineSignal,
|
|
2198
|
+
close: () => cleanupLease.release(),
|
|
1898
2199
|
resources: () => root === undefined ? [] : [root]
|
|
1899
2200
|
};
|
|
1900
2201
|
};
|
|
@@ -1903,17 +2204,26 @@ function init_NativeUiHelperRuntime() {
|
|
|
1903
2204
|
|
|
1904
2205
|
//#endregion
|
|
1905
2206
|
//#region dist/native/NativeUiObservation.js
|
|
1906
|
-
var helper, responseSchema, observeNativeUi, observeWithHelper;
|
|
2207
|
+
var helper, passiveInputSchema, responseSchema, observeNativeUi, observeWithHelper, finishNativeUiObservation;
|
|
1907
2208
|
function init_NativeUiObservation() {
|
|
1908
2209
|
return (init_NativeUiObservation = __esmMin((() => {
|
|
2210
|
+
init_ProviderDeadline();
|
|
1909
2211
|
init_binaryTargetTypes();
|
|
1910
2212
|
init_nativeUiObservation();
|
|
1911
2213
|
init_analysisErrorCore();
|
|
1912
2214
|
init_providerAdapterError();
|
|
2215
|
+
init_analysisErrorBase();
|
|
2216
|
+
init_analysisErrorCleanup();
|
|
2217
|
+
init_ExecFileOutput();
|
|
2218
|
+
init_NativeUiCleanupError();
|
|
1913
2219
|
init_result();
|
|
1914
2220
|
init_NativeUiHelperRuntime();
|
|
1915
2221
|
init_NativeUiOutputBudget();
|
|
1916
2222
|
helper = fileURLToPath(new URL("../../bridge/native/ReaNativeUI.swift", new URL("../native/NativeUiObservation.js", import.meta.url).href));
|
|
2223
|
+
passiveInputSchema = nativeUiObservationInputSchema.transform((input) => ({
|
|
2224
|
+
...input,
|
|
2225
|
+
steps: []
|
|
2226
|
+
}));
|
|
1917
2227
|
responseSchema = z.discriminatedUnion("ok", [z.strictObject({
|
|
1918
2228
|
ok: z.literal(true),
|
|
1919
2229
|
result: nativeUiSnapshotSchema
|
|
@@ -1924,28 +2234,43 @@ function init_NativeUiObservation() {
|
|
|
1924
2234
|
})]);
|
|
1925
2235
|
observeNativeUi = async (target, operation, parameters, options) => {
|
|
1926
2236
|
const runtime = options.runtime ?? createNativeUiHelperRuntime(options.environment);
|
|
2237
|
+
const signal = options.signal === undefined ? runtime.signal : AbortSignal.any([options.signal, runtime.signal]);
|
|
2238
|
+
let result;
|
|
1927
2239
|
try {
|
|
1928
|
-
|
|
1929
|
-
|
|
2240
|
+
result = await observeWithHelper(target, operation, parameters, {
|
|
2241
|
+
signal,
|
|
1930
2242
|
invoke: options.invoke ?? runtime.invoke
|
|
1931
2243
|
});
|
|
1932
|
-
}
|
|
1933
|
-
|
|
2244
|
+
} catch (cause) {
|
|
2245
|
+
result = err(cause instanceof AnalysisError ? cause : new ProviderAdapterError("native-macos", operation, { cause }));
|
|
1934
2246
|
}
|
|
2247
|
+
if (options.runtime === undefined) {
|
|
2248
|
+
try {
|
|
2249
|
+
await runtime.close();
|
|
2250
|
+
} catch (cause) {
|
|
2251
|
+
result = finishNativeUiObservation(result, operation, signal);
|
|
2252
|
+
const cleanup = new NativeUiCleanupError([{
|
|
2253
|
+
runtime,
|
|
2254
|
+
cause
|
|
2255
|
+
}], operation, result.ok ? result.value : undefined);
|
|
2256
|
+
return result.ok ? err(cleanup) : err(analysisErrorWithCleanupFailure(result.error, cleanup, operation).bindCleanupDependencies([result.error, cleanup]));
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
return finishNativeUiObservation(result, operation, signal);
|
|
1935
2260
|
};
|
|
1936
2261
|
observeWithHelper = async (target, operation, parameters, options) => {
|
|
1937
|
-
const parsed = (operation === "observe_native_ui" ?
|
|
2262
|
+
const parsed = (operation === "observe_native_ui" ? passiveInputSchema : nativeUiScenarioInputSchema).safeParse(parameters);
|
|
1938
2263
|
if (!parsed.success) return err(new AnalysisInputError(operation, { cause: parsed.error }));
|
|
1939
2264
|
if (target.kind !== "executable" || !isMachOFormat(target.format)) return err(new AnalysisCapabilityUnavailableError("native-macos", operation, "Native UI observation requires an active Mach-O executable or app target"));
|
|
1940
2265
|
const input = parsed.data;
|
|
1941
2266
|
if (!input.screenshot && !input.accessibility) return err(new AnalysisInputError(operation, { cause: new Error("Enable screenshot or accessibility capture") }));
|
|
1942
|
-
const steps =
|
|
1943
|
-
const signal = options.signal
|
|
2267
|
+
const steps = input.steps;
|
|
2268
|
+
const signal = options.signal;
|
|
1944
2269
|
const invoke = options.invoke;
|
|
1945
2270
|
let launchTime;
|
|
1946
2271
|
let outputBytes = 0;
|
|
1947
2272
|
const take = async (action) => {
|
|
1948
|
-
if (signal.aborted) return err(new AnalysisCancelledError(operation));
|
|
2273
|
+
if (signal.aborted) return err(new AnalysisCancelledError(operation, { cause: signal.reason }));
|
|
1949
2274
|
try {
|
|
1950
2275
|
const response = responseSchema.parse(await invoke({
|
|
1951
2276
|
pid: input.pid,
|
|
@@ -1965,7 +2290,8 @@ function init_NativeUiObservation() {
|
|
|
1965
2290
|
if (outputBytes > 67108864) return err(new AnalysisCapabilityUnavailableError("native-macos", operation, "Scenario captures exceeded the 64 MiB output budget"));
|
|
1966
2291
|
return ok(response.result);
|
|
1967
2292
|
} catch (cause) {
|
|
1968
|
-
|
|
2293
|
+
if (cause instanceof AnalysisError) return err(cause);
|
|
2294
|
+
return err(cause instanceof ExecFileOutputCancelledError ? new AnalysisCancelledError(operation, { cause: cause.cause }) : new ProviderAdapterError("native-macos", operation, {
|
|
1969
2295
|
cause,
|
|
1970
2296
|
diagnostics: {
|
|
1971
2297
|
helper_path: helper,
|
|
@@ -1979,8 +2305,10 @@ function init_NativeUiObservation() {
|
|
|
1979
2305
|
if (!initial.ok) return initial;
|
|
1980
2306
|
const results = [];
|
|
1981
2307
|
let before = initial.value;
|
|
2308
|
+
let terminalFailure;
|
|
1982
2309
|
for (const [index, step] of steps.entries()) {
|
|
1983
2310
|
if (signal.aborted) {
|
|
2311
|
+
terminalFailure = new AnalysisCancelledError(operation, { cause: signal.reason });
|
|
1984
2312
|
results.push({
|
|
1985
2313
|
index,
|
|
1986
2314
|
kind: step.kind,
|
|
@@ -1991,35 +2319,21 @@ function init_NativeUiObservation() {
|
|
|
1991
2319
|
});
|
|
1992
2320
|
break;
|
|
1993
2321
|
}
|
|
1994
|
-
if (step.kind === "wait") {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
2006
|
-
if (signal.aborted) abort();
|
|
2007
|
-
});
|
|
2008
|
-
} catch (cause) {
|
|
2009
|
-
void cause;
|
|
2010
|
-
results.push({
|
|
2011
|
-
index,
|
|
2012
|
-
kind: step.kind,
|
|
2013
|
-
before,
|
|
2014
|
-
after: null,
|
|
2015
|
-
outcome: "cancelled",
|
|
2016
|
-
reason: "Scenario cancelled during wait"
|
|
2017
|
-
});
|
|
2018
|
-
break;
|
|
2019
|
-
}
|
|
2322
|
+
if (step.kind === "wait" && await waitForAbortableDelay(step.milliseconds, signal) === "aborted") {
|
|
2323
|
+
terminalFailure = new AnalysisCancelledError(operation, { cause: signal.reason });
|
|
2324
|
+
results.push({
|
|
2325
|
+
index,
|
|
2326
|
+
kind: step.kind,
|
|
2327
|
+
before,
|
|
2328
|
+
after: null,
|
|
2329
|
+
outcome: "cancelled",
|
|
2330
|
+
reason: "Scenario cancelled during wait"
|
|
2331
|
+
});
|
|
2332
|
+
break;
|
|
2020
2333
|
}
|
|
2021
2334
|
const after = await take(step.kind === "wait" ? undefined : step);
|
|
2022
2335
|
if (!after.ok) {
|
|
2336
|
+
terminalFailure = after.error;
|
|
2023
2337
|
results.push({
|
|
2024
2338
|
index,
|
|
2025
2339
|
kind: step.kind,
|
|
@@ -2040,7 +2354,7 @@ function init_NativeUiObservation() {
|
|
|
2040
2354
|
});
|
|
2041
2355
|
before = after.value;
|
|
2042
2356
|
}
|
|
2043
|
-
|
|
2357
|
+
const report = nativeUiResultSchema.parse({
|
|
2044
2358
|
target_sha256: target.sha256,
|
|
2045
2359
|
initial: initial.value,
|
|
2046
2360
|
steps: results,
|
|
@@ -2052,7 +2366,342 @@ function init_NativeUiObservation() {
|
|
|
2052
2366
|
"Scenarios can change app data, cause app network activity and persist changes. The caller explicitly chooses leave-as-is; automatic restoration is unsupported.",
|
|
2053
2367
|
"Window matching uses exact PID and window ID for screenshots and unique accessibility geometry. Accessibility paths can change as the UI changes; stale or ambiguous paths fail. Screenshots are scaled to at most 2048 pixels; scenario output is budgeted at 64 MiB and execution is cancelled after 180 seconds."
|
|
2054
2368
|
]
|
|
2055
|
-
})
|
|
2369
|
+
});
|
|
2370
|
+
return terminalFailure === undefined ? finishNativeUiObservation(ok(report), operation, signal) : err(terminalFailure.retainPartialObservation(report));
|
|
2371
|
+
};
|
|
2372
|
+
finishNativeUiObservation = (result, operation, signal) => result.ok && signal?.aborted ? err(new AnalysisCancelledError(operation, {
|
|
2373
|
+
cause: signal.reason,
|
|
2374
|
+
partialObservation: result.value
|
|
2375
|
+
})) : result;
|
|
2376
|
+
})))();
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
//#endregion
|
|
2380
|
+
//#region dist/native/NativeCallTarget.js
|
|
2381
|
+
var OPERATION$2, nativeCallTargetFailure, verifyNativeCallTarget;
|
|
2382
|
+
function init_NativeCallTarget() {
|
|
2383
|
+
return (init_NativeCallTarget = __esmMin((() => {
|
|
2384
|
+
init_NativeMacOSProviderMetadata();
|
|
2385
|
+
init_analysisErrorCore();
|
|
2386
|
+
init_evidenceErrors();
|
|
2387
|
+
init_providerAdapterError();
|
|
2388
|
+
init_providerCleanupError();
|
|
2389
|
+
init_jsonValue();
|
|
2390
|
+
init_result();
|
|
2391
|
+
init_StableFileHash();
|
|
2392
|
+
init_RegularFile();
|
|
2393
|
+
init_OwnedRegularFile();
|
|
2394
|
+
init_AnalysisCleanupLease();
|
|
2395
|
+
init_ArtifactResourceScope();
|
|
2396
|
+
init_ArtifactFileOperation();
|
|
2397
|
+
OPERATION$2 = "observe_native_calls";
|
|
2398
|
+
nativeCallTargetFailure = (cause, path) => {
|
|
2399
|
+
if (cause instanceof ArtifactResourceRetryFailure && cause.cleanup !== undefined) {
|
|
2400
|
+
const failure = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, cause.cleanup.resources, {
|
|
2401
|
+
reason: cause.cleanup.reason,
|
|
2402
|
+
phase: "target-digest-retry"
|
|
2403
|
+
}, {
|
|
2404
|
+
operation: OPERATION$2,
|
|
2405
|
+
cause
|
|
2406
|
+
});
|
|
2407
|
+
bindArtifactFileCleanup(cause, failure);
|
|
2408
|
+
return failure;
|
|
2409
|
+
}
|
|
2410
|
+
if (cause instanceof RegularFileOperationCancelled || cause instanceof RegularFileCancelled) return new AnalysisCancelledError(OPERATION$2, {
|
|
2411
|
+
cause: cause.reason,
|
|
2412
|
+
...cause instanceof RegularFileCancelled ? { diagnostics: { completed_hash: jsonValueSchema.parse(cause.outcome.value) } } : {}
|
|
2413
|
+
});
|
|
2414
|
+
const physical = stableFileHashCause(cause);
|
|
2415
|
+
if (physical instanceof RegularFileChangedError) return new EvidenceIntegrityError("Native call observation target changed during digest verification", { cause: physical });
|
|
2416
|
+
return new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, OPERATION$2, {
|
|
2417
|
+
cause: physical,
|
|
2418
|
+
diagnostics: {
|
|
2419
|
+
path,
|
|
2420
|
+
phase: "target-digest",
|
|
2421
|
+
reason: "Unable to verify the selected target digest",
|
|
2422
|
+
detail: physical instanceof Error ? physical.message : String(physical)
|
|
2423
|
+
}
|
|
2424
|
+
});
|
|
2425
|
+
};
|
|
2426
|
+
verifyNativeCallTarget = async (target, resources, signal) => {
|
|
2427
|
+
let cleanupLease;
|
|
2428
|
+
try {
|
|
2429
|
+
const digest = await hashStableFile(target.path, {
|
|
2430
|
+
...signal === undefined ? {} : { signal },
|
|
2431
|
+
retainFailedClose: (owner) => {
|
|
2432
|
+
cleanupLease = new AnalysisCleanupLease(() => owner.close(), [target.path]);
|
|
2433
|
+
resources.retain({
|
|
2434
|
+
kind: "lease",
|
|
2435
|
+
resource: target.path,
|
|
2436
|
+
lease: cleanupLease
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
});
|
|
2440
|
+
return digest.sha256 === target.sha256 ? ok(undefined) : err(new EvidenceIntegrityError("Native call observation target digest changed after session binding"));
|
|
2441
|
+
} catch (cause) {
|
|
2442
|
+
if (cause instanceof RegularFileCleanupFailure && cleanupLease !== undefined) {
|
|
2443
|
+
const cancellation = regularFileCancellation(cause);
|
|
2444
|
+
const completed = cause.outcome.kind === "completed" ? { completed_hash: jsonValueSchema.parse(cause.outcome.value) } : undefined;
|
|
2445
|
+
const primary = cause.outcome.kind === "failed" ? nativeCallTargetFailure(cause.outcome.cause, target.path) : cancellation === undefined ? undefined : new AnalysisCancelledError(OPERATION$2, {
|
|
2446
|
+
cause: cancellation.reason,
|
|
2447
|
+
diagnostics: completed
|
|
2448
|
+
});
|
|
2449
|
+
const framed = new ArtifactFileCleanupFailure(cause, cleanupLease);
|
|
2450
|
+
const failure = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, [target.path], {
|
|
2451
|
+
phase: "target-digest-close",
|
|
2452
|
+
reason: cause.cleanupCause instanceof Error ? cause.cleanupCause.message : String(cause.cleanupCause),
|
|
2453
|
+
...completed
|
|
2454
|
+
}, {
|
|
2455
|
+
operation: OPERATION$2,
|
|
2456
|
+
cause: framed,
|
|
2457
|
+
cleanupPrimary: primary
|
|
2458
|
+
});
|
|
2459
|
+
bindArtifactFileCleanup(framed, failure);
|
|
2460
|
+
return err(failure);
|
|
2461
|
+
}
|
|
2462
|
+
return err(nativeCallTargetFailure(cause, target.path));
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2465
|
+
})))();
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region dist/domain/native/nativeCallPartialObservation.js
|
|
2470
|
+
var completed, nativeCallPartialObservationSchema;
|
|
2471
|
+
function init_nativeCallPartialObservation() {
|
|
2472
|
+
return (init_nativeCallPartialObservation = __esmMin((() => {
|
|
2473
|
+
init_nativeCallObservation();
|
|
2474
|
+
completed = nativeCallObservationResultSchema.shape;
|
|
2475
|
+
nativeCallPartialObservationSchema = z.strictObject({
|
|
2476
|
+
kind: z.literal("native-call-observation"),
|
|
2477
|
+
target: completed.target.omit({ launch_identity: true }).extend({ launch_identity: completed.target.shape.launch_identity.optional() }),
|
|
2478
|
+
process: completed.process.partial().extend({
|
|
2479
|
+
pid: z.number().int().positive().nullable(),
|
|
2480
|
+
stdout: nativeCapturedOutputSchema.nullable(),
|
|
2481
|
+
stderr: nativeCapturedOutputSchema.nullable(),
|
|
2482
|
+
other_stops: z.array(z.string())
|
|
2483
|
+
}),
|
|
2484
|
+
debugger: completed.debugger.partial().extend({ version: z.string().nullable() }),
|
|
2485
|
+
breakpoints: completed.breakpoints.optional(),
|
|
2486
|
+
events: z.array(nativeCallEventSchema),
|
|
2487
|
+
coverage: completed.coverage.omit({ status: true }).partial().extend({
|
|
2488
|
+
status: z.literal("partial"),
|
|
2489
|
+
reason: z.enum([
|
|
2490
|
+
"cancelled",
|
|
2491
|
+
"timeout",
|
|
2492
|
+
"tracer-failure",
|
|
2493
|
+
"capture-failure",
|
|
2494
|
+
"cleanup-failure"
|
|
2495
|
+
])
|
|
2496
|
+
}),
|
|
2497
|
+
limitations: z.array(z.string())
|
|
2498
|
+
});
|
|
2499
|
+
})))();
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
//#endregion
|
|
2503
|
+
//#region dist/native/NativeCallObservation.js
|
|
2504
|
+
var OPERATION$1, NATIVE_CALL_OBSERVATION_LIMITATIONS, observeNativeCalls, nativeCallFacts, projectNativeCalls, projectPartialNativeCalls;
|
|
2505
|
+
function init_NativeCallObservation() {
|
|
2506
|
+
return (init_NativeCallObservation = __esmMin((() => {
|
|
2507
|
+
init_analysisErrorCore();
|
|
2508
|
+
init_binaryTargetTypes();
|
|
2509
|
+
init_providerAdapterError();
|
|
2510
|
+
init_nativeCallObservation();
|
|
2511
|
+
init_NativeCallTarget();
|
|
2512
|
+
init_result();
|
|
2513
|
+
init_nativeCallPartialObservation();
|
|
2514
|
+
OPERATION$1 = "observe_native_calls";
|
|
2515
|
+
NATIVE_CALL_OBSERVATION_LIMITATIONS = [
|
|
2516
|
+
"Only entries are observed; return values, floating-point and stack-passed arguments are not captured.",
|
|
2517
|
+
"Registers are the raw integer argument registers at entry. For Objective-C methods the first two hold the receiver and the selector.",
|
|
2518
|
+
"Receiver classes come from LLDB's Objective-C runtime reader without running target code; they are null for class methods and for receivers LLDB cannot classify.",
|
|
2519
|
+
"Calls that never reach a symbol's entry, such as inlined code or objc_direct methods called directly, are not observed.",
|
|
2520
|
+
"The target is launched directly under LLDB, not through LaunchServices; LLDB disables ASLR for it, so load addresses can equal file addresses.",
|
|
2521
|
+
"The observation window is checked about once a second, and recording pauses the process at every entry, which slows it."
|
|
2522
|
+
];
|
|
2523
|
+
observeNativeCalls = async (target, parameters, tracer, resources, signal) => {
|
|
2524
|
+
if (target.kind !== "executable" || !isMachOFormat(target.format)) return err(new AnalysisCapabilityUnavailableError("native-macos", OPERATION$1, "Native call observation launches a Mach-O executable; the active target is not one"));
|
|
2525
|
+
const parsed = nativeCallObservationInputSchema.safeParse(parameters);
|
|
2526
|
+
if (!parsed.success) return err(new AnalysisInputError(OPERATION$1, { cause: parsed.error }));
|
|
2527
|
+
try {
|
|
2528
|
+
return await resources.run(async () => {
|
|
2529
|
+
const selected = await verifyNativeCallTarget(target, resources, signal);
|
|
2530
|
+
if (!selected.ok) return selected;
|
|
2531
|
+
if (signal?.aborted) return err(new AnalysisCancelledError(OPERATION$1, { cause: signal.reason }));
|
|
2532
|
+
try {
|
|
2533
|
+
const traced = await tracer.trace({
|
|
2534
|
+
executable: target.path,
|
|
2535
|
+
architecture: target.architecture,
|
|
2536
|
+
expectedSha256: target.sha256,
|
|
2537
|
+
input: parsed.data
|
|
2538
|
+
}, signal);
|
|
2539
|
+
if (!traced.ok) return traced;
|
|
2540
|
+
return signal?.aborted ? err(new AnalysisCancelledError(OPERATION$1, {
|
|
2541
|
+
cause: signal.reason,
|
|
2542
|
+
partialObservation: projectPartialNativeCalls(target, parsed.data, traced.value, "cancelled")
|
|
2543
|
+
})) : ok(projectNativeCalls(target, parsed.data, traced.value));
|
|
2544
|
+
} catch (cause) {
|
|
2545
|
+
return err(new ProviderAdapterError("native-macos", OPERATION$1, {
|
|
2546
|
+
cause,
|
|
2547
|
+
diagnostics: { phase: "trace-result" }
|
|
2548
|
+
}));
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
} catch (cause) {
|
|
2552
|
+
return err(nativeCallTargetFailure(cause, target.path));
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
nativeCallFacts = (target, input, trace) => {
|
|
2556
|
+
const { run } = trace;
|
|
2557
|
+
const unresolved = run.breakpoints.filter(({ location_count: count }) => count === 0).map(({ index }) => index);
|
|
2558
|
+
const eventLimit = run.outcome === "event-limit";
|
|
2559
|
+
const resourceLimit = run.outcome === "resource-limit";
|
|
2560
|
+
const breakpointLocationLimit = run.breakpoint_locations_truncated === true;
|
|
2561
|
+
const partial = eventLimit || resourceLimit || breakpointLocationLimit || run.outcome === "duration-elapsed" || run.outcome === "stop-limit" || unresolved.length > 0;
|
|
2562
|
+
return {
|
|
2563
|
+
target: {
|
|
2564
|
+
path: target.path,
|
|
2565
|
+
sha256: target.sha256,
|
|
2566
|
+
architecture: target.architecture,
|
|
2567
|
+
arguments: input.arguments,
|
|
2568
|
+
environment: input.environment,
|
|
2569
|
+
working_directory: input.working_directory ?? null,
|
|
2570
|
+
launch_identity: {
|
|
2571
|
+
loaded_image_sha256: run.target_identity.loaded_image_sha256,
|
|
2572
|
+
file_device: run.target_identity.file_device,
|
|
2573
|
+
file_inode: run.target_identity.file_inode,
|
|
2574
|
+
selected_file_sha256: run.target_identity.selected_file_sha256,
|
|
2575
|
+
module_path: run.target_identity.module_path,
|
|
2576
|
+
module_uuid: run.target_identity.module_uuid,
|
|
2577
|
+
stable: run.target_identity.stable
|
|
2578
|
+
}
|
|
2579
|
+
},
|
|
2580
|
+
debugger: trace.debugger,
|
|
2581
|
+
process: {
|
|
2582
|
+
pid: run.pid,
|
|
2583
|
+
outcome: run.outcome,
|
|
2584
|
+
exit_status: run.exit_status,
|
|
2585
|
+
exit_description: run.exit_description,
|
|
2586
|
+
terminated: run.terminated && trace.terminated,
|
|
2587
|
+
elapsed_ms: run.elapsed_ms,
|
|
2588
|
+
stdout: trace.stdout,
|
|
2589
|
+
stderr: trace.stderr,
|
|
2590
|
+
other_stops: run.other_stops
|
|
2591
|
+
},
|
|
2592
|
+
breakpoints: input.breakpoints.map((request, index) => ({
|
|
2593
|
+
index,
|
|
2594
|
+
request: request.kind === "function" ? {
|
|
2595
|
+
...request,
|
|
2596
|
+
module: request.module ?? null
|
|
2597
|
+
} : {
|
|
2598
|
+
...request,
|
|
2599
|
+
class_name: request.class_name ?? null
|
|
2600
|
+
},
|
|
2601
|
+
location_count: run.breakpoints[index]?.location_count ?? 0,
|
|
2602
|
+
locations: run.breakpoints[index]?.locations ?? []
|
|
2603
|
+
})),
|
|
2604
|
+
events: run.events,
|
|
2605
|
+
coverage: {
|
|
2606
|
+
status: partial ? "partial" : "complete",
|
|
2607
|
+
event_limit_reached: eventLimit,
|
|
2608
|
+
resource_limit_reached: resourceLimit,
|
|
2609
|
+
...breakpointLocationLimit ? { breakpoint_locations_truncated: true } : {},
|
|
2610
|
+
unresolved_breakpoints: unresolved
|
|
2611
|
+
},
|
|
2612
|
+
limitations: [
|
|
2613
|
+
...NATIVE_CALL_OBSERVATION_LIMITATIONS,
|
|
2614
|
+
"The selected pathname digest and LLDB module identity are checked around launch. No immutable executable snapshot is used; concurrent in-place mutation or replacement and restoration cannot be ruled out, so the loaded-image digest remains unknown.",
|
|
2615
|
+
...eventLimit ? [`Observation stopped at max_events (${input.max_events}); later calls were not recorded and the process was killed.`] : [],
|
|
2616
|
+
...resourceLimit ? ["Observation stopped before retaining the next complete event because the estimated 8 MiB trace-payload or 65,536-frame aggregate budget was reached; the process was killed."] : [],
|
|
2617
|
+
...run.outcome === "duration-elapsed" ? [`The process was still running after duration_ms (${input.duration_ms}) and was killed.`] : [],
|
|
2618
|
+
...run.target_identity.stable ? [] : ["LLDB did not provide enough module identity evidence to confirm pathname and module continuity around launch."],
|
|
2619
|
+
...run.outcome === "stop-limit" ? ["Observation stopped after repeated signal or exception stops; the process was killed."] : [],
|
|
2620
|
+
...unresolved.length === 0 ? [] : [`Breakpoints ${unresolved.join(", ")} matched no code in any image loaded while observing; their calls could not be observed.`],
|
|
2621
|
+
...run.breakpoints.some(({ location_count: count, locations }) => locations.length < count) ? ["Breakpoints with many matching locations list only the first 64; location_count gives the total."] : [],
|
|
2622
|
+
...breakpointLocationLimit ? ["Resolved breakpoint locations exceeded the aggregate 8 MiB metadata budget; omitted locations are counted in location_count. This metadata limit does not change the process outcome."] : [],
|
|
2623
|
+
...trace.stdout === null || trace.stderr === null ? ["One or more target output captures were unavailable."] : [],
|
|
2624
|
+
...trace.stdout?.truncated === true || trace.stderr?.truncated === true ? ["Target output beyond 1 MiB per stream is counted but not kept."] : [],
|
|
2625
|
+
...trace.stdout?.complete === false || trace.stderr?.complete === false ? ["Target output draining did not complete; reported byte counts are observed lower bounds, not stream totals."] : [],
|
|
2626
|
+
...run.terminated && trace.terminated ? [] : [`REA could not confirm that process ${run.pid} exited; check for it before relying on host state.`]
|
|
2627
|
+
]
|
|
2628
|
+
};
|
|
2629
|
+
};
|
|
2630
|
+
projectNativeCalls = (target, input, trace) => nativeCallObservationResultSchema.parse(nativeCallFacts(target, input, trace));
|
|
2631
|
+
projectPartialNativeCalls = (target, input, trace, reason) => {
|
|
2632
|
+
const facts = nativeCallFacts(target, input, trace);
|
|
2633
|
+
return nativeCallPartialObservationSchema.parse({
|
|
2634
|
+
...facts,
|
|
2635
|
+
kind: "native-call-observation",
|
|
2636
|
+
coverage: {
|
|
2637
|
+
...facts.coverage,
|
|
2638
|
+
status: "partial",
|
|
2639
|
+
reason
|
|
2640
|
+
}
|
|
2641
|
+
});
|
|
2642
|
+
};
|
|
2643
|
+
})))();
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
//#endregion
|
|
2647
|
+
//#region dist/native/LldbReadbackFiles.js
|
|
2648
|
+
var LldbReadbackFiles;
|
|
2649
|
+
function init_LldbReadbackFiles() {
|
|
2650
|
+
return (init_LldbReadbackFiles = __esmMin((() => {
|
|
2651
|
+
init_result();
|
|
2652
|
+
init_ArtifactResourceScope();
|
|
2653
|
+
init_ArtifactFileOperation();
|
|
2654
|
+
LldbReadbackFiles = class {
|
|
2655
|
+
#resources = new ArtifactResourceScope();
|
|
2656
|
+
#targetPids = new Map();
|
|
2657
|
+
#failed = new Map();
|
|
2658
|
+
get hasPending() {
|
|
2659
|
+
return this.#resources.hasPending;
|
|
2660
|
+
}
|
|
2661
|
+
get cleanupResources() {
|
|
2662
|
+
return [...new Set([...this.#failed].filter(([lease]) => !lease.released).map(([, failure]) => failure.path))];
|
|
2663
|
+
}
|
|
2664
|
+
get cleanupCause() {
|
|
2665
|
+
const failures = [...this.#failed].filter(([lease]) => !lease.released).map(([, failure]) => failure.cause);
|
|
2666
|
+
return failures.length === 0 ? undefined : new AggregateError(failures, "LLDB readback descriptors remain open or unconfirmed");
|
|
2667
|
+
}
|
|
2668
|
+
/** Preserve a completed value even if final close transfers its owner here. */
|
|
2669
|
+
async read(path, read) {
|
|
2670
|
+
const blocked = [...this.#failed].find(([lease, failure]) => !lease.released && failure.path === path);
|
|
2671
|
+
if (blocked !== undefined) return err(blocked[1].cause);
|
|
2672
|
+
let completed;
|
|
2673
|
+
try {
|
|
2674
|
+
return ok(await withArtifactRegularFile(path, this.#resources, undefined, async (handle) => {
|
|
2675
|
+
const value = await read(handle);
|
|
2676
|
+
completed = { value };
|
|
2677
|
+
return value;
|
|
2678
|
+
}));
|
|
2679
|
+
} catch (cause) {
|
|
2680
|
+
if (cause instanceof ArtifactFileCleanupFailure) this.#failed.set(cause.cleanupLease, {
|
|
2681
|
+
path,
|
|
2682
|
+
cause
|
|
2683
|
+
});
|
|
2684
|
+
return completed === undefined ? err(cause) : ok(completed.value);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
/** The producer publishes one target PID per runtime; retain its parsed fact. */
|
|
2688
|
+
async readTargetPid(path) {
|
|
2689
|
+
const known = this.#targetPids.get(path);
|
|
2690
|
+
if (known !== undefined) return known;
|
|
2691
|
+
const contents = await this.read(path, async (file) => (await file.readFile("utf8")).trim());
|
|
2692
|
+
if (!contents.ok || !/^[1-9]\d*$/u.test(contents.value)) return undefined;
|
|
2693
|
+
const pid = Number(contents.value);
|
|
2694
|
+
if (!Number.isSafeInteger(pid)) return undefined;
|
|
2695
|
+
this.#targetPids.set(path, pid);
|
|
2696
|
+
return pid;
|
|
2697
|
+
}
|
|
2698
|
+
async retryCleanup() {
|
|
2699
|
+
try {
|
|
2700
|
+
await this.#resources.retryCleanup();
|
|
2701
|
+
} finally {
|
|
2702
|
+
for (const lease of this.#failed.keys()) if (lease.released) this.#failed.delete(lease);
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2056
2705
|
};
|
|
2057
2706
|
})))();
|
|
2058
2707
|
}
|
|
@@ -2158,60 +2807,35 @@ function init_LldbRetainedObservations() {
|
|
|
2158
2807
|
};
|
|
2159
2808
|
};
|
|
2160
2809
|
readPrefix = (handle, requestedBytes) => readBoundedPrefix(requestedBytes, async (buffer, offset, length, position) => (await handle.read(buffer, offset, length, position)).bytesRead);
|
|
2161
|
-
readLldbObservationJournal = async (
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
await handle?.close().catch(() => undefined);
|
|
2185
|
-
}
|
|
2186
|
-
};
|
|
2187
|
-
readPartialCapture = async (path) => {
|
|
2188
|
-
let handle;
|
|
2189
|
-
try {
|
|
2190
|
-
handle = await open(path, "r");
|
|
2191
|
-
const { size } = await handle.stat();
|
|
2192
|
-
const length = Math.min(size, MAX_CAPTURE_BYTES);
|
|
2193
|
-
const { buffer, bytesRead } = await readPrefix(handle, length);
|
|
2194
|
-
return {
|
|
2195
|
-
capture: {
|
|
2196
|
-
text: buffer.subarray(0, bytesRead).toString("utf8"),
|
|
2197
|
-
bytes: Math.max(size, bytesRead),
|
|
2198
|
-
truncated: true,
|
|
2199
|
-
complete: false
|
|
2200
|
-
},
|
|
2201
|
-
limitations: bytesRead < length ? ["A target output capture became shorter while being read; its retained prefix may be incomplete."] : []
|
|
2202
|
-
};
|
|
2203
|
-
} catch {
|
|
2204
|
-
return null;
|
|
2205
|
-
} finally {
|
|
2206
|
-
await handle?.close().catch(() => undefined);
|
|
2207
|
-
}
|
|
2208
|
-
};
|
|
2810
|
+
readLldbObservationJournal = (path, files) => files.read(path, async (handle) => {
|
|
2811
|
+
const { size } = await handle.stat();
|
|
2812
|
+
const length = Math.min(size, LLDB_OBSERVATION_JOURNAL_MAX_BYTES);
|
|
2813
|
+
const { buffer, bytesRead } = await readPrefix(handle, length);
|
|
2814
|
+
return {
|
|
2815
|
+
parsed: parseLldbObservationJournal(buffer.subarray(0, bytesRead)),
|
|
2816
|
+
limitations: [...size > 8388608 ? ["The observation journal exceeded 8 MiB; only its bounded prefix was read."] : [], ...bytesRead < length ? ["The observation journal became shorter while being read; the available prefix was parsed."] : []]
|
|
2817
|
+
};
|
|
2818
|
+
});
|
|
2819
|
+
readPartialCapture = (path, files) => files.read(path, async (handle) => {
|
|
2820
|
+
const { size } = await handle.stat();
|
|
2821
|
+
const length = Math.min(size, MAX_CAPTURE_BYTES);
|
|
2822
|
+
const { buffer, bytesRead } = await readPrefix(handle, length);
|
|
2823
|
+
return {
|
|
2824
|
+
capture: {
|
|
2825
|
+
text: buffer.subarray(0, bytesRead).toString("utf8"),
|
|
2826
|
+
bytes: Math.max(size, bytesRead),
|
|
2827
|
+
truncated: true,
|
|
2828
|
+
complete: false
|
|
2829
|
+
},
|
|
2830
|
+
limitations: bytesRead < length ? ["A target output capture became shorter while being read; its retained prefix may be incomplete."] : []
|
|
2831
|
+
};
|
|
2832
|
+
});
|
|
2209
2833
|
})))();
|
|
2210
2834
|
}
|
|
2211
2835
|
|
|
2212
2836
|
//#endregion
|
|
2213
2837
|
//#region dist/native/LldbCallTracer.js
|
|
2214
|
-
var OPERATION
|
|
2838
|
+
var OPERATION, PROVIDER, LLDB_REQUIREMENT, MAX_OUTPUT_BYTES, DEADLINE_GRACE_MS, DIAGNOSTIC_BYTES, BRIDGE, tracedSchema, tracerOutputSchema, ATTACH_REMEDIATION, LldbCallTracer, quote, tracerFailure, partialNativeObservation, partialObservationFromTrace, lldbRuntimePaths, readTracerOutput, capturedOutput, errorReason, releaseLldbRuntime, bindLldbCleanup, lldbCleanupFailure, lldbCleanupResources, runLldb, ensureTerminated, targetTerminationReason, alive;
|
|
2215
2839
|
function init_LldbCallTracer() {
|
|
2216
2840
|
return (init_LldbCallTracer = __esmMin((() => {
|
|
2217
2841
|
init_snapshotEnvironment();
|
|
@@ -2229,8 +2853,13 @@ function init_LldbCallTracer() {
|
|
|
2229
2853
|
init_ProviderDeadline();
|
|
2230
2854
|
init_PrivateRuntimeRoot();
|
|
2231
2855
|
init_CommandRunner();
|
|
2856
|
+
init_NativeCallObservation();
|
|
2857
|
+
init_LldbReadbackFiles();
|
|
2858
|
+
init_AnalysisCleanupLease();
|
|
2859
|
+
init_analysisErrorCleanup();
|
|
2860
|
+
init_analysisErrorBase();
|
|
2232
2861
|
init_LldbRetainedObservations();
|
|
2233
|
-
OPERATION
|
|
2862
|
+
OPERATION = "observe_native_calls";
|
|
2234
2863
|
PROVIDER = "native-macos";
|
|
2235
2864
|
LLDB_REQUIREMENT = "LLDB from Xcode or the Command Line Tools is not available";
|
|
2236
2865
|
MAX_OUTPUT_BYTES = 1024 * 1024;
|
|
@@ -2289,9 +2918,10 @@ function init_LldbCallTracer() {
|
|
|
2289
2918
|
"tracer-error"
|
|
2290
2919
|
]),
|
|
2291
2920
|
error: z.string().nullable(),
|
|
2292
|
-
target_process_created: z.boolean().optional()
|
|
2921
|
+
target_process_created: z.boolean().optional(),
|
|
2922
|
+
target_process_exit_observed: z.boolean().optional()
|
|
2293
2923
|
})]);
|
|
2294
|
-
ATTACH_REMEDIATION = "Allow debugging for this user (Developer Tools access: `DevToolsSecurity -enable`, or membership in the _developer group). A hardened-runtime target is debuggable only with the com.apple.security.get-task-allow entitlement;
|
|
2924
|
+
ATTACH_REMEDIATION = "Allow debugging for this user (Developer Tools access: `DevToolsSecurity -enable`, or membership in the _developer group). A hardened-runtime target is debuggable only with the com.apple.security.get-task-allow entitlement; inspect_signature reports hardened_runtime and entitlements.";
|
|
2295
2925
|
LldbCallTracer = class {
|
|
2296
2926
|
launch;
|
|
2297
2927
|
resolveTool;
|
|
@@ -2310,15 +2940,27 @@ function init_LldbCallTracer() {
|
|
|
2310
2940
|
const pendingCleanup = await this.#retryPendingCleanup();
|
|
2311
2941
|
if (pendingCleanup !== undefined) return err(pendingCleanup);
|
|
2312
2942
|
const lldb = await this.resolveTool("lldb", signal);
|
|
2313
|
-
if (!lldb.ok) return err(lldb.error.reason === "cancelled" ? new AnalysisCancelledError(OPERATION
|
|
2943
|
+
if (!lldb.ok) return err(lldb.error.reason === "cancelled" ? new AnalysisCancelledError(OPERATION) : new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION, LLDB_REQUIREMENT, { userMessage: LLDB_REQUIREMENT }));
|
|
2314
2944
|
const root = await PrivateRuntimeRoot.create({ prefix: "rea-lldb-" });
|
|
2315
2945
|
const paths = lldbRuntimePaths(root.path);
|
|
2946
|
+
const owner = {
|
|
2947
|
+
root,
|
|
2948
|
+
rootLease: new AnalysisCleanupLease(() => root.close(), [root.path]),
|
|
2949
|
+
files: new LldbReadbackFiles(),
|
|
2950
|
+
supervisor: undefined,
|
|
2951
|
+
pidPath: paths.pid,
|
|
2952
|
+
targetIdentity: undefined,
|
|
2953
|
+
targetPid: undefined,
|
|
2954
|
+
processStopped: true,
|
|
2955
|
+
targetStopped: true
|
|
2956
|
+
};
|
|
2316
2957
|
let result;
|
|
2317
2958
|
try {
|
|
2318
|
-
result = await this.#run(lldb.value,
|
|
2959
|
+
result = await this.#run(lldb.value, owner, request, signal);
|
|
2319
2960
|
} catch (cause) {
|
|
2320
2961
|
const partialObservation = await partialNativeObservation({
|
|
2321
2962
|
request,
|
|
2963
|
+
files: owner.files,
|
|
2322
2964
|
pidPath: paths.pid,
|
|
2323
2965
|
stdoutPath: paths.stdoutCapture,
|
|
2324
2966
|
stderrPath: paths.stderrCapture,
|
|
@@ -2326,44 +2968,51 @@ function init_LldbCallTracer() {
|
|
|
2326
2968
|
version: null,
|
|
2327
2969
|
reason: "tracer-failure"
|
|
2328
2970
|
});
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
result = err(new ProviderAdapterError(PROVIDER, OPERATION$1, {
|
|
2971
|
+
if (!owner.processStopped || !owner.targetStopped || owner.files.hasPending) this.#pendingCleanup = owner;
|
|
2972
|
+
result = err(new ProviderAdapterError(PROVIDER, OPERATION, {
|
|
2332
2973
|
cause,
|
|
2333
|
-
diagnostics: { reason:
|
|
2974
|
+
diagnostics: { reason: errorReason(cause) },
|
|
2334
2975
|
partialObservation,
|
|
2335
|
-
...
|
|
2976
|
+
...this.#pendingCleanup === owner ? { cleanup: {
|
|
2336
2977
|
reason: "LLDB trace failed while owned resources remain",
|
|
2337
|
-
resources
|
|
2338
|
-
} }
|
|
2978
|
+
resources: lldbCleanupResources(owner)
|
|
2979
|
+
} } : {}
|
|
2339
2980
|
}));
|
|
2340
2981
|
}
|
|
2341
|
-
if (
|
|
2982
|
+
if (result.ok && signal?.aborted) result = err(new AnalysisCancelledError(OPERATION, {
|
|
2983
|
+
cause: signal.reason,
|
|
2984
|
+
partialObservation: partialObservationFromTrace(request, result.value, "cancelled")
|
|
2985
|
+
}));
|
|
2986
|
+
if (owner.files.hasPending) this.#pendingCleanup = owner;
|
|
2987
|
+
if (this.#pendingCleanup === owner) {
|
|
2988
|
+
if (!result.ok && result.error.cleanupIncomplete) {
|
|
2989
|
+
if (owner.files.hasPending) {
|
|
2990
|
+
const files = lldbCleanupFailure(owner, "LLDB readback descriptor cleanup remains incomplete", owner.files.cleanupCause);
|
|
2991
|
+
result.error.retainSecondaryFailure(files, { readback_cleanup: projectAnalysisError(files) });
|
|
2992
|
+
}
|
|
2993
|
+
return err(bindLldbCleanup(result.error, owner));
|
|
2994
|
+
}
|
|
2995
|
+
const cleanup = lldbCleanupFailure(owner, "LLDB readback descriptor cleanup remains incomplete", owner.files.cleanupCause, result.ok ? partialObservationFromTrace(request, result.value) : undefined);
|
|
2996
|
+
return result.ok ? err(cleanup) : err(analysisErrorWithCleanupFailure(result.error, cleanup, OPERATION).bindCleanupDependencies([result.error, cleanup]));
|
|
2997
|
+
}
|
|
2998
|
+
let rootCleanup;
|
|
2342
2999
|
try {
|
|
2343
|
-
await
|
|
3000
|
+
await releaseLldbRuntime(owner);
|
|
3001
|
+
rootCleanup = ok(undefined);
|
|
2344
3002
|
} catch (cause) {
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
supervisor: undefined,
|
|
2348
|
-
pidPath: paths.pid,
|
|
2349
|
-
targetIdentity: undefined,
|
|
2350
|
-
processStopped: true,
|
|
2351
|
-
targetStopped: true
|
|
2352
|
-
};
|
|
2353
|
-
const partialObservation = result.ok ? partialObservationFromTrace(request, result.value) : result.error.partialObservation;
|
|
2354
|
-
return err(new ProviderCleanupError(PROVIDER, [root.path], {
|
|
2355
|
-
reason: cause instanceof Error ? cause.message : String(cause),
|
|
2356
|
-
...result.ok ? {} : {
|
|
2357
|
-
execution_failure: projectAnalysisError(result.error).code,
|
|
2358
|
-
primary_failure: result.error.message
|
|
2359
|
-
}
|
|
2360
|
-
}, {
|
|
2361
|
-
operation: OPERATION$1,
|
|
2362
|
-
cause: result.ok ? cause : new AggregateError([result.error, cause], "LLDB trace and runtime cleanup both failed"),
|
|
2363
|
-
...partialObservation === undefined ? {} : { partialObservation }
|
|
2364
|
-
}));
|
|
3003
|
+
rootCleanup = err(cause);
|
|
3004
|
+
this.#pendingCleanup = owner;
|
|
2365
3005
|
}
|
|
2366
|
-
|
|
3006
|
+
if (result.ok && signal?.aborted) result = err(new AnalysisCancelledError(OPERATION, {
|
|
3007
|
+
cause: signal.reason,
|
|
3008
|
+
partialObservation: partialObservationFromTrace(request, result.value, "cancelled")
|
|
3009
|
+
}));
|
|
3010
|
+
if (!rootCleanup.ok) {
|
|
3011
|
+
const cleanup = lldbCleanupFailure(owner, errorReason(rootCleanup.error), rootCleanup.error, result.ok ? partialObservationFromTrace(request, result.value) : undefined);
|
|
3012
|
+
if (!result.ok && result.error.cleanupIncomplete) bindLldbCleanup(result.error, owner);
|
|
3013
|
+
return result.ok ? err(cleanup) : err(analysisErrorWithCleanupFailure(result.error, cleanup, OPERATION).bindCleanupDependencies([result.error, cleanup]));
|
|
3014
|
+
}
|
|
3015
|
+
return result.ok ? result : err(resolvedAnalysisError(bindLldbCleanup(result.error, owner)));
|
|
2367
3016
|
}
|
|
2368
3017
|
/** Retry retained LLDB cleanup without abandoning its process or runtime owner. */
|
|
2369
3018
|
async close() {
|
|
@@ -2381,37 +3030,50 @@ function init_LldbCallTracer() {
|
|
|
2381
3030
|
async #retryPendingCleanup() {
|
|
2382
3031
|
const owner = this.#pendingCleanup;
|
|
2383
3032
|
if (owner === undefined) return undefined;
|
|
2384
|
-
|
|
3033
|
+
const failures = [];
|
|
3034
|
+
try {
|
|
3035
|
+
await owner.files.retryCleanup();
|
|
3036
|
+
} catch (cause) {
|
|
3037
|
+
failures.push(cause);
|
|
3038
|
+
}
|
|
2385
3039
|
if (!owner.processStopped) {
|
|
2386
|
-
|
|
2387
|
-
if (stopped?.status === "incomplete") firstFailure = stopped.reason;
|
|
3040
|
+
if (owner.supervisor === undefined) failures.push(new Error("LLDB process cleanup ownership was unavailable"));
|
|
2388
3041
|
else {
|
|
2389
|
-
|
|
2390
|
-
|
|
3042
|
+
try {
|
|
3043
|
+
const stopped = await owner.supervisor.stop();
|
|
3044
|
+
if (stopped.status === "incomplete") failures.push(new Error(stopped.reason));
|
|
3045
|
+
else {
|
|
3046
|
+
owner.supervisor.dispose();
|
|
3047
|
+
owner.processStopped = true;
|
|
3048
|
+
}
|
|
3049
|
+
} catch (cause) {
|
|
3050
|
+
failures.push(cause);
|
|
3051
|
+
}
|
|
2391
3052
|
}
|
|
2392
3053
|
}
|
|
2393
|
-
if (
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
3054
|
+
if (owner.processStopped && !owner.targetStopped) {
|
|
3055
|
+
owner.targetPid = await owner.files.readTargetPid(owner.pidPath);
|
|
3056
|
+
try {
|
|
3057
|
+
const targetTermination = await ensureTerminated(owner.targetPid, owner.targetIdentity);
|
|
3058
|
+
if (targetTermination !== "terminated") failures.push(new Error(targetTerminationReason(targetTermination)));
|
|
3059
|
+
else owner.targetStopped = true;
|
|
3060
|
+
} catch (cause) {
|
|
3061
|
+
failures.push(cause);
|
|
3062
|
+
}
|
|
2397
3063
|
}
|
|
2398
|
-
if (
|
|
3064
|
+
if (failures.length === 0) {
|
|
2399
3065
|
try {
|
|
2400
|
-
await owner
|
|
3066
|
+
await releaseLldbRuntime(owner);
|
|
2401
3067
|
this.#pendingCleanup = undefined;
|
|
2402
3068
|
return undefined;
|
|
2403
3069
|
} catch (cause) {
|
|
2404
|
-
|
|
3070
|
+
failures.push(cause);
|
|
2405
3071
|
}
|
|
2406
3072
|
}
|
|
2407
|
-
|
|
2408
|
-
return new ProviderCleanupError(PROVIDER, resources, {
|
|
2409
|
-
reason: firstFailure ?? "LLDB cleanup remains incomplete",
|
|
2410
|
-
resources
|
|
2411
|
-
}, { operation: OPERATION$1 });
|
|
3073
|
+
return lldbCleanupFailure(owner, failures.map(errorReason).join("; "), new AggregateError(failures, "LLDB cleanup remains incomplete"));
|
|
2412
3074
|
}
|
|
2413
|
-
async #run(lldb,
|
|
2414
|
-
const directory = root.path;
|
|
3075
|
+
async #run(lldb, retained, request, signal) {
|
|
3076
|
+
const directory = retained.root.path;
|
|
2415
3077
|
const paths = lldbRuntimePaths(directory);
|
|
2416
3078
|
const { input } = request;
|
|
2417
3079
|
await writeFile(paths.config, JSON.stringify({
|
|
@@ -2442,6 +3104,9 @@ function init_LldbCallTracer() {
|
|
|
2442
3104
|
identity_ack_path: paths.identityAck,
|
|
2443
3105
|
observation_path: paths.observations
|
|
2444
3106
|
}), { mode: 384 });
|
|
3107
|
+
retained.processStopped = false;
|
|
3108
|
+
retained.targetStopped = false;
|
|
3109
|
+
this.#pendingCleanup = retained;
|
|
2445
3110
|
const exited = await this.launch(lldb.path, [
|
|
2446
3111
|
"--batch",
|
|
2447
3112
|
"--no-lldbinit",
|
|
@@ -2455,31 +3120,30 @@ function init_LldbCallTracer() {
|
|
|
2455
3120
|
pidPath: paths.pid,
|
|
2456
3121
|
identityAckPath: paths.identityAck,
|
|
2457
3122
|
environment: this.environment,
|
|
3123
|
+
files: retained.files,
|
|
2458
3124
|
...signal === undefined ? {} : { signal }
|
|
2459
3125
|
});
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
const output = exited.kind === "exited" ? await readTracerOutput(paths.result) : undefined;
|
|
2470
|
-
let targetTermination = exited.targetLaunched ? await ensureTerminated(paths.pid, exited.targetIdentity, true) : "terminated";
|
|
2471
|
-
if (output !== undefined && output.status !== "traced" && output.target_process_created === false && await readTargetPid(paths.pid) === undefined) targetTermination = "terminated";
|
|
3126
|
+
retained.supervisor = exited.cleanupOwner;
|
|
3127
|
+
retained.targetIdentity = exited.targetIdentity;
|
|
3128
|
+
retained.processStopped = exited.cleanupOwner === undefined && exited.cleanupFailure === undefined;
|
|
3129
|
+
retained.targetStopped = !exited.targetLaunched;
|
|
3130
|
+
const output = exited.kind === "exited" ? await readTracerOutput(paths.result, retained.files) : undefined;
|
|
3131
|
+
const bridgeObservedExit = output !== undefined && output.status !== "traced" && output.target_process_exit_observed === true;
|
|
3132
|
+
retained.targetPid = await retained.files.readTargetPid(paths.pid);
|
|
3133
|
+
let targetTermination = exited.targetLaunched && !bridgeObservedExit ? await ensureTerminated(retained.targetPid, exited.targetIdentity) : "terminated";
|
|
3134
|
+
if (output !== undefined && output.status !== "traced" && output.target_process_created === false && retained.targetPid === undefined) targetTermination = "terminated";
|
|
2472
3135
|
retained.targetStopped = targetTermination === "terminated";
|
|
2473
|
-
if (retained.processStopped && retained.targetStopped) this.#pendingCleanup = undefined;
|
|
3136
|
+
if (retained.processStopped && retained.targetStopped && !retained.files.hasPending) this.#pendingCleanup = undefined;
|
|
2474
3137
|
const terminated = targetTermination === "terminated";
|
|
2475
3138
|
const cleanupDetails = [exited.cleanupFailure, ...terminated ? [] : [targetTerminationReason(targetTermination)]].filter((detail) => detail !== undefined);
|
|
2476
3139
|
const lifecycleCleanup = cleanupDetails.length === 0 ? undefined : {
|
|
2477
3140
|
reason: cleanupDetails.join("; "),
|
|
2478
|
-
resources:
|
|
3141
|
+
resources: lldbCleanupResources(retained)
|
|
2479
3142
|
};
|
|
2480
3143
|
const partialReason = exited.kind === "cancelled" ? "cancelled" : exited.kind === "timeout" ? "timeout" : exited.cleanupFailure !== undefined ? "cleanup-failure" : "tracer-failure";
|
|
2481
3144
|
const getPartialObservation = (reason = partialReason) => partialNativeObservation({
|
|
2482
3145
|
request,
|
|
3146
|
+
files: retained.files,
|
|
2483
3147
|
pidPath: paths.pid,
|
|
2484
3148
|
stdoutPath: paths.stdoutCapture,
|
|
2485
3149
|
stderrPath: paths.stderrCapture,
|
|
@@ -2487,31 +3151,32 @@ function init_LldbCallTracer() {
|
|
|
2487
3151
|
version: output?.status === "traced" ? output.version : null,
|
|
2488
3152
|
reason
|
|
2489
3153
|
});
|
|
2490
|
-
if (exited.kind === "cancelled") return err(new AnalysisCancelledError(OPERATION
|
|
3154
|
+
if (exited.kind === "cancelled") return err(new AnalysisCancelledError(OPERATION, {
|
|
3155
|
+
cause: signal?.reason,
|
|
2491
3156
|
...lifecycleCleanup === undefined ? {} : { cleanup: lifecycleCleanup },
|
|
2492
3157
|
partialObservation: await getPartialObservation()
|
|
2493
3158
|
}));
|
|
2494
|
-
if (exited.kind === "timeout") return err(new AnalysisTimeoutError(OPERATION
|
|
3159
|
+
if (exited.kind === "timeout") return err(new AnalysisTimeoutError(OPERATION, input.duration_ms + DEADLINE_GRACE_MS, {
|
|
2495
3160
|
...lifecycleCleanup === undefined ? {} : { cleanup: lifecycleCleanup },
|
|
2496
3161
|
partialObservation: await getPartialObservation()
|
|
2497
3162
|
}));
|
|
2498
3163
|
if (output !== undefined && output.status !== "traced") return err(tracerFailure(output, lifecycleCleanup, await getPartialObservation()));
|
|
2499
|
-
if (exited.cleanupFailure !== undefined) return err(new ProviderCleanupError(PROVIDER,
|
|
3164
|
+
if (exited.cleanupFailure !== undefined) return err(new ProviderCleanupError(PROVIDER, lldbCleanupResources(retained), {
|
|
2500
3165
|
reason: "LLDB process-group cleanup could not be verified",
|
|
2501
3166
|
cleanup_failure: exited.cleanupFailure,
|
|
2502
3167
|
...lifecycleCleanup === undefined ? {} : { target_cleanup: lifecycleCleanup }
|
|
2503
3168
|
}, {
|
|
2504
|
-
operation: OPERATION
|
|
3169
|
+
operation: OPERATION,
|
|
2505
3170
|
partialObservation: await getPartialObservation()
|
|
2506
3171
|
}));
|
|
2507
|
-
if (!terminated) return err(new ProviderCleanupError(PROVIDER,
|
|
3172
|
+
if (!terminated) return err(new ProviderCleanupError(PROVIDER, lldbCleanupResources(retained), {
|
|
2508
3173
|
reason: "LLDB target process termination could not be verified",
|
|
2509
3174
|
...lifecycleCleanup === undefined ? {} : { target_cleanup: lifecycleCleanup }
|
|
2510
3175
|
}, {
|
|
2511
|
-
operation: OPERATION
|
|
3176
|
+
operation: OPERATION,
|
|
2512
3177
|
partialObservation: await getPartialObservation()
|
|
2513
3178
|
}));
|
|
2514
|
-
if (output === undefined) return err(new ProviderAdapterError(PROVIDER, OPERATION
|
|
3179
|
+
if (output === undefined) return err(new ProviderAdapterError(PROVIDER, OPERATION, {
|
|
2515
3180
|
diagnostics: {
|
|
2516
3181
|
reason: "LLDB exited without a tracer result",
|
|
2517
3182
|
exit_code: exited.exitCode,
|
|
@@ -2521,16 +3186,29 @@ function init_LldbCallTracer() {
|
|
|
2521
3186
|
partialObservation: await getPartialObservation(),
|
|
2522
3187
|
...lifecycleCleanup === undefined ? {} : { cleanup: lifecycleCleanup }
|
|
2523
3188
|
}));
|
|
2524
|
-
const stdout = await capturedOutput(paths.stdoutCapture, output.target_output.stdout_bytes, output.target_output.stdout_truncated, output.target_output.stdout_complete);
|
|
2525
|
-
const stderr = await capturedOutput(paths.stderrCapture, output.target_output.stderr_bytes, output.target_output.stderr_truncated, output.target_output.stderr_complete);
|
|
3189
|
+
const stdout = await capturedOutput(paths.stdoutCapture, output.target_output.stdout_bytes, output.target_output.stdout_truncated, output.target_output.stdout_complete, retained.files);
|
|
3190
|
+
const stderr = await capturedOutput(paths.stderrCapture, output.target_output.stderr_bytes, output.target_output.stderr_truncated, output.target_output.stderr_complete, retained.files);
|
|
2526
3191
|
if (!stdout.ok || !stderr.ok) {
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
partialObservation:
|
|
3192
|
+
return err(new ProviderAdapterError(PROVIDER, OPERATION, {
|
|
3193
|
+
cause: new AggregateError([...stdout.ok ? [] : [stdout.error], ...stderr.ok ? [] : [stderr.error]], "LLDB capture readback failed"),
|
|
3194
|
+
partialObservation: projectPartialNativeCalls({
|
|
3195
|
+
path: request.executable,
|
|
3196
|
+
sha256: request.expectedSha256,
|
|
3197
|
+
architecture: request.architecture
|
|
3198
|
+
}, request.input, {
|
|
3199
|
+
debugger: {
|
|
3200
|
+
...lldb,
|
|
3201
|
+
version: output.version
|
|
3202
|
+
},
|
|
3203
|
+
run: output,
|
|
3204
|
+
stdout: stdout.ok ? stdout.value : null,
|
|
3205
|
+
stderr: stderr.ok ? stderr.value : null,
|
|
3206
|
+
terminated
|
|
3207
|
+
}, "capture-failure"),
|
|
2530
3208
|
diagnostics: {
|
|
2531
3209
|
reason: "LLDB target output capture could not be read",
|
|
2532
|
-
...stdout.ok ? {} : { stdout_capture_error: stdout.error },
|
|
2533
|
-
...stderr.ok ? {} : { stderr_capture_error: stderr.error },
|
|
3210
|
+
...stdout.ok ? {} : { stdout_capture_error: errorReason(stdout.error) },
|
|
3211
|
+
...stderr.ok ? {} : { stderr_capture_error: errorReason(stderr.error) },
|
|
2534
3212
|
...lifecycleCleanup === undefined ? {} : { target_cleanup: lifecycleCleanup }
|
|
2535
3213
|
},
|
|
2536
3214
|
...lifecycleCleanup === undefined ? {} : { cleanup: lifecycleCleanup }
|
|
@@ -2556,29 +3234,29 @@ function init_LldbCallTracer() {
|
|
|
2556
3234
|
};
|
|
2557
3235
|
const message = output.error ?? "no LLDB error text";
|
|
2558
3236
|
if (output.status === "target-integrity-error") return new EvidenceIntegrityError(message || "The launched native target did not match its session digest", options);
|
|
2559
|
-
if (output.status === "target-identity-unavailable") return new ProviderAdapterError(PROVIDER, OPERATION
|
|
3237
|
+
if (output.status === "target-identity-unavailable") return new ProviderAdapterError(PROVIDER, OPERATION, {
|
|
2560
3238
|
...options,
|
|
2561
3239
|
diagnostics: {
|
|
2562
3240
|
reason: message,
|
|
2563
3241
|
constraint: "target process start identity could not be verified"
|
|
2564
3242
|
}
|
|
2565
3243
|
});
|
|
2566
|
-
if (output.status === "tracer-error") return new ProviderAdapterError(PROVIDER, OPERATION
|
|
3244
|
+
if (output.status === "tracer-error") return new ProviderAdapterError(PROVIDER, OPERATION, {
|
|
2567
3245
|
...options,
|
|
2568
3246
|
diagnostics: { reason: `LLDB bridge failed: ${message}` }
|
|
2569
3247
|
});
|
|
2570
|
-
if (output.status === "target-error") return new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION
|
|
2571
|
-
return /attach|not allowed|permission|denied|debugserver/iu.test(message) ? new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION
|
|
3248
|
+
if (output.status === "target-error") return new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION, `lldb-target-unloadable: ${message}`, options);
|
|
3249
|
+
return /attach|not allowed|permission|denied|debugserver/iu.test(message) ? new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION, `debugger-attach-denied: ${message}`, {
|
|
2572
3250
|
userMessage: ATTACH_REMEDIATION,
|
|
2573
3251
|
...options
|
|
2574
|
-
}) : new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION
|
|
3252
|
+
}) : new AnalysisCapabilityUnavailableError(PROVIDER, OPERATION, `launch-failed: ${message}`, options);
|
|
2575
3253
|
};
|
|
2576
3254
|
partialNativeObservation = async (options) => {
|
|
2577
3255
|
const [journal, pid, stdout, stderr] = await Promise.all([
|
|
2578
|
-
readLldbObservationJournal(options.observationPath),
|
|
2579
|
-
readTargetPid(options.pidPath),
|
|
2580
|
-
readPartialCapture(options.stdoutPath),
|
|
2581
|
-
readPartialCapture(options.stderrPath)
|
|
3256
|
+
readLldbObservationJournal(options.observationPath, options.files),
|
|
3257
|
+
options.files.readTargetPid(options.pidPath),
|
|
3258
|
+
readPartialCapture(options.stdoutPath, options.files),
|
|
3259
|
+
readPartialCapture(options.stderrPath, options.files)
|
|
2582
3260
|
]);
|
|
2583
3261
|
return projectLldbPartialObservation({
|
|
2584
3262
|
target: {
|
|
@@ -2590,35 +3268,26 @@ function init_LldbCallTracer() {
|
|
|
2590
3268
|
working_directory: options.request.input.working_directory ?? null
|
|
2591
3269
|
},
|
|
2592
3270
|
pid,
|
|
2593
|
-
stdout: stdout
|
|
2594
|
-
stderr: stderr
|
|
3271
|
+
stdout: stdout.ok ? stdout.value.capture : null,
|
|
3272
|
+
stderr: stderr.ok ? stderr.value.capture : null,
|
|
2595
3273
|
version: options.version,
|
|
2596
|
-
journal: journal.parsed
|
|
2597
|
-
|
|
2598
|
-
|
|
3274
|
+
journal: journal.ok ? journal.value.parsed : {
|
|
3275
|
+
events: [],
|
|
3276
|
+
otherStops: [],
|
|
3277
|
+
limitations: []
|
|
3278
|
+
},
|
|
3279
|
+
journalLimitations: journal.ok ? journal.value.limitations : [`The observation journal could not be read: ${errorReason(journal.error)}`],
|
|
3280
|
+
limitations: [...stdout.ok ? stdout.value.limitations : [`The target stdout capture could not be read: ${errorReason(stdout.error)}`], ...stderr.ok ? stderr.value.limitations : [`The target stderr capture could not be read: ${errorReason(stderr.error)}`]],
|
|
2599
3281
|
reason: options.reason
|
|
2600
3282
|
});
|
|
2601
3283
|
};
|
|
2602
|
-
partialObservationFromTrace = (request, trace) =>
|
|
2603
|
-
|
|
3284
|
+
partialObservationFromTrace = (request, trace, reason = "cleanup-failure") => {
|
|
3285
|
+
return projectPartialNativeCalls({
|
|
2604
3286
|
path: request.executable,
|
|
2605
3287
|
sha256: request.expectedSha256,
|
|
2606
|
-
architecture: request.architecture
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
working_directory: request.input.working_directory ?? null
|
|
2610
|
-
},
|
|
2611
|
-
pid: trace.run.pid,
|
|
2612
|
-
stdout: trace.stdout,
|
|
2613
|
-
stderr: trace.stderr,
|
|
2614
|
-
version: trace.run.version,
|
|
2615
|
-
journal: {
|
|
2616
|
-
events: trace.run.events,
|
|
2617
|
-
otherStops: trace.run.other_stops,
|
|
2618
|
-
limitations: []
|
|
2619
|
-
},
|
|
2620
|
-
reason: "cleanup-failure"
|
|
2621
|
-
});
|
|
3288
|
+
architecture: request.architecture
|
|
3289
|
+
}, request.input, trace, reason);
|
|
3290
|
+
};
|
|
2622
3291
|
lldbRuntimePaths = (directory) => ({
|
|
2623
3292
|
config: join(directory, "config.json"),
|
|
2624
3293
|
result: join(directory, "result.json"),
|
|
@@ -2630,50 +3299,48 @@ function init_LldbCallTracer() {
|
|
|
2630
3299
|
stderrCapture: join(directory, "stderr.capture"),
|
|
2631
3300
|
observations: join(directory, "observations.jsonl")
|
|
2632
3301
|
});
|
|
2633
|
-
readTracerOutput = async (path) => {
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
} catch {
|
|
2638
|
-
return undefined;
|
|
2639
|
-
}
|
|
2640
|
-
const parsed = safeParseJson(text);
|
|
3302
|
+
readTracerOutput = async (path, files) => {
|
|
3303
|
+
const text = await files.read(path, (file) => file.readFile("utf8"));
|
|
3304
|
+
if (!text.ok) return undefined;
|
|
3305
|
+
const parsed = safeParseJson(text.value);
|
|
2641
3306
|
if (!parsed.ok) return undefined;
|
|
2642
3307
|
const output = tracerOutputSchema.safeParse(parsed.value);
|
|
2643
3308
|
return output.success ? output.data : undefined;
|
|
2644
3309
|
};
|
|
2645
|
-
capturedOutput =
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
} catch (closeCause) {
|
|
2667
|
-
return err(`${failure}; closing capture file failed: ${closeCause instanceof Error ? closeCause.message : String(closeCause)}`);
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
return err(failure);
|
|
3310
|
+
capturedOutput = (path, observedBytes, truncated, complete, files) => files.read(path, async (handle) => {
|
|
3311
|
+
const { size } = await handle.stat();
|
|
3312
|
+
const { buffer, bytesRead } = await readBoundedPrefix(Math.min(size, MAX_OUTPUT_BYTES), async (target, offset, length, position) => (await handle.read(target, offset, length, position)).bytesRead);
|
|
3313
|
+
return {
|
|
3314
|
+
text: buffer.subarray(0, bytesRead).toString("utf8"),
|
|
3315
|
+
bytes: observedBytes,
|
|
3316
|
+
truncated: truncated || size > MAX_OUTPUT_BYTES,
|
|
3317
|
+
complete: complete && bytesRead >= Math.min(observedBytes, MAX_OUTPUT_BYTES)
|
|
3318
|
+
};
|
|
3319
|
+
});
|
|
3320
|
+
errorReason = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
3321
|
+
releaseLldbRuntime = async (owner) => {
|
|
3322
|
+
if (!owner.processStopped || !owner.targetStopped || owner.files.hasPending) throw new Error("LLDB runtime still owns unresolved child resources");
|
|
3323
|
+
await owner.rootLease.release();
|
|
3324
|
+
};
|
|
3325
|
+
bindLldbCleanup = (failure, owner) => {
|
|
3326
|
+
if (failure.cleanupIncomplete) {
|
|
3327
|
+
owner.rootLease.bindCleanupError(failure);
|
|
3328
|
+
failure.bindCleanupResourceOwner({ get cleanupResources() {
|
|
3329
|
+
return lldbCleanupResources(owner);
|
|
3330
|
+
} });
|
|
2671
3331
|
}
|
|
3332
|
+
return failure;
|
|
2672
3333
|
};
|
|
2673
|
-
|
|
3334
|
+
lldbCleanupFailure = (owner, reason, cause, partialObservation) => bindLldbCleanup(new ProviderCleanupError(PROVIDER, lldbCleanupResources(owner), { reason }, {
|
|
3335
|
+
operation: OPERATION,
|
|
3336
|
+
cause,
|
|
3337
|
+
partialObservation
|
|
3338
|
+
}), owner);
|
|
3339
|
+
lldbCleanupResources = (owner) => [
|
|
2674
3340
|
...owner.processStopped ? [] : ["lldb-process-group"],
|
|
2675
|
-
...owner.targetStopped ? [] : [`native-target:${String(
|
|
2676
|
-
owner.
|
|
3341
|
+
...owner.targetStopped ? [] : [`native-target:${String(owner.targetPid ?? "unknown")}`],
|
|
3342
|
+
...owner.files.cleanupResources,
|
|
3343
|
+
...owner.rootLease.released ? [] : [owner.root.path]
|
|
2677
3344
|
];
|
|
2678
3345
|
runLldb = async (executable, arguments_, options) => {
|
|
2679
3346
|
if (options.signal?.aborted === true) return {
|
|
@@ -2713,7 +3380,7 @@ function init_LldbCallTracer() {
|
|
|
2713
3380
|
}, { maxDiagnosticBytes: DIAGNOSTIC_BYTES });
|
|
2714
3381
|
let identityAckWritten = false;
|
|
2715
3382
|
while (!await supervisor.waitForOutputClose(20)) {
|
|
2716
|
-
const pid = await readTargetPid(options.pidPath);
|
|
3383
|
+
const pid = await options.files.readTargetPid(options.pidPath);
|
|
2717
3384
|
if (pid !== undefined && !identityAckWritten) {
|
|
2718
3385
|
let observation;
|
|
2719
3386
|
try {
|
|
@@ -2748,20 +3415,8 @@ function init_LldbCallTracer() {
|
|
|
2748
3415
|
deadline.dispose();
|
|
2749
3416
|
}
|
|
2750
3417
|
};
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
const contents = (await readFile(pidPath, "utf8")).trim();
|
|
2754
|
-
if (!/^[1-9]\d*$/u.test(contents)) return undefined;
|
|
2755
|
-
const pid = Number(contents);
|
|
2756
|
-
return Number.isSafeInteger(pid) ? pid : undefined;
|
|
2757
|
-
} catch {
|
|
2758
|
-
return undefined;
|
|
2759
|
-
}
|
|
2760
|
-
};
|
|
2761
|
-
ensureTerminated = async (pidPath, identity, missingPidIsUnknown) => {
|
|
2762
|
-
const pid = await readTargetPid(pidPath);
|
|
2763
|
-
if (pid === undefined) return missingPidIsUnknown ? "identity-unavailable" : "terminated";
|
|
2764
|
-
if (!Number.isSafeInteger(pid) || pid <= 0) return "identity-unavailable";
|
|
3418
|
+
ensureTerminated = async (pid, identity) => {
|
|
3419
|
+
if (pid === undefined) return "identity-unavailable";
|
|
2765
3420
|
let signalDisposition;
|
|
2766
3421
|
for (let attempt = 0; attempt < 20; attempt++) {
|
|
2767
3422
|
if (!alive(pid)) return "terminated";
|
|
@@ -2798,150 +3453,12 @@ function init_LldbCallTracer() {
|
|
|
2798
3453
|
})))();
|
|
2799
3454
|
}
|
|
2800
3455
|
|
|
2801
|
-
//#endregion
|
|
2802
|
-
//#region dist/native/NativeCallObservation.js
|
|
2803
|
-
var OPERATION, NATIVE_CALL_OBSERVATION_LIMITATIONS, observeNativeCalls, isAbortError, projectNativeCalls, fileSha256;
|
|
2804
|
-
function init_NativeCallObservation() {
|
|
2805
|
-
return (init_NativeCallObservation = __esmMin((() => {
|
|
2806
|
-
init_analysisErrorCore();
|
|
2807
|
-
init_binaryTargetTypes();
|
|
2808
|
-
init_evidenceErrors();
|
|
2809
|
-
init_providerAdapterError();
|
|
2810
|
-
init_nativeCallObservation();
|
|
2811
|
-
init_result();
|
|
2812
|
-
OPERATION = "observe_native_calls";
|
|
2813
|
-
NATIVE_CALL_OBSERVATION_LIMITATIONS = [
|
|
2814
|
-
"Only entries are observed; return values, floating-point and stack-passed arguments are not captured.",
|
|
2815
|
-
"Registers are the raw integer argument registers at entry. For Objective-C methods the first two hold the receiver and the selector.",
|
|
2816
|
-
"Receiver classes come from LLDB's Objective-C runtime reader without running target code; they are null for class methods and for receivers LLDB cannot classify.",
|
|
2817
|
-
"Calls that never reach a symbol's entry, such as inlined code or objc_direct methods called directly, are not observed.",
|
|
2818
|
-
"The target is launched directly under LLDB, not through LaunchServices; LLDB disables ASLR for it, so load addresses can equal file addresses.",
|
|
2819
|
-
"The observation window is checked about once a second, and recording pauses the process at every entry, which slows it."
|
|
2820
|
-
];
|
|
2821
|
-
observeNativeCalls = async (target, parameters, tracer, signal, readTargetDigest = fileSha256) => {
|
|
2822
|
-
if (target.kind !== "executable" || !isMachOFormat(target.format)) return err(new AnalysisCapabilityUnavailableError("native-macos", OPERATION, "Native call observation launches a Mach-O executable; the active target is not one"));
|
|
2823
|
-
const parsed = nativeCallObservationInputSchema.safeParse(parameters);
|
|
2824
|
-
if (!parsed.success) return err(new AnalysisInputError(OPERATION, { cause: parsed.error }));
|
|
2825
|
-
let digest;
|
|
2826
|
-
try {
|
|
2827
|
-
digest = await readTargetDigest(target.path, signal);
|
|
2828
|
-
} catch (cause) {
|
|
2829
|
-
if (signal?.aborted === true || isAbortError(cause)) return err(new AnalysisCancelledError(OPERATION));
|
|
2830
|
-
return err(new ProviderAdapterError("native-macos", OPERATION, { diagnostics: {
|
|
2831
|
-
reason: "Unable to verify the selected target digest",
|
|
2832
|
-
detail: cause instanceof Error ? cause.message : String(cause)
|
|
2833
|
-
} }));
|
|
2834
|
-
}
|
|
2835
|
-
if (digest !== target.sha256) return err(new EvidenceIntegrityError("Native call observation target digest changed after session binding"));
|
|
2836
|
-
if (signal?.aborted === true) return err(new AnalysisCancelledError(OPERATION));
|
|
2837
|
-
const traced = await tracer.trace({
|
|
2838
|
-
executable: target.path,
|
|
2839
|
-
architecture: target.architecture,
|
|
2840
|
-
expectedSha256: target.sha256,
|
|
2841
|
-
input: parsed.data
|
|
2842
|
-
}, signal);
|
|
2843
|
-
if (!traced.ok) return traced;
|
|
2844
|
-
return ok(projectNativeCalls(target, parsed.data, traced.value));
|
|
2845
|
-
};
|
|
2846
|
-
isAbortError = (cause) => cause instanceof Error && cause.name === "AbortError";
|
|
2847
|
-
projectNativeCalls = (target, input, trace) => {
|
|
2848
|
-
const { run } = trace;
|
|
2849
|
-
const unresolved = run.breakpoints.filter(({ location_count: count }) => count === 0).map(({ index }) => index);
|
|
2850
|
-
const eventLimit = run.outcome === "event-limit";
|
|
2851
|
-
const resourceLimit = run.outcome === "resource-limit";
|
|
2852
|
-
const breakpointLocationLimit = run.breakpoint_locations_truncated === true;
|
|
2853
|
-
const partial = eventLimit || resourceLimit || breakpointLocationLimit || run.outcome === "duration-elapsed" || run.outcome === "stop-limit" || unresolved.length > 0;
|
|
2854
|
-
return nativeCallObservationResultSchema.parse({
|
|
2855
|
-
target: {
|
|
2856
|
-
path: target.path,
|
|
2857
|
-
sha256: target.sha256,
|
|
2858
|
-
architecture: target.architecture,
|
|
2859
|
-
arguments: input.arguments,
|
|
2860
|
-
environment: input.environment,
|
|
2861
|
-
working_directory: input.working_directory ?? null,
|
|
2862
|
-
launch_identity: {
|
|
2863
|
-
loaded_image_sha256: run.target_identity.loaded_image_sha256,
|
|
2864
|
-
file_device: run.target_identity.file_device,
|
|
2865
|
-
file_inode: run.target_identity.file_inode,
|
|
2866
|
-
selected_file_sha256: run.target_identity.selected_file_sha256,
|
|
2867
|
-
module_path: run.target_identity.module_path,
|
|
2868
|
-
module_uuid: run.target_identity.module_uuid,
|
|
2869
|
-
stable: run.target_identity.stable
|
|
2870
|
-
}
|
|
2871
|
-
},
|
|
2872
|
-
debugger: trace.debugger,
|
|
2873
|
-
process: {
|
|
2874
|
-
pid: run.pid,
|
|
2875
|
-
outcome: run.outcome,
|
|
2876
|
-
exit_status: run.exit_status,
|
|
2877
|
-
exit_description: run.exit_description,
|
|
2878
|
-
terminated: run.terminated && trace.terminated,
|
|
2879
|
-
elapsed_ms: run.elapsed_ms,
|
|
2880
|
-
stdout: trace.stdout,
|
|
2881
|
-
stderr: trace.stderr,
|
|
2882
|
-
other_stops: run.other_stops
|
|
2883
|
-
},
|
|
2884
|
-
breakpoints: input.breakpoints.map((request, index) => ({
|
|
2885
|
-
index,
|
|
2886
|
-
request: request.kind === "function" ? {
|
|
2887
|
-
...request,
|
|
2888
|
-
module: request.module ?? null
|
|
2889
|
-
} : {
|
|
2890
|
-
...request,
|
|
2891
|
-
class_name: request.class_name ?? null
|
|
2892
|
-
},
|
|
2893
|
-
location_count: run.breakpoints[index]?.location_count ?? 0,
|
|
2894
|
-
locations: run.breakpoints[index]?.locations ?? []
|
|
2895
|
-
})),
|
|
2896
|
-
events: run.events,
|
|
2897
|
-
coverage: {
|
|
2898
|
-
status: partial ? "partial" : "complete",
|
|
2899
|
-
event_limit_reached: eventLimit,
|
|
2900
|
-
resource_limit_reached: resourceLimit,
|
|
2901
|
-
...breakpointLocationLimit ? { breakpoint_locations_truncated: true } : {},
|
|
2902
|
-
unresolved_breakpoints: unresolved
|
|
2903
|
-
},
|
|
2904
|
-
limitations: [
|
|
2905
|
-
...NATIVE_CALL_OBSERVATION_LIMITATIONS,
|
|
2906
|
-
"The selected pathname digest and LLDB module identity are checked around launch. No immutable executable snapshot is used; concurrent in-place mutation or replacement and restoration cannot be ruled out, so the loaded-image digest remains unknown.",
|
|
2907
|
-
...eventLimit ? [`Observation stopped at max_events (${input.max_events}); later calls were not recorded and the process was killed.`] : [],
|
|
2908
|
-
...resourceLimit ? ["Observation stopped before retaining the next complete event because the estimated 8 MiB trace-payload or 65,536-frame aggregate budget was reached; the process was killed."] : [],
|
|
2909
|
-
...run.outcome === "duration-elapsed" ? [`The process was still running after duration_ms (${input.duration_ms}) and was killed.`] : [],
|
|
2910
|
-
...run.target_identity.stable ? [] : ["LLDB did not provide enough module identity evidence to confirm pathname and module continuity around launch."],
|
|
2911
|
-
...run.outcome === "stop-limit" ? ["Observation stopped after repeated signal or exception stops; the process was killed."] : [],
|
|
2912
|
-
...unresolved.length === 0 ? [] : [`Breakpoints ${unresolved.join(", ")} matched no code in any image loaded while observing; their calls could not be observed.`],
|
|
2913
|
-
...run.breakpoints.some(({ location_count: count, locations }) => locations.length < count) ? ["Breakpoints with many matching locations list only the first 64; location_count gives the total."] : [],
|
|
2914
|
-
...breakpointLocationLimit ? ["Resolved breakpoint locations exceeded the aggregate 8 MiB metadata budget; omitted locations are counted in location_count. This metadata limit does not change the process outcome."] : [],
|
|
2915
|
-
...trace.stdout.truncated || trace.stderr.truncated ? ["Target output beyond 1 MiB per stream is counted but not kept."] : [],
|
|
2916
|
-
...!trace.stdout.complete || !trace.stderr.complete ? ["Target output draining did not complete; reported byte counts are observed lower bounds, not stream totals."] : [],
|
|
2917
|
-
...run.terminated && trace.terminated ? [] : [`REA could not confirm that process ${run.pid} exited; check for it before relying on host state.`]
|
|
2918
|
-
]
|
|
2919
|
-
});
|
|
2920
|
-
};
|
|
2921
|
-
fileSha256 = async (path, signal) => {
|
|
2922
|
-
const handle = await open(path, "r");
|
|
2923
|
-
try {
|
|
2924
|
-
const hash = createHash("sha256");
|
|
2925
|
-
const buffer = new Uint8Array(1024 * 1024);
|
|
2926
|
-
for (;;) {
|
|
2927
|
-
signal?.throwIfAborted();
|
|
2928
|
-
const { bytesRead } = await handle.read(buffer, 0, buffer.length, null);
|
|
2929
|
-
if (bytesRead === 0) break;
|
|
2930
|
-
hash.update(buffer.subarray(0, bytesRead));
|
|
2931
|
-
}
|
|
2932
|
-
return hash.digest("hex");
|
|
2933
|
-
} finally {
|
|
2934
|
-
await handle.close();
|
|
2935
|
-
}
|
|
2936
|
-
};
|
|
2937
|
-
})))();
|
|
2938
|
-
}
|
|
2939
|
-
|
|
2940
3456
|
//#endregion
|
|
2941
3457
|
//#region dist/native/SignatureTargetBinding.js
|
|
2942
|
-
var identity, changedTarget, signatureReadFailure, withSignatureTarget, combineCleanupFailure, snapshotFailure, snapshotIO, copySignatureBytes, bindSignatureTarget, verifySignatureTarget;
|
|
3458
|
+
var identity, changedTarget, signatureReadFailure, withSignatureTarget, combineCleanupFailure, signatureCleanupFailure, snapshotFailure, snapshotIO, copySignatureBytes, bindSignatureTarget, verifySignatureTarget;
|
|
2943
3459
|
function init_SignatureTargetBinding() {
|
|
2944
3460
|
return (init_SignatureTargetBinding = __esmMin((() => {
|
|
3461
|
+
init_RegularFile();
|
|
2945
3462
|
init_analysisErrorBase();
|
|
2946
3463
|
init_analysisErrorCore();
|
|
2947
3464
|
init_providerAdapterError();
|
|
@@ -2952,6 +3469,8 @@ function init_SignatureTargetBinding() {
|
|
|
2952
3469
|
init_ArtifactResourceScope();
|
|
2953
3470
|
init_PrivateRuntimeRoot();
|
|
2954
3471
|
init_ArtifactReader();
|
|
3472
|
+
init_AnalysisCleanupLease();
|
|
3473
|
+
init_ArtifactFileOperation();
|
|
2955
3474
|
init_NativeMacOSProviderMetadata();
|
|
2956
3475
|
identity = (stat) => [
|
|
2957
3476
|
stat.dev,
|
|
@@ -2962,6 +3481,7 @@ function init_SignatureTargetBinding() {
|
|
|
2962
3481
|
].join(":");
|
|
2963
3482
|
changedTarget = (target, reason) => err(new AnalysisArtifactChangedError("inspect_signature", target.path, reason));
|
|
2964
3483
|
signatureReadFailure = (target, cause) => {
|
|
3484
|
+
if (cause instanceof RegularFileOperationCancelled) return new AnalysisCancelledError("inspect_signature", { cause: cause.reason });
|
|
2965
3485
|
if (cause instanceof AnalysisError) return cause;
|
|
2966
3486
|
const code = cause instanceof Error && "code" in cause ? cause.code : undefined;
|
|
2967
3487
|
if (code === "EACCES" || code === "EPERM") return new AnalysisAccessDeniedError("inspect_signature", target.path, code, { cause });
|
|
@@ -2981,14 +3501,14 @@ function init_SignatureTargetBinding() {
|
|
|
2981
3501
|
return await resources.run(async () => {
|
|
2982
3502
|
let root;
|
|
2983
3503
|
try {
|
|
2984
|
-
signal
|
|
3504
|
+
assertRegularFileActive(signal);
|
|
2985
3505
|
root = await createRoot();
|
|
2986
3506
|
} catch (cause) {
|
|
2987
|
-
return err(
|
|
3507
|
+
return err(cause instanceof RegularFileOperationCancelled ? signatureReadFailure(target, cause) : snapshotFailure(target, "create", cause));
|
|
2988
3508
|
}
|
|
2989
3509
|
const owner = {
|
|
2990
|
-
kind: "
|
|
2991
|
-
root,
|
|
3510
|
+
kind: "lease",
|
|
3511
|
+
lease: new AnalysisCleanupLease(() => root.close(), [root.path]),
|
|
2992
3512
|
resource: root.path
|
|
2993
3513
|
};
|
|
2994
3514
|
let result;
|
|
@@ -2999,25 +3519,33 @@ function init_SignatureTargetBinding() {
|
|
|
2999
3519
|
try {
|
|
3000
3520
|
result = await inspect(binding.value);
|
|
3001
3521
|
} catch (cause) {
|
|
3002
|
-
result = err(
|
|
3522
|
+
result = err(new AnalysisOutputError("inspect_signature", "Native output parsing failed", { cause }));
|
|
3003
3523
|
}
|
|
3004
3524
|
}
|
|
3005
3525
|
} catch (cause) {
|
|
3006
|
-
result = err(
|
|
3526
|
+
result = err(signatureReadFailure(target, cause));
|
|
3007
3527
|
}
|
|
3008
3528
|
const cleanup = await resources.release(owner);
|
|
3009
|
-
if (
|
|
3529
|
+
if (result.ok && signal?.aborted) result = err(new AnalysisCancelledError("inspect_signature", {
|
|
3530
|
+
cause: signal.reason,
|
|
3531
|
+
partialObservation: result.value
|
|
3532
|
+
}));
|
|
3533
|
+
if (cleanup.kind === "failed") {
|
|
3534
|
+
const failure = signatureCleanupFailure(target, [root.path], cleanup.cause, "cleanup");
|
|
3535
|
+
new AnalysisCleanupLeaseGroup(failure, [owner.lease]);
|
|
3536
|
+
return combineCleanupFailure(result, failure);
|
|
3537
|
+
}
|
|
3010
3538
|
return result;
|
|
3011
3539
|
});
|
|
3012
3540
|
} catch (cause) {
|
|
3013
|
-
if (cause instanceof AnalysisError) return err(cause);
|
|
3014
3541
|
const retained = cause instanceof ArtifactReaderFailure && cause.cleanup !== undefined ? cause.cleanup : undefined;
|
|
3015
|
-
if (retained !== undefined) return combineCleanupFailure(
|
|
3016
|
-
return err(
|
|
3542
|
+
if (retained !== undefined) return combineCleanupFailure(err(signatureReadFailure(target, cause)), signatureCleanupFailure(target, retained.resources, cause, "retry"));
|
|
3543
|
+
return err(signatureReadFailure(target, cause));
|
|
3017
3544
|
}
|
|
3018
3545
|
};
|
|
3019
|
-
combineCleanupFailure = (
|
|
3020
|
-
|
|
3546
|
+
combineCleanupFailure = (primary, cleanup) => primary.ok ? err(cleanup) : err(analysisErrorWithCleanupFailure(primary.error, cleanup, "inspect_signature").bindCleanupDependencies([primary.error, cleanup]));
|
|
3547
|
+
signatureCleanupFailure = (target, resources, cause, phase) => {
|
|
3548
|
+
const failure = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, resources, {
|
|
3021
3549
|
reason: cause instanceof Error ? cause.message : String(cause),
|
|
3022
3550
|
phase: `signature-snapshot-${phase}`,
|
|
3023
3551
|
path: target.path
|
|
@@ -3025,7 +3553,8 @@ function init_SignatureTargetBinding() {
|
|
|
3025
3553
|
operation: "inspect_signature",
|
|
3026
3554
|
cause
|
|
3027
3555
|
});
|
|
3028
|
-
|
|
3556
|
+
bindArtifactFileCleanup(cause, failure);
|
|
3557
|
+
return failure;
|
|
3029
3558
|
};
|
|
3030
3559
|
snapshotFailure = (target, phase, cause) => new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_signature", {
|
|
3031
3560
|
cause,
|
|
@@ -3049,9 +3578,9 @@ function init_SignatureTargetBinding() {
|
|
|
3049
3578
|
const chunk = Buffer.alloc(64 * 1024);
|
|
3050
3579
|
let position = 0;
|
|
3051
3580
|
while (position < size) {
|
|
3052
|
-
signal
|
|
3581
|
+
assertRegularFileActive(signal);
|
|
3053
3582
|
const { bytesRead } = await source.file.read(chunk, 0, Math.min(chunk.length, size - position), position);
|
|
3054
|
-
signal
|
|
3583
|
+
assertRegularFileActive(signal);
|
|
3055
3584
|
if (bytesRead === 0) throw new AnalysisArtifactChangedError("inspect_signature", target.path, `Signature target was truncated while hashing: ${target.path}`);
|
|
3056
3585
|
const bytes = chunk.subarray(0, bytesRead);
|
|
3057
3586
|
hash.update(bytes);
|
|
@@ -3065,17 +3594,27 @@ function init_SignatureTargetBinding() {
|
|
|
3065
3594
|
let snapshotOwner;
|
|
3066
3595
|
const perform = async () => {
|
|
3067
3596
|
try {
|
|
3068
|
-
signal
|
|
3597
|
+
assertRegularFileActive(signal);
|
|
3069
3598
|
const before = await lstat(target.path, { bigint: true });
|
|
3070
|
-
signal
|
|
3599
|
+
assertRegularFileActive(signal);
|
|
3071
3600
|
if (!before.isFile() || before.isSymbolicLink()) return changedTarget(target, `Signature target is no longer a regular file: ${target.path}`);
|
|
3072
3601
|
const file = await open(target.path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
3073
|
-
|
|
3602
|
+
const sourceHandle = new OwnedFileHandle(file);
|
|
3603
|
+
sourceOwner = {
|
|
3604
|
+
kind: "lease",
|
|
3605
|
+
resource: target.path,
|
|
3606
|
+
lease: new AnalysisCleanupLease(() => sourceHandle.close(), [target.path])
|
|
3607
|
+
};
|
|
3074
3608
|
const opened = await file.stat({ bigint: true });
|
|
3075
|
-
signal
|
|
3609
|
+
assertRegularFileActive(signal);
|
|
3076
3610
|
if (identity(opened) !== identity(before)) return changedTarget(target, `Signature target changed before open: ${target.path}`);
|
|
3077
3611
|
const snapshot = await snapshotIO(target, "create-file", () => open(snapshotPath, "wx", 384));
|
|
3078
|
-
|
|
3612
|
+
const snapshotHandle = new OwnedFileHandle(snapshot);
|
|
3613
|
+
snapshotOwner = {
|
|
3614
|
+
kind: "lease",
|
|
3615
|
+
resource: snapshotPath,
|
|
3616
|
+
lease: new AnalysisCleanupLease(() => snapshotHandle.close(), [snapshotPath])
|
|
3617
|
+
};
|
|
3079
3618
|
const observed = await copySignatureBytes(target, {
|
|
3080
3619
|
file,
|
|
3081
3620
|
stat: opened
|
|
@@ -3083,7 +3622,7 @@ function init_SignatureTargetBinding() {
|
|
|
3083
3622
|
if (observed !== target.sha256) return changedTarget(target, `Signature target digest changed: ${target.path}; expected ${target.sha256}, observed ${observed}`);
|
|
3084
3623
|
const after = await file.stat({ bigint: true });
|
|
3085
3624
|
const current = await lstat(target.path, { bigint: true });
|
|
3086
|
-
signal
|
|
3625
|
+
assertRegularFileActive(signal);
|
|
3087
3626
|
if (identity(after) !== identity(opened) || identity(current) !== identity(opened)) return changedTarget(target, `Signature target changed while establishing its version: ${target.path}`);
|
|
3088
3627
|
await snapshotIO(target, "seal", () => snapshot.chmod(256));
|
|
3089
3628
|
return ok({
|
|
@@ -3091,37 +3630,42 @@ function init_SignatureTargetBinding() {
|
|
|
3091
3630
|
snapshotPath
|
|
3092
3631
|
});
|
|
3093
3632
|
} catch (cause) {
|
|
3094
|
-
return err(
|
|
3633
|
+
return err(signatureReadFailure(target, cause));
|
|
3095
3634
|
}
|
|
3096
3635
|
};
|
|
3097
3636
|
let result = await perform();
|
|
3098
3637
|
const cleanupFailures = [];
|
|
3099
|
-
for (const
|
|
3638
|
+
for (const owner of [snapshotOwner, sourceOwner]) {
|
|
3100
3639
|
if (owner === undefined) continue;
|
|
3101
|
-
const cleanup = await resources.release(
|
|
3102
|
-
kind: "file-handle",
|
|
3103
|
-
handle: owner,
|
|
3104
|
-
resource: path
|
|
3105
|
-
});
|
|
3640
|
+
const cleanup = await resources.release(owner);
|
|
3106
3641
|
if (cleanup.kind === "failed") cleanupFailures.push({
|
|
3107
|
-
|
|
3642
|
+
owner,
|
|
3108
3643
|
cause: cleanup.cause
|
|
3109
3644
|
});
|
|
3110
3645
|
}
|
|
3646
|
+
if (result.ok && signal?.aborted) result = err(new AnalysisCancelledError("inspect_signature", {
|
|
3647
|
+
cause: signal.reason,
|
|
3648
|
+
diagnostics: { snapshot_binding: {
|
|
3649
|
+
identity: result.value.identity,
|
|
3650
|
+
snapshot_path: result.value.snapshotPath
|
|
3651
|
+
} }
|
|
3652
|
+
}));
|
|
3111
3653
|
if (cleanupFailures.length > 0) {
|
|
3112
3654
|
const cause = new AggregateError(cleanupFailures.map(({ cause: failure }) => failure), "Signature snapshot file handles could not be closed");
|
|
3113
|
-
|
|
3655
|
+
const cleanup = signatureCleanupFailure(target, cleanupFailures.map(({ owner }) => owner.resource), cause, "close");
|
|
3656
|
+
new AnalysisCleanupLeaseGroup(cleanup, cleanupFailures.map(({ owner }) => owner.lease));
|
|
3657
|
+
result = combineCleanupFailure(result, cleanup);
|
|
3114
3658
|
}
|
|
3115
3659
|
return result;
|
|
3116
3660
|
};
|
|
3117
3661
|
verifySignatureTarget = async (target, binding, signal) => {
|
|
3118
3662
|
try {
|
|
3119
|
-
signal
|
|
3663
|
+
assertRegularFileActive(signal);
|
|
3120
3664
|
const current = await lstat(target.path, { bigint: true });
|
|
3121
|
-
signal
|
|
3665
|
+
assertRegularFileActive(signal);
|
|
3122
3666
|
return current.isFile() && identity(current) === binding.identity ? ok(undefined) : changedTarget(target, `Signature target changed during inspection: ${target.path}`);
|
|
3123
3667
|
} catch (cause) {
|
|
3124
|
-
return err(
|
|
3668
|
+
return err(signatureReadFailure(target, cause));
|
|
3125
3669
|
}
|
|
3126
3670
|
};
|
|
3127
3671
|
})))();
|
|
@@ -3210,19 +3754,12 @@ function init_codesign() {
|
|
|
3210
3754
|
|
|
3211
3755
|
//#endregion
|
|
3212
3756
|
//#region dist/native/parsers/demangle.js
|
|
3213
|
-
var
|
|
3757
|
+
var linkageName, undecodedSpelling, parseDemangledSymbols;
|
|
3214
3758
|
function init_demangle() {
|
|
3215
3759
|
return (init_demangle = __esmMin((() => {
|
|
3216
3760
|
init_swiftSymbolClassification();
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
output: z.string(),
|
|
3220
|
-
status: z.enum([
|
|
3221
|
-
"demangled",
|
|
3222
|
-
"unchanged",
|
|
3223
|
-
"invalid"
|
|
3224
|
-
])
|
|
3225
|
-
});
|
|
3761
|
+
linkageName = (input) => input.startsWith("__") ? input.slice(1) : input;
|
|
3762
|
+
undecodedSpelling = (input) => /^[Sse]/u.test(input) ? `$${input}` : linkageName(input);
|
|
3226
3763
|
parseDemangledSymbols = (inputs, output) => {
|
|
3227
3764
|
if (inputs.length === 0) {
|
|
3228
3765
|
if (output === "" || output === "\n") return [];
|
|
@@ -3233,11 +3770,12 @@ function init_demangle() {
|
|
|
3233
3770
|
return inputs.map((input, index) => {
|
|
3234
3771
|
const value = lines[index];
|
|
3235
3772
|
if (value === undefined) throw new TypeError("swift-demangle omitted an output line");
|
|
3236
|
-
|
|
3773
|
+
const decoded = value !== input && value !== undecodedSpelling(input);
|
|
3774
|
+
return {
|
|
3237
3775
|
input,
|
|
3238
3776
|
output: value,
|
|
3239
|
-
status:
|
|
3240
|
-
}
|
|
3777
|
+
status: decoded ? "demangled" : isSwiftMangledSymbolName(linkageName(input)) ? "invalid" : "unchanged"
|
|
3778
|
+
};
|
|
3241
3779
|
});
|
|
3242
3780
|
};
|
|
3243
3781
|
})))();
|
|
@@ -3245,18 +3783,20 @@ function init_demangle() {
|
|
|
3245
3783
|
|
|
3246
3784
|
//#endregion
|
|
3247
3785
|
//#region dist/native/parsers/plist.js
|
|
3248
|
-
var plistObject, INTEGRAL_LITERAL, decodePlistJson, plistJsonNeedsNumberTypes, parsePlistJson, parsePlistXml,
|
|
3786
|
+
var plistObject, INTEGRAL_LITERAL, decodePlistJson, plistJsonNeedsNumberTypes, parsePlistJson, parsePlistXml, prototypeKeyLimitations, negativeZeroLimitations, numberLimitations, mapJsonNumbers, projectPlistBundle;
|
|
3249
3787
|
function init_plist() {
|
|
3250
3788
|
return (init_plist = __esmMin((() => {
|
|
3251
3789
|
init_analysisErrorCore();
|
|
3252
3790
|
init_plistValue();
|
|
3253
3791
|
init_propertyListKeys();
|
|
3254
3792
|
init_result();
|
|
3793
|
+
init_plistNumbers();
|
|
3255
3794
|
plistObject = z.record(z.string(), z.unknown());
|
|
3256
3795
|
INTEGRAL_LITERAL = /^-?\d+$/u;
|
|
3257
|
-
decodePlistJson = (output, unsafe) => {
|
|
3796
|
+
decodePlistJson = (output, unsafe, negativeZero = (item) => item) => {
|
|
3258
3797
|
const text = output.replace(/^\uFEFF/u, "");
|
|
3259
3798
|
return JSON.parse(text, (_key, item, context) => {
|
|
3799
|
+
if (typeof item === "number" && Object.is(item, -0)) return negativeZero(item);
|
|
3260
3800
|
const source = context?.source;
|
|
3261
3801
|
return typeof item !== "number" || Number.isSafeInteger(item) || source === undefined || !INTEGRAL_LITERAL.test(source) ? item : unsafe(item, source);
|
|
3262
3802
|
});
|
|
@@ -3272,13 +3812,18 @@ function init_plist() {
|
|
|
3272
3812
|
return found;
|
|
3273
3813
|
};
|
|
3274
3814
|
parsePlistJson = (output, xmlConversion) => {
|
|
3275
|
-
|
|
3815
|
+
let literals;
|
|
3276
3816
|
let exactIntegerCount = 0;
|
|
3277
3817
|
let ambiguousNumberCount = 0;
|
|
3818
|
+
let negativeZeroRealCount = 0;
|
|
3819
|
+
const signedZero = () => {
|
|
3820
|
+
negativeZeroRealCount += 1;
|
|
3821
|
+
return negativeZeroReal();
|
|
3822
|
+
};
|
|
3278
3823
|
const classify = (item, digits) => {
|
|
3279
3824
|
const exact = BigInt(digits).toString();
|
|
3280
|
-
const integer = literals?.integers.get(item)?.has(exact) === true;
|
|
3281
|
-
const real = literals?.reals.has(item)
|
|
3825
|
+
const integer = literals?.incomplete === false && literals.integers.get(item)?.has(exact) === true;
|
|
3826
|
+
const real = literals?.incomplete === false && literals.reals.has(item);
|
|
3282
3827
|
if (integer && !real) {
|
|
3283
3828
|
exactIntegerCount += 1;
|
|
3284
3829
|
return {
|
|
@@ -3292,7 +3837,8 @@ function init_plist() {
|
|
|
3292
3837
|
};
|
|
3293
3838
|
let decoded;
|
|
3294
3839
|
try {
|
|
3295
|
-
|
|
3840
|
+
literals = xmlConversion === undefined ? undefined : parseXmlPropertyList(xmlConversion).numberLiterals;
|
|
3841
|
+
decoded = omitPrototypeKeys(decodePlistJson(output, classify, signedZero));
|
|
3296
3842
|
} catch (cause) {
|
|
3297
3843
|
return err(new AnalysisOutputError("inspect_plist", cause instanceof Error ? cause.message : String(cause), { cause }));
|
|
3298
3844
|
}
|
|
@@ -3300,27 +3846,33 @@ function init_plist() {
|
|
|
3300
3846
|
return ok({
|
|
3301
3847
|
value,
|
|
3302
3848
|
bundle: projectPlistBundle(value),
|
|
3303
|
-
limitations: [
|
|
3849
|
+
limitations: [
|
|
3850
|
+
...negativeZeroLimitations(negativeZeroRealCount),
|
|
3851
|
+
...literals?.incomplete === true ? [incompletePlistNumberLimitation] : [],
|
|
3852
|
+
...numberLimitations(exactIntegerCount, ambiguousNumberCount),
|
|
3853
|
+
...prototypeKeyLimitations(decoded.omittedPrototypeKeys)
|
|
3854
|
+
]
|
|
3304
3855
|
});
|
|
3305
3856
|
};
|
|
3306
3857
|
parsePlistXml = (output) => {
|
|
3307
3858
|
let projected;
|
|
3308
3859
|
let omittedPrototypeKeys;
|
|
3860
|
+
let literals;
|
|
3309
3861
|
try {
|
|
3310
3862
|
const decoded = parseXmlPropertyList(output);
|
|
3311
3863
|
omittedPrototypeKeys = decoded.omittedPrototypeKeys;
|
|
3864
|
+
literals = decoded.numberLiterals;
|
|
3312
3865
|
projected = projectPlistValue(decoded.value);
|
|
3313
3866
|
} catch (cause) {
|
|
3314
3867
|
return err(new AnalysisOutputError("inspect_plist", "plutil XML conversion was not a readable plist", { cause }));
|
|
3315
3868
|
}
|
|
3316
|
-
const literals = xmlNumberLiterals(output);
|
|
3317
3869
|
let exactIntegerCount = 0;
|
|
3318
3870
|
let ambiguousNumberCount = 0;
|
|
3319
3871
|
const value = mapJsonNumbers(projected.value, (item) => {
|
|
3320
3872
|
const decimals = literals.integers.get(item);
|
|
3321
3873
|
if (decimals === undefined) return item;
|
|
3322
3874
|
const [decimal] = decimals;
|
|
3323
|
-
if (decimals.size !== 1 || decimal === undefined || literals.reals.has(item)) {
|
|
3875
|
+
if (literals.incomplete || decimals.size !== 1 || decimal === undefined || literals.reals.has(item)) {
|
|
3324
3876
|
ambiguousNumberCount += 1;
|
|
3325
3877
|
return item;
|
|
3326
3878
|
}
|
|
@@ -3335,26 +3887,18 @@ function init_plist() {
|
|
|
3335
3887
|
bundle: projectPlistBundle(value),
|
|
3336
3888
|
limitations: [
|
|
3337
3889
|
"plutil cannot express this plist as JSON, so it was decoded from plutil's XML conversion; data and date values are typed objects such as { \"$plist_type\": \"data\", \"base64\": ... }.",
|
|
3338
|
-
...projected.
|
|
3890
|
+
...projected.nonFiniteRealCount === 0 ? [] : [nonFiniteRealLimitation(projected.nonFiniteRealCount)],
|
|
3891
|
+
...projected.unknownRealCount === 0 ? [] : [unknownRealLimitation(projected.unknownRealCount)],
|
|
3892
|
+
...negativeZeroLimitations(projected.negativeZeroRealCount),
|
|
3893
|
+
...projected.unknownDateCount === 0 ? [] : [unknownDateLimitation(projected.unknownDateCount)],
|
|
3894
|
+
...literals.incomplete ? [incompletePlistNumberLimitation] : [],
|
|
3339
3895
|
...numberLimitations(exactIntegerCount, ambiguousNumberCount),
|
|
3340
3896
|
...prototypeKeyLimitations(omittedPrototypeKeys)
|
|
3341
3897
|
]
|
|
3342
3898
|
});
|
|
3343
3899
|
};
|
|
3344
|
-
xmlNumberLiterals = (xml) => {
|
|
3345
|
-
const integers = new Map();
|
|
3346
|
-
for (const [, decimal = ""] of xml.matchAll(/<integer>\s*([+-]?\d+)\s*<\/integer>/gu)) {
|
|
3347
|
-
const rounded = Number(decimal);
|
|
3348
|
-
if (Number.isSafeInteger(rounded)) continue;
|
|
3349
|
-
integers.set(rounded, (integers.get(rounded) ?? new Set()).add(BigInt(decimal).toString()));
|
|
3350
|
-
}
|
|
3351
|
-
const reals = new Set([...xml.matchAll(/<real>([^<]*)<\/real>/gu)].map(([, text = ""]) => Number.parseFloat(text)));
|
|
3352
|
-
return {
|
|
3353
|
-
integers,
|
|
3354
|
-
reals
|
|
3355
|
-
};
|
|
3356
|
-
};
|
|
3357
3900
|
prototypeKeyLimitations = (count) => count === 0 ? [] : [omittedPrototypeKeysLimitation(count)];
|
|
3901
|
+
negativeZeroLimitations = (count) => count === 0 ? [] : [negativeZeroRealLimitation(count)];
|
|
3358
3902
|
numberLimitations = (exactIntegerCount, ambiguousNumberCount) => [...exactIntegerCount === 0 ? [] : [`${String(exactIntegerCount)} integer value(s) exceed the exact range of a JSON number and are reported as { "$plist_type": "integer", "decimal": "<exact digits>" }.`], ...ambiguousNumberCount === 0 ? [] : [`${String(ambiguousNumberCount)} number(s) beyond the exact range of a JSON number are reported as decoded because the XML literal they came from, a rounded <integer> or a <real>, cannot be identified.`]];
|
|
3359
3903
|
mapJsonNumbers = (value, map) => {
|
|
3360
3904
|
if (typeof value === "number") return map(value);
|
|
@@ -3499,7 +4043,7 @@ function init_echoedPath() {
|
|
|
3499
4043
|
|
|
3500
4044
|
//#endregion
|
|
3501
4045
|
//#region dist/native/parsers/otool.js
|
|
3502
|
-
var DYLIB_COMMANDS, DYLIB_FIELDS, DYLIB_ENCODING_FIELDS, EMPTY_VALUE_FIELDS, BUILD_PLATFORM_NAMES, BUILD_TOOL_NAMES, buildCodeName, normalizeLineEndings, parseOtoolLoadCommands, WORD_SIZES, cpuEndian, parseHeader, headerValue, validateLoadCommandFraming, createLoadCommandState, parseLoadCommand, validateDylibCommandLines, scalarFields, collectUuid, collectEntrypoint, collectBuild, collectDependency, collectSegment, parseFields, parseField, requireUniqueField, parseSegment, parseSections, parseBuildTools, permissions, NUMERIC_PATTERN, numeric,
|
|
4046
|
+
var DYLIB_COMMANDS, DYLIB_FIELDS, DYLIB_ENCODING_FIELDS, EMPTY_VALUE_FIELDS, BUILD_PLATFORM_NAMES, BUILD_TOOL_NAMES, buildCodeName, normalizeLineEndings, parseOtoolLoadCommands, WORD_SIZES, cpuEndian, parseHeader, headerValue, validateLoadCommandFraming, createLoadCommandState, parseLoadCommand, validateDylibCommandLines, validateLinkerOptionLines, scalarFields, collectUuid, collectEntrypoint, collectBuild, collectDependency, collectSegment, parseFields, TEXT_FIELDS, parseField, requireUniqueField, parseSegment, parseSections, parseBuildTools, permissions, NUMERIC_PATTERN, numeric, machoName, stringField, numberField, hexField, stripOffsetSuffix, sectionAlignment;
|
|
3503
4047
|
function init_otool() {
|
|
3504
4048
|
return (init_otool = __esmMin((() => {
|
|
3505
4049
|
DYLIB_COMMANDS = new Set([
|
|
@@ -3661,6 +4205,7 @@ function init_otool() {
|
|
|
3661
4205
|
if (kind === null) throw new TypeError("otool load command is missing cmd");
|
|
3662
4206
|
for (const key of scalarFields(kind)) requireUniqueField(parsed, key);
|
|
3663
4207
|
if (DYLIB_COMMANDS.has(kind)) validateDylibCommandLines(parsed);
|
|
4208
|
+
if (kind === "LC_LINKER_OPTION") validateLinkerOptionLines(parsed);
|
|
3664
4209
|
state.commands.push({
|
|
3665
4210
|
index,
|
|
3666
4211
|
kind,
|
|
@@ -3673,7 +4218,7 @@ function init_otool() {
|
|
|
3673
4218
|
collectSegment(kind, block, fields, state);
|
|
3674
4219
|
};
|
|
3675
4220
|
validateDylibCommandLines = (parsed) => {
|
|
3676
|
-
const encodingFields = DYLIB_ENCODING_FIELDS.filter((key) =>
|
|
4221
|
+
const encodingFields = DYLIB_ENCODING_FIELDS.filter((key) => parsed.rows.some((field) => field?.[0] === key));
|
|
3677
4222
|
if (encodingFields.length !== 1) throw new TypeError("otool dylib command must contain timestamp or options");
|
|
3678
4223
|
for (const key of encodingFields) requireUniqueField(parsed, key);
|
|
3679
4224
|
const allowed = new Set([...DYLIB_FIELDS, ...DYLIB_ENCODING_FIELDS]);
|
|
@@ -3682,9 +4227,15 @@ function init_otool() {
|
|
|
3682
4227
|
if (key === undefined || !allowed.has(key)) throw new TypeError("otool dylib command contains ambiguous multiline text");
|
|
3683
4228
|
}
|
|
3684
4229
|
};
|
|
4230
|
+
validateLinkerOptionLines = (parsed) => {
|
|
4231
|
+
const count = numberField(parsed.values, "count");
|
|
4232
|
+
const labels = parsed.rows.map((field) => field?.[0]).filter((key) => key !== "cmd" && key !== "cmdsize" && key !== "count");
|
|
4233
|
+
if (count === null || labels.length !== count || labels.some((key, index) => key !== `string #${String(index + 1)}`)) throw new TypeError("otool linker-option strings do not match count");
|
|
4234
|
+
};
|
|
3685
4235
|
scalarFields = (kind) => {
|
|
3686
4236
|
const common = ["cmd", "cmdsize"];
|
|
3687
4237
|
if (DYLIB_COMMANDS.has(kind)) return DYLIB_FIELDS;
|
|
4238
|
+
if (kind === "LC_LINKER_OPTION") return [...common, "count"];
|
|
3688
4239
|
if (kind === "LC_LOAD_DYLINKER" || kind === "LC_ID_DYLINKER") return [...common, "name"];
|
|
3689
4240
|
if (kind === "LC_UUID") return [...common, "uuid"];
|
|
3690
4241
|
if (kind === "LC_MAIN") return [...common, "entryoff"];
|
|
@@ -3742,7 +4293,7 @@ function init_otool() {
|
|
|
3742
4293
|
});
|
|
3743
4294
|
};
|
|
3744
4295
|
collectDependency = (kind, fields, state) => {
|
|
3745
|
-
if (!DYLIB_COMMANDS.has(kind)) return;
|
|
4296
|
+
if (!DYLIB_COMMANDS.has(kind) || kind === "LC_ID_DYLIB") return;
|
|
3746
4297
|
state.dependencies.push({
|
|
3747
4298
|
path: stripOffsetSuffix(stringField(fields, "name")),
|
|
3748
4299
|
kind,
|
|
@@ -3757,22 +4308,29 @@ function init_otool() {
|
|
|
3757
4308
|
state.segments.push(segment);
|
|
3758
4309
|
};
|
|
3759
4310
|
parseFields = (block) => {
|
|
3760
|
-
const fields = {};
|
|
3761
4311
|
const rows = [];
|
|
3762
|
-
for (const rawLine of block.split(/\r?\n/u).slice(1))
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
4312
|
+
for (const rawLine of block.split(/\r?\n/u).slice(1)) if (rawLine.trim().length > 0) rows.push(parseField(rawLine));
|
|
4313
|
+
const occurrences = new Map();
|
|
4314
|
+
for (const field of rows) if (field !== undefined) occurrences.set(field[0], (occurrences.get(field[0]) ?? 0) + 1);
|
|
4315
|
+
const fields = {};
|
|
4316
|
+
const ordinals = new Map();
|
|
4317
|
+
for (const field of rows) {
|
|
3766
4318
|
if (field === undefined) continue;
|
|
3767
4319
|
const [key, value] = field;
|
|
3768
|
-
|
|
4320
|
+
const ordinal = (ordinals.get(key) ?? 0) + 1;
|
|
4321
|
+
ordinals.set(key, ordinal);
|
|
4322
|
+
const label = (occurrences.get(key) ?? 0) > 1 ? `${key} #${String(ordinal)}` : key;
|
|
4323
|
+
fields[label] = TEXT_FIELDS.test(key) ? value : numeric(value) ?? value;
|
|
3769
4324
|
}
|
|
3770
4325
|
return {
|
|
3771
4326
|
values: fields,
|
|
3772
4327
|
rows
|
|
3773
4328
|
};
|
|
3774
4329
|
};
|
|
4330
|
+
TEXT_FIELDS = /^(?:segname|sectname|string #\d+)$/u;
|
|
3775
4331
|
parseField = (rawLine) => {
|
|
4332
|
+
const option = /^\s*(string #[1-9]\d*)(?: (.*))?$/u.exec(rawLine);
|
|
4333
|
+
if (option?.[1] !== undefined) return [option[1], option[2] ?? ""];
|
|
3776
4334
|
const line = rawLine.trim();
|
|
3777
4335
|
const match = /^((?:time stamp)|\S+(?:\s+version)?)(?:\s+(.+))?$/u.exec(line);
|
|
3778
4336
|
return match?.[1] === undefined ? undefined : [match[1], match[2]?.trim() ?? ""];
|
|
@@ -3784,7 +4342,7 @@ function init_otool() {
|
|
|
3784
4342
|
if (field[1] === "" && !EMPTY_VALUE_FIELDS.has(key)) throw new TypeError(`otool field ${key} has no value`);
|
|
3785
4343
|
};
|
|
3786
4344
|
parseSegment = (block, fields) => ({
|
|
3787
|
-
name:
|
|
4345
|
+
name: machoName(fields, "segname"),
|
|
3788
4346
|
vm_address: hexField(fields, "vmaddr"),
|
|
3789
4347
|
vm_size: numberField(fields, "vmsize"),
|
|
3790
4348
|
file_offset: numberField(fields, "fileoff"),
|
|
@@ -3806,8 +4364,8 @@ function init_otool() {
|
|
|
3806
4364
|
"flags"
|
|
3807
4365
|
]) requireUniqueField(parsed, key);
|
|
3808
4366
|
return {
|
|
3809
|
-
segment:
|
|
3810
|
-
name:
|
|
4367
|
+
segment: machoName(fields, "segname"),
|
|
4368
|
+
name: machoName(fields, "sectname"),
|
|
3811
4369
|
address: hexField(fields, "addr"),
|
|
3812
4370
|
size: numberField(fields, "size"),
|
|
3813
4371
|
file_offset: numberField(fields, "offset"),
|
|
@@ -3861,7 +4419,11 @@ function init_otool() {
|
|
|
3861
4419
|
const parsed = Number.parseInt(value, value.startsWith("0x") ? 16 : 10);
|
|
3862
4420
|
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
|
|
3863
4421
|
};
|
|
3864
|
-
|
|
4422
|
+
machoName = (fields, key) => {
|
|
4423
|
+
const name = stringField(fields, key);
|
|
4424
|
+
if (name === null) throw new TypeError(`otool field ${key} is missing`);
|
|
4425
|
+
return name;
|
|
4426
|
+
};
|
|
3865
4427
|
stringField = (fields, name) => {
|
|
3866
4428
|
const value = fields[name];
|
|
3867
4429
|
return typeof value === "string" ? value : value === undefined || value === null ? null : String(value);
|
|
@@ -3944,16 +4506,16 @@ function init_machoUuid() {
|
|
|
3944
4506
|
};
|
|
3945
4507
|
selectDwarfdumpRow = (rows, selectedArchitecture) => {
|
|
3946
4508
|
if (rows.length === 0) return { kind: "absent" };
|
|
3947
|
-
const selectedRows = selectedArchitecture === null ? rows : rows.filter(({ architecture }) => architecture === selectedArchitecture);
|
|
4509
|
+
const selectedRows = selectedArchitecture === null ? rows : rows.filter(({ architecture }) => architecture === selectedArchitecture.dwarfdumpName);
|
|
3948
4510
|
const validRows = selectedRows.filter(({ value }) => MACHO_UUID.test(value));
|
|
3949
4511
|
const distinctValid = new Set(validRows.map(({ value }) => value.toLowerCase()));
|
|
3950
4512
|
if (distinctValid.size > 1) return {
|
|
3951
4513
|
kind: "conflict",
|
|
3952
|
-
reason: `dwarfdump --uuid returned conflicting UUIDs for selected architecture ${selectedArchitecture ?? "unknown"}`
|
|
4514
|
+
reason: `dwarfdump --uuid returned conflicting UUIDs for selected architecture ${selectedArchitecture?.name ?? "unknown"}`
|
|
3953
4515
|
};
|
|
3954
4516
|
if (selectedRows.length !== 1) return {
|
|
3955
4517
|
kind: "invalid",
|
|
3956
|
-
reason: selectedRows.length > 1 ? `dwarfdump --uuid returned multiple rows for selected architecture ${selectedArchitecture}` : `dwarfdump --uuid returned no row for selected architecture ${selectedArchitecture}`
|
|
4518
|
+
reason: selectedRows.length > 1 ? `dwarfdump --uuid returned multiple rows for selected architecture ${selectedArchitecture?.name ?? "unknown"}` : `dwarfdump --uuid returned no row for selected architecture ${selectedArchitecture?.name ?? "unknown"}`
|
|
3957
4519
|
};
|
|
3958
4520
|
const [row] = selectedRows;
|
|
3959
4521
|
if (row === undefined) return { kind: "absent" };
|
|
@@ -4023,7 +4585,7 @@ function init_machoUuid() {
|
|
|
4023
4585
|
|
|
4024
4586
|
//#endregion
|
|
4025
4587
|
//#region dist/native/NativeMachoInspection.js
|
|
4026
|
-
var DISCOVERY_COMMANDS, SYMBOL_TABLE_EXPORTS, DYLD_INFO_EXPORTS, REQUIRED_SLICE_COMMANDS, OPTIONAL_VTOOL_COMMAND, VTOOL_UNAVAILABLE_LIMITATION, inspectNativeMacho, normalizeMacho, sliceOutput, captureLookup, namesEveryExport, parseNmExports, covered, uniqueSymbols, fileOffsetLocations, architectureLocations, selectedArchitectureArguments, selectArchitecture;
|
|
4588
|
+
var DISCOVERY_COMMANDS, SYMBOL_TABLE_EXPORTS, DYLD_INFO_EXPORTS, REQUIRED_SLICE_COMMANDS, OPTIONAL_VTOOL_COMMAND, VTOOL_UNAVAILABLE_LIMITATION, inspectNativeMacho, normalizeMacho, sliceOutput, captureLookup, namesEveryExport, parseNmExports, covered, uniqueSymbols, fileOffsetLocations, architectureLocations, toolArchitectureName, selectedArchitectureArguments, selectArchitecture;
|
|
4027
4589
|
function init_NativeMachoInspection() {
|
|
4028
4590
|
return (init_NativeMachoInspection = __esmMin((() => {
|
|
4029
4591
|
init_analysisErrorCore();
|
|
@@ -4067,13 +4629,15 @@ function init_NativeMachoInspection() {
|
|
|
4067
4629
|
...selectedArchitectureArguments(tool, selectedArchitecture),
|
|
4068
4630
|
context.target.path
|
|
4069
4631
|
], context.signal);
|
|
4070
|
-
const
|
|
4632
|
+
const vtoolSelectsSlice = selectedArchitecture === null || !toolArchitectureName("vtool", selectedArchitecture).includes(".");
|
|
4633
|
+
const [required, optional] = await Promise.all([Promise.all(REQUIRED_SLICE_COMMANDS.map(runSliceCommand)), vtoolSelectsSlice ? runSliceCommand(OPTIONAL_VTOOL_COMMAND) : null]);
|
|
4071
4634
|
for (const captured of required) {
|
|
4072
4635
|
if (!captured.ok) return err(captured.error);
|
|
4073
4636
|
captures.push(captured.value);
|
|
4074
4637
|
}
|
|
4075
4638
|
const limitations = [];
|
|
4076
|
-
if (optional
|
|
4639
|
+
if (optional === null) limitations.push(`vtool cannot select the ${selectedArchitecture} slice; build metadata is normalized from otool only.`);
|
|
4640
|
+
else if (optional.ok) captures.push(optional.value);
|
|
4077
4641
|
else if (optional.error._tag === "AnalysisCapabilityUnavailableError") limitations.push(VTOOL_UNAVAILABLE_LIMITATION);
|
|
4078
4642
|
else return err(optional.error);
|
|
4079
4643
|
const nmIndex = captures.findIndex(({ tool }) => tool === "nm");
|
|
@@ -4127,7 +4691,10 @@ function init_NativeMachoInspection() {
|
|
|
4127
4691
|
const dyldExports = parseDyldSymbols(sliceOutput(byTool("dyld_info", 1)), "exports", imageBase, new Set(nmExports.map(({ name }) => name)));
|
|
4128
4692
|
const exports = uniqueSymbols([...dyldExports, ...nmExports]);
|
|
4129
4693
|
const dwarfdump = byTool("dwarfdump");
|
|
4130
|
-
const uuid = reconcileMachoUuid(load.commands, dwarfdump.stdout, artifactPath, selectedArchitecture.name
|
|
4694
|
+
const uuid = reconcileMachoUuid(load.commands, dwarfdump.stdout, artifactPath, selectedArchitecture.name === null ? null : {
|
|
4695
|
+
name: selectedArchitecture.name,
|
|
4696
|
+
dwarfdumpName: toolArchitectureName("dwarfdump", selectedArchitecture.name)
|
|
4697
|
+
});
|
|
4131
4698
|
const provenance = captures.map(toInvocation);
|
|
4132
4699
|
const threadEntrypoint = load.entrypoints.length === 0 && load.commands.some((command) => command.kind === "LC_UNIXTHREAD" || command.kind === "LC_THREAD");
|
|
4133
4700
|
const threadEntrypointLimitation = "Thread-state entrypoints (LC_UNIXTHREAD/LC_THREAD) are retained as raw load commands; file offsets are not derived.";
|
|
@@ -4228,10 +4795,10 @@ function init_NativeMachoInspection() {
|
|
|
4228
4795
|
}
|
|
4229
4796
|
return locations;
|
|
4230
4797
|
};
|
|
4798
|
+
toolArchitectureName = (tool, architecture) => tool === "dyld_info" ? architecture : architecture.replace(/\.v\d+$/u, "");
|
|
4231
4799
|
selectedArchitectureArguments = (tool, architecture) => {
|
|
4232
4800
|
if (architecture === null) return [];
|
|
4233
|
-
const
|
|
4234
|
-
const toolArchitecture = tool === "dyld_info" ? architecture : baseArchitecture;
|
|
4801
|
+
const toolArchitecture = toolArchitectureName(tool, architecture);
|
|
4235
4802
|
return tool === "dwarfdump" ? [`--arch=${toolArchitecture}`] : ["-arch", toolArchitecture];
|
|
4236
4803
|
};
|
|
4237
4804
|
selectArchitecture = (target, available) => {
|
|
@@ -4253,26 +4820,31 @@ function init_NativeMachoInspection() {
|
|
|
4253
4820
|
|
|
4254
4821
|
//#endregion
|
|
4255
4822
|
//#region dist/native/NativeMacOSProvider.js
|
|
4256
|
-
var NativeMacOSProvider, NativeMacOSClient, nativeCommandCleanupFailure, isNativeOperation, translateCommandFailure, translateCodeSignExitFailure, commandOutput, isNonzeroUnsignedObservation, canonicalPath, codeSignCaptureFailure, codeSignArchitectures, invocation, parseEntitlements,
|
|
4823
|
+
var NativeMacOSProvider, NativeMacOSClient, nativeCommandCleanupFailure, closeNativeFileScope, nativeOutputFailure, isNativeOperation, translateCommandFailure, translateCodeSignExitFailure, commandOutput, isNonzeroUnsignedObservation, canonicalPath, codeSignCaptureFailure, codeSignArchitectures, invocation, parseEntitlements, plutilDiagnostic;
|
|
4257
4824
|
function init_NativeMacOSProvider() {
|
|
4258
4825
|
return (init_NativeMacOSProvider = __esmMin((() => {
|
|
4826
|
+
init_NativePlistSource();
|
|
4827
|
+
init_ArtifactFileOperation();
|
|
4259
4828
|
init_snapshotEnvironment();
|
|
4260
4829
|
init_NativeMacOSProviderMetadata();
|
|
4261
4830
|
init_AppleDispatchMetadata();
|
|
4262
4831
|
init_NativeUiObservation();
|
|
4832
|
+
init_NativeUiCleanupError();
|
|
4263
4833
|
init_LldbCallTracer();
|
|
4264
4834
|
init_NativeCallObservation();
|
|
4265
4835
|
init_AnalysisProvider();
|
|
4266
4836
|
init_nativeToolContracts();
|
|
4267
4837
|
init_binaryTargetTypes();
|
|
4838
|
+
init_objcSwiftMetadata();
|
|
4268
4839
|
init_toolContracts();
|
|
4269
4840
|
init_inputIssueProjection();
|
|
4270
4841
|
init_analysisErrorCore();
|
|
4271
|
-
init_configurationErrors();
|
|
4272
4842
|
init_providerAdapterError();
|
|
4273
4843
|
init_providerCleanupError();
|
|
4274
4844
|
init_analysisErrorBase();
|
|
4275
4845
|
init_jsonValue();
|
|
4846
|
+
init_plistValue();
|
|
4847
|
+
init_plistNumbers();
|
|
4276
4848
|
init_propertyListKeys();
|
|
4277
4849
|
init_nativeInspection();
|
|
4278
4850
|
init_result();
|
|
@@ -4319,6 +4891,9 @@ function init_NativeMacOSProvider() {
|
|
|
4319
4891
|
#pendingNativeUiRuntimes = new Set();
|
|
4320
4892
|
#pendingCommands = new Set();
|
|
4321
4893
|
#signatureResources = new ArtifactResourceScope();
|
|
4894
|
+
#plistResources = new ArtifactResourceScope();
|
|
4895
|
+
#callResources = new ArtifactResourceScope();
|
|
4896
|
+
#dispatchResources = new ArtifactResourceScope();
|
|
4322
4897
|
#nativeUiTail = Promise.resolve();
|
|
4323
4898
|
#closed = false;
|
|
4324
4899
|
constructor(target, runner, tracer, environment, privateRuntimeRootFactory) {
|
|
@@ -4330,14 +4905,14 @@ function init_NativeMacOSProvider() {
|
|
|
4330
4905
|
}
|
|
4331
4906
|
async execute(operation, parameters, options) {
|
|
4332
4907
|
if (this.#closed) return err(new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, operation, "Native provider client is closed"));
|
|
4333
|
-
if (options?.signal?.aborted === true) return err(new AnalysisCancelledError(operation));
|
|
4908
|
+
if (options?.signal?.aborted === true) return err(new AnalysisCancelledError(operation, { cause: options.signal.reason }));
|
|
4334
4909
|
if (operation === "health") return ok(createAnalysisExecution(null, NATIVE_MACOS_PROVIDER_IDENTITY));
|
|
4335
4910
|
if (operation === "inspect_native_dispatch_metadata") {
|
|
4336
4911
|
const input = toolContract(operation).inputSchema.safeParse(parameters);
|
|
4337
4912
|
if (!input.success) return err(analysisInputErrorFromIssues(operation, input.error.issues, parameters, { cause: input.error }));
|
|
4338
|
-
if (
|
|
4913
|
+
if (!isAppleDispatchMetadataTarget(this.target)) return err(new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, operation, "Binary Apple metadata requires Mach-O; other providers can report symbol-only metadata"));
|
|
4339
4914
|
try {
|
|
4340
|
-
const result = await inspectAppleDispatchMetadata(this.target, input.data.max_records, options?.signal);
|
|
4915
|
+
const result = await this.#dispatchResources.run(() => inspectAppleDispatchMetadata(this.target, input.data.max_records, this.#dispatchResources, options?.signal));
|
|
4341
4916
|
return ok(createAnalysisExecution(result, result.provider, {
|
|
4342
4917
|
locations: [{
|
|
4343
4918
|
kind: "artifact-path",
|
|
@@ -4346,19 +4921,12 @@ function init_NativeMacOSProvider() {
|
|
|
4346
4921
|
limitations: result.result.coverage.flatMap(({ reason }) => reason === null ? [] : [reason])
|
|
4347
4922
|
}));
|
|
4348
4923
|
} catch (cause) {
|
|
4349
|
-
|
|
4350
|
-
return err(options?.signal?.aborted ? new AnalysisCancelledError(operation) : new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, operation, {
|
|
4351
|
-
cause,
|
|
4352
|
-
diagnostics: {
|
|
4353
|
-
target_path: this.target.path,
|
|
4354
|
-
reason: cause instanceof Error ? cause.message : String(cause)
|
|
4355
|
-
}
|
|
4356
|
-
}));
|
|
4924
|
+
return err(appleDispatchMetadataFailure(cause, this.target.path));
|
|
4357
4925
|
}
|
|
4358
4926
|
}
|
|
4359
4927
|
if (!isNativeOperation(operation)) return err(new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, operation, "Operation is not implemented by native macOS tools."));
|
|
4360
4928
|
if (operation === "observe_native_calls") {
|
|
4361
|
-
const result = await observeNativeCalls(this.target, parameters, this.tracer, options?.signal);
|
|
4929
|
+
const result = await observeNativeCalls(this.target, parameters, this.tracer, this.#callResources, options?.signal);
|
|
4362
4930
|
return result.ok ? ok(createAnalysisExecution(result.value, NATIVE_MACOS_PROVIDER_IDENTITY, {
|
|
4363
4931
|
limitations: result.value.limitations,
|
|
4364
4932
|
locations: [{
|
|
@@ -4375,33 +4943,30 @@ function init_NativeMacOSProvider() {
|
|
|
4375
4943
|
return observation.ok ? ok(createAnalysisExecution(observation.value.result, NATIVE_MACOS_PROVIDER_IDENTITY, {
|
|
4376
4944
|
limitations: observation.value.limitations,
|
|
4377
4945
|
locations: observation.value.locations
|
|
4378
|
-
})) : observation;
|
|
4946
|
+
})) : err(resolvedAnalysisError(observation.error));
|
|
4379
4947
|
} catch (cause) {
|
|
4380
|
-
return err(
|
|
4948
|
+
return err(nativeOutputFailure(operation, cause));
|
|
4381
4949
|
}
|
|
4382
4950
|
}
|
|
4383
4951
|
async close() {
|
|
4384
4952
|
this.#closed = true;
|
|
4385
4953
|
await Promise.allSettled(this.#pendingCommands);
|
|
4386
4954
|
const uiCleanupFailures = await this.#serializeNativeUi(() => this.#retryNativeUiCleanup());
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
const observation = ArtifactReaderFailure.cleanupObservation(cause, "signature-snapshot");
|
|
4392
|
-
signatureCleanup = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, observation.resources, { reason: observation.reason }, {
|
|
4393
|
-
operation: "close_binary",
|
|
4394
|
-
cause
|
|
4395
|
-
});
|
|
4396
|
-
}
|
|
4955
|
+
const signatureCleanup = await closeNativeFileScope(this.#signatureResources, "signature-snapshot");
|
|
4956
|
+
const plistCleanup = await closeNativeFileScope(this.#plistResources, "plist-file");
|
|
4957
|
+
const callCleanup = await closeNativeFileScope(this.#callResources, "native-call-target");
|
|
4958
|
+
const dispatchCleanup = await closeNativeFileScope(this.#dispatchResources, "native-dispatch-metadata-target");
|
|
4397
4959
|
const commandCleanup = await this.#retryNativeCommandCleanup();
|
|
4398
4960
|
let result = await this.tracer.close();
|
|
4399
4961
|
const cleanupErrors = [
|
|
4400
4962
|
...uiCleanupFailures.length === 0 ? [] : [this.#nativeUiCleanupFailure(uiCleanupFailures, "close_binary")],
|
|
4401
4963
|
...commandCleanup === undefined ? [] : [commandCleanup],
|
|
4402
|
-
...signatureCleanup === undefined ? [] : [signatureCleanup]
|
|
4964
|
+
...signatureCleanup === undefined ? [] : [signatureCleanup],
|
|
4965
|
+
...plistCleanup === undefined ? [] : [plistCleanup],
|
|
4966
|
+
...callCleanup === undefined ? [] : [callCleanup],
|
|
4967
|
+
...dispatchCleanup === undefined ? [] : [dispatchCleanup]
|
|
4403
4968
|
];
|
|
4404
|
-
for (const cleanupError of cleanupErrors) result = result.ok ? err(cleanupError) : err(analysisErrorWithCleanupFailure(result.error, cleanupError));
|
|
4969
|
+
for (const cleanupError of cleanupErrors) result = result.ok ? err(cleanupError) : err(analysisErrorWithCleanupFailure(result.error, cleanupError).bindCleanupDependencies([result.error, cleanupError]));
|
|
4405
4970
|
return result;
|
|
4406
4971
|
}
|
|
4407
4972
|
#observeNativeUi(operation, parameters, signal) {
|
|
@@ -4410,12 +4975,13 @@ function init_NativeMacOSProvider() {
|
|
|
4410
4975
|
const earlierCleanupFailures = await this.#retryNativeUiCleanup();
|
|
4411
4976
|
if (earlierCleanupFailures.length > 0) return err(this.#nativeUiCleanupFailure(earlierCleanupFailures, operation));
|
|
4412
4977
|
const runtime = createNativeUiHelperRuntime(this.environment);
|
|
4978
|
+
const observationSignal = signal === undefined ? runtime.signal : AbortSignal.any([signal, runtime.signal]);
|
|
4413
4979
|
this.#pendingNativeUiRuntimes.add(runtime);
|
|
4414
4980
|
let result;
|
|
4415
4981
|
try {
|
|
4416
4982
|
result = await observeNativeUi(this.target, operation, parameters, {
|
|
4417
4983
|
environment: this.environment,
|
|
4418
|
-
signal,
|
|
4984
|
+
signal: observationSignal,
|
|
4419
4985
|
runtime
|
|
4420
4986
|
});
|
|
4421
4987
|
} catch (cause) {
|
|
@@ -4425,12 +4991,14 @@ function init_NativeMacOSProvider() {
|
|
|
4425
4991
|
await runtime.close();
|
|
4426
4992
|
this.#pendingNativeUiRuntimes.delete(runtime);
|
|
4427
4993
|
} catch (cause) {
|
|
4994
|
+
result = finishNativeUiObservation(result, operation, observationSignal);
|
|
4428
4995
|
const cleanup = this.#nativeUiCleanupFailure([{
|
|
4429
4996
|
runtime,
|
|
4430
4997
|
cause
|
|
4431
4998
|
}], operation, result.ok ? result.value : undefined);
|
|
4432
|
-
return err(result.ok ? cleanup : analysisErrorWithCleanupFailure(result.error, cleanup, operation));
|
|
4999
|
+
return err(result.ok ? cleanup : analysisErrorWithCleanupFailure(result.error, cleanup, operation).bindCleanupDependencies([result.error, cleanup]));
|
|
4433
5000
|
}
|
|
5001
|
+
result = finishNativeUiObservation(result, operation, observationSignal);
|
|
4434
5002
|
return result.ok ? ok(createAnalysisExecution(result.value, NATIVE_MACOS_PROVIDER_IDENTITY, { limitations: result.value.limitations })) : result;
|
|
4435
5003
|
});
|
|
4436
5004
|
}
|
|
@@ -4464,18 +5032,7 @@ function init_NativeMacOSProvider() {
|
|
|
4464
5032
|
}
|
|
4465
5033
|
}
|
|
4466
5034
|
#nativeUiCleanupFailure(failures, operation, partialObservation) {
|
|
4467
|
-
|
|
4468
|
-
return new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, resources.length === 0 ? ["native-ui-runtime"] : resources, {
|
|
4469
|
-
reason: "Native UI runtime cleanup remains incomplete",
|
|
4470
|
-
failures: failures.map(({ runtime, cause }) => ({
|
|
4471
|
-
resources: [...runtime.resources()],
|
|
4472
|
-
reason: cause instanceof Error ? cause.message : String(cause)
|
|
4473
|
-
}))
|
|
4474
|
-
}, {
|
|
4475
|
-
operation,
|
|
4476
|
-
cause: new AggregateError(failures.map(({ cause }) => cause), "Native UI runtime cleanup failed"),
|
|
4477
|
-
...partialObservation === undefined ? {} : { partialObservation }
|
|
4478
|
-
});
|
|
5035
|
+
return new NativeUiCleanupError(failures, operation, partialObservation);
|
|
4479
5036
|
}
|
|
4480
5037
|
#dispatch(operation, parameters, signal) {
|
|
4481
5038
|
switch (operation) {
|
|
@@ -4534,7 +5091,12 @@ function init_NativeMacOSProvider() {
|
|
|
4534
5091
|
}
|
|
4535
5092
|
async #inspectSignature(signal) {
|
|
4536
5093
|
if (this.target.kind !== "executable" || !isMachOFormat(this.target.format)) return err(new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_signature", "Active artifact is not Mach-O; its container-level signature layer is not evaluated by codesign."));
|
|
4537
|
-
|
|
5094
|
+
const inspected = await withSignatureTarget(this.target, this.#signatureResources, (binding) => this.#inspectBoundSignature(binding, signal), signal, this.privateRuntimeRootFactory);
|
|
5095
|
+
return inspected.ok ? ok({
|
|
5096
|
+
result: inspected.value,
|
|
5097
|
+
limitations: inspected.value.limitations,
|
|
5098
|
+
locations: []
|
|
5099
|
+
}) : inspected;
|
|
4538
5100
|
}
|
|
4539
5101
|
async #inspectBoundSignature(binding, signal) {
|
|
4540
5102
|
const display = await this.#captureSignature(binding, ["-d", "--verbose=4"], signal);
|
|
@@ -4564,6 +5126,7 @@ function init_NativeMacOSProvider() {
|
|
|
4564
5126
|
];
|
|
4565
5127
|
const limitations = [
|
|
4566
5128
|
...parsed.limitations,
|
|
5129
|
+
...entitlementValue.limitations.map((note) => `Entitlements: ${note}`),
|
|
4567
5130
|
"Inspected a digest-verified Mach-O byte snapshot; filesystem-bound signing context and trust validation are not examined.",
|
|
4568
5131
|
...entitlementValue.omittedPrototypeKeys === 0 ? [] : [`Entitlements: ${omittedPrototypeKeysLimitation(entitlementValue.omittedPrototypeKeys)}`]
|
|
4569
5132
|
];
|
|
@@ -4587,11 +5150,7 @@ function init_NativeMacOSProvider() {
|
|
|
4587
5150
|
provenance,
|
|
4588
5151
|
limitations
|
|
4589
5152
|
});
|
|
4590
|
-
return ok(
|
|
4591
|
-
result: jsonValueSchema.parse(result),
|
|
4592
|
-
limitations: result.limitations,
|
|
4593
|
-
locations: []
|
|
4594
|
-
});
|
|
5153
|
+
return ok(result);
|
|
4595
5154
|
}
|
|
4596
5155
|
async #inspectMixedSignatureSlices(binding, format, aggregateExits, signal) {
|
|
4597
5156
|
const captures = [];
|
|
@@ -4644,61 +5203,101 @@ function init_NativeMacOSProvider() {
|
|
|
4644
5203
|
async #inspectPlist(parameters, signal) {
|
|
4645
5204
|
const requested = parameters.path;
|
|
4646
5205
|
if (requested !== undefined && typeof requested !== "string") return err(new AnalysisOutputError("inspect_plist", "path was not a string"));
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
5206
|
+
try {
|
|
5207
|
+
return await this.#plistResources.run(async () => {
|
|
5208
|
+
try {
|
|
5209
|
+
const plist = await resolveNativePlistSelection(this.target, requested);
|
|
5210
|
+
if (!plist.ok) return plist;
|
|
5211
|
+
const fileInput = {
|
|
5212
|
+
selection: plist.value,
|
|
5213
|
+
resources: this.#plistResources,
|
|
5214
|
+
signal
|
|
5215
|
+
};
|
|
5216
|
+
const selected = await requireRegularPlist(fileInput);
|
|
5217
|
+
if (!selected.ok) return selected;
|
|
5218
|
+
const classified = await this.#run("inspect_plist", "file", ["-b", plist.value.path], { signal });
|
|
5219
|
+
if (!classified.ok) return classified;
|
|
5220
|
+
const json = await this.#run("inspect_plist", "plutil", [
|
|
5221
|
+
"-convert",
|
|
5222
|
+
"json",
|
|
5223
|
+
"-o",
|
|
5224
|
+
"-",
|
|
5225
|
+
"--",
|
|
5226
|
+
plist.value.path
|
|
5227
|
+
], {
|
|
5228
|
+
signal,
|
|
5229
|
+
acceptNonZero: true
|
|
5230
|
+
});
|
|
5231
|
+
if (!json.ok) return json;
|
|
5232
|
+
const jsonDecoded = json.value.exitCode === 0;
|
|
5233
|
+
const xml = jsonDecoded && !plistJsonNeedsNumberTypes(json.value.stdout) ? undefined : await this.#run("inspect_plist", "plutil", [
|
|
5234
|
+
"-convert",
|
|
5235
|
+
"xml1",
|
|
5236
|
+
"-o",
|
|
5237
|
+
"-",
|
|
5238
|
+
"--",
|
|
5239
|
+
plist.value.path
|
|
5240
|
+
], {
|
|
5241
|
+
signal,
|
|
5242
|
+
acceptNonZero: !jsonDecoded
|
|
5243
|
+
});
|
|
5244
|
+
if (xml !== undefined && !xml.ok) return xml;
|
|
5245
|
+
if (xml !== undefined && xml.value.exitCode !== 0) {
|
|
5246
|
+
const capture = failureCapture(xml.value, false);
|
|
5247
|
+
return err(unreadablePlist(plist.value, `plutil could not decode it as a property list (${plutilDiagnostic(capture, plist.value.path)})`, { capturedOutput: {
|
|
5248
|
+
stdout: capture.stdout,
|
|
5249
|
+
stderr: capture.stderr,
|
|
5250
|
+
truncated: capture.truncated,
|
|
5251
|
+
stdout_bytes: capture.stdoutBytes,
|
|
5252
|
+
stderr_bytes: capture.stderrBytes,
|
|
5253
|
+
exit_code: capture.exitCode,
|
|
5254
|
+
signal: capture.signal
|
|
5255
|
+
} }));
|
|
5256
|
+
}
|
|
5257
|
+
const parsed = xml === undefined ? parsePlistJson(json.value.stdout) : jsonDecoded ? parsePlistJson(json.value.stdout, xml.value.stdout) : parsePlistXml(xml.value.stdout);
|
|
5258
|
+
if (!parsed.ok) return parsed;
|
|
5259
|
+
const provenance = [
|
|
5260
|
+
classified.value,
|
|
5261
|
+
json.value,
|
|
5262
|
+
...xml === undefined ? [] : [xml.value]
|
|
5263
|
+
].map((item) => invocation(item, plist.value.path, "$PLIST"));
|
|
5264
|
+
const converted = xml?.value ?? json.value;
|
|
5265
|
+
const format = await plistSourceFormat(classified.value.stdout, {
|
|
5266
|
+
...fileInput,
|
|
5267
|
+
capturedOutput: {
|
|
5268
|
+
stdout: converted.stdout,
|
|
5269
|
+
stderr: converted.stderr,
|
|
5270
|
+
truncated: false,
|
|
5271
|
+
stdout_bytes: converted.stdoutBytes,
|
|
5272
|
+
stderr_bytes: converted.stderrBytes,
|
|
5273
|
+
exit_code: converted.exitCode,
|
|
5274
|
+
signal: converted.signal
|
|
5275
|
+
}
|
|
5276
|
+
});
|
|
5277
|
+
if (!format.ok) return format;
|
|
5278
|
+
const result = inspectPlistSchema.parse({
|
|
5279
|
+
format: format.value,
|
|
5280
|
+
value: parsed.value.value,
|
|
5281
|
+
bundle: parsed.value.bundle,
|
|
5282
|
+
source_path: plist.value.path,
|
|
5283
|
+
provenance,
|
|
5284
|
+
limitations: parsed.value.limitations
|
|
5285
|
+
});
|
|
5286
|
+
return ok({
|
|
5287
|
+
result: jsonValueSchema.parse(result),
|
|
5288
|
+
limitations: parsed.value.limitations,
|
|
5289
|
+
locations: [{
|
|
5290
|
+
kind: "artifact-path",
|
|
5291
|
+
path: plist.value.path
|
|
5292
|
+
}]
|
|
5293
|
+
});
|
|
5294
|
+
} catch (cause) {
|
|
5295
|
+
return err(nativeOutputFailure("inspect_plist", cause));
|
|
5296
|
+
}
|
|
5297
|
+
});
|
|
5298
|
+
} catch (cause) {
|
|
5299
|
+
return err(nativePlistFailure(cause, undefined));
|
|
5300
|
+
}
|
|
4702
5301
|
}
|
|
4703
5302
|
async #inspectMacho(signal) {
|
|
4704
5303
|
if (!isMachOFormat(this.target.format)) return err(new AnalysisCapabilityUnavailableError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_macho", "Active artifact is not Mach-O."));
|
|
@@ -4733,8 +5332,56 @@ function init_NativeMacOSProvider() {
|
|
|
4733
5332
|
resources: [...resources]
|
|
4734
5333
|
}))
|
|
4735
5334
|
});
|
|
5335
|
+
closeNativeFileScope = async (scope, resource) => {
|
|
5336
|
+
try {
|
|
5337
|
+
await scope.close();
|
|
5338
|
+
return undefined;
|
|
5339
|
+
} catch (cause) {
|
|
5340
|
+
const observation = ArtifactReaderFailure.cleanupObservation(cause, resource);
|
|
5341
|
+
const failure = new ProviderCleanupError(NATIVE_MACOS_PROVIDER_IDENTITY.id, observation.resources, { reason: observation.reason }, {
|
|
5342
|
+
operation: "close_binary",
|
|
5343
|
+
cause
|
|
5344
|
+
});
|
|
5345
|
+
bindArtifactFileCleanup(cause, failure);
|
|
5346
|
+
return failure;
|
|
5347
|
+
}
|
|
5348
|
+
};
|
|
5349
|
+
nativeOutputFailure = (operation, cause) => new AnalysisOutputError(operation, "Native output parsing failed", { cause });
|
|
4736
5350
|
isNativeOperation = (operation) => NATIVE_TOOL_CONTRACTS.some(({ name }) => name === operation);
|
|
4737
5351
|
translateCommandFailure = (operation, failure) => {
|
|
5352
|
+
const preparation = failure.preparationFailure;
|
|
5353
|
+
if (preparation !== undefined) {
|
|
5354
|
+
const marker = preparation.cleanupFailure;
|
|
5355
|
+
const compiler = preparation.compilerOutcome;
|
|
5356
|
+
const options = {
|
|
5357
|
+
cause: failure,
|
|
5358
|
+
...preparation.capturedOutput === undefined ? {} : { capturedOutput: preparation.capturedOutput },
|
|
5359
|
+
...marker === undefined ? {} : { cleanup: {
|
|
5360
|
+
reason: marker.message,
|
|
5361
|
+
resources: marker.cleanupResources
|
|
5362
|
+
} },
|
|
5363
|
+
diagnostics: {
|
|
5364
|
+
phase: "process-preparation",
|
|
5365
|
+
tool: failure.tool,
|
|
5366
|
+
reason: failure.reason,
|
|
5367
|
+
detail: preparation.message,
|
|
5368
|
+
...compiler === undefined ? {} : { compiler_outcome: {
|
|
5369
|
+
outcome: compiler.outcome,
|
|
5370
|
+
code: compiler.code,
|
|
5371
|
+
signal: compiler.signal,
|
|
5372
|
+
...compiler.timeoutMs === undefined ? {} : { timeout_ms: compiler.timeoutMs }
|
|
5373
|
+
} }
|
|
5374
|
+
}
|
|
5375
|
+
};
|
|
5376
|
+
const error = preparation.cancellation === undefined ? new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, operation, options) : failure.reason === "timeout" ? new AnalysisTimeoutError(operation, NATIVE_COMMAND_TIMEOUT_MS, {
|
|
5377
|
+
...options,
|
|
5378
|
+
cause: preparation.cancellation.reason
|
|
5379
|
+
}) : new AnalysisCancelledError(operation, {
|
|
5380
|
+
...options,
|
|
5381
|
+
cause: preparation.cancellation.reason
|
|
5382
|
+
});
|
|
5383
|
+
return marker === undefined ? error : error.bindCleanupDependencies([marker]);
|
|
5384
|
+
}
|
|
4738
5385
|
const capturedOutput = failure.capture === null ? undefined : {
|
|
4739
5386
|
stdout: failure.capture.stdout,
|
|
4740
5387
|
stderr: failure.capture.stderr,
|
|
@@ -4814,50 +5461,31 @@ function init_NativeMacOSProvider() {
|
|
|
4814
5461
|
const end = output.lastIndexOf("</plist>");
|
|
4815
5462
|
if (start < 0 || end < start) return {
|
|
4816
5463
|
value: null,
|
|
4817
|
-
omittedPrototypeKeys: 0
|
|
5464
|
+
omittedPrototypeKeys: 0,
|
|
5465
|
+
limitations: []
|
|
4818
5466
|
};
|
|
4819
|
-
const
|
|
5467
|
+
const decoded = parseXmlPropertyList(output.slice(start, end + "</plist>".length));
|
|
5468
|
+
const projected = projectPlistValue(decoded.value);
|
|
5469
|
+
const numbers = createPlistNumberProjection(decoded.numberLiterals);
|
|
5470
|
+
const value = numbers.project(projected.value);
|
|
4820
5471
|
return {
|
|
4821
|
-
value
|
|
4822
|
-
omittedPrototypeKeys
|
|
5472
|
+
value,
|
|
5473
|
+
omittedPrototypeKeys: decoded.omittedPrototypeKeys,
|
|
5474
|
+
limitations: [
|
|
5475
|
+
...numbers.limitations(),
|
|
5476
|
+
...projected.nonFiniteRealCount === 0 ? [] : [nonFiniteRealLimitation(projected.nonFiniteRealCount)],
|
|
5477
|
+
...projected.unknownRealCount === 0 ? [] : [unknownRealLimitation(projected.unknownRealCount)],
|
|
5478
|
+
...projected.negativeZeroRealCount === 0 ? [] : [negativeZeroRealLimitation(projected.negativeZeroRealCount)],
|
|
5479
|
+
...projected.unknownDateCount === 0 ? [] : [unknownDateLimitation(projected.unknownDateCount)]
|
|
5480
|
+
]
|
|
4823
5481
|
};
|
|
4824
5482
|
};
|
|
4825
|
-
|
|
4826
|
-
const
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
message: `Cannot inspect ${path}: ${sentence}`
|
|
4832
|
-
}]);
|
|
4833
|
-
};
|
|
4834
|
-
plutilDiagnostic = (stderr, path) => {
|
|
4835
|
-
const text = stderr.trim();
|
|
4836
|
-
return text.startsWith(`${path}: `) ? text.slice(path.length + 2) : text;
|
|
4837
|
-
};
|
|
4838
|
-
requireRegularPlist = async (path, requested) => {
|
|
4839
|
-
try {
|
|
4840
|
-
if (!(await stat(path)).isFile()) return err(unreadablePlist(path, requested, "it is not a regular file"));
|
|
4841
|
-
await (await open(path, "r")).close();
|
|
4842
|
-
return ok(null);
|
|
4843
|
-
} catch (cause) {
|
|
4844
|
-
const code = cause instanceof Error && "code" in cause ? cause.code : undefined;
|
|
4845
|
-
if (code === "ENOENT" || code === "ENOTDIR") return err(unreadablePlist(path, requested, "no file exists there"));
|
|
4846
|
-
if (code === "EACCES" || code === "EPERM") return err(new BinaryTargetError(path, `permission denied while reading plist (${code})`, { cause }));
|
|
4847
|
-
return err(new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", { cause }));
|
|
4848
|
-
}
|
|
4849
|
-
};
|
|
4850
|
-
resolvePlistPath = async (target, requested) => {
|
|
4851
|
-
try {
|
|
4852
|
-
const source = target.sourcePath ?? target.path;
|
|
4853
|
-
if (requested !== undefined && isAbsolute(requested)) return ok(resolve(requested));
|
|
4854
|
-
const sourceMetadata = await stat(source);
|
|
4855
|
-
const root = sourceMetadata.isDirectory() ? source : dirname(target.path);
|
|
4856
|
-
if (requested !== undefined) return ok(resolve(root, requested));
|
|
4857
|
-
return ok(target.bundleInfoPlist ?? resolve(root, "Contents/Info.plist"));
|
|
4858
|
-
} catch (cause) {
|
|
4859
|
-
return err(new ProviderAdapterError(NATIVE_MACOS_PROVIDER_IDENTITY.id, "inspect_plist", { cause }));
|
|
4860
|
-
}
|
|
5483
|
+
plutilDiagnostic = (capture, path) => {
|
|
5484
|
+
const diagnostics = [capture.stderr, capture.stdout].map((stream) => {
|
|
5485
|
+
const text = stream.trim();
|
|
5486
|
+
return text.startsWith(`${path}: `) ? text.slice(path.length + 2) : text;
|
|
5487
|
+
}).filter((text) => text.length > 0);
|
|
5488
|
+
return diagnostics.length === 0 ? "plutil printed no diagnostic" : diagnostics.join("\n");
|
|
4861
5489
|
};
|
|
4862
5490
|
})))();
|
|
4863
5491
|
}
|