rea-agents 4.1.0 → 5.0.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 +184 -86
- package/bridge/android/ReaJadxBridge.java +247 -0
- package/bridge/native/NativeUIChildren.swift +27 -0
- package/bridge/native/ReaNativeUI.swift +30 -16
- package/dist/android/AndroidTargetSnapshot.js +5 -3
- package/dist/android/JadxAnalysis.js +8 -6
- package/dist/android/JadxConfiguration.js +19 -3
- package/dist/android/JadxMcpTransport.js +43 -16
- package/dist/android/JadxProtocol.js +8 -0
- package/dist/android/JadxProvider.js +117 -28
- package/dist/android/JadxRelease.js +8 -0
- package/dist/android/JadxSession.js +32 -18
- package/dist/application/AppBundleExecutable.js +141 -0
- package/dist/application/ArtifactInventory/classify.js +1 -1
- package/dist/application/ArtifactInventory/scanCanonical.js +1 -1
- package/dist/application/ArtifactInventory/scanReader.js +1 -1
- package/dist/application/ArtifactInventory.js +1 -1
- package/dist/application/BinaryTargetResolver.js +9 -64
- package/dist/application/CapabilityInventory.js +61 -3
- package/dist/application/ClientConfigurationDocument.js +72 -12
- package/dist/application/ClientRegistrationStatus.js +7 -8
- package/dist/application/DirectAnalysis.js +12 -14
- package/dist/application/DirectAnalysisStatus.js +4 -5
- package/dist/application/DoctorDiagnostics.js +3 -3
- package/dist/application/EnhancedTools.js +4 -4
- package/dist/application/EvidenceBundleCommands.js +1 -1
- package/dist/application/FilesystemSnapshot.js +20 -5
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/LinuxHopper.js +8 -2
- package/dist/application/OptionalObservationProviders.js +3 -0
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCaptureLifecycle.js +2 -2
- package/dist/application/ProcessCli.js +5 -1
- package/dist/application/ProcessHarness.js +20 -9
- package/dist/application/ReconstructionCoverageService.js +2 -6
- package/dist/application/ReconstructionObligationCandidates.js +5 -2
- package/dist/application/ReferenceSourceImport.js +2 -0
- package/dist/application/ReferenceSourceImportEntries.js +20 -3
- package/dist/application/ReferenceSourceImportTypes.js +5 -0
- package/dist/application/Setup.js +10 -2
- package/dist/application/SetupClientConfiguration.js +19 -16
- package/dist/application/SetupHost.js +18 -3
- package/dist/application/SetupPlan.js +1 -1
- package/dist/application/Uninstall.js +23 -17
- package/dist/application/UpdateMaintenance.js +3 -3
- package/dist/application/ValidateSelectedWebScript.js +27 -0
- package/dist/application/WebModuleTraceService.js +209 -0
- package/dist/application/WebRuntimeService.js +73 -0
- package/dist/application/WebScriptExportService.js +115 -0
- package/dist/application/WebSourceLocationService.js +160 -0
- package/dist/application/{AndroidAnalysisService.js → android/AndroidAnalysisService.js} +6 -6
- package/dist/application/{AndroidApplicationService.js → android/AndroidApplicationService.js} +3 -3
- package/dist/application/{AppleApplicationService.js → apple/AppleApplicationService.js} +5 -5
- package/dist/application/{AnalysisClientCleanup.js → binary/AnalysisClientCleanup.js} +2 -2
- package/dist/application/{AnalysisProviderEvaluation.js → binary/AnalysisProviderEvaluation.js} +4 -4
- package/dist/application/{AnalysisProviderRegistry.js → binary/AnalysisProviderRegistry.js} +5 -5
- package/dist/application/{AnalysisSnapshotCache.js → binary/AnalysisSnapshotCache.js} +7 -9
- package/dist/application/{AnalysisSnapshotFiles.js → binary/AnalysisSnapshotFiles.js} +4 -4
- package/dist/application/{BinarySession.js → binary/BinarySession.js} +12 -10
- package/dist/application/{BinarySessionComposition.js → binary/BinarySessionComposition.js} +2 -1
- package/dist/application/{BinarySessionExecution.js → binary/BinarySessionExecution.js} +9 -7
- package/dist/application/{BinarySessionOpen.js → binary/BinarySessionOpen.js} +6 -6
- package/dist/application/{BinarySessionRecords.js → binary/BinarySessionRecords.js} +28 -40
- package/dist/application/{CompositeProvider.js → binary/CompositeProvider.js} +2 -2
- package/dist/application/{LazyAnalysisProvider.js → binary/LazyAnalysisProvider.js} +6 -6
- package/dist/application/{SessionProviderRouter.js → binary/SessionProviderRouter.js} +7 -7
- package/dist/application/{FirmwareAnalysisService.js → firmware/FirmwareAnalysisService.js} +5 -5
- package/dist/application/{EvidenceLedger.js → investigation/EvidenceLedger.js} +44 -7
- package/dist/application/investigation/InvestigationRecords.js +69 -0
- package/dist/application/{UnknownEvidence.js → investigation/UnknownEvidence.js} +1 -1
- package/dist/application/{ElectronActiveEvidence.js → javascript/ElectronActiveEvidence.js} +3 -3
- package/dist/application/javascript/ElectronActiveObservationPort.js +1 -0
- package/dist/application/{ElectronActiveObservationService.js → javascript/ElectronActiveObservationService.js} +3 -3
- package/dist/application/{ElectronBoundaryAnalysis.js → javascript/ElectronBoundaryAnalysis.js} +1 -1
- package/dist/application/{ElectronBoundaryGraphContext.js → javascript/ElectronBoundaryGraphContext.js} +1 -1
- package/dist/application/{ElectronEvidence.js → javascript/ElectronEvidence.js} +2 -2
- package/dist/application/javascript/ElectronObservationPort.js +1 -0
- package/dist/application/{ElectronObservationService.js → javascript/ElectronObservationService.js} +3 -3
- package/dist/application/{JavaScriptApplicationEvidence.js → javascript/JavaScriptApplicationEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationEvidenceGraph.js → javascript/JavaScriptApplicationEvidenceGraph.js} +5 -5
- package/dist/application/{JavaScriptApplicationService.js → javascript/JavaScriptApplicationService.js} +10 -10
- package/dist/application/{JavaScriptApplicationWorkflowEvidence.js → javascript/JavaScriptApplicationWorkflowEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationWorkflowService.js → javascript/JavaScriptApplicationWorkflowService.js} +12 -12
- package/dist/application/{JavaScriptArtifactAnalysis.js → javascript/JavaScriptArtifactAnalysis.js} +8 -24
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +1 -0
- package/dist/application/{JavaScriptArtifactGraphAccumulator.js → javascript/JavaScriptArtifactGraphAccumulator.js} +16 -2
- package/dist/application/{JavaScriptArtifactGraphBuilder.js → javascript/JavaScriptArtifactGraphBuilder.js} +2 -2
- package/dist/application/{JavaScriptArtifactGraphContext.js → javascript/JavaScriptArtifactGraphContext.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphDocuments.js → javascript/JavaScriptArtifactGraphDocuments.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphFindings.js → javascript/JavaScriptArtifactGraphFindings.js} +20 -7
- package/dist/application/{JavaScriptArtifactGraphStructure.js → javascript/JavaScriptArtifactGraphStructure.js} +1 -1
- package/dist/application/{JavaScriptArtifactPathResolution.js → javascript/JavaScriptArtifactPathResolution.js} +6 -12
- package/dist/application/{JavaScriptArtifactReconstruction.js → javascript/JavaScriptArtifactReconstruction.js} +4 -8
- package/dist/application/{JavaScriptJsonModules.js → javascript/JavaScriptJsonModules.js} +1 -1
- package/dist/application/{JavaScriptModuleRelationships.js → javascript/JavaScriptModuleRelationships.js} +2 -2
- package/dist/application/javascript/JavaScriptRecoveryPort.js +1 -0
- package/dist/application/javascript/JavaScriptRecoveryService.js +52 -0
- package/dist/application/{JavaScriptReturnShapeProjection.js → javascript/JavaScriptReturnShapeProjection.js} +3 -3
- package/dist/application/{JavaScriptRuntimeObservationEvidence.js → javascript/JavaScriptRuntimeObservationEvidence.js} +2 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationPort.js +1 -0
- package/dist/application/{JavaScriptRuntimeObservationService.js → javascript/JavaScriptRuntimeObservationService.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationEvidence.js → javascript/JavaScriptRuntimeReconciliationEvidence.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationService.js → javascript/JavaScriptRuntimeReconciliationService.js} +6 -6
- package/dist/application/{JavaScriptSemanticGraphAsyncProjection.js → javascript/JavaScriptSemanticGraphAsyncProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphBuilder.js → javascript/JavaScriptSemanticGraphBuilder.js} +5 -3
- package/dist/application/{JavaScriptSemanticGraphChildProcessProjection.js → javascript/JavaScriptSemanticGraphChildProcessProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphConstruction.js → javascript/JavaScriptSemanticGraphConstruction.js} +3 -2
- package/dist/application/{JavaScriptSemanticGraphDataProjection.js → javascript/JavaScriptSemanticGraphDataProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFingerprintProjection.js → javascript/JavaScriptSemanticGraphFingerprintProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFlowProjection.js → javascript/JavaScriptSemanticGraphFlowProjection.js} +2 -2
- package/dist/application/{JavaScriptSemanticGraphObjectProjection.js → javascript/JavaScriptSemanticGraphObjectProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphProjection.js → javascript/JavaScriptSemanticGraphProjection.js} +2 -2
- package/dist/application/{JavaScriptSemanticGraphResourceProjection.js → javascript/JavaScriptSemanticGraphResourceProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticTraceService.js → javascript/JavaScriptSemanticTraceService.js} +6 -6
- package/dist/application/{ManagedApplicationGraphService.js → managed/ManagedApplicationGraphService.js} +7 -7
- package/dist/application/{ManagedMemberComparisonService.js → managed/ManagedMemberComparisonService.js} +10 -10
- package/dist/application/{ManagedNativeVerificationService.js → managed/ManagedNativeVerificationService.js} +7 -7
- package/dist/application/{ManagedReconstructionService.js → managed/ManagedReconstructionService.js} +7 -7
- package/dist/application/{NativeApiInspection.js → native/NativeApiInspection.js} +1 -1
- package/dist/application/{NativeCallRoutes.js → native/NativeCallRoutes.js} +3 -3
- package/dist/application/{NativeDispatchMetadataInspection.js → native/NativeDispatchMetadataInspection.js} +4 -4
- package/dist/application/{NativeUiActionTrace.js → native/NativeUiActionTrace.js} +7 -7
- package/dist/application/{NativeValueTrace.js → native/NativeValueTrace.js} +6 -6
- package/dist/{application/ArtifactInventory/hash.js → artifacts/ArtifactHash.js} +4 -2
- package/dist/artifacts/ArtifactPaths.js +3 -3
- package/dist/artifacts/ArtifactProvider.js +7 -37
- package/dist/artifacts/ArtifactProviderMetadata.js +36 -0
- package/dist/artifacts/AsarArtifactReader.js +195 -23
- package/dist/artifacts/AsarEntryStream.js +76 -0
- package/dist/artifacts/DirectoryArtifactReader.js +41 -7
- package/dist/artifacts/NativeDmgArtifactReader.js +161 -9
- package/dist/{application → artifacts/apple}/AppleAssetCatalogAnalysis.js +4 -4
- package/dist/{application → artifacts/apple}/InterfaceBuilderAnalysis.js +125 -51
- package/dist/artifacts/{KeyedArchiveReader.js → apple/KeyedArchiveReader.js} +21 -27
- package/dist/artifacts/apple/NibViewHierarchy.js +150 -0
- package/dist/{application → artifacts/javascript}/JavaScriptArtifactFiles.js +27 -6
- package/dist/artifacts/javascript/JavaScriptArtifactReader.js +6 -0
- package/dist/artifacts/readStableArtifact.js +52 -0
- package/dist/browser/BrowserScenarioSecrets.js +50 -8
- package/dist/browser/CdpAuthorizedMainFrame.js +4 -4
- package/dist/browser/CdpAuthorizedTarget.js +22 -0
- package/dist/browser/CdpBrowserProvider.js +4 -15
- package/dist/browser/CdpCaptureDocuments.js +33 -21
- package/dist/browser/CdpCaptureEventBodyShapes.js +3 -3
- package/dist/browser/CdpCaptureEventHandlers.js +26 -26
- package/dist/browser/CdpCaptureEventHelpers.js +6 -6
- package/dist/browser/CdpCaptureStorage.js +10 -8
- package/dist/browser/CdpCaptureStorageFingerprints.js +24 -22
- package/dist/browser/CdpCaptureValues.js +2 -2
- package/dist/browser/CdpCommandRejection.js +17 -0
- package/dist/browser/CdpConnection.js +51 -11
- package/dist/browser/CdpElectronInspection.js +10 -10
- package/dist/browser/CdpElectronProvider.js +3 -6
- package/dist/browser/CdpElectronScriptEvents.js +6 -6
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpElectronWorkers.js +4 -4
- package/dist/browser/CdpObservationSession.js +18 -23
- package/dist/browser/CdpPageCapture.js +4 -4
- package/dist/browser/CdpPageCaptureScripts.js +2 -2
- package/dist/browser/CdpPageCaptureWorkers.js +9 -9
- package/dist/browser/CdpSafeMetadata.js +48 -10
- package/dist/browser/CdpScreenshot.js +5 -5
- package/dist/browser/CdpTargetEvents.js +8 -0
- package/dist/browser/CdpTargetSession.js +2 -2
- package/dist/browser/CdpWebMcpDiscovery.js +22 -16
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +7 -6
- package/dist/browser/PlaywrightElectronActiveProvider.js +3 -6
- package/dist/browser/PlaywrightScenarioEvents.js +59 -51
- package/dist/browser/PlaywrightScenarioSession.js +8 -1
- package/dist/browser/WebSourceMapFetcher.js +37 -53
- package/dist/browser/assets/LocalWebScriptArtifacts.js +87 -0
- package/dist/browser/assets/PageScriptCapture.js +32 -0
- package/dist/browser/assets/PublishWebScripts.js +74 -0
- package/dist/browser/assets/ScenarioScriptCapture.js +76 -0
- package/dist/browser/assets/ScriptCaptureAdapters.js +57 -0
- package/dist/browser/assets/WebArtifactReads.js +56 -0
- package/dist/browser/assets/WebSourceLocationArtifacts.js +40 -0
- package/dist/browser/execution/CdpEventListeners.js +79 -0
- package/dist/browser/execution/CdpExecutionCapture.js +135 -0
- package/dist/browser/execution/CdpExecutionCollection.js +57 -0
- package/dist/browser/execution/CdpExecutionWindow.js +100 -0
- package/dist/browser/execution/CdpListenerSelector.js +22 -0
- package/dist/browser/execution/CdpPreciseCoverage.js +48 -0
- package/dist/browser/execution/CdpRuntimeInitiator.js +18 -0
- package/dist/browser/execution/CdpRuntimeProtocol.js +106 -0
- package/dist/browser/execution/CdpRuntimeRequests.js +81 -0
- package/dist/browser/execution/CdpRuntimeSession.js +163 -0
- package/dist/browser/execution/CdpRuntimeSources.js +223 -0
- package/dist/browser/execution/CdpWebRuntimeProvider.js +51 -0
- package/dist/browser/modules/NativeModuleResolver.js +210 -0
- package/dist/browser/modules/WebModuleArtifacts.js +40 -0
- package/dist/browser/network/PlaywrightNetworkContent.js +71 -0
- package/dist/browser/network/PlaywrightScenarioNetwork.js +180 -0
- package/dist/browser/providerIdentities.js +24 -0
- package/dist/catalogIdentity.js +23 -15
- package/dist/cli/androidCommands.js +13 -3
- package/dist/cli/applicationCommands.js +39 -8
- package/dist/cli/artifactCommands.js +1 -1
- package/dist/cli/browserAdvancedCommands.js +27 -9
- package/dist/cli/coreAnalysisCommands.js +5 -493
- package/dist/cli/coreBinaryCommands.js +211 -0
- package/dist/cli/coreNativeCommands.js +293 -0
- package/dist/cli/electronCommands.js +13 -18
- package/dist/cli/firmwareCommands.js +3 -3
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/javascriptRecoveryCommands.js +45 -0
- package/dist/cli/managedCommands.js +4 -4
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/referenceSourceImportStatus.js +6 -1
- package/dist/cli/utilityCommands.js +47 -23
- package/dist/cli/webModuleCommands.js +56 -0
- package/dist/cli/webRuntimeCommands.js +60 -0
- package/dist/cli/webScriptCommands.js +31 -0
- package/dist/cli/webSourceLocationCommands.js +42 -0
- package/dist/cli.js +10 -0
- package/dist/cliBrowserContext.js +4 -2
- package/dist/cliBrowserScenarioCommands.js +4 -3
- package/dist/cliCommandNames.js +8 -0
- package/dist/cliJavaScriptRuntimeCommands.js +6 -4
- package/dist/cliJsonInput.js +9 -2
- package/dist/cliOutput.js +37 -11
- package/dist/composition/android.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +30 -0
- package/dist/composition/binary.js +25 -0
- package/dist/composition/browserObservation.js +3 -0
- package/dist/composition/browserScenario.js +3 -0
- package/dist/composition/directAnalysis.js +17 -0
- package/dist/composition/electronObservation.js +3 -0
- package/dist/composition/electronScenario.js +3 -0
- package/dist/composition/firmware.js +3 -0
- package/dist/composition/javascriptRecovery.js +3 -0
- package/dist/composition/javascriptRuntimeObservation.js +3 -0
- package/dist/composition/optionalObservationProviders.js +49 -0
- package/dist/composition/webModules.js +5 -0
- package/dist/composition/webRuntime.js +4 -0
- package/dist/composition/webSourceLocations.js +5 -0
- package/dist/config/parseConfig.js +22 -3
- package/dist/contracts/{androidToolContracts.js → android/androidToolContracts.js} +5 -5
- package/dist/contracts/applicationToolContracts.js +43 -8
- package/dist/contracts/artifactToolContracts.js +2 -2
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/enhancedInputs.js +1 -1
- package/dist/contracts/{firmwareToolContracts.js → firmware/firmwareToolContracts.js} +5 -5
- package/dist/contracts/{applicationWorkflowInputContracts.js → javascript/applicationWorkflowInputContracts.js} +6 -6
- package/dist/contracts/{electronToolContracts.js → javascript/electronToolContracts.js} +6 -6
- package/dist/contracts/{javascriptApplicationWorkflowExamples.js → javascript/javascriptApplicationWorkflowExamples.js} +3 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +23 -0
- package/dist/contracts/{javascriptRuntimeObservationToolContracts.js → javascript/javascriptRuntimeObservationToolContracts.js} +3 -3
- package/dist/contracts/{javascriptRuntimeReconciliationExample.js → javascript/javascriptRuntimeReconciliationExample.js} +5 -5
- package/dist/contracts/{managedToolContracts.js → managed/managedToolContracts.js} +3 -3
- package/dist/contracts/{managedWorkflowExamples.js → managed/managedWorkflowExamples.js} +1 -1
- package/dist/contracts/{managedWorkflowToolContracts.js → managed/managedWorkflowToolContracts.js} +6 -6
- package/dist/contracts/mobileApplicationGraphExamples.js +105 -0
- package/dist/contracts/{nativeToolContracts.js → native/nativeToolContracts.js} +14 -7
- package/dist/contracts/officialToolContracts.js +3 -3
- package/dist/contracts/sessionToolContracts.js +1 -1
- package/dist/contracts/toolContracts.js +13 -7
- package/dist/contracts/toolEffects.js +32 -0
- package/dist/contracts/toolOutputSchemaGroups.js +18 -18
- package/dist/contracts/webRuntimeToolContracts.js +43 -0
- package/dist/contracts/webScriptToolContracts.js +68 -0
- package/dist/domain/analysisErrorCore.js +4 -2
- package/dist/domain/analysisErrorProjection.js +1 -0
- package/dist/domain/{androidApplication.js → android/androidApplication.js} +7 -6
- package/dist/domain/apple/appleApplication.js +277 -0
- package/dist/domain/{appleAssetCatalog.js → apple/appleAssetCatalog.js} +2 -2
- package/dist/domain/apple/appleBundleAnatomy.js +236 -0
- package/dist/domain/{interfaceBuilderGraph.js → apple/interfaceBuilderGraph.js} +47 -314
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +411 -0
- package/dist/domain/{keyedArchive.js → apple/keyedArchive.js} +10 -9
- package/dist/domain/apple/plistValue.js +35 -0
- package/dist/domain/artifactInventoryEvidence.js +12 -2
- package/dist/domain/artifactInventorySnapshot.js +1 -0
- package/dist/domain/artifactOperationError.js +5 -1
- package/dist/domain/artifactPathSyntax.js +26 -0
- package/dist/domain/browserNetworkEvidence.js +82 -0
- package/dist/domain/browserObservationError.js +2 -0
- package/dist/domain/browserObservationSchemas.js +2 -1
- package/dist/domain/browserScenarioCapture.js +22 -0
- package/dist/domain/browserScenarioCaptureValues.js +25 -0
- package/dist/domain/browserScenarioDiff.js +6 -3
- package/dist/domain/browserScenarioDiffEvidence.js +35 -1
- package/dist/domain/browserScenarioValues.js +12 -1
- package/dist/domain/browserSession.js +2 -7
- package/dist/domain/bundleComparison.js +2 -1
- package/dist/domain/callPath.js +52 -44
- package/dist/domain/comparisonStatus.js +39 -0
- package/dist/domain/evidenceBundle.js +98 -35
- package/dist/domain/{firmwareAnalysis.js → firmware/firmwareAnalysis.js} +2 -2
- package/dist/domain/functionComparisonNormalization.js +11 -13
- package/dist/domain/hopperValues.js +2 -2
- package/dist/domain/inputIssueProjection.js +17 -2
- package/dist/domain/{electronObservation.js → javascript/electronObservation.js} +5 -11
- package/dist/domain/{electronStaticAnalysisBrowser.js → javascript/electronStaticAnalysisBrowser.js} +4 -3
- package/dist/domain/{electronStaticAnalysisIpc.js → javascript/electronStaticAnalysisIpc.js} +2 -2
- package/dist/domain/{electronStaticAnalysisNative.js → javascript/electronStaticAnalysisNative.js} +12 -13
- package/dist/domain/javascript/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/{electronStaticAnalysisValues.js → javascript/electronStaticAnalysisValues.js} +3 -3
- package/dist/domain/{javascriptApplicationAnalysis.js → javascript/javascriptApplicationAnalysis.js} +2 -2
- package/dist/domain/{javascriptApplicationChangeGraph.js → javascript/javascriptApplicationChangeGraph.js} +1 -1
- package/dist/domain/{javascriptApplicationEvidenceSchemas.js → javascript/javascriptApplicationEvidenceSchemas.js} +6 -4
- package/dist/domain/{javascriptApplicationGraph.js → javascript/javascriptApplicationGraph.js} +2 -2
- package/dist/domain/{javascriptApplicationGraphSchemas.js → javascript/javascriptApplicationGraphSchemas.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparison.js → javascript/javascriptApplicationVersionComparison.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparisonSchemas.js → javascript/javascriptApplicationVersionComparisonSchemas.js} +3 -3
- package/dist/domain/{javascriptApplicationVersionItems.js → javascript/javascriptApplicationVersionItems.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionKeys.js → javascript/javascriptApplicationVersionKeys.js} +16 -9
- package/dist/domain/javascript/javascriptArtifactFiles.js +1 -0
- package/dist/domain/{javascriptAstFingerprint.js → javascript/javascriptAstFingerprint.js} +38 -22
- package/dist/domain/javascript/javascriptAstValues.js +23 -0
- package/dist/domain/{javascriptExportShapeComparison.js → javascript/javascriptExportShapeComparison.js} +1 -1
- package/dist/domain/{javascriptExportShapeComparisonSchemas.js → javascript/javascriptExportShapeComparisonSchemas.js} +2 -2
- package/dist/domain/{javascriptExportShapeSelection.js → javascript/javascriptExportShapeSelection.js} +1 -1
- package/dist/domain/{javascriptExportShapeVariants.js → javascript/javascriptExportShapeVariants.js} +1 -1
- package/dist/domain/{javascriptFeatureSeed.js → javascript/javascriptFeatureSeed.js} +4 -3
- package/dist/domain/{javascriptFeatureTrace.js → javascript/javascriptFeatureTrace.js} +2 -2
- package/dist/domain/{javascriptFeatureTraceSchemas.js → javascript/javascriptFeatureTraceSchemas.js} +32 -18
- package/dist/domain/{javascriptFeatureTraversal.js → javascript/javascriptFeatureTraversal.js} +6 -2
- package/dist/domain/{javascriptNativeHandoff.js → javascript/javascriptNativeHandoff.js} +1 -1
- package/dist/domain/javascript/javascriptRecovery.js +88 -0
- package/dist/domain/{javascriptRuntimeLoadState.js → javascript/javascriptRuntimeLoadState.js} +1 -1
- package/dist/domain/{javascriptRuntimeObservation.js → javascript/javascriptRuntimeObservation.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationActive.js → javascript/javascriptRuntimeReconciliationActive.js} +3 -3
- package/dist/domain/{javascriptRuntimeReconciliationGraph.js → javascript/javascriptRuntimeReconciliationGraph.js} +1 -1
- package/dist/domain/{javascriptRuntimeReconciliationMatching.js → javascript/javascriptRuntimeReconciliationMatching.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationParsing.js → javascript/javascriptRuntimeReconciliationParsing.js} +5 -5
- package/dist/domain/{javascriptRuntimeReconciliationResult.js → javascript/javascriptRuntimeReconciliationResult.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationSchemas.js → javascript/javascriptRuntimeReconciliationSchemas.js} +4 -4
- package/dist/domain/{javascriptRuntimeStaticCandidates.js → javascript/javascriptRuntimeStaticCandidates.js} +1 -1
- package/dist/domain/{javascriptSemanticAnalysis.js → javascript/javascriptSemanticAnalysis.js} +40 -14
- package/dist/domain/{javascriptSemanticAsyncEffects.js → javascript/javascriptSemanticAsyncEffects.js} +2 -1
- package/dist/domain/{javascriptSemanticCallResolution.js → javascript/javascriptSemanticCallResolution.js} +10 -5
- package/dist/domain/{javascriptSemanticCalls.js → javascript/javascriptSemanticCalls.js} +7 -4
- package/dist/domain/{javascriptSemanticChildProcesses.js → javascript/javascriptSemanticChildProcesses.js} +4 -2
- package/dist/domain/{javascriptSemanticDataEffectHelpers.js → javascript/javascriptSemanticDataEffectHelpers.js} +7 -6
- package/dist/domain/{javascriptSemanticDataEffects.js → javascript/javascriptSemanticDataEffects.js} +8 -6
- package/dist/domain/{javascriptSemanticFingerprints.js → javascript/javascriptSemanticFingerprints.js} +40 -16
- package/dist/domain/{javascriptSemanticGraph.js → javascript/javascriptSemanticGraph.js} +2 -2
- package/dist/domain/{javascriptSemanticGraphSchemas.js → javascript/javascriptSemanticGraphSchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +116 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +53 -0
- package/dist/domain/{javascriptSemanticObjects.js → javascript/javascriptSemanticObjects.js} +5 -5
- package/dist/domain/{javascriptSemanticPrimitives.js → javascript/javascriptSemanticPrimitives.js} +1 -1
- package/dist/domain/{javascriptSemanticProjection.js → javascript/javascriptSemanticProjection.js} +31 -44
- package/dist/domain/{javascriptSemanticPromises.js → javascript/javascriptSemanticPromises.js} +77 -22
- package/dist/domain/{javascriptSemanticProvenance.js → javascript/javascriptSemanticProvenance.js} +4 -1
- package/dist/domain/{javascriptSemanticQuery.js → javascript/javascriptSemanticQuery.js} +1 -1
- package/dist/domain/{javascriptSemanticQueryAssessment.js → javascript/javascriptSemanticQueryAssessment.js} +1 -1
- package/dist/domain/{javascriptSemanticQueryIdentity.js → javascript/javascriptSemanticQueryIdentity.js} +1 -1
- package/dist/domain/{javascriptSemanticQuerySchemas.js → javascript/javascriptSemanticQuerySchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +25 -0
- package/dist/domain/{javascriptSemanticResources.js → javascript/javascriptSemanticResources.js} +2 -1
- package/dist/domain/{javascriptSemanticReturns.js → javascript/javascriptSemanticReturns.js} +1 -1
- package/dist/domain/{javascriptSemanticTraceSchemas.js → javascript/javascriptSemanticTraceSchemas.js} +2 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +55 -0
- package/dist/domain/javascript/javascriptSemanticValueTypes.js +1 -0
- package/dist/domain/{javascriptSemanticValues.js → javascript/javascriptSemanticValues.js} +72 -48
- package/dist/domain/{javascriptStaticAnalysis.js → javascript/javascriptStaticAnalysis.js} +7 -4
- package/dist/domain/{javascriptStaticAnalysisBundler.js → javascript/javascriptStaticAnalysisBundler.js} +14 -11
- package/dist/domain/{javascriptStaticAnalysisCalls.js → javascript/javascriptStaticAnalysisCalls.js} +2 -2
- package/dist/domain/{javascriptStaticAnalysisHelpers.js → javascript/javascriptStaticAnalysisHelpers.js} +231 -40
- package/dist/domain/{sourceToBundleComparison.js → javascript/sourceToBundleComparison.js} +2 -2
- package/dist/domain/{sourceToBundleComparisonSchemas.js → javascript/sourceToBundleComparisonSchemas.js} +4 -4
- package/dist/domain/{sourceToBundleSignals.js → javascript/sourceToBundleSignals.js} +2 -2
- package/dist/domain/{managedApplicationGraph.js → managed/managedApplicationGraph.js} +4 -4
- package/dist/domain/{managedApplicationGraphNodes.js → managed/managedApplicationGraphNodes.js} +1 -1
- package/dist/domain/{managedArtifact.js → managed/managedArtifact.js} +1 -1
- package/dist/domain/{managedMemberComparison.js → managed/managedMemberComparison.js} +4 -4
- package/dist/domain/{managedMemberComparisonCoverage.js → managed/managedMemberComparisonCoverage.js} +2 -1
- package/dist/domain/{managedMemberComparisonItems.js → managed/managedMemberComparisonItems.js} +97 -40
- package/dist/domain/{managedMemberComparisonMatch.js → managed/managedMemberComparisonMatch.js} +22 -11
- package/dist/domain/{managedNativeVerification.js → managed/managedNativeVerification.js} +1 -1
- package/dist/domain/{managedNativeVerificationMatch.js → managed/managedNativeVerificationMatch.js} +3 -3
- package/dist/domain/{managedNativeVerificationSchemas.js → managed/managedNativeVerificationSchemas.js} +6 -5
- package/dist/domain/{managedReconstruction.js → managed/managedReconstruction.js} +3 -3
- package/dist/domain/{nativeFunctionAnnotations.js → native/nativeFunctionAnnotations.js} +1 -1
- package/dist/domain/{nativeInspection.js → native/nativeInspection.js} +1 -1
- package/dist/domain/{nativeInvestigationGraph.js → native/nativeInvestigationGraph.js} +13 -4
- package/dist/domain/{nativeLoadImage.js → native/nativeLoadImage.js} +1 -1
- package/dist/domain/{nativeUiObservation.js → native/nativeUiObservation.js} +20 -6
- package/dist/domain/{objcSwiftMetadata.js → native/objcSwiftMetadata.js} +17 -0
- package/dist/domain/processCapture.js +4 -2
- package/dist/domain/processScenario.js +17 -17
- package/dist/domain/propertyListKeys.js +69 -0
- package/dist/domain/providerCleanupError.js +5 -2
- package/dist/domain/reconstructionCoverageEvaluation.js +46 -24
- package/dist/domain/reconstructionCoverageInput.js +7 -0
- package/dist/domain/runtimeVersion.js +2 -0
- package/dist/domain/sourceMapEnvelope.js +38 -0
- package/dist/domain/unicodeCodePointOrder.js +11 -6
- package/dist/domain/webBundleAnalyzerAst.js +2 -34
- package/dist/domain/webBundleAnalyzerInspection.js +12 -9
- package/dist/domain/webEventListeners.js +28 -0
- package/dist/domain/webExecution.js +74 -0
- package/dist/domain/webMcpDiscovery.js +1 -7
- package/dist/domain/webModuleImports.js +104 -0
- package/dist/domain/webModuleTrace.js +106 -0
- package/dist/domain/webRuntime.js +69 -0
- package/dist/domain/webScreenshot.js +1 -7
- package/dist/domain/webScriptArtifacts.js +39 -0
- package/dist/domain/webScriptExport.js +86 -0
- package/dist/domain/webScriptExportError.js +13 -0
- package/dist/domain/webScriptExportPlan.js +108 -0
- package/dist/domain/webSourceLocation.js +106 -0
- package/dist/domain/webSourcePosition.js +21 -0
- package/dist/dotnet/ManagedArtifactInspector.js +1 -1
- package/dist/dotnet/ManagedMemberInspector.js +1 -1
- package/dist/dotnet/ManagedMemberInspectorCore.js +34 -0
- package/dist/dotnet/ManagedMemberRows.js +5 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +22 -16
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +56 -50
- package/dist/dotnet/ManagedStaticProvider.js +3 -33
- package/dist/dotnet/ManagedStaticProviderMetadata.js +36 -0
- package/dist/evaluation/CodexAgentEval.js +2 -1
- package/dist/firmware/FirmwareProvider.js +18 -12
- package/dist/firmware/FirmwarePublication.js +1 -1
- package/dist/firmware/FirmwareRelease.js +1 -1
- package/dist/firmware/FirmwareReports.js +12 -0
- package/dist/firmware/FirmwareVersion.js +80 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraFunctionValues.js +5 -5
- package/dist/ghidra/GhidraInstallation.js +38 -34
- package/dist/ghidra/GhidraInstallationPolicy.js +140 -0
- package/dist/ghidra/GhidraInventoryValues.js +1 -1
- package/dist/ghidra/GhidraLauncher.js +12 -4
- package/dist/ghidra/GhidraLoadImageAttest.js +36 -0
- package/dist/ghidra/GhidraLoadImageValues.js +1 -1
- package/dist/ghidra/GhidraProvider.js +15 -233
- package/dist/ghidra/GhidraProviderCapabilities.js +7 -14
- package/dist/ghidra/GhidraProviderClient.js +209 -0
- package/dist/ghidra/GhidraResponseBuffer.js +7 -1
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +17 -1
- package/dist/hopper/HopperProvider.js +2 -48
- package/dist/hopper/HopperProviderCapabilities.js +73 -0
- package/dist/hopper/HopperResponseStream.js +7 -1
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -4
- package/dist/ida/IdaProviderCapabilities.js +3 -11
- package/dist/ida/IdaSessionClient.js +12 -0
- package/dist/{browser → inspector}/JavaScriptRuntimeScope.js +16 -5
- package/dist/{browser → inspector}/V8InspectorCaptureProjection.js +46 -8
- package/dist/{browser → inspector}/V8InspectorEndpoint.js +1 -1
- package/dist/{browser → inspector}/V8InspectorProvider.js +10 -13
- package/dist/inspector/providerIdentity.js +6 -0
- package/dist/javascript/recovery/RecoveryFiles.js +122 -0
- package/dist/javascript/recovery/WakaruCommand.js +116 -0
- package/dist/javascript/recovery/WakaruExecution.js +100 -0
- package/dist/javascript/recovery/WakaruProvider.js +96 -0
- package/dist/javascript/recovery/WakaruPublication.js +102 -0
- package/dist/javascript/recovery/WakaruRelease.js +29 -0
- package/dist/javascript/recovery/WakaruReport.js +134 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProcess.js +37 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProtocol.js +20 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +176 -0
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +61 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +185 -0
- package/dist/javascript/sourceMaps/TraceSourceMap.js +138 -0
- package/dist/main/shutdown.js +8 -2
- package/dist/main/transport.js +24 -7
- package/dist/main.js +4 -18
- package/dist/native/AppleDispatchCoverage.js +58 -0
- package/dist/native/AppleDispatchMetadata.js +71 -509
- package/dist/native/AppleMachoFixups.js +292 -0
- package/dist/native/AppleMachoSelection.js +188 -0
- package/dist/native/AppleObjcCategories.js +59 -0
- package/dist/native/AppleObjcDispatchFacets.js +257 -0
- package/dist/native/AppleObjcProperties.js +68 -0
- package/dist/native/AppleObjcProtocols.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +150 -0
- package/dist/native/NativeMacOSProvider.js +132 -72
- package/dist/native/NativeMacOSProviderMetadata.js +42 -0
- package/dist/native/NativeMachoInspection.js +45 -14
- package/dist/native/NativeUiHelperRuntime.js +7 -3
- package/dist/native/NativeUiObservation.js +8 -4
- package/dist/native/NativeUiOutputBudget.js +8 -0
- package/dist/native/parsers/codesign.js +40 -5
- package/dist/native/parsers/demangle.js +6 -2
- package/dist/native/parsers/dyldInfo.js +13 -4
- package/dist/native/parsers/echoedPath.js +14 -0
- package/dist/native/parsers/lipo.js +14 -0
- package/dist/native/parsers/otool.js +1 -1
- package/dist/native/parsers/plist.js +174 -19
- package/dist/process/ExecFileOutput.js +2 -0
- package/dist/process/ProviderProcess.js +38 -17
- package/dist/reference/ReferenceSourceReaderEntries.js +6 -1
- package/dist/server/createServer.js +48 -6
- package/dist/server/mcpClientMetadata.js +6 -3
- package/dist/server/registerAndroidTools.js +1 -1
- package/dist/server/registerApplicationTools/compareExportShapes.js +2 -2
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +2 -2
- package/dist/server/registerApplicationTools/compareVersions.js +2 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +43 -0
- package/dist/server/registerApplicationTools/traceFeature.js +1 -1
- package/dist/server/registerApplicationTools/traceSemantics.js +1 -1
- package/dist/server/registerApplicationTools.js +2 -0
- package/dist/server/registerBrowserScenarioTool.js +6 -2
- package/dist/server/registerBrowserTools.js +13 -2
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +21 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +17 -0
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -4
- package/dist/server/registerManagedTools.js +3 -3
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -2
- package/dist/server/registerManagedWorkflowTools/contract.js +1 -1
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +1 -1
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +1 -1
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -2
- package/dist/server/registerNativeTools.js +1 -1
- package/dist/server/registerPrompts.js +5 -1
- package/dist/server/registerSessionTools.js +1 -1
- package/dist/server/registerWebModuleTool.js +17 -0
- package/dist/server/registerWebRuntimeTools.js +31 -0
- package/dist/server/registerWebScriptTool.js +18 -0
- package/dist/server/registerWebSourceLocationTool.js +17 -0
- package/dist/server/sessionAvailabilityPolicy.js +24 -12
- package/dist/windows/WindowsOwnedProcess.js +3 -1
- package/install.sh +12 -2
- package/native/windows/README.md +5 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +40 -19
- package/scripts/hopper-demo-x11.py +67 -8
- package/scripts/rea.mjs +9 -1
- package/skills/reverse-engineer-anything/SKILL.md +3 -3
- package/skills/reverse-engineer-anything/references/android-applications.md +2 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +1 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +32 -23
- package/dist/application/runtime.js +0 -53
- package/dist/domain/appleApplication.js +0 -181
- package/dist/domain/javascriptAstValues.js +0 -13
- package/dist/domain/javascriptSemanticTraversal.js +0 -30
- package/dist/native/NativeHostCapabilities.js +0 -23
- /package/dist/application/{AndroidAnalysisPort.js → DirectAnalysisDependencies.js} +0 -0
- /package/dist/application/{BinarySessionPort.js → WebModulePorts.js} +0 -0
- /package/dist/application/{ElectronActiveObservationPort.js → WebRuntimePort.js} +0 -0
- /package/dist/application/{ElectronObservationPort.js → WebScriptArtifactPort.js} +0 -0
- /package/dist/application/{FirmwareAnalysisPort.js → WebSourceLocationPorts.js} +0 -0
- /package/dist/application/{JavaScriptArtifactAnalysisTypes.js → android/AndroidAnalysisPort.js} +0 -0
- /package/dist/application/{AbortablePromise.js → binary/AbortablePromise.js} +0 -0
- /package/dist/application/{JavaScriptRuntimeObservationPort.js → binary/BinarySessionPort.js} +0 -0
- /package/dist/application/{BinarySessionStatus.js → binary/BinarySessionStatus.js} +0 -0
- /package/dist/{domain/electronStaticAnalysisTypes.js → application/firmware/FirmwareAnalysisPort.js} +0 -0
- /package/dist/{domain/javascriptSemanticValueTypes.js → application/investigation/InvestigationRecordPort.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraph.js → javascript/ElectronBoundaryGraph.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphIpc.js → javascript/ElectronBoundaryGraphIpc.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphNative.js → javascript/ElectronBoundaryGraphNative.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphWindows.js → javascript/ElectronBoundaryGraphWindows.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphBundlers.js → javascript/JavaScriptArtifactGraphBundlers.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphEvidence.js → javascript/JavaScriptArtifactGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptArtifactReconstructionInput.js → javascript/JavaScriptArtifactReconstructionInput.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphEvidence.js → javascript/JavaScriptSemanticGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphValueProjection.js → javascript/JavaScriptSemanticGraphValueProjection.js} +0 -0
- /package/dist/artifacts/{NibArchive.js → apple/NibArchive.js} +0 -0
- /package/dist/domain/{androidAnalysis.js → android/androidAnalysis.js} +0 -0
- /package/dist/domain/{electronActiveObservation.js → javascript/electronActiveObservation.js} +0 -0
- /package/dist/domain/{electronStaticAnalysis.js → javascript/electronStaticAnalysis.js} +0 -0
- /package/dist/domain/{javascriptExportShapeComparisonIdentity.js → javascript/javascriptExportShapeComparisonIdentity.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliation.js → javascript/javascriptRuntimeReconciliation.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliationRuntime.js → javascript/javascriptRuntimeReconciliationRuntime.js} +0 -0
- /package/dist/domain/{javascriptSemanticCoverage.js → javascript/javascriptSemanticCoverage.js} +0 -0
- /package/dist/domain/{javascriptSemanticDerivedAnalysis.js → javascript/javascriptSemanticDerivedAnalysis.js} +0 -0
- /package/dist/domain/{javascriptSemanticGraphSerialization.js → javascript/javascriptSemanticGraphSerialization.js} +0 -0
- /package/dist/domain/{javascriptSemanticIr.js → javascript/javascriptSemanticIr.js} +0 -0
- /package/dist/domain/{javascriptSemanticQueryRelations.js → javascript/javascriptSemanticQueryRelations.js} +0 -0
- /package/dist/domain/{javascriptSemanticState.js → javascript/javascriptSemanticState.js} +0 -0
- /package/dist/domain/{javascriptSourceParser.js → javascript/javascriptSourceParser.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisFindings.js → javascript/javascriptStaticAnalysisFindings.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisState.js → javascript/javascriptStaticAnalysisState.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisTypes.js → javascript/javascriptStaticAnalysisTypes.js} +0 -0
- /package/dist/domain/{managedApplicationGraphCoverage.js → managed/managedApplicationGraphCoverage.js} +0 -0
- /package/dist/domain/{managedApplicationGraphNodeCoverage.js → managed/managedApplicationGraphNodeCoverage.js} +0 -0
- /package/dist/domain/{nativeApiBoundary.js → native/nativeApiBoundary.js} +0 -0
- /package/dist/domain/{nativeDataType.js → native/nativeDataType.js} +0 -0
- /package/dist/domain/{nativeInstruction.js → native/nativeInstruction.js} +0 -0
- /package/dist/domain/{nativeMetadataRecovery.js → native/nativeMetadataRecovery.js} +0 -0
- /package/dist/domain/{nativeValueFlow.js → native/nativeValueFlow.js} +0 -0
- /package/dist/domain/{nativeValueTrace.js → native/nativeValueTrace.js} +0 -0
|
@@ -1,67 +1,33 @@
|
|
|
1
|
+
import { NATIVE_MACOS_PROVIDER_IDENTITY as IDENTITY, nativeMacOSCapabilities, } from "./NativeMacOSProviderMetadata.js";
|
|
2
|
+
export { NATIVE_MACOS_PROVIDER_IDENTITY } from "./NativeMacOSProviderMetadata.js";
|
|
1
3
|
import { inspectAppleDispatchMetadata } from "./AppleDispatchMetadata.js";
|
|
2
4
|
import { observeNativeUi } from "./NativeUiObservation.js";
|
|
3
5
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
|
-
import { stat } from "node:fs/promises";
|
|
5
|
-
import { parse as parseXmlPlist } from "plist";
|
|
6
|
+
import { open, realpath, stat } from "node:fs/promises";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
import { createAnalysisExecution, } from "../application/AnalysisProvider.js";
|
|
8
|
-
import { NATIVE_TOOL_CONTRACTS, } from "../contracts/nativeToolContracts.js";
|
|
9
|
-
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
9
|
+
import { NATIVE_TOOL_CONTRACTS, } from "../contracts/native/nativeToolContracts.js";
|
|
10
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisInputError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
11
|
+
import { BinaryTargetError } from "../domain/configurationErrors.js";
|
|
10
12
|
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
11
13
|
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
12
14
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
13
|
-
import {
|
|
15
|
+
import { omittedPrototypeKeysLimitation, parseXmlPropertyList, } from "../domain/propertyListKeys.js";
|
|
16
|
+
import { demangleSwiftSchema, inspectPlistSchema, inspectSignatureSchema, listArchitecturesSchema, } from "../domain/native/nativeInspection.js";
|
|
14
17
|
import { err, ok } from "../domain/result.js";
|
|
15
18
|
import { NativeCommandFailure, XcrunCommandRunner, } from "./CommandRunner.js";
|
|
16
19
|
import { parseCodeSignature } from "./parsers/codesign.js";
|
|
17
20
|
import { parseDemangledSymbols } from "./parsers/demangle.js";
|
|
18
21
|
import { parseLipoArchitectures } from "./parsers/lipo.js";
|
|
19
|
-
import { parsePlistJson } from "./parsers/plist.js";
|
|
22
|
+
import { parsePlistJson, parsePlistXml, plistJsonNeedsNumberTypes, } from "./parsers/plist.js";
|
|
20
23
|
import { architectureLocations, inspectNativeMacho, } from "./NativeMachoInspection.js";
|
|
21
|
-
/** Public identity committed by macOS-native inspection observations. */
|
|
22
|
-
export const NATIVE_MACOS_PROVIDER_IDENTITY = Object.freeze({
|
|
23
|
-
id: "native-macos",
|
|
24
|
-
name: "macOS native inspection utilities",
|
|
25
|
-
version: null,
|
|
26
|
-
});
|
|
27
|
-
const IDENTITY = NATIVE_MACOS_PROVIDER_IDENTITY;
|
|
28
24
|
/** Read-only semantic provider composed from Xcode command-line utilities. */
|
|
29
25
|
export class NativeMacOSProvider {
|
|
30
26
|
runner;
|
|
31
27
|
#capabilities;
|
|
32
28
|
constructor(runner = new XcrunCommandRunner(), platform = process.platform) {
|
|
33
29
|
this.runner = runner;
|
|
34
|
-
|
|
35
|
-
this.#capabilities = Object.freeze([
|
|
36
|
-
...NATIVE_TOOL_CONTRACTS,
|
|
37
|
-
{ name: "inspect_native_dispatch_metadata" },
|
|
38
|
-
].map((contract) => {
|
|
39
|
-
const availability = available
|
|
40
|
-
? { available: true, reason: null }
|
|
41
|
-
: {
|
|
42
|
-
available: false,
|
|
43
|
-
availabilityCode: "unsupported_host",
|
|
44
|
-
reason: "Native macOS utilities require macOS.",
|
|
45
|
-
};
|
|
46
|
-
return Object.freeze({
|
|
47
|
-
provider: IDENTITY,
|
|
48
|
-
operation: contract.name,
|
|
49
|
-
...availability,
|
|
50
|
-
effects: Object.freeze({
|
|
51
|
-
mutatesArtifact: false,
|
|
52
|
-
launchesProcess: contract.name !== "inspect_native_dispatch_metadata",
|
|
53
|
-
mayShowUi: contract.name === "capture_native_ui_scenario",
|
|
54
|
-
mayAccessNetwork: contract.name === "capture_native_ui_scenario",
|
|
55
|
-
mayWriteFilesystem: contract.name === "capture_native_ui_scenario" ||
|
|
56
|
-
contract.name === "observe_native_ui",
|
|
57
|
-
changesPermissions: false,
|
|
58
|
-
requiresRoot: false,
|
|
59
|
-
}),
|
|
60
|
-
limitations: Object.freeze([
|
|
61
|
-
"Availability and textual formats depend on the installed macOS/Xcode toolchain.",
|
|
62
|
-
]),
|
|
63
|
-
});
|
|
64
|
-
}));
|
|
30
|
+
this.#capabilities = nativeMacOSCapabilities(platform);
|
|
65
31
|
}
|
|
66
32
|
identity() {
|
|
67
33
|
return IDENTITY;
|
|
@@ -191,7 +157,9 @@ class NativeMacOSClient {
|
|
|
191
157
|
const symbols = z.array(z.string()).safeParse(parameters.symbols);
|
|
192
158
|
if (!symbols.success)
|
|
193
159
|
return err(new AnalysisOutputError("demangle_swift", "symbols were not parsed strings"));
|
|
194
|
-
const capture = await this.#run("demangle_swift", "swift-demangle",
|
|
160
|
+
const capture = await this.#run("demangle_swift", "swift-demangle",
|
|
161
|
+
// `--` keeps symbols that begin with `-` from selecting demangler options.
|
|
162
|
+
["--compact", "--", ...symbols.data], { signal });
|
|
195
163
|
if (!capture.ok)
|
|
196
164
|
return capture;
|
|
197
165
|
const provenance = [invocation(capture.value, this.target.path)];
|
|
@@ -211,8 +179,7 @@ class NativeMacOSClient {
|
|
|
211
179
|
const display = await this.#run("inspect_signature", "codesign", ["-d", "--verbose=4", this.target.path], { signal, acceptNonZero: true });
|
|
212
180
|
if (!display.ok)
|
|
213
181
|
return display;
|
|
214
|
-
const
|
|
215
|
-
const unsigned = isUnsignedCodeSignObservation(display.value);
|
|
182
|
+
const unsigned = isNonzeroUnsignedObservation(display.value);
|
|
216
183
|
const displayFailure = codeSignCaptureFailure(display.value);
|
|
217
184
|
if (displayFailure !== null)
|
|
218
185
|
return err(displayFailure);
|
|
@@ -228,16 +195,29 @@ class NativeMacOSClient {
|
|
|
228
195
|
const entitlementsFailure = codeSignCaptureFailure(entitlements.value);
|
|
229
196
|
if (entitlementsFailure !== null)
|
|
230
197
|
return err(entitlementsFailure);
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
198
|
+
// codesign echoes the resolved executable path in its diagnostics.
|
|
199
|
+
const parsed = parseCodeSignature(display.value.stderr, unsigned, [
|
|
200
|
+
this.target.path,
|
|
201
|
+
...(await canonicalPath(this.target.path)),
|
|
202
|
+
]);
|
|
203
|
+
// The requirement is printed to stdout; stderr echoes the path.
|
|
204
|
+
const requirementText = /designated\s*=>\s*(.+)$/mu.exec(requirements.value.stdout)?.[1] ?? null;
|
|
205
|
+
// Entitlements XML is printed to stdout; stderr echoes the path.
|
|
206
|
+
const entitlementValue = parseEntitlements(entitlements.value.stdout);
|
|
234
207
|
const captures = [display.value, requirements.value, entitlements.value];
|
|
235
|
-
const limitations = [
|
|
208
|
+
const limitations = [
|
|
209
|
+
...parsed.limitations,
|
|
210
|
+
...(entitlementValue.omittedPrototypeKeys === 0
|
|
211
|
+
? []
|
|
212
|
+
: [
|
|
213
|
+
`Entitlements: ${omittedPrototypeKeysLimitation(entitlementValue.omittedPrototypeKeys)}`,
|
|
214
|
+
]),
|
|
215
|
+
];
|
|
236
216
|
const mixedSigning = !unsigned &&
|
|
237
217
|
(isNonzeroUnsignedObservation(requirements.value) ||
|
|
238
218
|
isNonzeroUnsignedObservation(entitlements.value));
|
|
239
219
|
if (mixedSigning) {
|
|
240
|
-
const slices = await this.#inspectMixedSignatureSlices(
|
|
220
|
+
const slices = await this.#inspectMixedSignatureSlices(parsed.format, requirements.value.exitCode !== 0, entitlements.value.exitCode !== 0, signal);
|
|
241
221
|
if (!slices.ok)
|
|
242
222
|
return slices;
|
|
243
223
|
captures.push(...slices.value.captures);
|
|
@@ -247,7 +227,7 @@ class NativeMacOSClient {
|
|
|
247
227
|
const result = inspectSignatureSchema.parse({
|
|
248
228
|
...parsed,
|
|
249
229
|
designated_requirement: requirementText,
|
|
250
|
-
entitlements: entitlementValue,
|
|
230
|
+
entitlements: entitlementValue.value,
|
|
251
231
|
provenance,
|
|
252
232
|
limitations,
|
|
253
233
|
});
|
|
@@ -258,11 +238,11 @@ class NativeMacOSClient {
|
|
|
258
238
|
locations: [],
|
|
259
239
|
});
|
|
260
240
|
}
|
|
261
|
-
async #inspectMixedSignatureSlices(
|
|
241
|
+
async #inspectMixedSignatureSlices(format, requirementsUnavailable, entitlementsUnavailable, signal) {
|
|
262
242
|
const captures = [];
|
|
263
243
|
const unsigned = [];
|
|
264
244
|
const unclassified = [];
|
|
265
|
-
for (const architecture of codeSignArchitectures(
|
|
245
|
+
for (const architecture of codeSignArchitectures(format, this.target)) {
|
|
266
246
|
const slice = await this.#run("inspect_signature", "codesign", ["-d", "-a", architecture, "--verbose=4", this.target.path], { signal, acceptNonZero: true });
|
|
267
247
|
if (!slice.ok)
|
|
268
248
|
return slice;
|
|
@@ -294,31 +274,55 @@ class NativeMacOSClient {
|
|
|
294
274
|
const plist = await resolvePlistPath(this.target, requested);
|
|
295
275
|
if (!plist.ok)
|
|
296
276
|
return plist;
|
|
277
|
+
const selected = await requireRegularPlist(plist.value, requested);
|
|
278
|
+
if (!selected.ok)
|
|
279
|
+
return selected;
|
|
297
280
|
const classified = await this.#run("inspect_plist", "file", ["-b", plist.value], { signal });
|
|
298
281
|
if (!classified.ok)
|
|
299
282
|
return classified;
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
302
|
-
return
|
|
303
|
-
|
|
283
|
+
const json = await this.#run("inspect_plist", "plutil", ["-convert", "json", "-o", "-", "--", plist.value], { signal, acceptNonZero: true });
|
|
284
|
+
if (!json.ok)
|
|
285
|
+
return json;
|
|
286
|
+
// JSON cannot express data, dates, or non-finite reals; plutil rejects
|
|
287
|
+
// such plists, so decode its lossless XML conversion instead. JSON also
|
|
288
|
+
// prints an integral <real> like an <integer>, so a number beyond the
|
|
289
|
+
// exact JSON range takes its element type from the XML conversion.
|
|
290
|
+
const jsonDecoded = json.value.exitCode === 0;
|
|
291
|
+
const xml = jsonDecoded && !plistJsonNeedsNumberTypes(json.value.stdout)
|
|
292
|
+
? undefined
|
|
293
|
+
: await this.#run("inspect_plist", "plutil", ["-convert", "xml1", "-o", "-", "--", plist.value], { signal, acceptNonZero: !jsonDecoded });
|
|
294
|
+
if (xml !== undefined && !xml.ok)
|
|
295
|
+
return xml;
|
|
296
|
+
if (xml !== undefined && xml.value.exitCode !== 0)
|
|
297
|
+
return err(unreadablePlist(plist.value, requested, `plutil could not decode it as a property list (${plutilDiagnostic(xml.value.stderr, plist.value)})`));
|
|
298
|
+
const parsed = xml === undefined
|
|
299
|
+
? parsePlistJson(json.value.stdout)
|
|
300
|
+
: jsonDecoded
|
|
301
|
+
? parsePlistJson(json.value.stdout, xml.value.stdout)
|
|
302
|
+
: parsePlistXml(xml.value.stdout);
|
|
304
303
|
if (!parsed.ok)
|
|
305
304
|
return parsed;
|
|
306
|
-
const provenance = [
|
|
305
|
+
const provenance = [
|
|
306
|
+
classified.value,
|
|
307
|
+
json.value,
|
|
308
|
+
...(xml === undefined ? [] : [xml.value]),
|
|
309
|
+
].map((item) => invocation(item, plist.value, "$PLIST"));
|
|
307
310
|
const result = inspectPlistSchema.parse({
|
|
308
311
|
format: /binary property list/iu.test(classified.value.stdout)
|
|
309
312
|
? "binary"
|
|
310
313
|
: /XML|text/iu.test(classified.value.stdout)
|
|
311
314
|
? "xml"
|
|
312
315
|
: "unknown",
|
|
313
|
-
|
|
316
|
+
value: parsed.value.value,
|
|
317
|
+
bundle: parsed.value.bundle,
|
|
314
318
|
source_path: plist.value,
|
|
315
319
|
provenance,
|
|
316
|
-
limitations:
|
|
320
|
+
limitations: parsed.value.limitations,
|
|
317
321
|
});
|
|
318
322
|
return ok({
|
|
319
323
|
result: jsonValueSchema.parse(result),
|
|
320
324
|
provenance,
|
|
321
|
-
limitations:
|
|
325
|
+
limitations: parsed.value.limitations,
|
|
322
326
|
locations: [{ kind: "artifact-path", path: plist.value }],
|
|
323
327
|
});
|
|
324
328
|
}
|
|
@@ -354,15 +358,26 @@ const translateCommandFailure = (operation, failure) => {
|
|
|
354
358
|
};
|
|
355
359
|
const translateCodeSignExitFailure = (capture) => translateCommandFailure("inspect_signature", new NativeCommandFailure("codesign", "nonzero-exit", capture.exitCode));
|
|
356
360
|
const commandOutput = (capture) => `${capture.stdout}\n${capture.stderr}`;
|
|
357
|
-
|
|
361
|
+
/**
|
|
362
|
+
* A signed artifact exits zero; its diagnostics can still contain this text
|
|
363
|
+
* through the echoed path or identifier.
|
|
364
|
+
*/
|
|
358
365
|
const isNonzeroUnsignedObservation = (capture) => capture.exitCode !== null &&
|
|
359
366
|
capture.exitCode !== 0 &&
|
|
360
|
-
|
|
367
|
+
/not signed at all|code object is not signed/iu.test(commandOutput(capture));
|
|
368
|
+
const canonicalPath = async (path) => {
|
|
369
|
+
try {
|
|
370
|
+
return [await realpath(path)];
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
return [];
|
|
374
|
+
}
|
|
375
|
+
};
|
|
361
376
|
const codeSignCaptureFailure = (capture) => capture.exitCode === 0 || isNonzeroUnsignedObservation(capture)
|
|
362
377
|
? null
|
|
363
378
|
: translateCodeSignExitFailure(capture);
|
|
364
|
-
const codeSignArchitectures = (
|
|
365
|
-
const universal = /^
|
|
379
|
+
const codeSignArchitectures = (format, target) => {
|
|
380
|
+
const universal = /^Mach-O universal \(([^)\r\n]+)\)$/u.exec(format ?? "")?.[1];
|
|
366
381
|
if (universal !== undefined) {
|
|
367
382
|
const architectures = universal
|
|
368
383
|
.split(/\s+/u)
|
|
@@ -391,8 +406,51 @@ const parseEntitlements = (output) => {
|
|
|
391
406
|
const start = output.indexOf("<?xml");
|
|
392
407
|
const end = output.lastIndexOf("</plist>");
|
|
393
408
|
if (start < 0 || end < start)
|
|
394
|
-
return null;
|
|
395
|
-
|
|
409
|
+
return { value: null, omittedPrototypeKeys: 0 };
|
|
410
|
+
const { value, omittedPrototypeKeys } = parseXmlPropertyList(output.slice(start, end + "</plist>".length));
|
|
411
|
+
return { value: jsonValueSchema.parse(value), omittedPrototypeKeys };
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Report a plist that cannot be decoded as the caller's selection, or as the
|
|
415
|
+
* target's missing default, rather than as a failed tool run.
|
|
416
|
+
*/
|
|
417
|
+
const unreadablePlist = (path, requested, reason) => {
|
|
418
|
+
const sentence = reason.endsWith(".") ? reason : `${reason}.`;
|
|
419
|
+
return requested === undefined
|
|
420
|
+
? new AnalysisCapabilityUnavailableError(IDENTITY.id, "inspect_plist", `The target has no readable Contents/Info.plist at ${path}: ${sentence} Pass path to inspect another plist.`)
|
|
421
|
+
: new AnalysisInputError("inspect_plist", undefined, [
|
|
422
|
+
{
|
|
423
|
+
path: ["path"],
|
|
424
|
+
reason: "invalid_value",
|
|
425
|
+
message: `Cannot inspect ${path}: ${sentence}`,
|
|
426
|
+
},
|
|
427
|
+
]);
|
|
428
|
+
};
|
|
429
|
+
/** plutil prefixes its diagnostic with the path the message already names. */
|
|
430
|
+
const plutilDiagnostic = (stderr, path) => {
|
|
431
|
+
const text = stderr.trim();
|
|
432
|
+
return text.startsWith(`${path}: `) ? text.slice(path.length + 2) : text;
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Admit a readable regular file before plutil runs, so a later plutil failure
|
|
436
|
+
* reflects the bytes rather than a missing path or a host permission denial.
|
|
437
|
+
*/
|
|
438
|
+
const requireRegularPlist = async (path, requested) => {
|
|
439
|
+
try {
|
|
440
|
+
if (!(await stat(path)).isFile())
|
|
441
|
+
return err(unreadablePlist(path, requested, "it is not a regular file"));
|
|
442
|
+
// Opening also observes ACL and macOS privacy denials that stat permits.
|
|
443
|
+
await (await open(path, "r")).close();
|
|
444
|
+
return ok(null);
|
|
445
|
+
}
|
|
446
|
+
catch (cause) {
|
|
447
|
+
const code = cause instanceof Error && "code" in cause ? cause.code : undefined;
|
|
448
|
+
if (code === "ENOENT" || code === "ENOTDIR")
|
|
449
|
+
return err(unreadablePlist(path, requested, "no file exists there"));
|
|
450
|
+
if (code === "EACCES" || code === "EPERM")
|
|
451
|
+
return err(new BinaryTargetError(path, `permission denied while reading plist (${code})`, { cause }));
|
|
452
|
+
return err(new ProviderAdapterError(IDENTITY.id, "inspect_plist", { cause }));
|
|
453
|
+
}
|
|
396
454
|
};
|
|
397
455
|
const resolvePlistPath = async (target, requested) => {
|
|
398
456
|
try {
|
|
@@ -401,9 +459,11 @@ const resolvePlistPath = async (target, requested) => {
|
|
|
401
459
|
return ok(resolve(requested));
|
|
402
460
|
const sourceMetadata = await stat(source);
|
|
403
461
|
const root = sourceMetadata.isDirectory() ? source : dirname(target.path);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
462
|
+
if (requested !== undefined)
|
|
463
|
+
return ok(resolve(root, requested));
|
|
464
|
+
// A bundle target records the Info.plist its program file was declared
|
|
465
|
+
// in: Contents/Info.plist, or the root plist of an iOS-style bundle.
|
|
466
|
+
return ok(target.bundleInfoPlist ?? resolve(root, "Contents/Info.plist"));
|
|
407
467
|
}
|
|
408
468
|
catch (cause) {
|
|
409
469
|
return err(new ProviderAdapterError(IDENTITY.id, "inspect_plist", { cause }));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { NATIVE_TOOL_CONTRACTS } from "../contracts/native/nativeToolContracts.js";
|
|
2
|
+
/** Public identity committed by macOS-native inspection observations. */
|
|
3
|
+
export const NATIVE_MACOS_PROVIDER_IDENTITY = Object.freeze({
|
|
4
|
+
id: "native-macos",
|
|
5
|
+
name: "macOS native inspection utilities",
|
|
6
|
+
version: null,
|
|
7
|
+
});
|
|
8
|
+
const IDENTITY = NATIVE_MACOS_PROVIDER_IDENTITY;
|
|
9
|
+
/** Declare native host coverage without creating a command runner. */
|
|
10
|
+
export const nativeMacOSCapabilities = (platform = process.platform) => {
|
|
11
|
+
const available = platform === "darwin";
|
|
12
|
+
return Object.freeze([
|
|
13
|
+
...NATIVE_TOOL_CONTRACTS,
|
|
14
|
+
{ name: "inspect_native_dispatch_metadata" },
|
|
15
|
+
].map((contract) => {
|
|
16
|
+
const availability = available
|
|
17
|
+
? { available: true, reason: null }
|
|
18
|
+
: {
|
|
19
|
+
available: false,
|
|
20
|
+
availabilityCode: "unsupported_host",
|
|
21
|
+
reason: "Native macOS utilities require macOS.",
|
|
22
|
+
};
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
provider: IDENTITY,
|
|
25
|
+
operation: contract.name,
|
|
26
|
+
...availability,
|
|
27
|
+
effects: Object.freeze({
|
|
28
|
+
mutatesArtifact: false,
|
|
29
|
+
launchesProcess: contract.name !== "inspect_native_dispatch_metadata",
|
|
30
|
+
mayShowUi: contract.name === "capture_native_ui_scenario",
|
|
31
|
+
mayAccessNetwork: contract.name === "capture_native_ui_scenario",
|
|
32
|
+
mayWriteFilesystem: contract.name === "capture_native_ui_scenario" ||
|
|
33
|
+
contract.name === "observe_native_ui",
|
|
34
|
+
changesPermissions: false,
|
|
35
|
+
requiresRoot: false,
|
|
36
|
+
}),
|
|
37
|
+
limitations: Object.freeze([
|
|
38
|
+
"Availability and textual formats depend on the installed macOS/Xcode toolchain.",
|
|
39
|
+
]),
|
|
40
|
+
});
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { inspectMachoSchema, } from "../domain/nativeInspection.js";
|
|
1
|
+
import { inspectMachoSchema, } from "../domain/native/nativeInspection.js";
|
|
2
2
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
3
3
|
import { err, ok } from "../domain/result.js";
|
|
4
4
|
import { parseDyldSymbols } from "./parsers/dyldInfo.js";
|
|
5
5
|
import { parseLipoArchitectures } from "./parsers/lipo.js";
|
|
6
|
+
import { withoutEchoedPathHeader } from "./parsers/echoedPath.js";
|
|
6
7
|
import { parseOtoolLoadCommands } from "./parsers/otool.js";
|
|
7
8
|
const DISCOVERY_COMMANDS = [
|
|
8
9
|
["file", ["-b"]],
|
|
@@ -53,25 +54,33 @@ export const inspectNativeMacho = async (context) => {
|
|
|
53
54
|
limitations.push(VTOOL_UNAVAILABLE_LIMITATION);
|
|
54
55
|
else
|
|
55
56
|
return err(optional.error);
|
|
56
|
-
const
|
|
57
|
+
const normalized = normalizeMacho(captures, context.invocation, limitations);
|
|
58
|
+
const segmentOffset = segmentContainerOffset(normalized, selectedArchitecture, /^Non-fat file:/mu.test(lipo.stdout));
|
|
59
|
+
const result = segmentOffset === undefined
|
|
60
|
+
? inspectMachoSchema.parse({
|
|
61
|
+
...normalized,
|
|
62
|
+
limitations: [
|
|
63
|
+
...normalized.limitations,
|
|
64
|
+
"Segment evidence file offsets are unavailable because the selected Mach-O slice's container offset was not observed.",
|
|
65
|
+
],
|
|
66
|
+
})
|
|
67
|
+
: normalized;
|
|
57
68
|
return ok({
|
|
58
69
|
result: jsonValueSchema.parse(result),
|
|
59
70
|
provenance: result.provenance,
|
|
60
71
|
limitations: result.limitations,
|
|
61
|
-
locations: fileOffsetLocations(result),
|
|
72
|
+
locations: fileOffsetLocations(result, segmentOffset),
|
|
62
73
|
});
|
|
63
74
|
};
|
|
64
75
|
const normalizeMacho = (captures, toInvocation, additionalLimitations) => {
|
|
65
76
|
const byTool = captureLookup(captures);
|
|
66
77
|
const architectures = parseLipoArchitectures(byTool("lipo").stdout);
|
|
67
|
-
const load = parseOtoolLoadCommands(byTool("otool")
|
|
68
|
-
const imports = parseDyldSymbols(byTool("dyld_info", 0)
|
|
78
|
+
const load = parseOtoolLoadCommands(sliceOutput(byTool("otool")));
|
|
79
|
+
const imports = parseDyldSymbols(sliceOutput(byTool("dyld_info", 0)), "imports");
|
|
69
80
|
const imageBase = load.segments.find((segment) => segment.file_offset === 0 && (segment.file_size ?? 0) > 0)?.vm_address ?? null;
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
...parseNmExports(byTool("nm").stdout),
|
|
74
|
-
]);
|
|
81
|
+
const nmExports = parseNmExports(byTool("nm").stdout);
|
|
82
|
+
const dyldExports = parseDyldSymbols(sliceOutput(byTool("dyld_info", 1)), "exports", imageBase, new Set(nmExports.map(({ name }) => name)));
|
|
83
|
+
const exports = uniqueSymbols([...dyldExports, ...nmExports]);
|
|
75
84
|
const uuid = /UUID:\s*([A-Fa-f0-9-]+)/u.exec(byTool("dwarfdump").stdout)?.[1] ??
|
|
76
85
|
load.uuid;
|
|
77
86
|
const provenance = captures.map(toInvocation);
|
|
@@ -90,7 +99,7 @@ const normalizeMacho = (captures, toInvocation, additionalLimitations) => {
|
|
|
90
99
|
...additionalLimitations,
|
|
91
100
|
...(threadEntrypoint ? [threadEntrypointLimitation] : []),
|
|
92
101
|
...(imageBase === null &&
|
|
93
|
-
/^\s*offset\s+symbol\s*$/mu.test(byTool("dyld_info", 1)
|
|
102
|
+
/^\s*offset\s+symbol\s*$/mu.test(sliceOutput(byTool("dyld_info", 1)))
|
|
94
103
|
? [
|
|
95
104
|
"Export virtual addresses are unavailable because no file-backed image base was observed.",
|
|
96
105
|
]
|
|
@@ -122,6 +131,8 @@ const normalizeMacho = (captures, toInvocation, additionalLimitations) => {
|
|
|
122
131
|
limitations,
|
|
123
132
|
});
|
|
124
133
|
};
|
|
134
|
+
/** Slice output without the echoed operand path, which can contain any text. */
|
|
135
|
+
const sliceOutput = (capture) => withoutEchoedPathHeader(capture.stdout, capture.arguments.at(-1));
|
|
125
136
|
const captureLookup = (captures) => (tool, occurrence = 0) => {
|
|
126
137
|
const capture = captures.filter((item) => item.tool === tool)[occurrence];
|
|
127
138
|
if (capture === undefined)
|
|
@@ -157,19 +168,39 @@ const uniqueSymbols = (items) => {
|
|
|
157
168
|
unique.set(item.name, item);
|
|
158
169
|
return [...unique.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
159
170
|
};
|
|
160
|
-
const fileOffsetLocations = (macho) => {
|
|
171
|
+
const fileOffsetLocations = (macho, segmentOffset) => {
|
|
161
172
|
const locations = architectureLocations(macho.architectures.items);
|
|
173
|
+
if (segmentOffset === undefined)
|
|
174
|
+
return locations;
|
|
162
175
|
for (const segment of macho.segments.items) {
|
|
163
176
|
if (segment.file_offset === null || segment.file_size === null)
|
|
164
177
|
continue;
|
|
165
178
|
locations.push({
|
|
166
179
|
kind: "file-offset-range",
|
|
167
|
-
start: segment.file_offset,
|
|
168
|
-
end: segment.file_offset + segment.file_size,
|
|
180
|
+
start: segmentOffset + segment.file_offset,
|
|
181
|
+
end: segmentOffset + segment.file_offset + segment.file_size,
|
|
169
182
|
});
|
|
170
183
|
}
|
|
171
184
|
return locations;
|
|
172
185
|
};
|
|
186
|
+
/** otool segment offsets are slice-relative; evidence addresses the input file. */
|
|
187
|
+
const segmentContainerOffset = (macho, selectedArchitecture, thinInput) => {
|
|
188
|
+
const architectures = macho.architectures.items;
|
|
189
|
+
const slice = selectedArchitecture === null
|
|
190
|
+
? architectures.length === 1
|
|
191
|
+
? architectures[0]
|
|
192
|
+
: undefined
|
|
193
|
+
: architectures.find(({ name }) => name === selectedArchitecture);
|
|
194
|
+
if (slice?.file_offset !== null && slice?.file_offset !== undefined)
|
|
195
|
+
return slice.file_offset;
|
|
196
|
+
// A thin lipo observation has no separate slice offset. Unknown FAT slice
|
|
197
|
+
// offsets must not silently become zero and identify unrelated container bytes.
|
|
198
|
+
return thinInput &&
|
|
199
|
+
selectedArchitecture === null &&
|
|
200
|
+
architectures.length === 1
|
|
201
|
+
? 0
|
|
202
|
+
: undefined;
|
|
203
|
+
};
|
|
173
204
|
/** Project architecture slices into evidence file-offset locations. */
|
|
174
205
|
export const architectureLocations = (architectures) => {
|
|
175
206
|
const locations = [];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { mkdtemp, rm } from "node:fs/promises";
|
|
1
|
+
import { mkdtemp, rm, symlink } from "node:fs/promises";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { execFileOutput } from "../process/ExecFileOutput.js";
|
|
6
6
|
import { safeParseJson } from "../domain/safeJson.js";
|
|
7
|
+
import { NATIVE_UI_HELPER_MAX_BUFFER } from "./NativeUiOutputBudget.js";
|
|
7
8
|
/** Lazily compile one owned helper per observation/scenario and remove its compiler cache. */
|
|
8
9
|
export const createNativeUiHelperRuntime = () => {
|
|
9
10
|
let root;
|
|
@@ -12,11 +13,14 @@ export const createNativeUiHelperRuntime = () => {
|
|
|
12
13
|
if (executable === undefined) {
|
|
13
14
|
root = await mkdtemp(join(tmpdir(), "rea-native-ui-"));
|
|
14
15
|
const output = join(root, "observer");
|
|
16
|
+
const main = join(root, "main.swift");
|
|
17
|
+
await symlink(fileURLToPath(new URL("../../bridge/native/ReaNativeUI.swift", import.meta.url)), main);
|
|
15
18
|
await execFileOutput("/usr/bin/xcrun", [
|
|
16
19
|
"swiftc",
|
|
17
20
|
"-module-cache-path",
|
|
18
21
|
join(root, "modules"),
|
|
19
|
-
fileURLToPath(new URL("../../bridge/native/
|
|
22
|
+
fileURLToPath(new URL("../../bridge/native/NativeUIChildren.swift", import.meta.url)),
|
|
23
|
+
main,
|
|
20
24
|
"-o",
|
|
21
25
|
output,
|
|
22
26
|
], {
|
|
@@ -28,7 +32,7 @@ export const createNativeUiHelperRuntime = () => {
|
|
|
28
32
|
}
|
|
29
33
|
const output = await execFileOutput(executable, [JSON.stringify(parameters)], {
|
|
30
34
|
timeout: 30_000,
|
|
31
|
-
maxBuffer:
|
|
35
|
+
maxBuffer: NATIVE_UI_HELPER_MAX_BUFFER,
|
|
32
36
|
...(signal === undefined ? {} : { signal }),
|
|
33
37
|
});
|
|
34
38
|
const parsed = safeParseJson(output.stdout);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { nativeUiObservationInputSchema, nativeUiScenarioInputSchema, nativeUiSnapshotSchema, nativeUiResultSchema, } from "../domain/nativeUiObservation.js";
|
|
3
|
+
import { nativeUiObservationInputSchema, nativeUiScenarioInputSchema, nativeUiSnapshotSchema, nativeUiResultSchema, } from "../domain/native/nativeUiObservation.js";
|
|
4
4
|
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisInputError, } from "../domain/analysisErrorCore.js";
|
|
5
5
|
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
6
6
|
import {} from "../domain/analysisErrorBase.js";
|
|
7
7
|
import { err, ok } from "../domain/result.js";
|
|
8
8
|
import { createNativeUiHelperRuntime } from "./NativeUiHelperRuntime.js";
|
|
9
|
+
import { NATIVE_UI_OUTPUT_BUDGET_BYTES, NATIVE_UI_OUTPUT_WEIGHT, } from "./NativeUiOutputBudget.js";
|
|
9
10
|
const helper = fileURLToPath(new URL("../../bridge/native/ReaNativeUI.swift", import.meta.url));
|
|
10
11
|
const responseSchema = z.discriminatedUnion("ok", [
|
|
11
12
|
z.strictObject({ ok: z.literal(true), result: nativeUiSnapshotSchema }),
|
|
@@ -74,8 +75,10 @@ const observeWithHelper = async (target, operation, parameters, options) => {
|
|
|
74
75
|
response.result.window.launch_time !== launchTime))
|
|
75
76
|
return err(new AnalysisCapabilityUnavailableError("native-macos", operation, "Native helper returned a different target process or window"));
|
|
76
77
|
launchTime = response.result.window.launch_time;
|
|
77
|
-
outputBytes +=
|
|
78
|
-
|
|
78
|
+
outputBytes +=
|
|
79
|
+
NATIVE_UI_OUTPUT_WEIGHT *
|
|
80
|
+
Buffer.byteLength(JSON.stringify(response.result));
|
|
81
|
+
if (outputBytes > NATIVE_UI_OUTPUT_BUDGET_BYTES)
|
|
79
82
|
return err(new AnalysisCapabilityUnavailableError("native-macos", operation, "Scenario captures exceeded the 64 MiB output budget"));
|
|
80
83
|
return ok(response.result);
|
|
81
84
|
}
|
|
@@ -86,7 +89,8 @@ const observeWithHelper = async (target, operation, parameters, options) => {
|
|
|
86
89
|
cause,
|
|
87
90
|
diagnostics: {
|
|
88
91
|
helper_path: helper,
|
|
89
|
-
reason:
|
|
92
|
+
reason: cause instanceof Error ? cause.message : String(cause),
|
|
93
|
+
remediation: "Native helper failed, timed out, or returned malformed capture data; install compatible Xcode command-line tools and inspect local OS permissions",
|
|
90
94
|
},
|
|
91
95
|
}));
|
|
92
96
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const HELPER_SUCCESS_WRAPPER = Buffer.from(JSON.stringify({ ok: true, result: {} }));
|
|
2
|
+
/** Scenario output is charged at twice the encoded result size before return. */
|
|
3
|
+
export const NATIVE_UI_OUTPUT_BUDGET_BYTES = 64 * 1024 * 1024;
|
|
4
|
+
export const NATIVE_UI_OUTPUT_WEIGHT = 2;
|
|
5
|
+
/** Bytes added around a result by the helper's success JSON response. */
|
|
6
|
+
export const NATIVE_UI_HELPER_ENVELOPE_BYTES = HELPER_SUCCESS_WRAPPER.byteLength - Buffer.byteLength("{}");
|
|
7
|
+
/** Raw helper output is bounded by the scenario's existing unweighted byte budget. */
|
|
8
|
+
export const NATIVE_UI_HELPER_MAX_BUFFER = NATIVE_UI_OUTPUT_BUDGET_BYTES + NATIVE_UI_HELPER_ENVELOPE_BYTES;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { inspectSignatureSchema, } from "../../domain/nativeInspection.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
1
|
+
import { inspectSignatureSchema, } from "../../domain/native/nativeInspection.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parse bounded `codesign -d --verbose=4` diagnostics, which Apple emits on
|
|
4
|
+
* stderr. codesign echoes the executable path and signing identifier
|
|
5
|
+
* verbatim, and an ad hoc identifier derives from the file name, so either
|
|
6
|
+
* can contain line breaks and text that resembles other fields. The path is
|
|
7
|
+
* removed by its exact value from `executablePaths`, and the identifier runs
|
|
8
|
+
* to the `Format=` field that codesign prints after it.
|
|
9
|
+
*/
|
|
10
|
+
export const parseCodeSignature = (output, unsigned, executablePaths = []) => {
|
|
11
|
+
const { identifier, fields } = splitEchoedValues(output.replaceAll("\r\n", "\n"), executablePaths);
|
|
4
12
|
const values = new Map();
|
|
5
13
|
const authorities = [];
|
|
6
14
|
const cdhashes = [];
|
|
7
|
-
for (const line of
|
|
15
|
+
for (const line of fields.split("\n")) {
|
|
8
16
|
if (line.startsWith("CodeDirectory ")) {
|
|
9
17
|
values.set("CodeDirectory", line.slice("CodeDirectory ".length));
|
|
10
18
|
continue;
|
|
@@ -23,7 +31,7 @@ export const parseCodeSignature = (output, unsigned) => {
|
|
|
23
31
|
}
|
|
24
32
|
const parsed = inspectSignatureSchema.omit({ provenance: true }).parse({
|
|
25
33
|
signed: !unsigned,
|
|
26
|
-
identifier:
|
|
34
|
+
identifier: identifier ?? null,
|
|
27
35
|
team_identifier: nullableCodeSignValue(values.get("TeamIdentifier")),
|
|
28
36
|
format: values.get("Format") ?? null,
|
|
29
37
|
cdhashes,
|
|
@@ -41,6 +49,33 @@ export const parseCodeSignature = (output, unsigned) => {
|
|
|
41
49
|
});
|
|
42
50
|
return parsed;
|
|
43
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Separate the echoed executable path and signing identifier, which codesign
|
|
54
|
+
* prints first, from the fields that follow them.
|
|
55
|
+
*/
|
|
56
|
+
const splitEchoedValues = (text, executablePaths) => {
|
|
57
|
+
const executable = executablePaths
|
|
58
|
+
.map((path) => `Executable=${path}\n`)
|
|
59
|
+
.find((line) => text.startsWith(line));
|
|
60
|
+
let rest = text;
|
|
61
|
+
if (executable !== undefined)
|
|
62
|
+
rest = text.slice(executable.length);
|
|
63
|
+
else if (text.startsWith("Executable=")) {
|
|
64
|
+
const identifierLine = text.indexOf("\nIdentifier=");
|
|
65
|
+
rest = identifierLine < 0 ? text : text.slice(identifierLine + 1);
|
|
66
|
+
}
|
|
67
|
+
if (!rest.startsWith("Identifier="))
|
|
68
|
+
return { identifier: undefined, fields: rest };
|
|
69
|
+
// Later fields come from the signature itself, so the last `Format=` line
|
|
70
|
+
// is the one codesign printed after the identifier.
|
|
71
|
+
const format = rest.lastIndexOf("\nFormat=");
|
|
72
|
+
const lineEnd = rest.indexOf("\n");
|
|
73
|
+
const end = format >= 0 ? format : lineEnd >= 0 ? lineEnd : rest.length;
|
|
74
|
+
return {
|
|
75
|
+
identifier: rest.slice("Identifier=".length, end),
|
|
76
|
+
fields: rest.slice(end),
|
|
77
|
+
};
|
|
78
|
+
};
|
|
44
79
|
const nullableCodeSignValue = (value) => value === undefined || value === "not set" ? null : value;
|
|
45
80
|
const splitAlgorithms = (value) => value === undefined
|
|
46
81
|
? []
|
|
@@ -4,9 +4,13 @@ const resultSchema = z.object({
|
|
|
4
4
|
output: z.string(),
|
|
5
5
|
status: z.enum(["demangled", "unchanged", "invalid"]),
|
|
6
6
|
});
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Preserve input ordering while parsing `swift-demangle --compact` lines.
|
|
9
|
+
* The demangler ends each record with LF, so a carriage return belongs to the
|
|
10
|
+
* symbol text.
|
|
11
|
+
*/
|
|
8
12
|
export const parseDemangledSymbols = (inputs, output) => {
|
|
9
|
-
const lines = output.replace(/\
|
|
13
|
+
const lines = output.replace(/\n$/u, "").split("\n");
|
|
10
14
|
if (lines.length !== inputs.length)
|
|
11
15
|
throw new TypeError("swift-demangle output count does not match input");
|
|
12
16
|
return inputs.map((input, index) => {
|