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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { semanticSlotAtPath } from "./javascriptSemanticSlots.js";
|
|
2
3
|
import { invalidateSemanticMutationPath } from "./javascriptSemanticMutationValues.js";
|
|
3
4
|
import { resolveSemanticBindingState, } from "./javascriptSemanticState.js";
|
|
4
5
|
import { semanticRequireOrigin } from "./javascriptSemanticRequireOrigin.js";
|
|
5
6
|
import { compareCodePoints } from "../canonicalOrdering.js";
|
|
6
|
-
import { semanticStaticPropertyKey } from "./javascriptAstValues.js";
|
|
7
|
+
import { readExactJavaScriptLiteral, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
7
8
|
import { semanticAmbiguousProvenance, semanticLocalProvenance, semanticOriginsProvenance, semanticUnresolvedProvenance, uniqueSemanticOrigins, } from "./javascriptSemanticProvenance.js";
|
|
8
|
-
import {
|
|
9
|
+
import { semanticPrimitiveCandidates as primitiveCandidates, semanticPrimitiveSet as primitiveSet, } from "./javascriptSemanticPrimitives.js";
|
|
9
10
|
import { SEMANTIC_EXPRESSION_DEPTH_LIMIT, SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT, exceedsSemanticPrimitiveAdditionByteBudget, exceedsSemanticTemplateByteBudget, semanticResourceLimitUnknown, semanticResourceLimitReason, } from "./javascriptSemanticResourceLimits.js";
|
|
10
11
|
const primitiveBindingValuesByState = new WeakMap();
|
|
11
12
|
const primitiveBindingValuesFor = (state) => {
|
|
@@ -50,6 +51,16 @@ const evaluateBinding = (binding, context) => {
|
|
|
50
51
|
status: "unknown",
|
|
51
52
|
reason: `Binding ${binding.name} has no constant initializer.`,
|
|
52
53
|
};
|
|
54
|
+
if (binding.initializers.some(({ node }) => t.isUpdateExpression(node) ||
|
|
55
|
+
(t.isAssignmentExpression(node) &&
|
|
56
|
+
node.operator !== "=" &&
|
|
57
|
+
node.operator !== "&&=" &&
|
|
58
|
+
node.operator !== "||=" &&
|
|
59
|
+
node.operator !== "??=")))
|
|
60
|
+
return {
|
|
61
|
+
status: "unknown",
|
|
62
|
+
reason: `Binding ${binding.name} has a compound or update write.`,
|
|
63
|
+
};
|
|
53
64
|
if (binding.initializers.length > 1)
|
|
54
65
|
return {
|
|
55
66
|
status: "ambiguous",
|
|
@@ -72,7 +83,7 @@ const evaluateBinding = (binding, context) => {
|
|
|
72
83
|
const evaluateExpression = (node, context) => {
|
|
73
84
|
if (context.expressionDepth > SEMANTIC_EXPRESSION_DEPTH_LIMIT)
|
|
74
85
|
return semanticResourceLimitUnknown("expression-depth");
|
|
75
|
-
const literal =
|
|
86
|
+
const literal = readExactJavaScriptLiteral(node);
|
|
76
87
|
if (literal.found)
|
|
77
88
|
return { status: "literal", value: literal.value };
|
|
78
89
|
if (t.isIdentifier(node)) {
|
|
@@ -114,9 +125,12 @@ const evaluateTemplate = (node, context) => {
|
|
|
114
125
|
let candidates = [""];
|
|
115
126
|
for (let index = 0; index < node.quasis.length; index += 1) {
|
|
116
127
|
const quasi = node.quasis[index];
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
128
|
+
const text = quasi?.value.cooked;
|
|
129
|
+
if (text === undefined || text === null)
|
|
130
|
+
return {
|
|
131
|
+
status: "unknown",
|
|
132
|
+
reason: "Template text has no cooked representation.",
|
|
133
|
+
};
|
|
120
134
|
if (exceedsSemanticTemplateByteBudget(candidates, [text]))
|
|
121
135
|
return semanticResourceLimitUnknown("primitive-bytes");
|
|
122
136
|
candidates = candidates.map((prefix) => `${prefix}${text}`);
|
|
@@ -150,6 +164,7 @@ const evaluateObject = (node, context) => {
|
|
|
150
164
|
for (const [name] of propertiesByName)
|
|
151
165
|
propertiesByName.set(name, {
|
|
152
166
|
name,
|
|
167
|
+
presence: "present",
|
|
153
168
|
value: {
|
|
154
169
|
status: "unknown",
|
|
155
170
|
reason: "A later property may overwrite this value.",
|
|
@@ -183,6 +198,7 @@ const evaluateObject = (node, context) => {
|
|
|
183
198
|
}
|
|
184
199
|
propertiesByName.set(name, {
|
|
185
200
|
name,
|
|
201
|
+
presence: "present",
|
|
186
202
|
value: t.isObjectProperty(property)
|
|
187
203
|
? evaluateExpression(property.value, nestedContext(context))
|
|
188
204
|
: {
|
|
@@ -218,20 +234,27 @@ const evaluateArray = (node, context) => {
|
|
|
218
234
|
break;
|
|
219
235
|
}
|
|
220
236
|
if (element === null) {
|
|
221
|
-
unknownItems = true;
|
|
222
|
-
if (omittedItems !== null)
|
|
223
|
-
omittedItems += 1;
|
|
224
237
|
items.push({
|
|
225
|
-
|
|
226
|
-
|
|
238
|
+
name: String(items.length),
|
|
239
|
+
presence: "absent",
|
|
240
|
+
value: { status: "unknown", reason: "Array hole has no own value." },
|
|
227
241
|
});
|
|
228
242
|
continue;
|
|
229
243
|
}
|
|
230
|
-
items.push(
|
|
244
|
+
items.push({
|
|
245
|
+
name: String(items.length),
|
|
246
|
+
presence: "present",
|
|
247
|
+
value: evaluateExpression(element, nestedContext(context)),
|
|
248
|
+
});
|
|
231
249
|
}
|
|
232
250
|
return unknownItems
|
|
233
251
|
? { status: "array", items, unknownItems: true, omittedItems }
|
|
234
|
-
: {
|
|
252
|
+
: {
|
|
253
|
+
status: "array",
|
|
254
|
+
items,
|
|
255
|
+
unknownItems: false,
|
|
256
|
+
omittedItems: 0,
|
|
257
|
+
};
|
|
235
258
|
};
|
|
236
259
|
const evaluateMember = (node, context) => {
|
|
237
260
|
const keys = [];
|
|
@@ -290,7 +313,7 @@ const addPrimitiveValues = (leftValue, rightValue) => {
|
|
|
290
313
|
return rightValue;
|
|
291
314
|
return { status: "unknown", reason: "Non-primitive addition." };
|
|
292
315
|
}
|
|
293
|
-
if (left.length >
|
|
316
|
+
if (left.length > SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT / right.length)
|
|
294
317
|
return semanticResourceLimitUnknown("primitive-candidates");
|
|
295
318
|
if (exceedsSemanticPrimitiveAdditionByteBudget(left, right))
|
|
296
319
|
return semanticResourceLimitUnknown("primitive-bytes");
|
|
@@ -316,46 +339,16 @@ const evaluateUnary = (node, context) => {
|
|
|
316
339
|
return { status: "unknown", reason: `Unsupported unary ${node.operator}.` };
|
|
317
340
|
};
|
|
318
341
|
const projectValue = (value, projection) => {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return {
|
|
330
|
-
status: current.unknownProperties ? "unknown" : "unknown",
|
|
331
|
-
reason: `Object property ${key} was not observed.`,
|
|
332
|
-
};
|
|
333
|
-
current = property.value;
|
|
334
|
-
}
|
|
335
|
-
else if (current.status === "array") {
|
|
336
|
-
const index = typeof key === "number" ? key : Number(key);
|
|
337
|
-
if (!Number.isSafeInteger(index) ||
|
|
338
|
-
index < 0 ||
|
|
339
|
-
String(index) !== String(key))
|
|
340
|
-
return {
|
|
341
|
-
status: "unknown",
|
|
342
|
-
reason: `Array property ${String(key)} is not a canonical index.`,
|
|
343
|
-
};
|
|
344
|
-
const item = current.items[index];
|
|
345
|
-
if (item === undefined)
|
|
346
|
-
return {
|
|
347
|
-
status: "unknown",
|
|
348
|
-
reason: `Array item ${String(key)} missing.`,
|
|
349
|
-
};
|
|
350
|
-
current = item;
|
|
351
|
-
}
|
|
352
|
-
else
|
|
353
|
-
return {
|
|
354
|
-
status: "unknown",
|
|
355
|
-
reason: `Cannot project ${String(key)} from ${current.status}.`,
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
return current;
|
|
342
|
+
if (projection.includes(null))
|
|
343
|
+
return { status: "unknown", reason: "Cannot project a dynamic property." };
|
|
344
|
+
const path = projection.map((key) => String(key));
|
|
345
|
+
const slot = semanticSlotAtPath(value, path);
|
|
346
|
+
return slot.presence === "present"
|
|
347
|
+
? slot.value
|
|
348
|
+
: {
|
|
349
|
+
status: "unknown",
|
|
350
|
+
reason: `Own property ${path.join("/")} is ${slot.presence}.`,
|
|
351
|
+
};
|
|
359
352
|
};
|
|
360
353
|
const provenanceForBinding = (binding, context) => {
|
|
361
354
|
if (context.bindings.has(binding.bindingId))
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
/** Map-scoped source declaration and its path interpretation for matching. */
|
|
5
|
+
export const javascriptSourceMapReferenceSchema = z.strictObject({
|
|
6
|
+
source_name: z.string(),
|
|
7
|
+
source_root: z.string().nullable(),
|
|
8
|
+
map_path: z.string().min(1),
|
|
9
|
+
resolution: z.discriminatedUnion("kind", [
|
|
10
|
+
z.strictObject({
|
|
11
|
+
kind: z.enum(["artifact-relative", "suffix"]),
|
|
12
|
+
path: z.string().min(1),
|
|
13
|
+
}),
|
|
14
|
+
z.strictObject({
|
|
15
|
+
kind: z.literal("unresolved"),
|
|
16
|
+
reason: z.string().min(1),
|
|
17
|
+
}),
|
|
18
|
+
]),
|
|
19
|
+
});
|
|
20
|
+
/** Interpret a declaration once at the source-map ingestion boundary. */
|
|
21
|
+
export const resolveJavaScriptSourceMapReference = (sourceName, sourceRoot, mapPath) => {
|
|
22
|
+
// TraceMap's producer prefixes sourceRoot before resolving the URL reference.
|
|
23
|
+
const reference = `${sourceRoot ? `${sourceRoot}/` : ""}${sourceName}`;
|
|
24
|
+
return {
|
|
25
|
+
source_name: sourceName,
|
|
26
|
+
source_root: sourceRoot,
|
|
27
|
+
map_path: mapPath,
|
|
28
|
+
resolution: resolveJavaScriptSourceMapPath(reference, mapPath),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** Resolve a source-map URL reference without changing its recorded identity. */
|
|
32
|
+
const resolveJavaScriptSourceMapPath = (source, mapPath) => {
|
|
33
|
+
const portable = source.replaceAll("\\", "/");
|
|
34
|
+
const windowsPath = /^[a-z]:\//iu.test(portable) || source.startsWith("\\\\");
|
|
35
|
+
// Preserve parent traversal rather than letting URL resolution clamp at '/'.
|
|
36
|
+
const anchor = `/${"source/".repeat(portable.split("/").length + 1)}`;
|
|
37
|
+
const directory = posix.join(anchor, posix.dirname(mapPath.replaceAll("\\", "/")));
|
|
38
|
+
const base = pathToFileURL(`${directory}/`, { windows: false });
|
|
39
|
+
const absolute = windowsPath ? windowsFileUrl(source) : URL.parse(source);
|
|
40
|
+
const resolved = windowsPath ? absolute : URL.parse(source, base);
|
|
41
|
+
if (resolved === null)
|
|
42
|
+
return {
|
|
43
|
+
kind: "unresolved",
|
|
44
|
+
reason: "Source reference is not a valid URL or filesystem path.",
|
|
45
|
+
};
|
|
46
|
+
if (!resolved.pathname.startsWith("/"))
|
|
47
|
+
return {
|
|
48
|
+
kind: "unresolved",
|
|
49
|
+
reason: "Source reference uses a non-hierarchical URL without a file pathname.",
|
|
50
|
+
};
|
|
51
|
+
if (resolved.pathname.endsWith("/"))
|
|
52
|
+
return {
|
|
53
|
+
kind: "unresolved",
|
|
54
|
+
reason: "Source reference names a directory rather than a file.",
|
|
55
|
+
};
|
|
56
|
+
// Encoded separators must not manufacture a different filesystem hierarchy.
|
|
57
|
+
if (/%(?:2f|5c)/iu.test(resolved.pathname))
|
|
58
|
+
return {
|
|
59
|
+
kind: "unresolved",
|
|
60
|
+
reason: "Source reference contains an encoded path separator.",
|
|
61
|
+
};
|
|
62
|
+
const relative = absolute === null
|
|
63
|
+
? !portable.startsWith("/")
|
|
64
|
+
: absolute.href !== resolved.href;
|
|
65
|
+
const path = decodedUrlPath(resolved);
|
|
66
|
+
if (path === null)
|
|
67
|
+
return {
|
|
68
|
+
kind: "unresolved",
|
|
69
|
+
reason: "Source reference has malformed URL encoding or an invalid file URL.",
|
|
70
|
+
};
|
|
71
|
+
const value = relative
|
|
72
|
+
? posix.relative(anchor, path)
|
|
73
|
+
: path.replace(/^\/+/, "");
|
|
74
|
+
if (value === "" || value === ".." || value.startsWith("../"))
|
|
75
|
+
return {
|
|
76
|
+
kind: "unresolved",
|
|
77
|
+
reason: "Source reference resolves outside the inventoried artifact.",
|
|
78
|
+
};
|
|
79
|
+
return { path: value, kind: relative ? "artifact-relative" : "suffix" };
|
|
80
|
+
};
|
|
81
|
+
const windowsFileUrl = (path) => {
|
|
82
|
+
try {
|
|
83
|
+
return pathToFileURL(path, { windows: true });
|
|
84
|
+
}
|
|
85
|
+
catch (cause) {
|
|
86
|
+
if (cause instanceof TypeError)
|
|
87
|
+
return null;
|
|
88
|
+
throw cause;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const decodedUrlPath = (url) => {
|
|
92
|
+
try {
|
|
93
|
+
if (url.protocol === "file:")
|
|
94
|
+
return fileURLToPath(url, {
|
|
95
|
+
windows: url.hostname !== "" && url.hostname !== "localhost",
|
|
96
|
+
}).replaceAll("\\", "/");
|
|
97
|
+
return `${url.host}${decodeURIComponent(url.pathname)}`;
|
|
98
|
+
}
|
|
99
|
+
catch (cause) {
|
|
100
|
+
if (cause instanceof URIError || cause instanceof TypeError)
|
|
101
|
+
return null;
|
|
102
|
+
throw cause;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { sanitizeEndpointCandidate } from "../browserObservation.js";
|
|
3
3
|
import { addFindingOnce, addLocatedFinding, } from "./javascriptStaticAnalysisFindings.js";
|
|
4
|
-
import { STATIC_ROUTE_CALL_NAMES, argumentValue, calleeName, endpointArgument as endpointArgumentHelper, prefixedArgument,
|
|
4
|
+
import { STATIC_ROUTE_CALL_NAMES, argumentValue, calleeName, endpointArgument as endpointArgumentHelper, prefixedArgument, range, rangeForOffsets, sourceSlice, staticPath, staticPathResolutionContext, storageKind, stringValue, } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
|
+
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
5
6
|
/** Inspect one call or new expression for references, endpoints, storage, and roles. */
|
|
6
7
|
export const inspectCall = (source, node, context) => {
|
|
7
8
|
const { accumulator } = context;
|
|
@@ -4,7 +4,6 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
import * as t from "@babel/types";
|
|
5
5
|
import { readExactJavaScriptLiteral, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
6
6
|
import { compareCodePoints } from "../canonicalOrdering.js";
|
|
7
|
-
export { propertyName, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
8
7
|
/** Explicit result for source text that Babel cannot parse. */
|
|
9
8
|
export const failedJavaScriptStaticAnalysis = () => ({
|
|
10
9
|
parse_status: "failed",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { compareCodePoints, uniqueSorted } from "../canonicalOrdering.js";
|
|
2
2
|
import { absenceClaimable, canonicalDigest } from "../comparisonSemantics.js";
|
|
3
3
|
import { SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS, sourceToBundleComparisonResultSchema, } from "./sourceToBundleComparisonSchemas.js";
|
|
4
|
-
import { buildSourceToBundleCandidateIndex, candidateIdsForSource, historicalSourceFiles, scoreSourceToBundleCandidate, sourceBearingNodes, } from "./sourceToBundleSignals.js";
|
|
4
|
+
import { buildSourceToBundleCandidateIndex, candidateHasDigest, candidateIdsForSource, historicalSourceFiles, scoreSourceToBundleCandidate, sourceBearingNodes, } from "./sourceToBundleSignals.js";
|
|
5
5
|
/** Compare historical source files to static source-bearing application nodes. */
|
|
6
6
|
export const compareSourceToBundle = (input) => {
|
|
7
7
|
const projection = projectComparison(input);
|
|
@@ -63,7 +63,7 @@ const compareMappings = (input, projection) => {
|
|
|
63
63
|
.map((nodeId) => scoreSourceToBundleCandidate(source, nodeId, projection.index))
|
|
64
64
|
.filter((candidate) => candidate !== null)
|
|
65
65
|
.sort(compareCandidates);
|
|
66
|
-
const classification = classifyMapping(scored, projection.absenceComplete);
|
|
66
|
+
const classification = classifyMapping(scored, projection.absenceComplete, (nodeId) => source.sha256 !== null && candidateHasDigest(projection.index, nodeId));
|
|
67
67
|
const semantic = {
|
|
68
68
|
source_path: source.path,
|
|
69
69
|
source_sha256: source.sha256,
|
|
@@ -103,7 +103,7 @@ const scoringModel = () => ({
|
|
|
103
103
|
weight,
|
|
104
104
|
})),
|
|
105
105
|
});
|
|
106
|
-
const classifyMapping = (candidates, absenceComplete) => {
|
|
106
|
+
const classifyMapping = (candidates, absenceComplete, digestComparable) => {
|
|
107
107
|
const exact = candidates.filter((candidate) => hasSignal(candidate, "exact-source-digest"));
|
|
108
108
|
if (exact.length === 1)
|
|
109
109
|
return {
|
|
@@ -134,6 +134,15 @@ const classifyMapping = (candidates, absenceComplete) => {
|
|
|
134
134
|
: pathCandidates.filter(({ score }) => score === topScore);
|
|
135
135
|
if (topPathCandidates.length === 1) {
|
|
136
136
|
const candidate = topPathCandidates[0];
|
|
137
|
+
if (candidate !== undefined && digestComparable(candidate.current_node_id))
|
|
138
|
+
return {
|
|
139
|
+
status: "modified",
|
|
140
|
+
confidence: candidate.confidence === "high" ? "high" : "medium",
|
|
141
|
+
currentNodeIds: [candidate.current_node_id],
|
|
142
|
+
limitations: [
|
|
143
|
+
"Location evidence links the source to the current node, but their source digests differ.",
|
|
144
|
+
],
|
|
145
|
+
};
|
|
137
146
|
return {
|
|
138
147
|
status: "unknown",
|
|
139
148
|
confidence: "unknown",
|
|
@@ -39,7 +39,9 @@ export const buildSourceToBundleCandidateIndex = (nodes) => {
|
|
|
39
39
|
for (const digest of projection.digests)
|
|
40
40
|
addIndexValue(byDigest, digest, projection.node.node_id);
|
|
41
41
|
for (const path of projection.paths) {
|
|
42
|
-
for (const suffix of
|
|
42
|
+
for (const suffix of path.allowSuffix
|
|
43
|
+
? pathSuffixes(path.value)
|
|
44
|
+
: [path.value])
|
|
43
45
|
addIndexValue(byPathSuffix, suffix, projection.node.node_id);
|
|
44
46
|
addIndexValue(byBasename, posix.basename(path.value), projection.node.node_id);
|
|
45
47
|
}
|
|
@@ -72,6 +74,8 @@ export const candidateIdsForSource = (source, index) => {
|
|
|
72
74
|
}
|
|
73
75
|
return output;
|
|
74
76
|
};
|
|
77
|
+
/** Whether an indexed candidate carries any content digest to compare. */
|
|
78
|
+
export const candidateHasDigest = (index, nodeId) => (index.nodes.get(nodeId)?.digests.size ?? 0) > 0;
|
|
75
79
|
/** Score one indexed candidate from explicit, caller-visible signals. */
|
|
76
80
|
export const scoreSourceToBundleCandidate = (source, nodeId, index) => {
|
|
77
81
|
const projection = index.nodes.get(nodeId);
|
|
@@ -97,16 +101,26 @@ const projectCurrentNode = (node) => {
|
|
|
97
101
|
if (node.identity.strategy === "source-map-original") {
|
|
98
102
|
if (node.identity.source_sha256 !== null)
|
|
99
103
|
digests.add(node.identity.source_sha256);
|
|
100
|
-
addPath(paths, "source-map-original", node.identity.original_source);
|
|
101
104
|
}
|
|
102
105
|
if (node.identity.strategy === "canonical-path")
|
|
103
106
|
addPath(paths, "canonical-path", node.identity.path);
|
|
104
107
|
for (const observation of node.observations) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
if (node.identity.strategy === "source-map-original") {
|
|
109
|
+
const resolution = observation.source_map_reference?.resolution;
|
|
110
|
+
if (resolution !== undefined && resolution.kind !== "unresolved")
|
|
111
|
+
paths.push({
|
|
112
|
+
kind: "source-map-original",
|
|
113
|
+
value: resolution.path,
|
|
114
|
+
allowSuffix: resolution.kind === "suffix",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const sourceDigest = observation.properties.source_sha256;
|
|
119
|
+
if (typeof sourceDigest === "string" && isDigest(sourceDigest))
|
|
120
|
+
digests.add(sourceDigest);
|
|
121
|
+
for (const key of PATH_PROPERTIES)
|
|
122
|
+
addJsonPath(paths, observation.properties[key]);
|
|
123
|
+
}
|
|
110
124
|
}
|
|
111
125
|
return {
|
|
112
126
|
node,
|
|
@@ -128,7 +142,9 @@ const candidateSignals = (source, current) => {
|
|
|
128
142
|
if (exactPaths.length > 0)
|
|
129
143
|
signals.push(signal("current-path-exact", source.path, exactPaths));
|
|
130
144
|
const suffixPaths = otherPaths
|
|
131
|
-
.filter(({ value }) =>
|
|
145
|
+
.filter(({ value, allowSuffix }) => allowSuffix &&
|
|
146
|
+
value !== source.path &&
|
|
147
|
+
value.endsWith(`/${source.path}`))
|
|
132
148
|
.map(({ value }) => value);
|
|
133
149
|
if (suffixPaths.length > 0)
|
|
134
150
|
signals.push(signal("current-path-suffix", source.path, suffixPaths));
|
|
@@ -161,7 +177,8 @@ const candidateConfidence = (signals) => {
|
|
|
161
177
|
return kinds.has("current-path-suffix") ? "medium" : "low";
|
|
162
178
|
};
|
|
163
179
|
const matchingPaths = (sourcePath, currentPaths) => currentPaths
|
|
164
|
-
.filter(({ value }) => value === sourcePath ||
|
|
180
|
+
.filter(({ value, allowSuffix }) => value === sourcePath ||
|
|
181
|
+
(allowSuffix && value.endsWith(`/${sourcePath}`)))
|
|
165
182
|
.map(({ value }) => value);
|
|
166
183
|
const addJsonPath = (paths, value) => {
|
|
167
184
|
if (typeof value === "string")
|
|
@@ -170,27 +187,38 @@ const addJsonPath = (paths, value) => {
|
|
|
170
187
|
const addPath = (paths, kind, raw) => {
|
|
171
188
|
const value = normalizeCurrentPath(raw);
|
|
172
189
|
if (value !== null)
|
|
173
|
-
paths.push({ kind, value });
|
|
190
|
+
paths.push({ kind, value, allowSuffix: true });
|
|
174
191
|
};
|
|
175
|
-
/** Matches a `scheme://...` URL prefix; bare filesystem paths keep `?`/`#`. */
|
|
176
192
|
const SCHEME_URL = /^[a-z][a-z0-9+.-]*:\/\//iu;
|
|
177
|
-
/** Matches a `scheme://...` URL prefix with any run of slashes, for stripping. */
|
|
178
193
|
const SCHEME_URL_PREFIX = /^[a-z][a-z0-9+.-]*:\/\/+/iu;
|
|
179
194
|
const normalizeCurrentPath = (raw) => {
|
|
180
195
|
const withoutQuery = SCHEME_URL.test(raw)
|
|
181
196
|
? (raw.split(/[?#]/u, 1)[0] ?? "")
|
|
182
197
|
: raw;
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
.replaceAll("\\", "/")
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
198
|
+
const portable = withoutQuery
|
|
199
|
+
.replace(SCHEME_URL_PREFIX, "")
|
|
200
|
+
.replaceAll("\\", "/");
|
|
201
|
+
const parts = [];
|
|
202
|
+
for (const part of portable.split("/")) {
|
|
203
|
+
if (part === "" || part === ".")
|
|
204
|
+
continue;
|
|
205
|
+
if (part === "..") {
|
|
206
|
+
if (parts.length === 0)
|
|
207
|
+
return null;
|
|
208
|
+
parts.pop();
|
|
209
|
+
}
|
|
210
|
+
else
|
|
211
|
+
parts.push(part);
|
|
212
|
+
}
|
|
213
|
+
if (parts.length === 0)
|
|
189
214
|
return null;
|
|
190
215
|
return parts.join("/");
|
|
191
216
|
};
|
|
192
217
|
const uniquePaths = (paths) => [
|
|
193
|
-
...new Map(paths.map((path) => [
|
|
218
|
+
...new Map(paths.map((path) => [
|
|
219
|
+
`${path.kind}\0${path.value}\0${String(path.allowSuffix)}`,
|
|
220
|
+
path,
|
|
221
|
+
])).values(),
|
|
194
222
|
].sort((left, right) => compareCodePoints(`${left.kind}\0${left.value}`, `${right.kind}\0${right.value}`));
|
|
195
223
|
const pathSuffixes = (path) => {
|
|
196
224
|
const parts = path.split("/");
|
package/dist/domain/localPath.js
CHANGED
|
@@ -4,7 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
export const localPathStringSchema = z
|
|
5
5
|
.string()
|
|
6
6
|
.min(1)
|
|
7
|
-
.regex(/^[^\
|
|
7
|
+
.regex(/^[^\u0000]*$/u, "Local filesystem paths cannot contain NUL");
|
|
8
8
|
/** True when the value is an absolute filesystem path on the host platform. */
|
|
9
9
|
export const isAbsoluteLocalPath = (value) => isAbsolute(value);
|
|
10
10
|
/** Test lexical containment on the host platform; callers must resolve symlinks first. */
|
|
@@ -413,7 +413,8 @@ export const managedNativeBoundaryInspectionSchema = z.object({
|
|
|
413
413
|
requires_artifact_sha256: digestSchema,
|
|
414
414
|
requires_mvid: cliMetadataGuidSchema.nullable(),
|
|
415
415
|
}),
|
|
416
|
-
cli_native: z
|
|
416
|
+
cli_native: z
|
|
417
|
+
.object({
|
|
417
418
|
il_only: z.boolean(),
|
|
418
419
|
requires_32bit: z.boolean(),
|
|
419
420
|
strong_name_signed: z.boolean(),
|
|
@@ -421,7 +422,8 @@ export const managedNativeBoundaryInspectionSchema = z.object({
|
|
|
421
422
|
ready_to_run_signature: z.boolean(),
|
|
422
423
|
managed_native_header_rva: z.number().int().min(0).max(0xffff_ffff),
|
|
423
424
|
managed_native_header_size: z.number().int().min(0).max(0xffff_ffff),
|
|
424
|
-
})
|
|
425
|
+
})
|
|
426
|
+
.nullable(),
|
|
425
427
|
module_refs: z.array(managedModuleReferenceSchema),
|
|
426
428
|
pinvoke_imports: z.array(managedNativeImportSchema),
|
|
427
429
|
native_implementations: z.array(managedNativeImplementationSchema),
|
|
@@ -429,8 +431,8 @@ export const managedNativeBoundaryInspectionSchema = z.object({
|
|
|
429
431
|
module_ref_count: z.number().int().min(0),
|
|
430
432
|
pinvoke_import_count: z.number().int().min(0),
|
|
431
433
|
native_implementation_count: z.number().int().min(0),
|
|
432
|
-
ready_to_run: z.boolean(),
|
|
433
|
-
mixed_mode_or_native_header: z.boolean(),
|
|
434
|
+
ready_to_run: z.boolean().nullable(),
|
|
435
|
+
mixed_mode_or_native_header: z.boolean().nullable(),
|
|
434
436
|
}),
|
|
435
437
|
coverage: z.object({
|
|
436
438
|
state: z.enum(["complete", "partial", "unavailable"]),
|
|
@@ -165,18 +165,12 @@ export const managedMemberComparisonResultSchema = z.strictObject({
|
|
|
165
165
|
});
|
|
166
166
|
/** Compare managed members with constrained exact and structural identities. */
|
|
167
167
|
export const compareManagedMembers = (left, right) => {
|
|
168
|
-
const leftCoverage = {
|
|
169
|
-
sourceComplete: left.result.coverage.state === "complete",
|
|
170
|
-
};
|
|
171
|
-
const rightCoverage = {
|
|
172
|
-
sourceComplete: right.result.coverage.state === "complete",
|
|
173
|
-
};
|
|
174
168
|
const { methodMatches, fieldMatches } = keyMembers(left, right);
|
|
175
169
|
const itemContext = {
|
|
176
170
|
leftEvidenceId: left.evidenceId,
|
|
177
171
|
rightEvidenceId: right.evidenceId,
|
|
178
|
-
leftComplete:
|
|
179
|
-
rightComplete:
|
|
172
|
+
leftComplete: left.result.metadata.status === "complete",
|
|
173
|
+
rightComplete: right.result.metadata.status === "complete",
|
|
180
174
|
};
|
|
181
175
|
const methodItems = buildMethodItems(methodMatches, itemContext);
|
|
182
176
|
const fieldItems = buildFieldItems(fieldMatches, itemContext);
|
|
@@ -212,4 +206,3 @@ export const compareManagedMembers = (left, right) => {
|
|
|
212
206
|
};
|
|
213
207
|
return managedMemberComparisonResultSchema.parse(result);
|
|
214
208
|
};
|
|
215
|
-
export { parseManagedMemberEvidence } from "./managedMemberComparisonMatch.js";
|
|
@@ -4,8 +4,6 @@ import { managedNativeBoundaryInspectionSchema, } from "./managedArtifact.js";
|
|
|
4
4
|
import { parseManagedInspectionEvidence } from "./managedInspectionEvidence.js";
|
|
5
5
|
import { managedNativeVerificationResultSchema, } from "./managedNativeVerificationSchemas.js";
|
|
6
6
|
import { buildVerificationResult, collectNativeSymbols, verifyPinvoke, } from "./managedNativeVerificationMatch.js";
|
|
7
|
-
export { managedNativeVerificationInputSchema, } from "./managedNativeVerificationSchemas.js";
|
|
8
|
-
export { managedNativeVerificationResultSchema };
|
|
9
7
|
const sha256 = (value) => {
|
|
10
8
|
const serialized = canonicalize(value);
|
|
11
9
|
if (serialized === undefined)
|
|
@@ -71,16 +71,22 @@ const sameSymbolName = (expected, native) => expected ===
|
|
|
71
71
|
: native.name);
|
|
72
72
|
const normalizeModule = (value) => basename(value)
|
|
73
73
|
.toLowerCase()
|
|
74
|
-
.replace(/^lib/u, "")
|
|
75
74
|
.replace(/\.(dll|dylib|so|node|exe)$/u, "");
|
|
75
|
+
const nativeModuleIdentities = (value) => {
|
|
76
|
+
const filename = basename(value).toLowerCase();
|
|
77
|
+
const stem = normalizeModule(filename);
|
|
78
|
+
const identities = new Set([stem]);
|
|
79
|
+
if (/\.(dylib|so)$/u.test(filename) && stem.startsWith("lib"))
|
|
80
|
+
identities.add(stem.slice("lib".length));
|
|
81
|
+
return identities;
|
|
82
|
+
};
|
|
76
83
|
const moduleCompatible = (scope, symbol) => {
|
|
77
84
|
if (scope === null)
|
|
78
85
|
return true;
|
|
79
86
|
const expected = normalizeModule(scope);
|
|
80
87
|
return [symbol.module_name, symbol.module_path]
|
|
81
88
|
.filter((value) => value !== null)
|
|
82
|
-
.
|
|
83
|
-
.some((value) => value === expected);
|
|
89
|
+
.some((value) => nativeModuleIdentities(value).has(expected));
|
|
84
90
|
};
|
|
85
91
|
const candidateNames = (managed) => {
|
|
86
92
|
const names = new Set([managed.import_name]);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CANONICAL_BASE64_PATTERN } from "../stringPatterns.js";
|
|
2
3
|
const unsignedHex = z.string().regex(/^0x(?:0|[1-9a-f][0-9a-f]{0,15})$/);
|
|
3
4
|
const index = z.number().int().nonnegative();
|
|
4
5
|
const scalar = z.union([z.string(), z.number().int()]);
|
|
5
6
|
const range = z.strictObject({ offset: unsignedHex, bytes: unsignedHex });
|
|
6
|
-
const canonicalBase64 = z
|
|
7
|
-
.string()
|
|
8
|
-
.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?$/);
|
|
7
|
+
const canonicalBase64 = z.string().regex(CANONICAL_BASE64_PATTERN);
|
|
9
8
|
const name = z.strictObject({
|
|
10
9
|
display: z.string(),
|
|
11
10
|
bytes_base64: canonicalBase64.nullable(),
|
|
@@ -71,7 +71,7 @@ const inferredJumpTableSchema = z
|
|
|
71
71
|
dispatch_address: z.string().min(1),
|
|
72
72
|
data_sources: z.array(jumpTableDataSourceSchema),
|
|
73
73
|
mappings: z.array(jumpTableMappingSchema),
|
|
74
|
-
default_targets: z.array(jumpTableDefaultTargetSchema)
|
|
74
|
+
default_targets: z.array(jumpTableDefaultTargetSchema),
|
|
75
75
|
limitations: z.array(z.string()),
|
|
76
76
|
})
|
|
77
77
|
.strict();
|
|
@@ -3,11 +3,11 @@ import { localPathStringSchema } from "../localPath.js";
|
|
|
3
3
|
const hexSchema = z.string().regex(/^0x[0-9a-f]+$/u);
|
|
4
4
|
const nativeString = z
|
|
5
5
|
.string()
|
|
6
|
-
.regex(/^[^\
|
|
6
|
+
.regex(/^[^\u0000]*$/u, "Native launch and breakpoint strings cannot contain NUL");
|
|
7
7
|
/** Objective-C class names and selectors never contain spaces or brackets. */
|
|
8
8
|
const objcName = nativeString
|
|
9
9
|
.min(1)
|
|
10
|
-
.regex(/^[^\s
|
|
10
|
+
.regex(/^[^\s\x5b\x5d]+$/u, "Use the bare name without spaces or brackets");
|
|
11
11
|
const functionBreakpoint = {
|
|
12
12
|
kind: z.literal("function"),
|
|
13
13
|
name: nativeString
|
|
@@ -46,7 +46,9 @@ export const nativeCallObservationInputSchema = z.strictObject({
|
|
|
46
46
|
.record(z
|
|
47
47
|
.string()
|
|
48
48
|
.min(1)
|
|
49
|
-
.regex(/^[^=\
|
|
49
|
+
.regex(/^[^=\u0000]+$/u, "Environment names cannot contain '=' or NUL"), z
|
|
50
|
+
.string()
|
|
51
|
+
.regex(/^[^\u0000]*$/u, "Environment values cannot contain NUL"))
|
|
50
52
|
.default({})
|
|
51
53
|
.describe("Overrides on top of the environment REA runs with."),
|
|
52
54
|
working_directory: localPathStringSchema.optional(),
|
|
@@ -54,6 +54,13 @@ export const nativeInstructionSchema = z.strictObject({
|
|
|
54
54
|
conditional: z.boolean(),
|
|
55
55
|
computed: z.boolean(),
|
|
56
56
|
direct_destinations: z.array(z.string()),
|
|
57
|
+
classification_evidence: z
|
|
58
|
+
.array(z.strictObject({
|
|
59
|
+
source: z.string().min(1),
|
|
60
|
+
value: z.string().min(1),
|
|
61
|
+
}))
|
|
62
|
+
.optional()
|
|
63
|
+
.describe("Observed provider facts used to classify flow; older captures or other providers may omit them."),
|
|
57
64
|
}),
|
|
58
65
|
references: z.array(reference),
|
|
59
66
|
limitations: z.array(z.string()),
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CANONICAL_BASE64_PATTERN } from "../stringPatterns.js";
|
|
2
3
|
import { recordedNoteCoverageIssues } from "./recordedCrashNoteCoverage.js";
|
|
3
4
|
const hex = z.string().regex(/^0x(?:0|[1-9a-f][0-9a-f]{0,15})$/);
|
|
4
5
|
const index = z.number().int().nonnegative();
|
|
5
6
|
const signed32 = z.number().int().min(-2147483648).max(2147483647);
|
|
6
|
-
const base64 = z
|
|
7
|
-
.string()
|
|
8
|
-
.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?$/);
|
|
7
|
+
const base64 = z.string().regex(CANONICAL_BASE64_PATTERN);
|
|
9
8
|
const range = z.strictObject({ offset: hex, bytes: hex });
|
|
10
9
|
const diagnostics = z.strictObject({
|
|
11
10
|
stdout: z.string(),
|