rea-agents 6.3.0 → 6.4.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 -4
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +51 -19
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +22 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +70 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +66 -31
- package/dist/application/DirectAnalysis.js +2 -2
- package/dist/application/DirectAnalysisCleanup.js +1 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +5 -3
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/JsonFiles.js +6 -5
- package/dist/{cliJsonFile.js → application/JsonInputFile.js} +108 -35
- package/dist/application/LinuxHopper.js +4 -12
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +9 -3
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +93 -7
- package/dist/application/Setup.js +54 -6
- package/dist/application/SetupClientConfiguration.js +116 -16
- package/dist/application/SetupHost.js +102 -24
- package/dist/application/SetupPlan.js +5 -8
- package/dist/application/SetupSkill.js +58 -39
- package/dist/application/SupportedClients.js +290 -65
- package/dist/application/Uninstall.js +158 -10
- package/dist/application/UpdateMaintenance.js +17 -21
- package/dist/application/Utf8JsonInput.js +7 -0
- package/dist/application/WebScriptExportService.js +131 -65
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/BinarySession.js +2 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +19 -6
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationService.js +22 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -30
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +67 -19
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +19 -16
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +258 -235
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +115 -26
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -1
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -4
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +199 -61
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +20 -15
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +176 -102
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +29 -22
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +32 -13
- package/dist/artifacts/extraction/ArtifactExtraction.js +110 -86
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +110 -43
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +75 -32
- package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +62 -25
- package/dist/artifacts/inventory/scanReader.js +38 -11
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +15 -9
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +5 -0
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +32 -10
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +60 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +69 -7
- package/dist/browser/PlaywrightScenarioSession.js +127 -54
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +3 -3
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreBinaryCommands.js +0 -5
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +6 -1
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +17 -1
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +11 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/utilityCommands.js +66 -18
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +6 -0
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +2 -2
- package/dist/cliObservationOptions.js +3 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/directAnalysis.js +12 -4
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +10 -10
- package/dist/contracts/javascript/electronToolContracts.js +15 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionToolContracts.js +2 -2
- package/dist/contracts/sessionToolSchemas.js +6 -2
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +5 -3
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -6
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +2 -1
- package/dist/domain/analysisView/analysisView.js +52 -2
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +2 -2
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +35 -7
- package/dist/domain/artifactGraph.js +5 -3
- package/dist/domain/artifactIdentity.js +30 -2
- package/dist/domain/artifactInspection.js +3 -43
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +11 -12
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/evidence.js +2 -1
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -13
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -20
- package/dist/domain/javascript/electronStaticAnalysisNative.js +70 -40
- package/dist/domain/javascript/electronStaticAnalysisValues.js +16 -0
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +6 -6
- package/dist/domain/javascript/javascriptApplicationGraph.js +79 -18
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +58 -31
- package/dist/domain/javascript/javascriptAstValues.js +32 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -1
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +8 -11
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +190 -33
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +42 -41
- package/dist/domain/javascript/javascriptSemanticGraph.js +69 -23
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -10
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +40 -7
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +341 -87
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +7 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +52 -14
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
- package/dist/domain/javascript/javascriptSemanticQuery.js +27 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +13 -23
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +19 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -19
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +8 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonShape.js +63 -52
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/managed/managedApplicationGraph.js +37 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +32 -22
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +91 -1
- package/dist/domain/process/processCaptureExample.js +24 -0
- package/dist/domain/process/processCaptureValidation.js +79 -0
- package/dist/domain/process/processScenario.js +59 -7
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/referenceSourceGraph.js +25 -16
- package/dist/domain/referenceSourceImportParsing.js +6 -3
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/webBundleAnalyzerInspection.js +14 -2
- package/dist/domain/webCaptureDiff.js +102 -4
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +4 -2
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +55 -24
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +33 -1
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +76 -4
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +1 -1
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +80 -39
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +8 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +3 -1
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/NativeMacOSProvider.js +91 -16
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +96 -39
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +28 -4
- package/dist/process/capture/ProcessCaptureLifecycle.js +350 -59
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessHarness.js +194 -26
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +97 -25
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +32 -3
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +49 -18
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +33 -5
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +22 -1
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { failedJavaScriptSemanticIr, } from "./javascriptSemanticIr.js";
|
|
3
|
-
import { collectSemanticModuleLink, collectSemanticCallable, collectSemanticReferences, immutableSemanticBindings, immutableSemanticScopes, } from "./javascriptSemanticProjection.js";
|
|
4
|
-
import { semanticStaticPropertyKey } from "./javascriptAstValues.js";
|
|
5
|
-
import { currentSemanticScope, resolveSemanticBindingState, semanticResolutionBlocked, resolveSemanticBindingFromScope, semanticScopeId, semanticVariableScope, } from "./javascriptSemanticState.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { collectSemanticModuleLink, collectSemanticCallable, collectSemanticReferences, collectSemanticReferencesSteps, immutableSemanticBindings, immutableSemanticScopes, } from "./javascriptSemanticProjection.js";
|
|
4
|
+
import { semanticObjectPatternKeys, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
5
|
+
import { currentSemanticScope, resolveSemanticBindingState, semanticResolutionBlocked, resolveSemanticBindingFromScope, semanticBindingId, semanticScopeId, semanticVariableScope, } from "./javascriptSemanticState.js";
|
|
6
|
+
import { completeSemanticSteps, traverseJavaScriptAstSteps, } from "./javascriptSemanticTraversal.js";
|
|
7
|
+
import { semanticRequireOrigin } from "./javascriptSemanticRequireOrigin.js";
|
|
8
|
+
import { collectSemanticMemberMutationsSteps } from "./javascriptSemanticMemberMutations.js";
|
|
8
9
|
import { collectSemanticReturns, resolveSemanticModuleCallables, } from "./javascriptSemanticReturns.js";
|
|
9
|
-
import {
|
|
10
|
+
import { collectJavaScriptDerivedSemanticsSteps } from "./javascriptSemanticDerivedAnalysis.js";
|
|
11
|
+
import { evaluateSemanticProvenance } from "./javascriptSemanticValues.js";
|
|
12
|
+
import { collectElectronMemberWritesSteps, electronExportPath, electronMemberPath, ELECTRON_MODULE, } from "./javascriptElectronMemberWrites.js";
|
|
10
13
|
import { range } from "./javascriptStaticAnalysisHelpers.js";
|
|
11
14
|
import { propertyName } from "./javascriptAstValues.js";
|
|
12
15
|
import { semanticCoverage } from "./javascriptSemanticCoverage.js";
|
|
13
16
|
import { semanticResourceLimitsIn } from "./javascriptSemanticResourceLimits.js";
|
|
14
17
|
import { parseJavaScriptSource, } from "./javascriptSourceParser.js";
|
|
18
|
+
import { isJavaScriptRpcClientFactory } from "./javascriptRpcEndpoints.js";
|
|
15
19
|
/** Recover lexical bindings, aliases, constants, and module links. */
|
|
16
20
|
export const analyzeJavaScriptSemantics = (source) => {
|
|
17
21
|
const file = parseJavaScriptSource(source);
|
|
@@ -22,23 +26,33 @@ export const analyzeJavaScriptSemantics = (source) => {
|
|
|
22
26
|
/** Recover lexical references, optionally for one name, without evaluating values or provenance. */
|
|
23
27
|
export const analyzeParsedJavaScriptReferences = (file, name) => {
|
|
24
28
|
const state = createState(file.program);
|
|
25
|
-
|
|
29
|
+
completeSemanticSteps(collectDefinitionsSteps(file.program, state));
|
|
26
30
|
return collectSemanticReferences(file.program, state, name);
|
|
27
31
|
};
|
|
28
32
|
/** Recover semantics from an already parsed JavaScript artifact. */
|
|
29
|
-
export const analyzeParsedJavaScriptSemantics = (file) =>
|
|
33
|
+
export const analyzeParsedJavaScriptSemantics = (file) => completeSemanticSteps(analyzeParsedJavaScriptSemanticsSteps(file));
|
|
34
|
+
/**
|
|
35
|
+
* Recover semantics from a parsed artifact with a yield between analysis
|
|
36
|
+
* phases, so a caller can serve control messages within one large file.
|
|
37
|
+
* Each phase completes before the next starts; results equal the synchronous
|
|
38
|
+
* form.
|
|
39
|
+
*/
|
|
40
|
+
export function* analyzeParsedJavaScriptSemanticsSteps(file) {
|
|
30
41
|
const state = createState(file.program);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
yield* collectDefinitionsSteps(file.program, state);
|
|
43
|
+
yield* collectSemanticMemberMutationsSteps(file.program, state);
|
|
44
|
+
yield* traverseJavaScriptAstSteps(file.program, {
|
|
34
45
|
enter: (node) => collectSemanticModuleLink(node, state),
|
|
35
46
|
});
|
|
36
|
-
|
|
47
|
+
yield;
|
|
48
|
+
const references = yield* collectSemanticReferencesSteps(file.program, state);
|
|
37
49
|
const parserPartial = file.errors.length > 0;
|
|
38
50
|
const bindings = immutableSemanticBindings(state);
|
|
51
|
+
yield;
|
|
39
52
|
const callables = collectSemanticReturns(file.program, state, parserPartial);
|
|
53
|
+
yield;
|
|
40
54
|
const moduleLinks = resolveSemanticModuleCallables(state, callables);
|
|
41
|
-
const derived =
|
|
55
|
+
const derived = yield* collectJavaScriptDerivedSemanticsSteps(file.program, state, callables, parserPartial);
|
|
42
56
|
return {
|
|
43
57
|
schema: "JavaScriptSemanticIR",
|
|
44
58
|
scopes: immutableSemanticScopes(state),
|
|
@@ -64,17 +78,53 @@ export const analyzeParsedJavaScriptSemantics = (file) => {
|
|
|
64
78
|
"Cross-function mutation and dynamic property resolution remain unknown.",
|
|
65
79
|
],
|
|
66
80
|
};
|
|
67
|
-
}
|
|
81
|
+
}
|
|
82
|
+
/** Resolve tRPC client roots by lexical identity, excluding overwritten bindings. */
|
|
83
|
+
export function* classifyParsedJavaScriptRpcClientRootsSteps(file) {
|
|
84
|
+
const state = createState(file.program);
|
|
85
|
+
yield* collectDefinitionsSteps(file.program, state);
|
|
86
|
+
const roots = new Set();
|
|
87
|
+
const clients = new Map();
|
|
88
|
+
yield* traverseJavaScriptAstSteps(file.program, {
|
|
89
|
+
enter: (node) => {
|
|
90
|
+
if (!t.isMemberExpression(node) && !t.isOptionalMemberExpression(node))
|
|
91
|
+
return;
|
|
92
|
+
const root = node.object;
|
|
93
|
+
if (!t.isIdentifier(root))
|
|
94
|
+
return;
|
|
95
|
+
const binding = resolveSemanticBindingState(state, root, root.name);
|
|
96
|
+
if (binding === undefined)
|
|
97
|
+
return;
|
|
98
|
+
let client = clients.get(binding.bindingId);
|
|
99
|
+
if (client === undefined) {
|
|
100
|
+
const [initializer] = binding.initializers;
|
|
101
|
+
client =
|
|
102
|
+
initializer !== undefined &&
|
|
103
|
+
initializer.projection.length === 0 &&
|
|
104
|
+
binding.initializers.length === 1 &&
|
|
105
|
+
!binding.definitions.some(({ kind }) => kind === "assignment") &&
|
|
106
|
+
!state.conditionalInitializers.has(initializer.node) &&
|
|
107
|
+
isJavaScriptRpcClientFactory(initializer.node);
|
|
108
|
+
clients.set(binding.bindingId, client);
|
|
109
|
+
}
|
|
110
|
+
if (client)
|
|
111
|
+
roots.add(root);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
return roots;
|
|
115
|
+
}
|
|
68
116
|
/**
|
|
69
117
|
* Resolve only the lexical receiver identity needed to distinguish browser
|
|
70
118
|
* `window.open` from XHR and global storage `.open` calls. This deliberately
|
|
71
119
|
* builds definitions without running semantic value or provenance analysis.
|
|
72
120
|
*/
|
|
73
|
-
export const classifyParsedJavaScriptOpenReceivers = (file) =>
|
|
121
|
+
export const classifyParsedJavaScriptOpenReceivers = (file) => completeSemanticSteps(classifyParsedJavaScriptOpenReceiversSteps(file));
|
|
122
|
+
/** Classify `.open` receivers while yielding during lexical and AST scans. */
|
|
123
|
+
export function* classifyParsedJavaScriptOpenReceiversSteps(file) {
|
|
74
124
|
const state = createState(file.program);
|
|
75
|
-
|
|
125
|
+
yield* collectDefinitionsSteps(file.program, state);
|
|
76
126
|
const facts = new Map();
|
|
77
|
-
|
|
127
|
+
yield* traverseJavaScriptAstSteps(file.program, {
|
|
78
128
|
enter: (node) => {
|
|
79
129
|
if ((!t.isCallExpression(node) && !t.isOptionalCallExpression(node)) ||
|
|
80
130
|
(!t.isMemberExpression(node.callee) &&
|
|
@@ -133,7 +183,7 @@ export const classifyParsedJavaScriptOpenReceivers = (file) => {
|
|
|
133
183
|
},
|
|
134
184
|
});
|
|
135
185
|
return facts;
|
|
136
|
-
}
|
|
186
|
+
}
|
|
137
187
|
const openGlobalFact = (name) => {
|
|
138
188
|
if (name === "window" ||
|
|
139
189
|
name === "self" ||
|
|
@@ -156,6 +206,95 @@ const resolveGlobalAliasFact = (state, node, name) => {
|
|
|
156
206
|
return undefined;
|
|
157
207
|
return openGlobalFact(name);
|
|
158
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Proven Electron export path segments for call and construction roots, keyed by
|
|
211
|
+
* root offset. Only proven Electron origins are present; callers must not
|
|
212
|
+
* infer an Electron export from an absent entry or familiar local name.
|
|
213
|
+
*/
|
|
214
|
+
export const classifyParsedJavaScriptElectronBindings = (file) => completeSemanticSteps(classifyParsedJavaScriptElectronBindingsSteps(file));
|
|
215
|
+
/** Resolve Electron aliases while yielding during lexical and AST scans. */
|
|
216
|
+
export function* classifyParsedJavaScriptElectronBindingsSteps(file) {
|
|
217
|
+
const facts = new Map();
|
|
218
|
+
const state = createState(file.program);
|
|
219
|
+
yield* collectDefinitionsSteps(file.program, state);
|
|
220
|
+
const exportsByBinding = new Map();
|
|
221
|
+
const rootExport = (root) => {
|
|
222
|
+
if (t.isIdentifier(root)) {
|
|
223
|
+
if (semanticResolutionBlocked(state, root, root.name))
|
|
224
|
+
return undefined;
|
|
225
|
+
const binding = resolveSemanticBindingState(state, root, root.name);
|
|
226
|
+
if (binding === undefined)
|
|
227
|
+
return undefined;
|
|
228
|
+
let exported = exportsByBinding.get(binding.bindingId);
|
|
229
|
+
if (exported === undefined) {
|
|
230
|
+
exported = electronExport(binding, state);
|
|
231
|
+
exportsByBinding.set(binding.bindingId, exported);
|
|
232
|
+
}
|
|
233
|
+
return exported ?? undefined;
|
|
234
|
+
}
|
|
235
|
+
const origin = semanticRequireOrigin(root, state);
|
|
236
|
+
return origin !== undefined && ELECTRON_MODULE.test(origin.specifier)
|
|
237
|
+
? electronExportPath(origin.importedPath)
|
|
238
|
+
: undefined;
|
|
239
|
+
};
|
|
240
|
+
const writes = yield* collectElectronMemberWritesSteps(file.program, rootExport);
|
|
241
|
+
yield* traverseJavaScriptAstSteps(file.program, {
|
|
242
|
+
enter: (node) => {
|
|
243
|
+
if (!t.isCallExpression(node) &&
|
|
244
|
+
!t.isOptionalCallExpression(node) &&
|
|
245
|
+
!t.isNewExpression(node))
|
|
246
|
+
return;
|
|
247
|
+
const { root, members } = electronMemberPath(node.callee);
|
|
248
|
+
const exported = rootExport(root);
|
|
249
|
+
if (exported !== undefined && !writes.covers([...exported, ...members]))
|
|
250
|
+
facts.set(root.start ?? -1, exported);
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
return facts;
|
|
254
|
+
}
|
|
255
|
+
// Read import and require origins directly; general value evaluation is
|
|
256
|
+
// unnecessary here and costly across large vendor bundles.
|
|
257
|
+
const electronExport = (binding, state) => {
|
|
258
|
+
if (binding.definitions.some(({ kind }) => kind === "assignment"))
|
|
259
|
+
return null;
|
|
260
|
+
const directOrigin = bindingOrigin(binding, state);
|
|
261
|
+
const [initializer] = binding.initializers;
|
|
262
|
+
if (directOrigin === undefined &&
|
|
263
|
+
(initializer === undefined ||
|
|
264
|
+
binding.initializers.length !== 1 ||
|
|
265
|
+
state.conditionalInitializers.has(initializer.node)))
|
|
266
|
+
return null;
|
|
267
|
+
const provenance = directOrigin === undefined
|
|
268
|
+
? evaluateSemanticProvenance(binding, state)
|
|
269
|
+
: undefined;
|
|
270
|
+
const origin = directOrigin ??
|
|
271
|
+
(provenance?.status === "module" && provenance.origins.length === 1
|
|
272
|
+
? provenance.origins[0]
|
|
273
|
+
: undefined);
|
|
274
|
+
return origin !== undefined && ELECTRON_MODULE.test(origin.specifier)
|
|
275
|
+
? electronExportPath(origin.importedPath)
|
|
276
|
+
: null;
|
|
277
|
+
};
|
|
278
|
+
const bindingOrigin = (binding, state) => {
|
|
279
|
+
if (binding.directOrigins.length > 0)
|
|
280
|
+
return binding.directOrigins.length === 1
|
|
281
|
+
? binding.directOrigins[0]
|
|
282
|
+
: undefined;
|
|
283
|
+
const [initializer] = binding.initializers;
|
|
284
|
+
// A var/let declaration permits writes without proving one occurred.
|
|
285
|
+
// Require one unconditional initializer and no actual binding writes.
|
|
286
|
+
if (initializer === undefined ||
|
|
287
|
+
binding.initializers.length !== 1 ||
|
|
288
|
+
binding.definitions.some(({ kind }) => kind === "assignment") ||
|
|
289
|
+
state.conditionalInitializers.has(initializer.node))
|
|
290
|
+
return undefined;
|
|
291
|
+
const origin = semanticRequireOrigin(initializer.node, state);
|
|
292
|
+
const projection = initializer.projection;
|
|
293
|
+
return origin === undefined ||
|
|
294
|
+
!projection.every((key) => typeof key === "string")
|
|
295
|
+
? undefined
|
|
296
|
+
: { ...origin, importedPath: [...origin.importedPath, ...projection] };
|
|
297
|
+
};
|
|
159
298
|
const createState = (program) => {
|
|
160
299
|
const root = {
|
|
161
300
|
scopeId: semanticScopeId("program", program),
|
|
@@ -178,15 +317,17 @@ const createState = (program) => {
|
|
|
178
317
|
conditionalInitializers: new WeakSet(),
|
|
179
318
|
};
|
|
180
319
|
};
|
|
181
|
-
|
|
320
|
+
function* collectDefinitionsSteps(program, state) {
|
|
182
321
|
const stack = [
|
|
183
322
|
currentSemanticScope(state.scopes),
|
|
184
323
|
];
|
|
185
324
|
const openedScopes = new WeakMap();
|
|
186
325
|
const assignments = [];
|
|
187
326
|
const functionBodies = [];
|
|
188
|
-
|
|
327
|
+
yield* traverseJavaScriptAstSteps(program, {
|
|
189
328
|
enter: (node, parent, readAncestors) => {
|
|
329
|
+
if (parent !== null)
|
|
330
|
+
state.parentsByNode.set(node, parent);
|
|
190
331
|
let parentScope = currentSemanticScope(stack);
|
|
191
332
|
if (parent !== null &&
|
|
192
333
|
(t.isObjectMethod(parent) || t.isClassMethod(parent)) &&
|
|
@@ -232,7 +373,10 @@ const collectDefinitions = (program, state) => {
|
|
|
232
373
|
});
|
|
233
374
|
}
|
|
234
375
|
const scope = currentSemanticScope(stack);
|
|
235
|
-
|
|
376
|
+
// Other nodes inherit the nearest boundary through their AST parents.
|
|
377
|
+
// Avoid a second full-tree index for the same lexical relationship.
|
|
378
|
+
if (parent === null || openedScopes.has(node))
|
|
379
|
+
state.scopeByNode.set(node, scope);
|
|
236
380
|
collectSemanticCallable({
|
|
237
381
|
node,
|
|
238
382
|
parent,
|
|
@@ -260,13 +404,19 @@ const collectDefinitions = (program, state) => {
|
|
|
260
404
|
});
|
|
261
405
|
// All declarations must exist before resolving writes, including hoisted
|
|
262
406
|
// functions and local declarations that shadow an outer binding.
|
|
263
|
-
for (const { node, scope } of assignments)
|
|
407
|
+
for (const [index, { node, scope }] of assignments.entries()) {
|
|
408
|
+
if (index % 64 === 0)
|
|
409
|
+
yield;
|
|
264
410
|
bindAssignment(node, scope, state);
|
|
265
|
-
|
|
411
|
+
}
|
|
412
|
+
for (const [index, { body, scope, parameters }] of functionBodies.entries()) {
|
|
413
|
+
if (index % 64 === 0)
|
|
414
|
+
yield;
|
|
266
415
|
for (const parameter of parameters)
|
|
267
416
|
for (const identifier of assignedPatternIdentifiers(t.isTSParameterProperty(parameter) ? parameter.parameter : parameter))
|
|
268
417
|
copyParameterToBody({ identifier, body, scope, state });
|
|
269
|
-
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
270
420
|
const copyParameterToBody = (input) => {
|
|
271
421
|
const { identifier, body, scope, state } = input;
|
|
272
422
|
const binding = scope.bindings.get(identifier.name);
|
|
@@ -383,9 +533,21 @@ const bindAssignment = (node, scope, state) => {
|
|
|
383
533
|
else if (t.isForOfStatement(node) || t.isForInStatement(node))
|
|
384
534
|
for (const pattern of t.isVariableDeclaration(node.left)
|
|
385
535
|
? node.left.declarations.map(({ id }) => id)
|
|
386
|
-
: [node.left])
|
|
536
|
+
: [node.left]) {
|
|
387
537
|
for (const identifier of assignedPatternIdentifiers(pattern))
|
|
388
538
|
addAssignment(identifier, node, scope, state);
|
|
539
|
+
if (t.isForOfStatement(node))
|
|
540
|
+
// Keep the loop value unknown, but preserve references yielded into
|
|
541
|
+
// each bound slot so writes/escapes can reach their iterable origins.
|
|
542
|
+
bindPattern({
|
|
543
|
+
pattern,
|
|
544
|
+
initializer: node,
|
|
545
|
+
scope,
|
|
546
|
+
state,
|
|
547
|
+
mutable: true,
|
|
548
|
+
referenceOnly: true,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
389
551
|
};
|
|
390
552
|
const assignedPatternIdentifiers = (pattern) => {
|
|
391
553
|
const identifiers = [];
|
|
@@ -564,7 +726,7 @@ const bindPattern = (input) => {
|
|
|
564
726
|
}
|
|
565
727
|
if (t.isIdentifier(pattern)) {
|
|
566
728
|
if (referenceOnly) {
|
|
567
|
-
const binding = scope
|
|
729
|
+
const binding = resolveSemanticBindingFromScope(scope, pattern.name, state);
|
|
568
730
|
if (binding !== undefined && initializer !== null)
|
|
569
731
|
binding.referenceInitializers.push({
|
|
570
732
|
node: initializer,
|
|
@@ -647,12 +809,7 @@ const bindPattern = (input) => {
|
|
|
647
809
|
referenceOnly: true,
|
|
648
810
|
copyKind: "object-rest",
|
|
649
811
|
copyProjectionOffset: projection.length,
|
|
650
|
-
copyExcludedKeys: pattern
|
|
651
|
-
if (t.isRestElement(property))
|
|
652
|
-
return [];
|
|
653
|
-
const key = semanticStaticPropertyKey(property.key, property.computed);
|
|
654
|
-
return key === null ? [] : [key];
|
|
655
|
-
}),
|
|
812
|
+
copyExcludedKeys: semanticObjectPatternKeys(pattern),
|
|
656
813
|
});
|
|
657
814
|
}
|
|
658
815
|
else {
|
|
@@ -703,7 +860,7 @@ const addBinding = (input) => {
|
|
|
703
860
|
binding.directOrigins.push(directOrigin);
|
|
704
861
|
};
|
|
705
862
|
const createBinding = (scope, name, kind, mutable) => ({
|
|
706
|
-
bindingId:
|
|
863
|
+
bindingId: semanticBindingId(scope.scopeId, name),
|
|
707
864
|
scopeId: scope.scopeId,
|
|
708
865
|
name,
|
|
709
866
|
kind,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
import { childNodes } from "./javascriptSemanticTraversal.js";
|
|
3
|
+
/** Collect direct result syntax without executing or evaluating a callable. */
|
|
4
|
+
export const semanticCallableResultExpressions = (callable) => {
|
|
5
|
+
if (t.isArrowFunctionExpression(callable) &&
|
|
6
|
+
!t.isBlockStatement(callable.body))
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
node: callable.body,
|
|
10
|
+
site: callable.body,
|
|
11
|
+
kind: "return",
|
|
12
|
+
delegated: false,
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
if (!t.isFunction(callable))
|
|
16
|
+
return [];
|
|
17
|
+
const output = [];
|
|
18
|
+
const pending = childNodes(callable.body).reverse();
|
|
19
|
+
while (pending.length > 0) {
|
|
20
|
+
const node = pending.pop();
|
|
21
|
+
if (node === undefined || t.isFunction(node) || t.isClass(node))
|
|
22
|
+
continue;
|
|
23
|
+
if (t.isReturnStatement(node)) {
|
|
24
|
+
output.push({
|
|
25
|
+
node: node.argument ?? null,
|
|
26
|
+
site: node,
|
|
27
|
+
kind: "return",
|
|
28
|
+
delegated: false,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (t.isYieldExpression(node))
|
|
32
|
+
output.push({
|
|
33
|
+
node: node.argument ?? null,
|
|
34
|
+
site: node,
|
|
35
|
+
kind: "yield",
|
|
36
|
+
delegated: node.delegate,
|
|
37
|
+
});
|
|
38
|
+
for (const child of childNodes(node).reverse())
|
|
39
|
+
pending.push(child);
|
|
40
|
+
}
|
|
41
|
+
return output;
|
|
42
|
+
};
|
|
@@ -262,4 +262,11 @@ const bindingIsWithinCallable = (binding, bodyScopeId, state) => {
|
|
|
262
262
|
return false;
|
|
263
263
|
};
|
|
264
264
|
const enclosingFunction = (stack) => stack.findLast(({ kind }) => kind !== "class");
|
|
265
|
-
const semanticCallSiteId = (node) =>
|
|
265
|
+
const semanticCallSiteId = (node) =>
|
|
266
|
+
// Join once so retained IDs do not keep a chain of intermediate strings.
|
|
267
|
+
[
|
|
268
|
+
"call",
|
|
269
|
+
t.isNewExpression(node) ? "construct" : "call",
|
|
270
|
+
String(node.start ?? -1),
|
|
271
|
+
String(node.end ?? -1),
|
|
272
|
+
].join(":");
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import { collectJavaScriptSemanticAsyncEffects } from "./javascriptSemanticAsyncEffects.js";
|
|
2
2
|
import { collectJavaScriptSemanticCalls } from "./javascriptSemanticCalls.js";
|
|
3
3
|
import { collectJavaScriptSemanticChildProcesses } from "./javascriptSemanticChildProcesses.js";
|
|
4
|
-
import {
|
|
4
|
+
import { collectJavaScriptSemanticFingerprintsSteps } from "./javascriptSemanticFingerprints.js";
|
|
5
5
|
import { collectJavaScriptSemanticDataEffects } from "./javascriptSemanticDataEffects.js";
|
|
6
6
|
import { collectJavaScriptSemanticPromises } from "./javascriptSemanticPromises.js";
|
|
7
7
|
import { collectJavaScriptSemanticObjects } from "./javascriptSemanticObjects.js";
|
|
8
8
|
import { collectJavaScriptSemanticResources } from "./javascriptSemanticResources.js";
|
|
9
9
|
/** Compose bounded semantic passes after lexical definitions are available. */
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Collect derived semantics with a yield between collectors. Each collector
|
|
12
|
+
* completes before the next starts, so results equal the synchronous form.
|
|
13
|
+
*/
|
|
14
|
+
export function* collectJavaScriptDerivedSemanticsSteps(program, state, callables, parserPartial) {
|
|
11
15
|
const calls = collectJavaScriptSemanticCalls(program, state, callables);
|
|
16
|
+
yield;
|
|
12
17
|
const promiseOperations = collectJavaScriptSemanticPromises(program, state, callables);
|
|
18
|
+
yield;
|
|
13
19
|
const asyncEffects = collectJavaScriptSemanticAsyncEffects(program, state, callables);
|
|
20
|
+
yield;
|
|
14
21
|
const childProcesses = collectJavaScriptSemanticChildProcesses(program, state, callables);
|
|
22
|
+
yield;
|
|
15
23
|
const dataEffects = collectJavaScriptSemanticDataEffects(program, state, callables);
|
|
24
|
+
yield;
|
|
16
25
|
const resourceOperations = collectJavaScriptSemanticResources(program, state, callables);
|
|
26
|
+
yield;
|
|
17
27
|
const objectOperations = collectJavaScriptSemanticObjects(program, state, callables);
|
|
18
|
-
|
|
28
|
+
yield;
|
|
29
|
+
const functionFingerprints = yield* collectJavaScriptSemanticFingerprintsSteps({
|
|
19
30
|
state,
|
|
20
31
|
callables,
|
|
21
32
|
calls,
|
|
@@ -38,4 +49,4 @@ export const collectJavaScriptDerivedSemantics = (program, state, callables, par
|
|
|
38
49
|
objectOperations,
|
|
39
50
|
functionFingerprints,
|
|
40
51
|
};
|
|
41
|
-
}
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,9 +2,9 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
3
|
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
4
4
|
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
|
|
5
|
-
import {
|
|
6
|
-
/** Build bounded rename- and formatting-resistant components per callable. */
|
|
7
|
-
export
|
|
5
|
+
import { traverseJavaScriptAstSteps } from "./javascriptSemanticTraversal.js";
|
|
6
|
+
/** Build bounded rename- and formatting-resistant components per callable, yielding between callables. */
|
|
7
|
+
export function* collectJavaScriptSemanticFingerprintsSteps(input) {
|
|
8
8
|
const { state, callables, calls, promises, events, timers, childProcessSpawns, childProcessInteractions, requestOperations, resourceOperations, parserPartial, } = input;
|
|
9
9
|
const callSitesByCaller = groupByOwner(calls.callSites, ({ callerCallableId }) => callerCallableId);
|
|
10
10
|
const captureCountByCallable = countByOwner(calls.closureCaptures, ({ callableId }) => callableId);
|
|
@@ -14,53 +14,54 @@ export const collectJavaScriptSemanticFingerprints = (input) => {
|
|
|
14
14
|
const childProcessEffectsByOwner = groupByOwner([...childProcessSpawns, ...childProcessInteractions], ownerId);
|
|
15
15
|
const networkEffectsByOwner = groupByOwner(requestOperations, ownerId);
|
|
16
16
|
const resourceEffectsByOwner = groupByOwner(resourceOperations, ownerId);
|
|
17
|
-
|
|
17
|
+
const fingerprints = [];
|
|
18
|
+
for (const callable of callables) {
|
|
18
19
|
if (callable.kind === "class")
|
|
19
|
-
|
|
20
|
+
continue;
|
|
20
21
|
const node = state.callableNodesById.get(callable.callableId);
|
|
21
22
|
if (node === undefined)
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
continue;
|
|
24
|
+
yield;
|
|
25
|
+
const syntax = yield* fingerprintSyntaxSteps(node, callable.callableId);
|
|
24
26
|
const promiseEffects = promiseEffectsByOwner.get(callable.callableId) ?? [];
|
|
25
27
|
const eventEffects = eventEffectsByOwner.get(callable.callableId) ?? [];
|
|
26
28
|
const timerEffects = timerEffectsByOwner.get(callable.callableId) ?? [];
|
|
27
29
|
const childProcessEffects = childProcessEffectsByOwner.get(callable.callableId) ?? [];
|
|
28
30
|
const networkEffects = networkEffectsByOwner.get(callable.callableId) ?? [];
|
|
29
31
|
const resourceEffects = resourceEffectsByOwner.get(callable.callableId) ?? [];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
? ["child-process"]
|
|
46
|
-
: []),
|
|
47
|
-
...(eventEffects.length > 0 ? ["event"] : []),
|
|
48
|
-
...(networkEffects.length > 0 ? ["network"] : []),
|
|
49
|
-
...(promiseEffects.length > 0 ? ["promise"] : []),
|
|
50
|
-
...(resourceEffects.length > 0 ? ["resource"] : []),
|
|
51
|
-
...(timerEffects.length > 0 ? ["timer"] : []),
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
limitations: [
|
|
55
|
-
"The fingerprint is a static candidate and does not prove behavioral equivalence.",
|
|
56
|
-
...(parserPartial
|
|
57
|
-
? ["Incomplete semantic recovery makes this fingerprint partial."]
|
|
32
|
+
fingerprints.push({
|
|
33
|
+
callableId: callable.callableId,
|
|
34
|
+
status: parserPartial || callable.returnCoverage.status !== "complete"
|
|
35
|
+
? "partial"
|
|
36
|
+
: "complete",
|
|
37
|
+
components: {
|
|
38
|
+
parameterArity: callableParameterArity(node),
|
|
39
|
+
normalizedAstSha256: digest(syntax.normalizedTokens),
|
|
40
|
+
controlFlowSha256: digest(syntax.controlFlowTokens),
|
|
41
|
+
relationShapeSha256: digest(relationShape(callable, callSitesByCaller.get(callable.callableId) ?? [], captureCountByCallable.get(callable.callableId) ?? 0, promiseEffects)),
|
|
42
|
+
literalSetSha256: digest([...new Set(syntax.literals)].sort(compareUnicodeCodePoints)),
|
|
43
|
+
effects: [
|
|
44
|
+
...(isAsyncCallable(node) ? ["async"] : []),
|
|
45
|
+
...(childProcessEffects.length > 0
|
|
46
|
+
? ["child-process"]
|
|
58
47
|
: []),
|
|
48
|
+
...(eventEffects.length > 0 ? ["event"] : []),
|
|
49
|
+
...(networkEffects.length > 0 ? ["network"] : []),
|
|
50
|
+
...(promiseEffects.length > 0 ? ["promise"] : []),
|
|
51
|
+
...(resourceEffects.length > 0 ? ["resource"] : []),
|
|
52
|
+
...(timerEffects.length > 0 ? ["timer"] : []),
|
|
59
53
|
],
|
|
60
54
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
limitations: [
|
|
56
|
+
"The fingerprint is a static candidate and does not prove behavioral equivalence.",
|
|
57
|
+
...(parserPartial
|
|
58
|
+
? ["Incomplete semantic recovery makes this fingerprint partial."]
|
|
59
|
+
: []),
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return fingerprints;
|
|
64
|
+
}
|
|
64
65
|
const ownerId = (value) => value.ownerCallableId;
|
|
65
66
|
const groupByOwner = (values, getOwner) => {
|
|
66
67
|
const grouped = new Map();
|
|
@@ -82,12 +83,12 @@ const countByOwner = (values, getOwner) => {
|
|
|
82
83
|
}
|
|
83
84
|
return counts;
|
|
84
85
|
};
|
|
85
|
-
|
|
86
|
+
function* fingerprintSyntaxSteps(root, targetCallableId) {
|
|
86
87
|
const normalizedTokens = [];
|
|
87
88
|
const controlFlowTokens = [];
|
|
88
89
|
const literals = [];
|
|
89
90
|
const callableStack = [];
|
|
90
|
-
|
|
91
|
+
yield* traverseJavaScriptAstSteps(root, {
|
|
91
92
|
enter: (node, parent) => {
|
|
92
93
|
const callableId = semanticCallableIdForNode(node);
|
|
93
94
|
if (callableId !== null)
|
|
@@ -109,7 +110,7 @@ const fingerprintSyntax = (root, targetCallableId) => {
|
|
|
109
110
|
},
|
|
110
111
|
});
|
|
111
112
|
return { normalizedTokens, controlFlowTokens, literals };
|
|
112
|
-
}
|
|
113
|
+
}
|
|
113
114
|
const normalizedNodeToken = (node, parent) => {
|
|
114
115
|
if (t.isIdentifier(node))
|
|
115
116
|
return propertyIdentity(node, parent)
|