rea-agents 6.1.0 → 6.2.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 +7 -5
- package/bridge/ghidra/ReaGhidraBridge.java +32 -4
- package/bridge/hopper_bridge.py +6 -1
- package/dist/android/JadxConfiguration.js +87 -7
- package/dist/android/JadxMcpTransport.js +14 -2
- package/dist/android/JadxProvider.js +57 -35
- package/dist/application/BinaryTargetResolver.js +5 -3
- package/dist/application/BrowserEvidence.js +3 -8
- package/dist/application/BrowserScenarioEvidence.js +2 -18
- package/dist/application/CapabilityInventory.js +43 -9
- package/dist/application/ClientConfigurationDocument.js +69 -25
- package/dist/application/DirectAnalysis.js +29 -14
- package/dist/application/DirectAnalysisCleanup.js +72 -0
- package/dist/application/DirectAnalysisStatus.js +4 -5
- package/dist/application/Doctor.js +15 -19
- package/dist/application/DoctorDiagnostics.js +1 -2
- package/dist/application/EnhancedTools.js +51 -6
- package/dist/application/EvidenceBundleFiles.js +8 -3
- package/dist/application/InvestigationProviders.js +9 -1
- package/dist/application/JsonFiles.js +42 -9
- package/dist/application/LinuxHopper.js +9 -6
- package/dist/application/MacHopper.js +15 -18
- package/dist/application/RealHopperAssertions.js +0 -11
- package/dist/application/ReconstructionObligationCandidates.js +1 -1
- package/dist/application/ReferenceSourceImportEntries.js +1 -1
- package/dist/application/Setup.js +8 -16
- package/dist/application/SetupHost.js +16 -27
- package/dist/application/SetupPlan.js +6 -6
- package/dist/application/Uninstall.js +81 -29
- package/dist/application/UpdateMaintenance.js +7 -5
- package/dist/application/UpdateRuntime.js +12 -12
- package/dist/application/WebScriptExportService.js +30 -4
- package/dist/application/WorkflowEvidence.js +25 -2
- package/dist/application/XrefsAddressResolution.js +45 -0
- package/dist/application/analysisView/AnalysisViewService.js +76 -0
- package/dist/application/binary/AnalysisClientCleanup.js +30 -5
- package/dist/application/binary/AnalysisProviderEvaluation.js +1 -2
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -6
- package/dist/application/binary/AnalysisSnapshotCache.js +10 -8
- package/dist/application/binary/BinarySession.js +70 -29
- package/dist/application/binary/BinarySessionComposition.js +1 -3
- package/dist/application/binary/BinarySessionExecution.js +3 -5
- package/dist/application/binary/BinarySessionOpen.js +1 -1
- package/dist/application/binary/BinarySessionRecords.js +1 -1
- package/dist/application/binary/BinarySessionStatus.js +1 -6
- package/dist/application/binary/CompositeProvider.js +4 -18
- package/dist/application/binary/LazyAnalysisProvider.js +5 -5
- package/dist/application/binary/SessionProviderRouter.js +27 -135
- package/dist/application/homebrew.js +48 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +9 -13
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +2 -6
- package/dist/application/javascript/JavaScriptApplicationService.js +6 -1
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +5 -3
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +11 -9
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +11 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +9 -0
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +8 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +12 -3
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +43 -16
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +46 -6
- package/dist/application/javascript/JavaScriptModuleRelationships.js +1 -1
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -2
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +1 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +75 -46
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +42 -19
- package/dist/application/managed/ManagedMemberComparisonService.js +2 -1
- package/dist/application/managed/ManagedNativeVerificationService.js +2 -1
- package/dist/application/process/ProcessCli.js +11 -11
- package/dist/application/process/ProcessEvidence.js +0 -1
- package/dist/artifacts/ArtifactProvider.js +39 -14
- package/dist/artifacts/ArtifactReader.js +31 -0
- package/dist/artifacts/DirectoryArtifactReader.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +9 -2
- package/dist/artifacts/NativeDmgArtifactReader.js +65 -20
- package/dist/artifacts/SafeOutputTree.js +16 -2
- package/dist/artifacts/ZipArtifactReader.js +11 -4
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +4 -2
- package/dist/artifacts/apple/DylibResolutionReader.js +17 -7
- package/dist/artifacts/apple/KeyedArchiveReader.js +21 -3
- package/dist/artifacts/extraction/ArtifactExtraction.js +78 -21
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +67 -61
- package/dist/artifacts/inventory/ArtifactInventory.js +0 -1
- package/dist/artifacts/inventory/reader.js +3 -3
- package/dist/artifacts/inventory/scanCanonical.js +48 -24
- package/dist/artifacts/inventory/scanReader.js +5 -9
- package/dist/browser/BrowserScenarioPartialObservation.js +106 -0
- package/dist/browser/CdpBrowserProvider.js +2 -3
- package/dist/browser/CdpCaptureEventHandlers.js +2 -4
- package/dist/browser/CdpCaptureEvents.js +0 -1
- package/dist/browser/CdpCaptureValues.js +20 -0
- package/dist/browser/CdpElectronProvider.js +0 -2
- package/dist/browser/CdpElectronScriptEvents.js +2 -8
- package/dist/browser/CdpElectronScripts.js +2 -3
- package/dist/browser/CdpPageCaptureScripts.js +2 -3
- package/dist/browser/CdpSafeMetadata.js +10 -10
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +59 -44
- package/dist/browser/PlaywrightElectronActiveActions.js +2 -56
- package/dist/browser/PlaywrightElectronActiveProvider.js +10 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +1 -1
- package/dist/browser/PlaywrightScenarioBrowser.js +139 -39
- package/dist/browser/PlaywrightScenarioEvents.js +1 -1
- package/dist/browser/PlaywrightScenarioSession.js +39 -22
- package/dist/browser/assets/ScriptCaptureAdapters.js +1 -1
- package/dist/browser/history/CaptureFailures.js +6 -2
- package/dist/browser/history/MitmproxyCaptureAdapter.js +4 -2
- package/dist/catalogIdentity.js +0 -1
- package/dist/cli/analysisViewCommands.js +36 -0
- package/dist/cli/artifactCommands.js +11 -12
- package/dist/cli/coreAnalysisCommands.js +3 -3
- package/dist/cli/coreBinaryCommands.js +32 -27
- package/dist/cli/coreNativeCommands.js +9 -10
- package/dist/cli/electronCommands.js +4 -4
- package/dist/cli/interactiveSetup.js +6 -6
- package/dist/cli/managedCommands.js +7 -8
- package/dist/cli/nativeCallCommands.js +1 -2
- package/dist/cli/omittableDefaults.js +50 -0
- package/dist/cli/processCommands.js +3 -2
- package/dist/cli/setupCommands.js +16 -15
- package/dist/cli/utilityCommands.js +9 -9
- package/dist/cli.js +16 -8
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +1 -0
- package/dist/cliJsonInput.js +15 -1
- package/dist/cliOutput.js +0 -38
- package/dist/composition/auxiliaryAnalysisProviders.js +27 -23
- package/dist/composition/binary.js +9 -9
- package/dist/composition/browserScenario.js +2 -1
- package/dist/composition/directAnalysis.js +20 -13
- package/dist/composition/electronScenario.js +1 -1
- package/dist/composition/optionalObservationProviders.js +12 -7
- package/dist/config/environment.js +6 -0
- package/dist/config/ghidraStartupTimeout.js +4 -9
- package/dist/config/homeDirectory.js +12 -0
- package/dist/config/mcpResponseBudget.js +9 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/config/parsers.js +19 -22
- package/dist/contracts/analysisViewToolContracts.js +56 -0
- package/dist/contracts/applicationToolContracts.js +5 -4
- package/dist/contracts/artifactComparisonExample.js +2 -2
- package/dist/contracts/artifactToolContracts.js +1 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +19 -15
- package/dist/contracts/enhancedInputs.js +2 -2
- package/dist/contracts/enhancedToolContracts.js +4 -3
- package/dist/contracts/evm/evmToolContracts.js +1 -1
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +90 -0
- package/dist/contracts/investigationExamples.js +4 -3
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +0 -20
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +245 -0
- package/dist/contracts/javascript/javascriptRuntimeObservationToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +5 -10
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +3 -3
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +1 -1
- package/dist/contracts/native/nativeToolContracts.js +2 -2
- package/dist/contracts/officialToolContracts.js +2 -1
- package/dist/contracts/promptContracts.js +2 -2
- package/dist/contracts/providerSelection.js +1 -1
- package/dist/contracts/sessionToolContracts.js +14 -2
- package/dist/contracts/sessionToolSchemas.js +1 -14
- package/dist/contracts/toolContracts.js +2 -0
- package/dist/contracts/toolEffects.js +1 -0
- package/dist/contracts/toolOutputSchemaGroups.js +136 -92
- package/dist/contracts/toolOutputSchemaPrimitives.js +11 -21
- package/dist/contracts/toolSchemaMetadata.js +18 -69
- package/dist/contracts/webNetworkCaptureToolContracts.js +1 -1
- package/dist/contracts/webRuntimeToolContracts.js +1 -1
- package/dist/contracts/webScriptToolContracts.js +1 -1
- package/dist/doctorRuntime.js +7 -5
- package/dist/domain/analysisErrorCore.js +3 -0
- package/dist/domain/analysisErrorPresentation.js +18 -3
- package/dist/domain/analysisErrorProjection.js +24 -5
- package/dist/domain/analysisSnapshot.js +29 -31
- package/dist/domain/analysisView/analysisView.js +243 -0
- package/dist/domain/analysisView/analysisViewCoverage.js +19 -0
- package/dist/domain/analysisView/binaryLayoutView.js +159 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +238 -0
- package/dist/domain/android/androidApplication.js +1 -1
- package/dist/domain/apple/appleApplication.js +1 -1
- package/dist/domain/apple/dylibResolution.js +10 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +0 -1
- package/dist/domain/apple/keyedArchive.js +26 -2
- package/dist/domain/artifactComparison.js +15 -6
- package/dist/domain/artifactGraph.js +16 -3
- package/dist/domain/artifactInventoryEvidence.js +9 -16
- package/dist/domain/artifactOperationError.js +3 -3
- package/dist/domain/artifactPartialObservation.js +1 -0
- package/dist/domain/artifactPathSyntax.js +49 -0
- package/dist/domain/binaryTarget.js +39 -13
- package/dist/domain/browserCaptureComparison.js +13 -49
- package/dist/domain/browserNetworkEvidence.js +10 -4
- package/dist/domain/browserObservation.js +0 -1
- package/dist/domain/browserObservationSchemas.js +14 -3
- package/dist/domain/browserScenario.js +0 -1
- package/dist/domain/browserScenarioCapture.js +1 -2
- package/dist/domain/browserScenarioDiff.js +0 -2
- package/dist/domain/browserScenarioDiffEvidence.js +0 -12
- package/dist/domain/browserScenarioDiffValues.js +2 -2
- package/dist/domain/browserScenarioValues.js +3 -4
- package/dist/domain/callPath.js +8 -9
- package/dist/domain/callPathSchemas.js +2 -2
- package/dist/domain/changedBehavior.js +3 -3
- package/dist/domain/completionLedgerGeneration.js +2 -1
- package/dist/domain/configurationErrors.js +12 -0
- package/dist/domain/conformancePackage.js +4 -3
- package/dist/domain/evidence.js +10 -36
- package/dist/domain/evidenceBundle.js +7 -9
- package/dist/domain/evidenceCompletionLedger.js +2 -1
- package/dist/domain/functionComparison.js +4 -5
- package/dist/domain/functionComparisonDimensions.js +120 -87
- package/dist/domain/functionComparisonNormalization.js +23 -34
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/functionComparisonSchemas.js +2 -8
- package/dist/domain/functionDossierEvidence.js +2 -37
- package/dist/domain/javascript/electronActiveObservation.js +26 -69
- package/dist/domain/javascript/electronObservation.js +14 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +10 -9
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +2 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +2 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +26 -3
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +9 -2
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +5 -2
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +2 -1
- package/dist/{application/javascript/JavaScriptReturnShapeProjection.js → domain/javascript/javascriptExportReturnShapeProjection.js} +4 -4
- package/dist/domain/javascript/javascriptExportShapeComparison.js +7 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonIdentity.js +6 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +29 -1
- package/dist/domain/javascript/javascriptExportShapeSelection.js +5 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +67 -14
- package/dist/domain/javascript/javascriptFeatureSeed.js +20 -0
- package/dist/domain/javascript/javascriptFeatureTraversal.js +0 -1
- package/dist/domain/javascript/javascriptNativeHandoff.js +1 -1
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeObservation.js +10 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +1 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +3 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +0 -1
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +9 -3
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +2 -1
- package/dist/domain/javascript/javascriptSemanticCalls.js +2 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +1 -1
- package/dist/domain/javascript/javascriptSemanticGraph.js +88 -46
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +77 -20
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +21 -27
- package/dist/domain/javascript/javascriptSemanticObjects.js +83 -42
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +1 -12
- package/dist/domain/javascript/javascriptSemanticProjection.js +2 -3
- package/dist/domain/javascript/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +1 -1
- package/dist/domain/javascript/javascriptSemanticResources.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReturns.js +32 -17
- package/dist/domain/javascript/javascriptSemanticSlots.js +72 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -54
- package/dist/domain/javascript/javascriptSourceMapPaths.js +104 -0
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +2 -1
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +0 -1
- package/dist/domain/javascript/sourceToBundleComparison.js +12 -3
- package/dist/domain/javascript/sourceToBundleSignals.js +47 -19
- package/dist/domain/localPath.js +1 -1
- package/dist/domain/managed/managedArtifact.js +6 -4
- package/dist/domain/managed/managedMemberComparison.js +2 -9
- package/dist/domain/managed/managedNativeVerification.js +0 -2
- package/dist/domain/managed/managedNativeVerificationMatch.js +9 -3
- package/dist/domain/native/binaryLayout.js +2 -3
- package/dist/domain/native/nativeApiBoundary.js +1 -1
- package/dist/domain/native/nativeCallObservation.js +5 -3
- package/dist/domain/native/nativeInstruction.js +7 -0
- package/dist/domain/native/recordedCrash.js +2 -3
- package/dist/domain/offsetDateTime.js +17 -0
- package/dist/domain/process/processCapture.js +13 -12
- package/dist/domain/process/processCaptureCoverage.js +67 -0
- package/dist/domain/process/processCaptureExample.js +2 -1
- package/dist/domain/process/processCaptureParsing.js +1 -34
- package/dist/domain/process/processCaptureValidation.js +81 -13
- package/dist/domain/process/processComparison.js +41 -22
- package/dist/domain/process/processObservation.js +10 -2
- package/dist/domain/process/processScenario.js +24 -2
- package/dist/domain/process/processTraceComparison.js +0 -2
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +15 -11
- package/dist/domain/process/processTraceSpecification.js +3 -4
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/reconstructionCoverage.js +5 -2
- package/dist/domain/reconstructionObligationLedgerSchemas.js +2 -1
- package/dist/domain/reconstructionReadinessSchemas.js +2 -1
- package/dist/domain/reconstructionVerification.js +3 -3
- package/dist/domain/reconstructionVerificationSchemas.js +2 -1
- package/dist/domain/referenceSourceGraph.js +20 -21
- package/dist/domain/staticRuntimeCorrelation.js +2 -2
- package/dist/domain/stringPatterns.js +6 -0
- package/dist/domain/swiftSymbolClassification.js +61 -0
- package/dist/domain/symbolAnalysis.js +66 -18
- package/dist/domain/webCaptureDiff.js +0 -1
- package/dist/domain/webCaptureDiffSchemas.js +6 -3
- package/dist/domain/webEventListeners.js +3 -2
- package/dist/domain/webExecution.js +3 -2
- package/dist/domain/webRuntime.js +0 -2
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/dotnet/ManagedArtifactInspector.js +2 -19
- package/dist/dotnet/ManagedMemberInspector.js +12 -18
- package/dist/dotnet/ManagedMemberInspectorCore.js +47 -44
- package/dist/dotnet/ManagedMemberRows.js +75 -62
- package/dist/dotnet/ManagedMetadataInventory.js +16 -22
- package/dist/dotnet/ManagedMethodBodyReader.js +4 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +109 -94
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +12 -21
- package/dist/dotnet/ManagedReaderFailure.js +16 -0
- package/dist/dotnet/ManagedStaticProvider.js +3 -5
- package/dist/evaluation/AgentEvaluationFixtures.js +250 -0
- package/dist/evaluation/AgentEvaluationReport.js +28 -0
- package/dist/evaluation/CodexAgentEval.js +12 -8
- package/dist/evaluation/KnownAnswerEvaluation.js +281 -0
- package/dist/evm/EvmoleInterfaceProvider.js +2 -1
- package/dist/firmware/FirmwareCommand.js +9 -5
- package/dist/firmware/FirmwareProvider.js +4 -4
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +3 -6
- package/dist/ghidra/GhidraClient.js +91 -32
- package/dist/ghidra/GhidraClientStartup.js +0 -2
- package/dist/ghidra/GhidraDoctor.js +6 -5
- package/dist/ghidra/GhidraFunctionValues.js +3 -5
- package/dist/ghidra/GhidraInstallation.js +40 -12
- package/dist/ghidra/GhidraJavaLaunch.js +6 -2
- package/dist/ghidra/GhidraLauncher.js +15 -7
- package/dist/ghidra/GhidraProvider.js +6 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +6 -0
- package/dist/ghidra/GhidraProviderClient.js +13 -3
- package/dist/ghidra/GhidraSessionError.js +2 -0
- package/dist/ghidra/GhidraSessionRoot.js +39 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +17 -10
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +8 -2
- package/dist/hopper/BridgeLauncher.js +34 -45
- package/dist/hopper/HopperAnalysisProfile.js +3 -8
- package/dist/hopper/HopperCleanup.js +56 -27
- package/dist/hopper/HopperClient.js +86 -65
- package/dist/hopper/HopperMachOImage.js +3 -2
- package/dist/hopper/HopperProvider.js +16 -18
- package/dist/hopper/HopperRegexSearch.js +3 -6
- package/dist/hopper/HopperTargetLease.js +132 -49
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -0
- package/dist/ida/IdaConfiguration.js +8 -3
- package/dist/ida/IdaInput.js +1 -7
- package/dist/ida/IdaMcpConnection.js +8 -4
- package/dist/ida/IdaOperationRunner.js +3 -3
- package/dist/ida/IdaProvider.js +8 -12
- package/dist/ida/IdaSessionClient.js +20 -18
- package/dist/ida/IdaWorkspace.js +12 -13
- package/dist/inspector/V8InspectorCaptureProjection.js +1 -1
- package/dist/inspector/V8InspectorProvider.js +38 -28
- package/dist/javascript/recovery/WakaruCommand.js +7 -2
- package/dist/javascript/recovery/WakaruExecution.js +5 -2
- package/dist/main/shutdown.js +11 -3
- package/dist/main/startup.js +9 -2
- package/dist/main/transport.js +22 -2
- package/dist/main.js +11 -18
- package/dist/native/AppleMachoSelection.js +16 -6
- package/dist/native/CommandRunner.js +9 -7
- package/dist/native/LldbCallTracer.js +8 -2
- package/dist/native/NativeMacOSProvider.js +25 -15
- package/dist/native/NativeUiHelperRuntime.js +11 -2
- package/dist/native/NativeUiObservation.js +2 -2
- package/dist/native/pwntools/PwntoolsDecoder.js +2 -1
- package/dist/process/DarwinProcessRunTokenReader.js +16 -2
- package/dist/process/ExecFileOutput.js +88 -6
- package/dist/process/PrivateRuntimeRoot.js +10 -5
- package/dist/process/ProcessOwnership.js +1 -4
- package/dist/process/ProcessOwnershipObservation.js +11 -5
- package/dist/process/ProviderProcess.js +1 -3
- package/dist/process/capture/FilesystemSnapshot.js +50 -13
- package/dist/process/capture/ProcessCaptureError.js +13 -0
- package/dist/process/capture/ProcessCaptureLifecycle.js +158 -70
- package/dist/process/capture/ProcessFilesystemEffects.js +33 -3
- package/dist/process/capture/ProcessHarness.js +21 -25
- package/dist/process/capture/ProcessNormalization.js +20 -2
- package/dist/process/capture/ProcessSampling.js +25 -2
- package/dist/process/capture/TerminalRenderer.js +14 -0
- package/dist/process/snapshotEnvironment.js +14 -0
- package/dist/server/EvidenceMcpServer.js +25 -14
- package/dist/server/createServer.js +49 -36
- package/dist/server/mcpClientMetadata.js +12 -5
- package/dist/server/promptCompletion.js +3 -8
- package/dist/server/registerAnalysisViewTool.js +15 -0
- package/dist/server/registerAndroidTools.js +2 -3
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -5
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +4 -5
- package/dist/server/registerApplicationTools/coverage.js +1 -2
- package/dist/server/registerApplicationTools/helpers.js +1 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +4 -5
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -4
- package/dist/server/registerApplicationTools/traceFeature.js +4 -5
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +4 -5
- package/dist/server/registerBinaryDiagnosticsTools.js +2 -3
- package/dist/server/registerBrowserScenarioTool.js +3 -4
- package/dist/server/registerBrowserTools.js +13 -16
- package/dist/server/registerBundleComparisonTool.js +5 -6
- package/dist/server/registerCloseLifecycleTool.js +2 -3
- package/dist/server/registerElectronTools.js +10 -13
- package/dist/server/registerEnhancedTools.js +23 -23
- package/dist/server/registerEvidenceTools.js +3 -4
- package/dist/server/registerEvmTools.js +2 -3
- package/dist/server/registerFirmwareTools.js +2 -3
- package/dist/server/registerFunctionComparisonTool.js +7 -8
- package/dist/server/registerInvestigationTools.js +14 -15
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -3
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +6 -6
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +5 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +4 -5
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +6 -7
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +6 -7
- package/dist/server/registerOfficialTools.js +4 -19
- package/dist/server/registerProcessComparisonTool.js +8 -8
- package/dist/server/registerRecordedCrashTools.js +2 -3
- package/dist/server/registerSessionRecordTools.js +15 -19
- package/dist/server/registerSessionStatusTool.js +3 -4
- package/dist/server/registerSessionTools.js +12 -18
- package/dist/server/registerWebModuleTool.js +2 -3
- package/dist/server/registerWebNetworkCaptureTool.js +2 -3
- package/dist/server/registerWebRuntimeTools.js +4 -5
- package/dist/server/registerWebScriptTool.js +2 -3
- package/dist/server/registerWebSourceLocationTool.js +2 -3
- package/dist/server/toolResult.js +66 -94
- package/dist/server/toolResultEncoding.js +11 -10
- package/dist/windows/WindowsNativeLoader.js +1 -0
- package/dist/windows/WindowsOwnedProcess.js +60 -15
- package/dist/windows/WindowsPrivateRuntime.js +7 -8
- package/native/windows/README.md +3 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +39 -30
- package/scripts/rea.mjs +3 -6
- package/skills/reverse-engineer-anything/SKILL.md +9 -8
- package/skills/reverse-engineer-anything/references/android-applications.md +6 -3
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +16 -6
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +9 -0
- package/dist/config.js +0 -1
- package/dist/contracts/browserCaptureToolInputSchema.js +0 -43
- package/dist/contracts/process/processCaptureExample.js +0 -2
- package/dist/contracts/toolOutputSchemas.js +0 -2
- package/dist/main/reload.js +0 -12
- package/dist/main/state.js +0 -3
- package/dist/server/sessionToolPolicies.js +0 -2
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { AnalysisInputError, } from "../analysisErrorCore.js";
|
|
2
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
3
|
+
import { err, ok } from "../result.js";
|
|
4
|
+
import { completeWithinViewCoverage as completeCoverage, pageViewCoverage as pageCoverage, } from "./analysisViewCoverage.js";
|
|
5
|
+
const OPERATION = "inspect_analysis_view";
|
|
6
|
+
const inputError = (issues) => new AnalysisInputError(OPERATION, undefined, issues);
|
|
7
|
+
const layoutUnknowns = (layout) => {
|
|
8
|
+
const unknowns = [
|
|
9
|
+
"runtime_load_base is unknown",
|
|
10
|
+
"entry_point.execution_status is unknown",
|
|
11
|
+
"relocation_inventory_completeness is unknown",
|
|
12
|
+
"linkage.convenience_maps_completeness is unknown",
|
|
13
|
+
"linkage.runtime_library_paths are unknown",
|
|
14
|
+
];
|
|
15
|
+
if (layout.mitigations.nx_indicator === null)
|
|
16
|
+
unknowns.push("mitigations.nx_indicator is unknown");
|
|
17
|
+
if (layout.mitigations.relro === null)
|
|
18
|
+
unknowns.push("mitigations.relro is unknown");
|
|
19
|
+
return unknowns;
|
|
20
|
+
};
|
|
21
|
+
const displayName = (name) => name.display;
|
|
22
|
+
const namedMatches = (rows, name) => rows.flatMap((row, index) => row.name.unknown_reason === null && displayName(row.name) === name
|
|
23
|
+
? [{ index, row }]
|
|
24
|
+
: []);
|
|
25
|
+
const selectNamed = (collection, rows, name) => {
|
|
26
|
+
const matches = namedMatches(rows, name);
|
|
27
|
+
if (matches.length === 1) {
|
|
28
|
+
const selected = matches[0];
|
|
29
|
+
if (selected !== undefined)
|
|
30
|
+
return ok(selected.row);
|
|
31
|
+
}
|
|
32
|
+
if (matches.length === 0)
|
|
33
|
+
return err(inputError([
|
|
34
|
+
{
|
|
35
|
+
path: ["view", "selector", "name"],
|
|
36
|
+
reason: "invalid_value",
|
|
37
|
+
message: `No ${collection} named ${JSON.stringify(name)}. Collection has ${String(rows.length)} entries; page it to inspect exact indexes and names.`,
|
|
38
|
+
},
|
|
39
|
+
]));
|
|
40
|
+
return err(inputError([
|
|
41
|
+
{
|
|
42
|
+
path: ["view", "selector", "name"],
|
|
43
|
+
reason: "invalid_value",
|
|
44
|
+
message: `Multiple ${collection} named ${JSON.stringify(name)}; select one by index.`,
|
|
45
|
+
expected: matches.map(({ index }) => ({ index })),
|
|
46
|
+
},
|
|
47
|
+
]));
|
|
48
|
+
};
|
|
49
|
+
const selectIndexed = (collection, rows, index) => {
|
|
50
|
+
const row = rows[index];
|
|
51
|
+
if (row !== undefined)
|
|
52
|
+
return ok(row);
|
|
53
|
+
return err(inputError([
|
|
54
|
+
{
|
|
55
|
+
path: ["view", "selector", "index"],
|
|
56
|
+
reason: "out_of_range",
|
|
57
|
+
message: `${collection} index ${String(index)} is outside 0..${String(Math.max(0, rows.length - 1))} (${String(rows.length)} entries).`,
|
|
58
|
+
minimum: 0,
|
|
59
|
+
maximum: Math.max(0, rows.length - 1),
|
|
60
|
+
},
|
|
61
|
+
]));
|
|
62
|
+
};
|
|
63
|
+
const pageRows = (rows, offset, limit) => rows.slice(offset, offset + limit);
|
|
64
|
+
const layoutIncompatible = (detail) => inputError([
|
|
65
|
+
{
|
|
66
|
+
path: ["view"],
|
|
67
|
+
reason: "invalid_value",
|
|
68
|
+
message: detail,
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
const parentFields = (parent, layout) => ({
|
|
72
|
+
parent_evidence_id: parent.evidenceId,
|
|
73
|
+
parent_operation: "inspect_binary_layout",
|
|
74
|
+
parent_digest: parent.evidenceId.slice(3),
|
|
75
|
+
artifact: {
|
|
76
|
+
path: layout.artifact.path,
|
|
77
|
+
sha256: layout.artifact.sha256,
|
|
78
|
+
},
|
|
79
|
+
limitations: uniqueSorted([...parent.limitations, ...layout.limitations]),
|
|
80
|
+
unknowns: uniqueSorted([...layoutUnknowns(layout)]),
|
|
81
|
+
});
|
|
82
|
+
const layoutSummary = (layout) => ({
|
|
83
|
+
bytes: layout.artifact.bytes,
|
|
84
|
+
format: layout.format,
|
|
85
|
+
architecture: layout.architecture,
|
|
86
|
+
image_type: layout.image_type,
|
|
87
|
+
entry: layout.entry_point,
|
|
88
|
+
counts: {
|
|
89
|
+
sections: layout.sections.length,
|
|
90
|
+
segments: layout.segments.length,
|
|
91
|
+
symbols: layout.symbols.length,
|
|
92
|
+
relocations: layout.relocations.length,
|
|
93
|
+
},
|
|
94
|
+
limitation_count: layout.limitations.length,
|
|
95
|
+
});
|
|
96
|
+
/** Project one layout view without re-running the decoder. */
|
|
97
|
+
export const projectBinaryLayoutView = (parent, layout, view) => {
|
|
98
|
+
const shared = parentFields(parent, layout);
|
|
99
|
+
if (view.kind === "summary")
|
|
100
|
+
return ok({
|
|
101
|
+
kind: "summary",
|
|
102
|
+
view,
|
|
103
|
+
summary: layoutSummary(layout),
|
|
104
|
+
coverage: completeCoverage(layout.sections.length +
|
|
105
|
+
layout.segments.length +
|
|
106
|
+
layout.symbols.length +
|
|
107
|
+
layout.relocations.length, layout.sections.length +
|
|
108
|
+
layout.segments.length +
|
|
109
|
+
layout.symbols.length +
|
|
110
|
+
layout.relocations.length),
|
|
111
|
+
...shared,
|
|
112
|
+
});
|
|
113
|
+
if (view.kind === "facet")
|
|
114
|
+
return ok({
|
|
115
|
+
kind: "facet",
|
|
116
|
+
view,
|
|
117
|
+
facet: view.facet === "mitigations" ? layout.mitigations : layout.linkage,
|
|
118
|
+
coverage: completeCoverage(1, 1),
|
|
119
|
+
...shared,
|
|
120
|
+
});
|
|
121
|
+
if (view.kind === "item") {
|
|
122
|
+
if (view.collection === "modules")
|
|
123
|
+
return err(layoutIncompatible("modules collection applies to analyze_javascript_application Evidence."));
|
|
124
|
+
const selected = view.collection === "sections"
|
|
125
|
+
? selectLayoutItem(view.collection, layout.sections, view.selector)
|
|
126
|
+
: selectLayoutItem(view.collection, layout.symbols, view.selector);
|
|
127
|
+
if (!selected.ok)
|
|
128
|
+
return selected;
|
|
129
|
+
return ok({
|
|
130
|
+
kind: "item",
|
|
131
|
+
view,
|
|
132
|
+
item: selected.value,
|
|
133
|
+
coverage: completeCoverage(1, view.collection === "sections"
|
|
134
|
+
? layout.sections.length
|
|
135
|
+
: layout.symbols.length),
|
|
136
|
+
...shared,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (view.collection === "modules")
|
|
140
|
+
return err(layoutIncompatible("modules collection applies to analyze_javascript_application Evidence."));
|
|
141
|
+
const rows = view.collection === "sections" ? layout.sections : layout.symbols;
|
|
142
|
+
const items = view.collection === "sections"
|
|
143
|
+
? pageRows(layout.sections, view.offset, view.limit)
|
|
144
|
+
: pageRows(layout.symbols, view.offset, view.limit);
|
|
145
|
+
return ok({
|
|
146
|
+
kind: "page",
|
|
147
|
+
view,
|
|
148
|
+
items: [...items],
|
|
149
|
+
coverage: pageCoverage(view.offset, items.length, rows.length),
|
|
150
|
+
...shared,
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
const selectLayoutItem = (collection, rows, selector) => {
|
|
154
|
+
if ("index" in selector)
|
|
155
|
+
return selectIndexed(collection, rows, selector.index);
|
|
156
|
+
if ("name" in selector)
|
|
157
|
+
return selectNamed(collection, rows, selector.name);
|
|
158
|
+
return err(layoutIncompatible("Section and symbol items are selected by index or exact name."));
|
|
159
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { AnalysisInputError, } from "../analysisErrorCore.js";
|
|
2
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
3
|
+
import { jsonObjectSchema } from "../jsonValue.js";
|
|
4
|
+
import { err, ok } from "../result.js";
|
|
5
|
+
import { completeWithinViewCoverage as completeCoverage, pageViewCoverage as pageCoverage, } from "./analysisViewCoverage.js";
|
|
6
|
+
const OPERATION = "inspect_analysis_view";
|
|
7
|
+
const inputError = (issues) => new AnalysisInputError(OPERATION, undefined, issues);
|
|
8
|
+
const jsIncompatible = (detail) => inputError([
|
|
9
|
+
{
|
|
10
|
+
path: ["view"],
|
|
11
|
+
reason: "invalid_value",
|
|
12
|
+
message: detail,
|
|
13
|
+
},
|
|
14
|
+
]);
|
|
15
|
+
/** Exact module path or original source-map reference, when available. */
|
|
16
|
+
export const javascriptModulePath = (node) => {
|
|
17
|
+
if (node.identity.strategy === "canonical-path")
|
|
18
|
+
return node.identity.path;
|
|
19
|
+
if (node.identity.strategy === "source-map-original")
|
|
20
|
+
return node.identity.original_source;
|
|
21
|
+
for (const observation of node.observations) {
|
|
22
|
+
const path = observation.properties.path;
|
|
23
|
+
if (typeof path === "string")
|
|
24
|
+
return path;
|
|
25
|
+
const location = observation.evidence.location;
|
|
26
|
+
if (location.available && location.value.kind === "artifact-path")
|
|
27
|
+
return location.value.path;
|
|
28
|
+
if (location.available && location.value.kind === "source-range")
|
|
29
|
+
return location.value.source;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
const moduleEntries = (nodes) => nodes
|
|
34
|
+
.filter((node) => node.kind === "javascript-asset" ||
|
|
35
|
+
node.kind === "javascript-module" ||
|
|
36
|
+
node.kind === "source-module")
|
|
37
|
+
.map((node) => ({ node, path: javascriptModulePath(node) }));
|
|
38
|
+
const exportNames = (node) => {
|
|
39
|
+
const names = new Set();
|
|
40
|
+
for (const observation of node.observations) {
|
|
41
|
+
const value = observation.properties.export_names ?? observation.properties.exports;
|
|
42
|
+
if (!Array.isArray(value))
|
|
43
|
+
continue;
|
|
44
|
+
for (const entry of value)
|
|
45
|
+
if (typeof entry === "string")
|
|
46
|
+
names.add(entry);
|
|
47
|
+
}
|
|
48
|
+
return [...names];
|
|
49
|
+
};
|
|
50
|
+
const nodeHashes = (node) => {
|
|
51
|
+
const hashes = new Set();
|
|
52
|
+
const { identity } = node;
|
|
53
|
+
if (identity.strategy === "content-digest")
|
|
54
|
+
hashes.add(identity.sha256);
|
|
55
|
+
if (identity.strategy === "canonical-path")
|
|
56
|
+
hashes.add(identity.artifact_sha256);
|
|
57
|
+
if (identity.strategy === "source-map-original") {
|
|
58
|
+
hashes.add(identity.source_map_sha256);
|
|
59
|
+
if (identity.source_sha256 !== null)
|
|
60
|
+
hashes.add(identity.source_sha256);
|
|
61
|
+
}
|
|
62
|
+
for (const observation of node.observations) {
|
|
63
|
+
for (const key of [
|
|
64
|
+
"sha256",
|
|
65
|
+
"container_sha256",
|
|
66
|
+
"entry_sha256",
|
|
67
|
+
"source_sha256",
|
|
68
|
+
]) {
|
|
69
|
+
const value = observation.properties[key];
|
|
70
|
+
if (typeof value === "string" && /^[a-f0-9]{64}$/u.test(value))
|
|
71
|
+
hashes.add(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return [...hashes];
|
|
75
|
+
};
|
|
76
|
+
const sourceRanges = (node) => node.observations.flatMap((observation) => {
|
|
77
|
+
const location = observation.evidence.location;
|
|
78
|
+
return location.available && location.value.kind === "source-range"
|
|
79
|
+
? [location.value]
|
|
80
|
+
: [];
|
|
81
|
+
});
|
|
82
|
+
const moduleItem = (node) => ({
|
|
83
|
+
node_id: node.node_id,
|
|
84
|
+
kind: node.kind,
|
|
85
|
+
path: javascriptModulePath(node),
|
|
86
|
+
identity: node.identity,
|
|
87
|
+
hashes: [...nodeHashes(node)],
|
|
88
|
+
exports: [...exportNames(node)],
|
|
89
|
+
source_ranges: [...sourceRanges(node)],
|
|
90
|
+
observations: node.observations.map((observation) => ({
|
|
91
|
+
observation_id: observation.observation_id,
|
|
92
|
+
label: observation.label,
|
|
93
|
+
properties: observation.properties,
|
|
94
|
+
evidence: {
|
|
95
|
+
...observation.evidence,
|
|
96
|
+
location: observation.evidence.location,
|
|
97
|
+
},
|
|
98
|
+
})),
|
|
99
|
+
});
|
|
100
|
+
const applicationUnknownCount = (analysis) => analysis.graph.nodes.reduce((count, node) => count + Number(node.kind === "unknown"), 0);
|
|
101
|
+
const javascriptUnknowns = (analysis) => {
|
|
102
|
+
const unknowns = [
|
|
103
|
+
...analysis.limitations,
|
|
104
|
+
...analysis.graph.limitations,
|
|
105
|
+
...analysis.semantic_graph.limitations,
|
|
106
|
+
];
|
|
107
|
+
if (analysis.graph.coverage.status !== "complete")
|
|
108
|
+
unknowns.push(`graph.coverage.status is ${analysis.graph.coverage.status}`);
|
|
109
|
+
if (analysis.semantic_graph.coverage.status !== "complete")
|
|
110
|
+
unknowns.push(`semantic_graph.coverage.status is ${analysis.semantic_graph.coverage.status}`);
|
|
111
|
+
if (applicationUnknownCount(analysis) > 0)
|
|
112
|
+
unknowns.push(`${String(applicationUnknownCount(analysis))} application graph unknowns remain in the parent Evidence.`);
|
|
113
|
+
if (analysis.semantic_graph.unknowns.length > 0)
|
|
114
|
+
unknowns.push(`${String(analysis.semantic_graph.unknowns.length)} semantic graph unknowns remain in the parent Evidence.`);
|
|
115
|
+
return unknowns;
|
|
116
|
+
};
|
|
117
|
+
const parentFields = (parent, analysis) => ({
|
|
118
|
+
parent_evidence_id: parent.evidenceId,
|
|
119
|
+
parent_operation: "analyze_javascript_application",
|
|
120
|
+
parent_digest: parent.evidenceId.slice(3),
|
|
121
|
+
artifact: {
|
|
122
|
+
path: analysis.input_path,
|
|
123
|
+
sha256: analysis.root_artifact_sha256,
|
|
124
|
+
},
|
|
125
|
+
limitations: uniqueSorted([
|
|
126
|
+
...parent.limitations,
|
|
127
|
+
...analysis.limitations,
|
|
128
|
+
...analysis.graph.limitations,
|
|
129
|
+
...analysis.semantic_graph.limitations,
|
|
130
|
+
]),
|
|
131
|
+
unknowns: uniqueSorted([...javascriptUnknowns(analysis)]),
|
|
132
|
+
});
|
|
133
|
+
const selectModule = (modules, selector) => {
|
|
134
|
+
if ("node_id" in selector) {
|
|
135
|
+
const matches = modules.filter(({ node }) => node.node_id === selector.node_id);
|
|
136
|
+
if (matches.length === 1) {
|
|
137
|
+
const selected = matches[0];
|
|
138
|
+
if (selected !== undefined)
|
|
139
|
+
return ok(selected.node);
|
|
140
|
+
}
|
|
141
|
+
return err(inputError([
|
|
142
|
+
{
|
|
143
|
+
path: ["view", "selector", "node_id"],
|
|
144
|
+
reason: "invalid_value",
|
|
145
|
+
message: `No module has node_id ${JSON.stringify(selector.node_id)}. Page the modules collection to inspect available identities.`,
|
|
146
|
+
},
|
|
147
|
+
]));
|
|
148
|
+
}
|
|
149
|
+
if ("path" in selector) {
|
|
150
|
+
const matches = modules.filter((entry) => entry.path === selector.path);
|
|
151
|
+
if (matches.length === 1) {
|
|
152
|
+
const selected = matches[0];
|
|
153
|
+
if (selected !== undefined)
|
|
154
|
+
return ok(selected.node);
|
|
155
|
+
}
|
|
156
|
+
if (matches.length === 0)
|
|
157
|
+
return err(inputError([
|
|
158
|
+
{
|
|
159
|
+
path: ["view", "selector", "path"],
|
|
160
|
+
reason: "invalid_value",
|
|
161
|
+
message: `No module has path ${JSON.stringify(selector.path)}. Page the modules collection to inspect exact paths and node_id values.`,
|
|
162
|
+
},
|
|
163
|
+
]));
|
|
164
|
+
return err(inputError([
|
|
165
|
+
{
|
|
166
|
+
path: ["view", "selector", "path"],
|
|
167
|
+
reason: "invalid_value",
|
|
168
|
+
message: `Multiple modules have path ${JSON.stringify(selector.path)}; select one by node_id.`,
|
|
169
|
+
expected: matches.map((entry) => ({ node_id: entry.node.node_id })),
|
|
170
|
+
},
|
|
171
|
+
]));
|
|
172
|
+
}
|
|
173
|
+
return err(jsIncompatible("Module items are selected by exact path or node_id."));
|
|
174
|
+
};
|
|
175
|
+
/** Project one JavaScript application view without re-running reconstruction. */
|
|
176
|
+
export const projectJavaScriptApplicationView = (parent, analysis, view) => {
|
|
177
|
+
const shared = parentFields(parent, analysis);
|
|
178
|
+
const modules = moduleEntries(analysis.graph.nodes);
|
|
179
|
+
if (view.kind === "summary")
|
|
180
|
+
return ok({
|
|
181
|
+
kind: "summary",
|
|
182
|
+
view,
|
|
183
|
+
summary: {
|
|
184
|
+
input_path: analysis.input_path,
|
|
185
|
+
format: analysis.format,
|
|
186
|
+
root_artifact_sha256: analysis.root_artifact_sha256,
|
|
187
|
+
statistics: jsonObjectSchema.parse(analysis.statistics),
|
|
188
|
+
electron: jsonObjectSchema.parse(analysis.summary),
|
|
189
|
+
coverage: jsonObjectSchema.parse({
|
|
190
|
+
application: analysis.graph.coverage,
|
|
191
|
+
semantic: {
|
|
192
|
+
...analysis.semantic_graph.coverage,
|
|
193
|
+
families: analysis.semantic_graph.coverage.families.map(({ unknown_ids, ...family }) => ({
|
|
194
|
+
...family,
|
|
195
|
+
unknown_count: unknown_ids.length,
|
|
196
|
+
})),
|
|
197
|
+
},
|
|
198
|
+
application_unknowns: applicationUnknownCount(analysis),
|
|
199
|
+
semantic_unknowns: analysis.semantic_graph.unknowns.length,
|
|
200
|
+
}),
|
|
201
|
+
limitation_count: analysis.limitations.length,
|
|
202
|
+
},
|
|
203
|
+
coverage: completeCoverage(modules.length, analysis.graph.nodes.length),
|
|
204
|
+
...shared,
|
|
205
|
+
});
|
|
206
|
+
if (view.kind === "facet")
|
|
207
|
+
return err(jsIncompatible("facet views apply to inspect_binary_layout Evidence (mitigations or linkage)."));
|
|
208
|
+
if (view.kind === "item") {
|
|
209
|
+
if (view.collection !== "modules")
|
|
210
|
+
return err(jsIncompatible("Section and symbol collections apply to inspect_binary_layout Evidence."));
|
|
211
|
+
const selected = selectModule(modules, view.selector);
|
|
212
|
+
if (!selected.ok)
|
|
213
|
+
return selected;
|
|
214
|
+
return ok({
|
|
215
|
+
kind: "item",
|
|
216
|
+
view,
|
|
217
|
+
item: moduleItem(selected.value),
|
|
218
|
+
coverage: completeCoverage(1, modules.length),
|
|
219
|
+
...shared,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (view.collection !== "modules")
|
|
223
|
+
return err(jsIncompatible("Section and symbol collections apply to inspect_binary_layout Evidence."));
|
|
224
|
+
const items = modules
|
|
225
|
+
.slice(view.offset, view.offset + view.limit)
|
|
226
|
+
.map(({ node, path }) => ({
|
|
227
|
+
node_id: node.node_id,
|
|
228
|
+
kind: node.kind,
|
|
229
|
+
path,
|
|
230
|
+
}));
|
|
231
|
+
return ok({
|
|
232
|
+
kind: "page",
|
|
233
|
+
view,
|
|
234
|
+
items,
|
|
235
|
+
coverage: pageCoverage(view.offset, items.length, modules.length),
|
|
236
|
+
...shared,
|
|
237
|
+
});
|
|
238
|
+
};
|
|
@@ -3,9 +3,16 @@ import { compatibleSlice, directoryOf, expandPrefix, joinPath, resolveTreePath,
|
|
|
3
3
|
import { digestSchema } from "../digests.js";
|
|
4
4
|
import { hasApplicableDyldOverrides, embeddedDyldOverrides, } from "./dyldEnvironment.js";
|
|
5
5
|
import { DYLIB_RESOLUTION_LIMITATIONS, deriveFindings, } from "./dylibResolutionFindings.js";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Normalized path below the analyzed root: nonempty segments joined by single
|
|
8
|
+
* `/`, none of them `.` or `..`, without backslash or NUL. Advertised schema
|
|
9
|
+
* patterns avoid look-around, which RE2 and Rust validators reject.
|
|
10
|
+
*/
|
|
11
|
+
const ROOT_RELATIVE_PATH = /^(?:[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.\.[^\x2f\\\u0000]+)(?:\x2f(?:[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.\.[^\x2f\\\u0000]+))*$/u;
|
|
12
|
+
const rootRelativePathSchema = z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.regex(ROOT_RELATIVE_PATH, "Use a normalized path relative to the analyzed root, without a leading or trailing '/', '//', or '.' and '..' segments");
|
|
9
16
|
/** Caller selection of process roots and one CPU slice. */
|
|
10
17
|
export const dylibResolutionInputSchema = z.strictObject({
|
|
11
18
|
roots: z.array(rootRelativePathSchema).min(1).optional(),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { firstString, parseInterfaceBuilderRecords, record, } from "./interfaceBuilderKeyedArchive.js";
|
|
3
3
|
import { nativeInvestigationEdgeSchema, nativeInvestigationGraphSchema, nativeInvestigationNodeSchema, nativeInvestigationTraceLimitsSchema, } from "../native/nativeInvestigationGraph.js";
|
|
4
|
-
export { parseInterfaceBuilderRecords } from "./interfaceBuilderKeyedArchive.js";
|
|
5
4
|
/** One compiled Interface Builder document projected from ibtool output. */
|
|
6
5
|
export const interfaceBuilderDocumentSchema = z.strictObject({
|
|
7
6
|
relative_path: z.string().min(1),
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AnalysisInputError } from "../analysisErrorCore.js";
|
|
3
3
|
import { jsonValueSchema } from "../jsonValue.js";
|
|
4
|
+
/**
|
|
5
|
+
* The selected file is intact but is another kind of file, so another tool
|
|
6
|
+
* applies. A malformed NSKeyedArchiver archive is not this error.
|
|
7
|
+
*/
|
|
8
|
+
export class KeyedArchiveKindError extends TypeError {
|
|
9
|
+
kind;
|
|
10
|
+
name = "KeyedArchiveKindError";
|
|
11
|
+
constructor(message,
|
|
12
|
+
/** What the selected file is instead. */
|
|
13
|
+
kind) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.kind = kind;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
4
18
|
/** Select one archive within the active bundle and optionally one named root. */
|
|
5
19
|
export const keyedArchiveInputSchema = z.strictObject({
|
|
6
20
|
path: z.string().min(1).default("."),
|
|
@@ -60,11 +74,21 @@ const uid = (value) => {
|
|
|
60
74
|
const marker = Object.hasOwn(object, "UID") ? object.UID : object["CF$UID"];
|
|
61
75
|
return typeof marker === "number" ? marker : undefined;
|
|
62
76
|
};
|
|
77
|
+
const archiverMismatch = (archive) => {
|
|
78
|
+
if (archive === undefined)
|
|
79
|
+
return "its root is not a dictionary";
|
|
80
|
+
if (!Object.hasOwn(archive, "$archiver"))
|
|
81
|
+
return "it has no $archiver key";
|
|
82
|
+
return typeof archive.$archiver === "string"
|
|
83
|
+
? `its $archiver is ${JSON.stringify(archive.$archiver)}`
|
|
84
|
+
: "its $archiver is not a string";
|
|
85
|
+
};
|
|
63
86
|
/** Interpret serialized Foundation references without instantiating archive classes. */
|
|
64
87
|
export const projectKeyedArchive = (value, selection) => {
|
|
65
88
|
const archive = record(jsonValueSchema.parse(value));
|
|
66
|
-
if (archive?.$archiver !== "NSKeyedArchiver"
|
|
67
|
-
|
|
89
|
+
if (archive?.$archiver !== "NSKeyedArchiver")
|
|
90
|
+
throw new KeyedArchiveKindError(`Selected property list is not an NSKeyedArchiver archive: ${archiverMismatch(archive)}`, "property-list");
|
|
91
|
+
if (!Array.isArray(archive.$objects))
|
|
68
92
|
throw new TypeError("Expected NSKeyedArchiver with an $objects array");
|
|
69
93
|
const table = archive.$objects;
|
|
70
94
|
if (table.length > 200_000)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import {} from "./artifactGraph.js";
|
|
3
4
|
import { evidenceSchema } from "./evidence.js";
|
|
@@ -111,7 +112,7 @@ export const compareArtifacts = (leftEvidence, rightEvidence) => {
|
|
|
111
112
|
right_manifest_id: right.inventory.manifest.manifest_id,
|
|
112
113
|
summary,
|
|
113
114
|
changes,
|
|
114
|
-
limitations: [...new Set(limitations)].sort(
|
|
115
|
+
limitations: [...new Set(limitations)].sort(compareCodePoints),
|
|
115
116
|
});
|
|
116
117
|
};
|
|
117
118
|
const compareOccurrences = (left, right, evidenceLinks, complete) => {
|
|
@@ -123,7 +124,7 @@ const compareOccurrences = (left, right, evidenceLinks, complete) => {
|
|
|
123
124
|
const rightRelations = relationsByPath(right);
|
|
124
125
|
const paths = [
|
|
125
126
|
...new Set([...leftByPath.keys(), ...rightByPath.keys()]),
|
|
126
|
-
].sort(
|
|
127
|
+
].sort(compareCodePoints);
|
|
127
128
|
const output = [];
|
|
128
129
|
for (const path of paths) {
|
|
129
130
|
const leftOccurrence = leftByPath.get(path);
|
|
@@ -208,8 +209,17 @@ const changedDimensions = (input) => {
|
|
|
208
209
|
return ["availability"];
|
|
209
210
|
const checks = [
|
|
210
211
|
["content", left.sha256 !== right.sha256],
|
|
211
|
-
[
|
|
212
|
-
|
|
212
|
+
[
|
|
213
|
+
"kind",
|
|
214
|
+
input.leftOccurrence?.artifact_kind !==
|
|
215
|
+
input.rightOccurrence?.artifact_kind,
|
|
216
|
+
],
|
|
217
|
+
[
|
|
218
|
+
"format",
|
|
219
|
+
left.format !== right.format ||
|
|
220
|
+
input.leftOccurrence?.artifact_format !==
|
|
221
|
+
input.rightOccurrence?.artifact_format,
|
|
222
|
+
],
|
|
213
223
|
["size", left.size !== right.size],
|
|
214
224
|
[
|
|
215
225
|
"executable",
|
|
@@ -228,7 +238,6 @@ const changedDimensions = (input) => {
|
|
|
228
238
|
};
|
|
229
239
|
const metadataChanged = (input, left, right) => left.media_type !== right.media_type ||
|
|
230
240
|
left.architecture !== right.architecture ||
|
|
231
|
-
left.executable !== right.executable ||
|
|
232
241
|
left.content_state !== right.content_state ||
|
|
233
242
|
input.leftOccurrence?.entry_kind !== input.rightOccurrence?.entry_kind ||
|
|
234
243
|
input.leftOccurrence?.encrypted !== input.rightOccurrence?.encrypted ||
|
|
@@ -262,7 +271,7 @@ const relationsByPath = (inventory) => {
|
|
|
262
271
|
values.push(projection);
|
|
263
272
|
}
|
|
264
273
|
for (const values of output.values())
|
|
265
|
-
values.sort((left, right) => canonicalJson(left)
|
|
274
|
+
values.sort((left, right) => compareCodePoints(canonicalJson(left), canonicalJson(right)));
|
|
266
275
|
return output;
|
|
267
276
|
};
|
|
268
277
|
const summarize = (left, right, changes, covered) => {
|
|
@@ -55,6 +55,19 @@ const artifactFormatSchema = z.enum([
|
|
|
55
55
|
"file",
|
|
56
56
|
"unknown",
|
|
57
57
|
]);
|
|
58
|
+
/** Formats established from bytes or a virtual directory tree, independent of path roles. */
|
|
59
|
+
const artifactContentFormatSchema = artifactFormatSchema.extract([
|
|
60
|
+
"zip",
|
|
61
|
+
"mach-o-universal",
|
|
62
|
+
"mach-o",
|
|
63
|
+
"elf",
|
|
64
|
+
"pe",
|
|
65
|
+
"dos-mz",
|
|
66
|
+
"plist",
|
|
67
|
+
"directory",
|
|
68
|
+
"file",
|
|
69
|
+
"unknown",
|
|
70
|
+
]);
|
|
58
71
|
/** File byte interval for an artifact derived without writing it to disk. */
|
|
59
72
|
const artifactByteRangeSchema = z.object({
|
|
60
73
|
offset: z.number().int().min(0),
|
|
@@ -72,13 +85,11 @@ const artifactCommandSchema = z.object({
|
|
|
72
85
|
/** One content-addressed application artifact in deterministic manifest order. */
|
|
73
86
|
const artifactNodeSchema = z.object({
|
|
74
87
|
artifact_id: artifactIdSchema,
|
|
75
|
-
|
|
76
|
-
format: artifactFormatSchema,
|
|
88
|
+
format: artifactContentFormatSchema,
|
|
77
89
|
sha256: sha256Schema,
|
|
78
90
|
size: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
79
91
|
media_type: z.string().min(1).nullable(),
|
|
80
92
|
architecture: z.string().min(1).nullable(),
|
|
81
|
-
executable: z.boolean(),
|
|
82
93
|
content_state: z.enum(["materialized", "embedded", "virtual"]),
|
|
83
94
|
limitations: z.array(z.string()),
|
|
84
95
|
});
|
|
@@ -89,6 +100,8 @@ const artifactOccurrenceSchema = z.object({
|
|
|
89
100
|
parent_occurrence_id: occurrenceIdSchema.nullable(),
|
|
90
101
|
logical_path: boundedRelativePathSchema,
|
|
91
102
|
entry_kind: z.enum(["file", "directory", "symlink", "slice"]),
|
|
103
|
+
artifact_kind: artifactKindSchema,
|
|
104
|
+
artifact_format: artifactFormatSchema,
|
|
92
105
|
declared_size: z
|
|
93
106
|
.number()
|
|
94
107
|
.int()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { artifactInventoryResultSchema, } from "./artifactGraph.js";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { canonicalJson } from "./comparisonSemantics.js";
|
|
3
4
|
import { artifactContradictionId, artifactEdgeId, artifactGraphDigest, artifactIdForContent, artifactManifestId, occurrenceIdForLocation, } from "./artifactIdentity.js";
|
|
4
5
|
import { parseEvidence } from "./evidence.js";
|
|
5
6
|
import { artifactInspectionResultSchema } from "./artifactInspection.js";
|
|
6
|
-
import { err, ok } from "./result.js";
|
|
7
7
|
/** Parse, merge, and verify inventory Evidence pages. */
|
|
8
8
|
export const parseArtifactInventoryEvidence = (input) => assembleInventorySet((Array.isArray(input) ? input : [input]).map((value) => {
|
|
9
9
|
const evidence = parseEvidence(value);
|
|
@@ -33,17 +33,6 @@ const validateInventoryPage = (inventory) => {
|
|
|
33
33
|
if (node.artifact_id !== artifactIdForContent(node.sha256))
|
|
34
34
|
throw new TypeError("Artifact node ID is not content-addressed");
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Result-returning seam for the empty-pages leaf. Other assembly failures
|
|
38
|
-
* still throw TypeError (migration in progress); parseArtifactInventoryEvidence
|
|
39
|
-
* keeps its throwing contract until callers switch.
|
|
40
|
-
*/
|
|
41
|
-
export const tryAssembleInventorySet = (pages) => pages.length === 0
|
|
42
|
-
? err({
|
|
43
|
-
code: "empty",
|
|
44
|
-
message: "Artifact inventory requires Evidence pages",
|
|
45
|
-
})
|
|
46
|
-
: ok(assembleInventorySet(pages));
|
|
47
36
|
const assembleInventorySet = (pages) => {
|
|
48
37
|
const first = pages[0];
|
|
49
38
|
if (first === undefined)
|
|
@@ -79,9 +68,9 @@ const assembleInventorySet = (pages) => {
|
|
|
79
68
|
return { evidence: pages.map(({ evidence }) => evidence), inventory };
|
|
80
69
|
};
|
|
81
70
|
const orderedInventory = (first, pages, values) => {
|
|
82
|
-
const nodes = [...values.nodes.values()].sort((left, right) => left.artifact_id
|
|
83
|
-
const occurrences = [...values.occurrences.values()].sort((left, right) => left.logical_path
|
|
84
|
-
const edges = [...values.edges.values()].sort((left, right) => left.edge_id
|
|
71
|
+
const nodes = [...values.nodes.values()].sort((left, right) => compareCodePoints(left.artifact_id, right.artifact_id));
|
|
72
|
+
const occurrences = [...values.occurrences.values()].sort((left, right) => compareCodePoints(left.logical_path, right.logical_path));
|
|
73
|
+
const edges = [...values.edges.values()].sort((left, right) => compareCodePoints(left.edge_id, right.edge_id));
|
|
85
74
|
return {
|
|
86
75
|
manifest: first.manifest,
|
|
87
76
|
nodes,
|
|
@@ -90,7 +79,7 @@ const orderedInventory = (first, pages, values) => {
|
|
|
90
79
|
integrityContradictions: first.integrity_contradictions,
|
|
91
80
|
limitations: [
|
|
92
81
|
...new Set(pages.flatMap(({ inventory }) => inventory.limitations)),
|
|
93
|
-
].sort(
|
|
82
|
+
].sort(compareCodePoints),
|
|
94
83
|
complete: nodes.length === first.manifest.node_count &&
|
|
95
84
|
occurrences.length === first.manifest.occurrence_count &&
|
|
96
85
|
edges.length === first.manifest.edge_count,
|
|
@@ -102,6 +91,10 @@ const validateCompleteInventory = (inventory) => {
|
|
|
102
91
|
const rootNode = inventory.nodes.find(({ artifact_id: id }) => id === inventory.manifest.root_artifact_id);
|
|
103
92
|
if (rootNode?.sha256 !== inventory.manifest.root_sha256)
|
|
104
93
|
throw new TypeError("Artifact root node does not match its manifest digest");
|
|
94
|
+
const rootOccurrence = inventory.occurrences.find(({ logical_path }) => logical_path === ".");
|
|
95
|
+
if (rootOccurrence?.artifact_id !== inventory.manifest.root_artifact_id ||
|
|
96
|
+
rootOccurrence.artifact_format !== inventory.manifest.root_format)
|
|
97
|
+
throw new TypeError("Artifact root occurrence does not match its manifest representation");
|
|
105
98
|
for (const occurrence of inventory.occurrences)
|
|
106
99
|
validateOccurrence(occurrence, inventory, nodeIds, occurrenceIds);
|
|
107
100
|
for (const edge of inventory.edges)
|