rea-agents 6.2.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 +24 -23
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/bridge/hopper_bridge.py +2 -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 +59 -21
- package/dist/android/JadxSession.js +51 -9
- 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 +85 -19
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +98 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +75 -27
- package/dist/application/DirectAnalysis.js +14 -8
- package/dist/application/DirectAnalysisCleanup.js +1 -2
- package/dist/application/DirectAnalysisStatus.js +3 -6
- package/dist/application/Doctor.js +27 -34
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/EvidenceBundleFiles.js +1 -1
- 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 +10 -4
- package/dist/application/JsonFiles.js +16 -15
- package/dist/application/JsonInputFile.js +252 -0
- package/dist/application/LinuxHopper.js +6 -13
- 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 +16 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- 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 +103 -0
- package/dist/application/Setup.js +69 -10
- package/dist/application/SetupClientConfiguration.js +134 -23
- package/dist/application/SetupHost.js +102 -22
- package/dist/application/SetupPlan.js +18 -17
- package/dist/application/SetupSkill.js +81 -13
- package/dist/application/SupportedClients.js +305 -37
- package/dist/application/Uninstall.js +172 -8
- package/dist/application/UpdateMaintenance.js +23 -23
- package/dist/application/Utf8JsonInput.js +71 -0
- package/dist/application/WebScriptExportService.js +130 -57
- 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/android/AndroidAnalysisService.js +1 -1
- 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/AnalysisSnapshotCache.js +5 -4
- package/dist/application/binary/BinarySession.js +18 -1
- package/dist/application/binary/BinarySessionOpen.js +9 -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/ElectronActiveEvidence.js +2 -2
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -3
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +23 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -36
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +74 -36
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +53 -42
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +293 -238
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +120 -28
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +10 -20
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +11 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +206 -66
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +18 -23
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +5 -2
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +6 -4
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +29 -15
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- 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/NativeCallRoutes.js +2 -4
- 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 +34 -31
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +218 -80
- 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 +179 -87
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- 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 +76 -49
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +134 -92
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +116 -50
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +87 -25
- package/dist/artifacts/inventory/hashStableRootArtifact.js +70 -0
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +73 -30
- package/dist/artifacts/inventory/scanReader.js +43 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +72 -28
- 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 +9 -3
- 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/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -3
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +48 -23
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +63 -7
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +208 -43
- package/dist/browser/PlaywrightScenarioSession.js +130 -65
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +35 -9
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- 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/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +12 -13
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +14 -10
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +19 -13
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +12 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +68 -22
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +11 -2
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +47 -34
- package/dist/cliObservationOptions.js +7 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +5 -4
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/browserScenario.js +2 -2
- package/dist/composition/directAnalysis.js +14 -7
- 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/artifactComparisonExample.js +5 -5
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +104 -13
- package/dist/contracts/javascript/electronToolContracts.js +16 -3
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +6 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/managed/managedToolContracts.js +3 -2
- package/dist/contracts/mobileApplicationGraphExamples.js +5 -5
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/native/nativeToolContracts.js +1 -1
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +5 -4
- package/dist/contracts/sessionToolSchemas.js +9 -4
- 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 +7 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +2 -5
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -4
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +5 -2
- package/dist/domain/analysisView/analysisView.js +53 -5
- 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/android/androidPartialObservation.js +36 -0
- 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 +3 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +39 -11
- package/dist/domain/artifactGraph.js +6 -4
- package/dist/domain/artifactIdentity.js +37 -9
- package/dist/domain/artifactInspection.js +10 -50
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +16 -17
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +3 -2
- package/dist/domain/callPath.js +8 -10
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +12 -6
- package/dist/domain/evidenceBundle.js +51 -33
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +2 -1
- package/dist/domain/functionComparisonNormalization.js +4 -3
- package/dist/domain/functionComparisonResults.js +2 -2
- package/dist/domain/functionDossierEvidence.js +2 -1
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronActiveObservation.js +4 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +14 -15
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +20 -21
- package/dist/domain/javascript/electronStaticAnalysisNative.js +73 -41
- package/dist/domain/javascript/electronStaticAnalysisValues.js +24 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +6 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +18 -14
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +4 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +91 -28
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +72 -45
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +16 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +60 -33
- package/dist/domain/javascript/javascriptAstValues.js +54 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +3 -2
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +31 -23
- package/dist/domain/javascript/javascriptExportShapeSelection.js +2 -2
- package/dist/domain/javascript/javascriptExportShapeVariants.js +3 -2
- package/dist/domain/javascript/javascriptFeatureSeed.js +5 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -4
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +12 -7
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeObservation.js +8 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +5 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -223
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +15 -17
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +379 -30
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +43 -42
- package/dist/domain/javascript/javascriptSemanticGraph.js +205 -52
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +21 -11
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +139 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +774 -136
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +98 -41
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +9 -7
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +7 -2
- package/dist/domain/javascript/javascriptSemanticProjection.js +72 -28
- package/dist/domain/javascript/javascriptSemanticPromises.js +15 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +100 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +33 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +4 -5
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +34 -48
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -2
- package/dist/domain/javascript/javascriptSemanticValues.js +169 -30
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptSourceMapPaths.js +11 -1
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +13 -12
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -15
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +7 -5
- package/dist/domain/javascript/sourceToBundleSignals.js +7 -7
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +69 -31
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +47 -6
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +94 -59
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeCallObservation.js +2 -4
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +102 -11
- package/dist/domain/process/processCaptureCoverage.js +8 -5
- package/dist/domain/process/processCaptureExample.js +67 -0
- package/dist/domain/process/processCaptureValidation.js +83 -3
- package/dist/domain/process/processComparison.js +0 -23
- package/dist/domain/process/processScenario.js +62 -10
- package/dist/domain/process/processTraceEvaluation.js +4 -4
- package/dist/domain/process/processTraceSpecification.js +1 -3
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +3 -2
- package/dist/domain/referenceSourceGraph.js +32 -23
- package/dist/domain/referenceSourceImportParsing.js +40 -48
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +2 -1
- package/dist/domain/swiftSymbolClassification.js +6 -1
- package/dist/domain/symbolAnalysis.js +17 -2
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +23 -3
- package/dist/domain/webCaptureDiff.js +170 -30
- package/dist/domain/webCaptureDiffSchemas.js +2 -8
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webScriptExport.js +1 -1
- 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 +5 -4
- 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 +65 -31
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- 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 +73 -0
- 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 +90 -8
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +111 -10
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +123 -58
- 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/HopperCleanup.js +1 -1
- 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 +10 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +7 -3
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +46 -13
- package/dist/inspector/V8InspectorProvider.js +60 -8
- 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/main/shutdown.js +76 -32
- package/dist/main/transport.js +1 -1
- 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/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/LldbCallTracer.js +241 -75
- package/dist/native/NativeMacOSProvider.js +100 -20
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- 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 +104 -51
- 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 +116 -22
- package/dist/process/capture/ProcessCaptureLifecycle.js +363 -86
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessFilesystemEffects.js +19 -4
- package/dist/process/capture/ProcessHarness.js +202 -47
- 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/analysisAdmission.js +8 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +118 -47
- 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 +6 -7
- 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/helpers.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/registerArtifactTools.js +2 -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 +36 -5
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEnhancedTools.js +78 -73
- package/dist/server/registerEvidenceTools.js +54 -46
- 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/registerManagedTools.js +7 -4
- 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/registerOfficialTools.js +31 -25
- 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 +58 -21
- 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 +38 -7
- 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 +31 -1
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/server/registerNativeTools.js +0 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
3
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
4
|
-
import {
|
|
5
|
-
import { propertyName } from "./javascriptAstValues.js";
|
|
4
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
5
|
+
import { propertyName, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
6
6
|
import { stringValue } from "./javascriptStaticAnalysisHelpers.js";
|
|
7
7
|
/** Derive a rename-resistant syntax fingerprint without code execution. */
|
|
8
8
|
export const fingerprintJavaScriptAst = (node) => {
|
|
@@ -28,7 +28,7 @@ export const collectJavaScriptExports = (node) => {
|
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
30
|
return {
|
|
31
|
-
values: [...exports].sort(
|
|
31
|
+
values: [...exports].sort(compareUnicodeCodePoints),
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
const semanticTokens = (node) => {
|
|
@@ -59,40 +59,71 @@ const semanticTokens = (node) => {
|
|
|
59
59
|
};
|
|
60
60
|
const collectAssignmentExports = (left, right, output) => {
|
|
61
61
|
const path = memberPath(left);
|
|
62
|
-
if (path ===
|
|
62
|
+
if (path === null)
|
|
63
|
+
return;
|
|
64
|
+
// Rebinding the CommonJS alias does not replace module.exports.
|
|
65
|
+
if (path.length === 1 && path[0] === "exports")
|
|
66
|
+
return;
|
|
67
|
+
const exportOffset = path[0] === "exports"
|
|
68
|
+
? 1
|
|
69
|
+
: path[0] === "module" && path[1] === "exports"
|
|
70
|
+
? 2
|
|
71
|
+
: null;
|
|
72
|
+
if (exportOffset === null)
|
|
73
|
+
return;
|
|
74
|
+
if (path.length === exportOffset) {
|
|
63
75
|
if (t.isObjectExpression(right))
|
|
64
76
|
collectObjectKeys(right, output);
|
|
65
77
|
else
|
|
66
78
|
addExport(output, "default");
|
|
67
79
|
return;
|
|
68
80
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
// A CommonJS export assignment exposes the first property below the
|
|
82
|
+
// exports object. Deeper writes mutate that exported value, rather than
|
|
83
|
+
// creating an export whose name is the dotted member path.
|
|
84
|
+
addExport(output, path[exportOffset]);
|
|
73
85
|
};
|
|
74
86
|
const collectCallExports = (call, output) => {
|
|
75
87
|
const callee = memberPath(call.callee);
|
|
76
|
-
if (callee ===
|
|
77
|
-
|
|
88
|
+
if (callee === null)
|
|
89
|
+
return;
|
|
90
|
+
const definePropertyCall = callee.length === 2 &&
|
|
91
|
+
callee[0] === "Object" &&
|
|
92
|
+
callee[1] === "defineProperty";
|
|
93
|
+
const declarationCall = callee.length >= 2 && callee.at(-1) === "d";
|
|
94
|
+
if (!definePropertyCall && !declarationCall)
|
|
95
|
+
return;
|
|
96
|
+
const target = memberPath(call.arguments[0]);
|
|
97
|
+
const exportTarget = target !== null &&
|
|
98
|
+
((target.length === 1 && target[0] === "exports") ||
|
|
99
|
+
(target.length === 2 &&
|
|
100
|
+
target[0] === "module" &&
|
|
101
|
+
target[1] === "exports"));
|
|
102
|
+
if (!exportTarget)
|
|
103
|
+
return;
|
|
104
|
+
if (definePropertyCall) {
|
|
78
105
|
const name = stringValue(call.arguments[1]);
|
|
79
|
-
if (
|
|
106
|
+
if (name !== undefined)
|
|
80
107
|
addExport(output, name);
|
|
81
|
-
}
|
|
82
|
-
if (!callee.endsWith(".d"))
|
|
83
108
|
return;
|
|
84
|
-
|
|
109
|
+
}
|
|
85
110
|
const declarations = call.arguments[1];
|
|
86
|
-
if ((
|
|
87
|
-
t.isObjectExpression(declarations))
|
|
111
|
+
if (t.isObjectExpression(declarations))
|
|
88
112
|
collectObjectKeys(declarations, output);
|
|
89
113
|
};
|
|
90
114
|
const collectObjectKeys = (object, output) => {
|
|
91
115
|
for (const property of object.properties) {
|
|
92
116
|
if (!t.isObjectProperty(property) && !t.isObjectMethod(property))
|
|
93
117
|
continue;
|
|
94
|
-
const name =
|
|
95
|
-
|
|
118
|
+
const name = semanticStaticPropertyKey(property.key, property.computed);
|
|
119
|
+
// In an object literal, a non-computed `__proto__: value` sets the
|
|
120
|
+
// prototype instead of creating an own property. Shorthand, computed,
|
|
121
|
+
// and method forms do create own properties.
|
|
122
|
+
if (name !== null &&
|
|
123
|
+
!(t.isObjectProperty(property) &&
|
|
124
|
+
!property.computed &&
|
|
125
|
+
!property.shorthand &&
|
|
126
|
+
name === "__proto__"))
|
|
96
127
|
addExport(output, name);
|
|
97
128
|
}
|
|
98
129
|
};
|
|
@@ -105,22 +136,18 @@ const memberPath = (node) => {
|
|
|
105
136
|
while (current !== undefined &&
|
|
106
137
|
current !== null &&
|
|
107
138
|
(t.isMemberExpression(current) || t.isOptionalMemberExpression(current))) {
|
|
108
|
-
|
|
109
|
-
|
|
139
|
+
const property = semanticStaticPropertyKey(current.property, current.computed);
|
|
140
|
+
if (property === null)
|
|
141
|
+
return null;
|
|
142
|
+
properties.push(property);
|
|
143
|
+
current = current.object;
|
|
110
144
|
}
|
|
111
|
-
|
|
145
|
+
if (current === undefined || current === null)
|
|
146
|
+
return null;
|
|
147
|
+
const root = t.isIdentifier(current)
|
|
112
148
|
? current.name
|
|
113
|
-
:
|
|
149
|
+
: t.isThisExpression(current)
|
|
114
150
|
? "this"
|
|
115
|
-
:
|
|
116
|
-
|
|
117
|
-
return root;
|
|
118
|
-
properties.reverse();
|
|
119
|
-
const path = root === "" ? [] : [root];
|
|
120
|
-
for (const property of properties) {
|
|
121
|
-
if (path.length === 0 && property === "")
|
|
122
|
-
continue;
|
|
123
|
-
path.push(property);
|
|
124
|
-
}
|
|
125
|
-
return path.join(".");
|
|
151
|
+
: null;
|
|
152
|
+
return root === null ? null : [root, ...properties.reverse()];
|
|
126
153
|
};
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
/**
|
|
3
|
+
* Remove wrappers that affect TypeScript or Flow checking but not runtime
|
|
4
|
+
* expression identity. The returned depth lets bounded evaluators account for
|
|
5
|
+
* syntax that normalization would otherwise skip.
|
|
6
|
+
*/
|
|
7
|
+
export const unwrapJavaScriptExpression = (node) => {
|
|
8
|
+
let current = node;
|
|
9
|
+
let depth = 0;
|
|
10
|
+
while (t.isParenthesizedExpression(current) ||
|
|
11
|
+
t.isTSAsExpression(current) ||
|
|
12
|
+
t.isTSTypeAssertion(current) ||
|
|
13
|
+
t.isTSNonNullExpression(current) ||
|
|
14
|
+
t.isTSSatisfiesExpression(current) ||
|
|
15
|
+
t.isTSInstantiationExpression(current) ||
|
|
16
|
+
t.isTypeCastExpression(current)) {
|
|
17
|
+
current = current.expression;
|
|
18
|
+
depth += 1;
|
|
19
|
+
}
|
|
20
|
+
return { node: current, depth };
|
|
21
|
+
};
|
|
2
22
|
/** Read one syntax-level primitive only when its value is exact. */
|
|
3
23
|
export const readExactJavaScriptLiteral = (node) => {
|
|
24
|
+
node = unwrapJavaScriptExpression(node).node;
|
|
4
25
|
if (t.isStringLiteral(node))
|
|
5
26
|
return { found: true, value: node.value };
|
|
6
27
|
if (t.isNumericLiteral(node) && Number.isFinite(node.value))
|
|
@@ -31,10 +52,43 @@ export const propertyName = (node) => {
|
|
|
31
52
|
export const semanticStaticPropertyName = (property, computed) => semanticStaticPropertyKey(property, computed) ?? "";
|
|
32
53
|
/** Read an exact property key, preserving the legal empty-string key. */
|
|
33
54
|
export const semanticStaticPropertyKey = (property, computed) => {
|
|
55
|
+
property = unwrapJavaScriptExpression(property).node;
|
|
34
56
|
if (t.isStringLiteral(property) || t.isNumericLiteral(property))
|
|
35
57
|
return String(property.value);
|
|
36
58
|
return !computed && t.isIdentifier(property) ? property.name : null;
|
|
37
59
|
};
|
|
60
|
+
/** Read exact consumed object-pattern keys, leaving dynamic keys unknown. */
|
|
61
|
+
export const semanticObjectPatternKeys = (pattern) => pattern.properties.flatMap((property) => {
|
|
62
|
+
if (t.isRestElement(property))
|
|
63
|
+
return [];
|
|
64
|
+
const key = semanticStaticPropertyKey(property.key, property.computed);
|
|
65
|
+
return key === null ? [] : [key];
|
|
66
|
+
});
|
|
67
|
+
/** Visit member write targets in direct and destructuring assignment forms. */
|
|
68
|
+
export function* semanticMemberWriteTargets(root) {
|
|
69
|
+
const pending = [root];
|
|
70
|
+
while (pending.length > 0) {
|
|
71
|
+
const next = pending.pop();
|
|
72
|
+
if (next === undefined)
|
|
73
|
+
break;
|
|
74
|
+
const node = unwrapJavaScriptExpression(next).node;
|
|
75
|
+
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node))
|
|
76
|
+
yield node;
|
|
77
|
+
else if (t.isRestElement(node))
|
|
78
|
+
pending.push(node.argument);
|
|
79
|
+
else if (t.isAssignmentPattern(node))
|
|
80
|
+
pending.push(node.left);
|
|
81
|
+
else if (t.isArrayPattern(node)) {
|
|
82
|
+
for (const element of node.elements.toReversed())
|
|
83
|
+
if (element !== null)
|
|
84
|
+
pending.push(element);
|
|
85
|
+
}
|
|
86
|
+
else if (t.isObjectPattern(node)) {
|
|
87
|
+
for (const property of node.properties.toReversed())
|
|
88
|
+
pending.push(t.isRestElement(property) ? property.argument : property.value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
38
92
|
/**
|
|
39
93
|
* Display an exact JavaScript string as nonempty label text. Graph labels and
|
|
40
94
|
* artifact-local keys are nonempty, so the legal empty value is shown as `""`;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
import { semanticStaticPropertyKey, semanticMemberWriteTargets, unwrapJavaScriptExpression, } from "./javascriptAstValues.js";
|
|
3
|
+
import { SemanticPropertyPathCoverage } from "./javascriptSemanticPropertyPaths.js";
|
|
4
|
+
import { traverseJavaScriptAstSteps } from "./javascriptSemanticTraversal.js";
|
|
5
|
+
/** Match Electron's supported module entry points. */
|
|
6
|
+
export const ELECTRON_MODULE = /^electron(?:\/(?:common|main|renderer|utility))?$/u;
|
|
7
|
+
/**
|
|
8
|
+
* Electron's CommonJS exports define no `default` member, so a leading
|
|
9
|
+
* `default` segment can only denote the module object itself, as an ES module
|
|
10
|
+
* default import (`import electron from "electron"`) binds it.
|
|
11
|
+
*/
|
|
12
|
+
export const electronExportPath = (importedPath) => importedPath[0] === "default" ? importedPath.slice(1) : importedPath;
|
|
13
|
+
/** Static identity recovery cannot establish the absence of Electron usage. */
|
|
14
|
+
export const ELECTRON_IDENTITY_LIMITATION = "Electron API identity follows proven lexical module aliases. Reassigned bindings, dynamic selections, and visibly overwritten namespace members are unresolved; missing findings do not establish absence. Arbitrary call side effects and runtime registration are not evaluated.";
|
|
15
|
+
/** Preserve exact property segments instead of flattening literal dotted keys. */
|
|
16
|
+
export const electronMemberPath = (node) => {
|
|
17
|
+
let root = unwrapJavaScriptExpression(node).node;
|
|
18
|
+
const members = [];
|
|
19
|
+
while (t.isMemberExpression(root) || t.isOptionalMemberExpression(root)) {
|
|
20
|
+
members.push(semanticStaticPropertyKey(root.property, root.computed));
|
|
21
|
+
root = unwrapJavaScriptExpression(root.object).node;
|
|
22
|
+
}
|
|
23
|
+
return { root, members: members.toReversed() };
|
|
24
|
+
};
|
|
25
|
+
/** Index visible writes through proven Electron aliases, without executing them. */
|
|
26
|
+
export function* collectElectronMemberWritesSteps(program, origin) {
|
|
27
|
+
const writes = new SemanticPropertyPathCoverage();
|
|
28
|
+
yield* traverseJavaScriptAstSteps(program, {
|
|
29
|
+
enter: (node) => {
|
|
30
|
+
const target = t.isAssignmentExpression(node)
|
|
31
|
+
? node.left
|
|
32
|
+
: t.isUpdateExpression(node)
|
|
33
|
+
? node.argument
|
|
34
|
+
: t.isUnaryExpression(node, { operator: "delete" })
|
|
35
|
+
? node.argument
|
|
36
|
+
: t.isForOfStatement(node) || t.isForInStatement(node)
|
|
37
|
+
? node.left
|
|
38
|
+
: undefined;
|
|
39
|
+
if (target === undefined)
|
|
40
|
+
return;
|
|
41
|
+
for (const member of semanticMemberWriteTargets(target)) {
|
|
42
|
+
const { root, members } = electronMemberPath(member);
|
|
43
|
+
const exported = origin(root);
|
|
44
|
+
if (exported !== undefined)
|
|
45
|
+
writes.retain([...exported, ...members]);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
return writes;
|
|
50
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
2
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
2
3
|
import { canonicalExportShapeValue, digestExportShapeValue, } from "./javascriptExportShapeComparisonIdentity.js";
|
|
3
4
|
import { javaScriptExportShapeComparisonResultSchema, } from "./javascriptExportShapeComparisonSchemas.js";
|
|
4
5
|
import { retainJavaScriptExportShapes, selectJavaScriptExport, } from "./javascriptExportShapeSelection.js";
|
|
@@ -65,7 +66,7 @@ const sortChanges = (changes) => changes
|
|
|
65
66
|
change_id: change.change_id,
|
|
66
67
|
}),
|
|
67
68
|
}))
|
|
68
|
-
.sort((left, right) =>
|
|
69
|
+
.sort((left, right) => compareUnicodeCodePoints(left.sortKey, right.sortKey) ||
|
|
69
70
|
left.index - right.index)
|
|
70
71
|
.map(({ change }) => change);
|
|
71
72
|
const comparisonCoverage = (context) => {
|
|
@@ -5,7 +5,6 @@ const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
|
5
5
|
const graphIdSchema = prefixedDigestSchema("jag");
|
|
6
6
|
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
|
7
7
|
const textSchema = z.string().min(1);
|
|
8
|
-
const selectorTextSchema = textSchema;
|
|
9
8
|
const semanticPrimitiveSchema = z.union([
|
|
10
9
|
z.string(),
|
|
11
10
|
z.number().finite(),
|
|
@@ -49,24 +48,34 @@ const sourceRangeSchema = z
|
|
|
49
48
|
message: "Source range end must not precede its start",
|
|
50
49
|
});
|
|
51
50
|
});
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
.strictObject({
|
|
55
|
-
left: evidenceSchema,
|
|
56
|
-
right: evidenceSchema,
|
|
57
|
-
left_module_path: selectorTextSchema,
|
|
58
|
-
left_export_name: selectorTextSchema,
|
|
59
|
-
right_module_path: selectorTextSchema,
|
|
60
|
-
right_export_name: selectorTextSchema,
|
|
61
|
-
})
|
|
62
|
-
.superRefine((input, context) => {
|
|
51
|
+
/** Check that export-shape comparisons bind distinct source Evidence. */
|
|
52
|
+
const validateJavaScriptExportShapeIdentities = (input, context) => {
|
|
63
53
|
if (input.left.evidence_id === input.right.evidence_id)
|
|
64
54
|
context.addIssue({
|
|
65
55
|
code: "custom",
|
|
66
56
|
path: ["right"],
|
|
67
57
|
message: "JavaScript export shape Evidence must be distinct",
|
|
68
58
|
});
|
|
69
|
-
}
|
|
59
|
+
};
|
|
60
|
+
const evidenceIdentitySchema = z.object({ evidence_id: evidenceIdSchema });
|
|
61
|
+
/** Validate export-shape identities without capturing complete source graphs. */
|
|
62
|
+
export const javaScriptExportShapeIdentitiesSchema = z
|
|
63
|
+
.object({
|
|
64
|
+
left: evidenceIdentitySchema,
|
|
65
|
+
right: evidenceIdentitySchema,
|
|
66
|
+
})
|
|
67
|
+
.superRefine(validateJavaScriptExportShapeIdentities);
|
|
68
|
+
/** Two authenticated application graphs and exact export selectors. */
|
|
69
|
+
export const compareJavaScriptExportShapesInputSchema = z
|
|
70
|
+
.strictObject({
|
|
71
|
+
left: evidenceSchema,
|
|
72
|
+
right: evidenceSchema,
|
|
73
|
+
left_module_path: textSchema,
|
|
74
|
+
left_export_name: textSchema,
|
|
75
|
+
right_module_path: textSchema,
|
|
76
|
+
right_export_name: textSchema,
|
|
77
|
+
})
|
|
78
|
+
.superRefine(validateJavaScriptExportShapeIdentities);
|
|
70
79
|
const projectedReturnFieldShape = {
|
|
71
80
|
path: jsonPointerSchema,
|
|
72
81
|
presence: z.enum(["present", "absent", "unknown-coverage"]),
|
|
@@ -138,8 +147,8 @@ const projectedReturnShapeSchema = z
|
|
|
138
147
|
export const projectedExportReturnShapesSchema = z
|
|
139
148
|
.strictObject({
|
|
140
149
|
semantic_role: z.literal("export-return-shapes"),
|
|
141
|
-
module_path:
|
|
142
|
-
exported_name:
|
|
150
|
+
module_path: textSchema,
|
|
151
|
+
exported_name: textSchema,
|
|
143
152
|
callable_id: textSchema,
|
|
144
153
|
callable_kind: z.enum(["function", "class", "method"]),
|
|
145
154
|
static_return_shapes: z.array(projectedReturnShapeSchema),
|
|
@@ -163,16 +172,16 @@ export const projectedExportReturnShapesSchema = z
|
|
|
163
172
|
});
|
|
164
173
|
const exportCandidateSchema = z.strictObject({
|
|
165
174
|
node_id: nodeIdSchema,
|
|
166
|
-
module_path:
|
|
167
|
-
export_name:
|
|
175
|
+
module_path: textSchema,
|
|
176
|
+
export_name: textSchema,
|
|
168
177
|
matches_requested_module: z.boolean(),
|
|
169
178
|
matches_requested_export: z.boolean(),
|
|
170
179
|
});
|
|
171
180
|
const selectorResultShape = {
|
|
172
181
|
evidence_id: evidenceIdSchema,
|
|
173
182
|
graph_id: graphIdSchema,
|
|
174
|
-
requested_module_path:
|
|
175
|
-
requested_export_name:
|
|
183
|
+
requested_module_path: textSchema,
|
|
184
|
+
requested_export_name: textSchema,
|
|
176
185
|
candidates: z.array(exportCandidateSchema),
|
|
177
186
|
omitted_candidates: z.number().int().min(0),
|
|
178
187
|
};
|
|
@@ -217,7 +226,8 @@ const propertyPresenceSchema = z.enum([
|
|
|
217
226
|
"absent",
|
|
218
227
|
"unknown-coverage",
|
|
219
228
|
]);
|
|
220
|
-
|
|
229
|
+
/** One change row; presence is required even when values stay unknown. */
|
|
230
|
+
export const javaScriptExportShapeComparisonChangeSchema = z.strictObject({
|
|
221
231
|
change_id: prefixedDigestSchema("jesc_change"),
|
|
222
232
|
status: z.enum(["added", "removed", "changed", "unknown"]),
|
|
223
233
|
path: jsonPointerSchema,
|
|
@@ -233,8 +243,6 @@ const comparisonChangeSchema = z.strictObject({
|
|
|
233
243
|
evidence_links: z.array(evidenceIdSchema).length(2),
|
|
234
244
|
limitations: z.array(textSchema),
|
|
235
245
|
});
|
|
236
|
-
/** One change row; presence is required even when values stay unknown. */
|
|
237
|
-
export const javaScriptExportShapeComparisonChangeSchema = comparisonChangeSchema;
|
|
238
246
|
const inventoryPropertyCoverageSchema = z.strictObject({
|
|
239
247
|
path: jsonPointerSchema,
|
|
240
248
|
status: z.enum(["complete", "partial"]),
|
|
@@ -260,7 +268,7 @@ export const javaScriptExportShapeComparisonResultSchema = z.strictObject({
|
|
|
260
268
|
changed: z.number().int().min(0),
|
|
261
269
|
unknown: z.number().int().min(0),
|
|
262
270
|
}),
|
|
263
|
-
changes: z.array(
|
|
271
|
+
changes: z.array(javaScriptExportShapeComparisonChangeSchema),
|
|
264
272
|
coverage: z.strictObject({
|
|
265
273
|
status: z.enum(["complete-within-inputs", "partial", "truncated"]),
|
|
266
274
|
left_graph_status: z.enum([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { projectedExportReturnShapesSchema, } from "./javascriptExportShapeComparisonSchemas.js";
|
|
2
|
-
import {
|
|
2
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
3
3
|
/** Select one exact trusted export and its exact static return-shape observation. */
|
|
4
4
|
export const selectJavaScriptExport = (side) => {
|
|
5
5
|
const candidates = exportCandidates(side.graph);
|
|
@@ -90,7 +90,7 @@ const exportCandidates = (graph) => {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
return [...candidates.values()].sort((left, right) =>
|
|
93
|
+
return [...candidates.values()].sort((left, right) => compareUnicodeCodePoints(candidateKey(left), candidateKey(right)));
|
|
94
94
|
};
|
|
95
95
|
const candidateKey = (candidate) => `${candidate.modulePath}\0${candidate.exportName}\0${candidate.node.node_id}`;
|
|
96
96
|
const returnShapeFor = (node, side) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { canonicalExportShapeValue, digestExportShapeValue, } from "./javascriptExportShapeComparisonIdentity.js";
|
|
2
|
-
import {
|
|
2
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
3
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
3
4
|
const UNKNOWN_COVERAGE_PRESENCE = {
|
|
4
5
|
left: "unknown-coverage",
|
|
5
6
|
right: "unknown-coverage",
|
|
@@ -139,7 +140,7 @@ const addTarget = (map, source, target) => {
|
|
|
139
140
|
map.set(source, values);
|
|
140
141
|
};
|
|
141
142
|
const indexesNotIn = (shapes, paired) => shapes.map((_, index) => index).filter((index) => !paired.has(index));
|
|
142
|
-
const compareDiscriminants = (left, right) =>
|
|
143
|
+
const compareDiscriminants = (left, right) => compareUnicodeCodePoints(canonicalExportShapeValue(left), canonicalExportShapeValue(right));
|
|
143
144
|
const selectionUnknownChange = (input) => changeWithId({
|
|
144
145
|
status: "unknown",
|
|
145
146
|
path: "",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
2
2
|
import { featureSeedMatchMode, } from "./javascriptFeatureTraceSchemas.js";
|
|
3
3
|
/** Locate every graph node matching a typed literal seed without regex execution. */
|
|
4
4
|
export const findApplicationFeatureSeeds = (nodes, seed) => nodes
|
|
5
5
|
.flatMap((node) => seedMatch(node, seed))
|
|
6
|
-
.sort((left, right) =>
|
|
6
|
+
.sort((left, right) => compareUnicodeCodePoints(`${left.node_id}\0${left.basis}\0${left.field}`, `${right.node_id}\0${right.basis}\0${right.field}`));
|
|
7
7
|
const seedMatch = (node, seed) => {
|
|
8
8
|
if (seed.kind === "node-id")
|
|
9
9
|
return node.node_id === seed.value
|
|
@@ -171,7 +171,9 @@ const propertyFields = (value, prefix) => {
|
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
173
|
if (current !== null && typeof current === "object") {
|
|
174
|
-
for (const key of Object.keys(current)
|
|
174
|
+
for (const key of Object.keys(current)
|
|
175
|
+
.sort(compareUnicodeCodePoints)
|
|
176
|
+
.reverse())
|
|
175
177
|
pending.push({
|
|
176
178
|
current: current[key] ?? null,
|
|
177
179
|
path: `${path}.${key}`,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { digestCanonicalValue } from "../canonicalDigest.js";
|
|
2
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
3
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
3
4
|
import { createJavaScriptApplicationGraph, } from "./javascriptApplicationGraph.js";
|
|
4
5
|
import { applicationFeatureTraceResultSchema, } from "./javascriptFeatureTraceSchemas.js";
|
|
5
6
|
import { findApplicationFeatureSeeds, } from "./javascriptFeatureSeed.js";
|
|
@@ -46,7 +47,7 @@ export const traceApplicationFeature = (input) => {
|
|
|
46
47
|
};
|
|
47
48
|
return applicationFeatureTraceResultSchema.parse({
|
|
48
49
|
...semantic,
|
|
49
|
-
trace_id: `jatr_${
|
|
50
|
+
trace_id: `jatr_${digestCanonicalValue(semantic, "Feature trace")}`,
|
|
50
51
|
});
|
|
51
52
|
};
|
|
52
53
|
const noMatchResult = (input) => {
|
|
@@ -83,7 +84,7 @@ const noMatchResult = (input) => {
|
|
|
83
84
|
};
|
|
84
85
|
return applicationFeatureTraceResultSchema.parse({
|
|
85
86
|
...semantic,
|
|
86
|
-
trace_id: `jatr_${
|
|
87
|
+
trace_id: `jatr_${digestCanonicalValue(semantic, "Feature trace")}`,
|
|
87
88
|
});
|
|
88
89
|
};
|
|
89
90
|
const traceGraph = (input, seedMatches, traversal) => {
|
|
@@ -112,7 +113,7 @@ const terminalPaths = (traversal, seeds) => {
|
|
|
112
113
|
(!seedIds.has(node.node_id) || traversal.nodes.length === 1))
|
|
113
114
|
.map((node) => pathTo(node, traversal.predecessors, edgeById))
|
|
114
115
|
.filter((path) => path !== null)
|
|
115
|
-
.sort((left, right) =>
|
|
116
|
+
.sort((left, right) => compareUnicodeCodePoints(left.path_id, right.path_id));
|
|
116
117
|
};
|
|
117
118
|
const pathTo = (node, predecessors, edgeById) => {
|
|
118
119
|
const nodeIds = [node.node_id];
|
|
@@ -144,7 +145,7 @@ const pathTo = (node, predecessors, edgeById) => {
|
|
|
144
145
|
};
|
|
145
146
|
return {
|
|
146
147
|
...semantic,
|
|
147
|
-
path_id: `jatp_${
|
|
148
|
+
path_id: `jatp_${digestCanonicalValue(semantic, "Feature trace")}`,
|
|
148
149
|
};
|
|
149
150
|
};
|
|
150
151
|
const isTerminal = (node) => ["endpoint", "storage", "native-addon", "native-export", "unknown"].includes(node.kind);
|
|
@@ -36,6 +36,22 @@ const applicationFeatureSeedSchema = z.union([
|
|
|
36
36
|
case_sensitive: z.boolean().default(false),
|
|
37
37
|
}),
|
|
38
38
|
]);
|
|
39
|
+
/** Check unique native identities before projecting an application trace. */
|
|
40
|
+
const validateApplicationTraceIdentities = (input, context) => {
|
|
41
|
+
const ids = input.native_observations.map(({ evidence_id: id }) => id);
|
|
42
|
+
if (new Set(ids).size !== ids.length)
|
|
43
|
+
context.addIssue({
|
|
44
|
+
code: "custom",
|
|
45
|
+
path: ["native_observations"],
|
|
46
|
+
message: "Native observations must be unique",
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
/** Validate native trace identities without capturing their complete Evidence. */
|
|
50
|
+
export const applicationTraceIdentitiesSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
native_observations: z.array(z.object({ evidence_id: evidenceIdSchema })),
|
|
53
|
+
})
|
|
54
|
+
.superRefine(validateApplicationTraceIdentities);
|
|
39
55
|
/** Evidence-backed application graph and feature seed. */
|
|
40
56
|
export const traceApplicationFeatureInputSchema = z
|
|
41
57
|
.strictObject({
|
|
@@ -44,15 +60,7 @@ export const traceApplicationFeatureInputSchema = z
|
|
|
44
60
|
seed: applicationFeatureSeedSchema,
|
|
45
61
|
direction: z.enum(["outgoing", "incoming", "both"]).default("both"),
|
|
46
62
|
})
|
|
47
|
-
.superRefine(
|
|
48
|
-
const ids = input.native_observations.map(({ evidence_id: id }) => id);
|
|
49
|
-
if (new Set(ids).size !== ids.length)
|
|
50
|
-
context.addIssue({
|
|
51
|
-
code: "custom",
|
|
52
|
-
path: ["native_observations"],
|
|
53
|
-
message: "Native observations must be unique",
|
|
54
|
-
});
|
|
55
|
-
});
|
|
63
|
+
.superRefine(validateApplicationTraceIdentities);
|
|
56
64
|
const seedMatchSchema = z.strictObject({
|
|
57
65
|
node_id: nodeIdSchema,
|
|
58
66
|
kind: z.string().min(1),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
2
2
|
/** Traverse a JAG without treating edge inference as observed reachability. */
|
|
3
3
|
export const traverseApplicationFeature = (graph, seedNodeIds, direction) => {
|
|
4
4
|
const nodeById = new Map(graph.nodes.map((node) => [node.node_id, node]));
|
|
@@ -29,8 +29,8 @@ export const traverseApplicationFeature = (graph, seedNodeIds, direction) => {
|
|
|
29
29
|
nodes: [...visited]
|
|
30
30
|
.map((nodeId) => nodeById.get(nodeId))
|
|
31
31
|
.filter((node) => node !== undefined)
|
|
32
|
-
.sort((left, right) =>
|
|
33
|
-
edges: [...retainedEdges.values()].sort((left, right) =>
|
|
32
|
+
.sort((left, right) => compareUnicodeCodePoints(left.node_id, right.node_id)),
|
|
33
|
+
edges: [...retainedEdges.values()].sort((left, right) => compareUnicodeCodePoints(left.edge_id, right.edge_id)),
|
|
34
34
|
predecessors,
|
|
35
35
|
};
|
|
36
36
|
};
|
|
@@ -49,7 +49,7 @@ const buildAdjacency = (edges, direction) => {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
for (const entries of adjacency.values())
|
|
52
|
-
entries.sort((left, right) =>
|
|
52
|
+
entries.sort((left, right) => compareUnicodeCodePoints(`${left.edge.edge_id}\0${left.nextNodeId}`, `${right.edge.edge_id}\0${right.nextNodeId}`));
|
|
53
53
|
return adjacency;
|
|
54
54
|
};
|
|
55
55
|
const addAdjacency = (adjacency, nodeId, entry) => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Retain facts consumed by source-module and export-return composition. */
|
|
2
|
+
export const projectJavaScriptModuleSemantics = (ir) => {
|
|
3
|
+
const scopes = ir.scopes.filter(({ kind }) => kind === "program");
|
|
4
|
+
const programScopeId = scopes[0]?.scopeId;
|
|
5
|
+
const localNames = new Set(ir.moduleLinks.map(({ localName }) => localName));
|
|
6
|
+
const callableIds = new Set(ir.moduleLinks.map(({ callableId }) => callableId));
|
|
7
|
+
return {
|
|
8
|
+
scopes,
|
|
9
|
+
bindings: ir.bindings.filter(({ name, scopeId }) => scopeId === programScopeId && localNames.has(name)),
|
|
10
|
+
callables: ir.callables.filter(({ callableId }) => callableIds.has(callableId)),
|
|
11
|
+
moduleLinks: ir.moduleLinks,
|
|
12
|
+
coverage: ir.coverage,
|
|
13
|
+
limitations: ir.limitations,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
2
2
|
import {} from "./javascriptApplicationGraphSchemas.js";
|
|
3
3
|
/** Build provider-neutral addon targets and link exact-subject native Evidence. */
|
|
4
4
|
export const buildJavaScriptNativeHandoffs = (nodes, edges, nativeEvidence) => {
|
|
@@ -24,7 +24,7 @@ export const buildJavaScriptNativeHandoffs = (nodes, edges, nativeEvidence) => {
|
|
|
24
24
|
providers: uniqueProviders(linked),
|
|
25
25
|
evidence_ids: linked
|
|
26
26
|
.map(({ evidence_id: id }) => id)
|
|
27
|
-
.sort(
|
|
27
|
+
.sort(compareUnicodeCodePoints),
|
|
28
28
|
recommended_tools: [
|
|
29
29
|
"open_binary",
|
|
30
30
|
"binary_overview",
|
|
@@ -35,7 +35,7 @@ export const buildJavaScriptNativeHandoffs = (nodes, edges, nativeEvidence) => {
|
|
|
35
35
|
},
|
|
36
36
|
];
|
|
37
37
|
})
|
|
38
|
-
.sort((left, right) =>
|
|
38
|
+
.sort((left, right) => compareUnicodeCodePoints(left.native_node_id, right.native_node_id));
|
|
39
39
|
};
|
|
40
40
|
const artifactDigest = (node) => {
|
|
41
41
|
if (node.identity.strategy === "content-digest")
|
|
@@ -65,15 +65,20 @@ const nativeExportNodes = (addon, edges, nodeById) => {
|
|
|
65
65
|
return [...new Set(ids)]
|
|
66
66
|
.map((id) => nodeById.get(id))
|
|
67
67
|
.filter((node) => node?.kind === "native-export")
|
|
68
|
-
.sort((left, right) =>
|
|
68
|
+
.sort((left, right) => compareUnicodeCodePoints(left.node_id, right.node_id));
|
|
69
69
|
};
|
|
70
70
|
const requestedExports = (nodes) => {
|
|
71
71
|
const values = nodes.flatMap((node) => node.observations.flatMap((observation) => [
|
|
72
|
-
|
|
72
|
+
// Display labels can summarize several names or namespace access.
|
|
73
|
+
// Only legacy observations without structured member facts need them.
|
|
74
|
+
...(observation.label === null ||
|
|
75
|
+
Array.isArray(observation.properties.requested_members)
|
|
76
|
+
? []
|
|
77
|
+
: [observation.label]),
|
|
73
78
|
...stringArray(observation.properties.requested_members),
|
|
74
79
|
...stringArray(observation.properties.members),
|
|
75
80
|
]));
|
|
76
|
-
return [...new Set(values)].sort(
|
|
81
|
+
return [...new Set(values)].sort(compareUnicodeCodePoints);
|
|
77
82
|
};
|
|
78
83
|
const stringArray = (value) => Array.isArray(value)
|
|
79
84
|
? value.filter((item) => typeof item === "string")
|
|
@@ -83,4 +88,4 @@ const uniqueProviders = (evidence) => [
|
|
|
83
88
|
`${provider.id}\0${provider.name}\0${provider.version ?? ""}`,
|
|
84
89
|
provider,
|
|
85
90
|
])).values(),
|
|
86
|
-
].sort((left, right) =>
|
|
91
|
+
].sort((left, right) => compareUnicodeCodePoints(`${left.id}\0${left.name}\0${left.version ?? ""}`, `${right.id}\0${right.name}\0${right.version ?? ""}`));
|