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,14 +1,23 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { semanticCapturePosition, semanticEscapeFollowsCapture, semanticBindingPrecedesCapture, } from "./javascriptSemanticMutationInitializers.js";
|
|
2
3
|
import { semanticSlotAtPath } from "./javascriptSemanticSlots.js";
|
|
3
|
-
import {
|
|
4
|
+
import { invalidateSemanticEscapedPath, invalidateSemanticMutationPaths, } from "./javascriptSemanticMutationValues.js";
|
|
4
5
|
import { resolveSemanticBindingState, } from "./javascriptSemanticState.js";
|
|
5
6
|
import { semanticRequireOrigin } from "./javascriptSemanticRequireOrigin.js";
|
|
6
|
-
import {
|
|
7
|
-
import { readExactJavaScriptLiteral, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
7
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
8
|
+
import { readExactJavaScriptLiteral, semanticStaticPropertyKey, unwrapJavaScriptExpression, } from "./javascriptAstValues.js";
|
|
8
9
|
import { semanticAmbiguousProvenance, semanticLocalProvenance, semanticOriginsProvenance, semanticUnresolvedProvenance, uniqueSemanticOrigins, } from "./javascriptSemanticProvenance.js";
|
|
9
10
|
import { semanticPrimitiveCandidates as primitiveCandidates, semanticPrimitiveSet as primitiveSet, } from "./javascriptSemanticPrimitives.js";
|
|
10
11
|
import { SEMANTIC_EXPRESSION_DEPTH_LIMIT, SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT, exceedsSemanticPrimitiveAdditionByteBudget, exceedsSemanticTemplateByteBudget, semanticResourceLimitUnknown, semanticResourceLimitReason, } from "./javascriptSemanticResourceLimits.js";
|
|
11
12
|
const primitiveBindingValuesByState = new WeakMap();
|
|
13
|
+
const primitiveExpressionValuesByState = new WeakMap();
|
|
14
|
+
const capturedBindingValuesByState = new WeakMap();
|
|
15
|
+
/** Discard primitive projections evaluated before mutation collection finished. */
|
|
16
|
+
export const clearSemanticPrimitiveBindingValues = (state) => {
|
|
17
|
+
primitiveBindingValuesByState.delete(state);
|
|
18
|
+
capturedBindingValuesByState.delete(state);
|
|
19
|
+
primitiveExpressionValuesByState.delete(state);
|
|
20
|
+
};
|
|
12
21
|
const primitiveBindingValuesFor = (state) => {
|
|
13
22
|
const existing = primitiveBindingValuesByState.get(state);
|
|
14
23
|
if (existing !== undefined)
|
|
@@ -26,13 +35,18 @@ export const evaluateSemanticBinding = (binding, state) => evaluateBinding(bindi
|
|
|
26
35
|
expressionDepth: 0,
|
|
27
36
|
primitiveBindingValues: primitiveBindingValuesFor(state),
|
|
28
37
|
});
|
|
29
|
-
/** Evaluate
|
|
30
|
-
export const evaluateSemanticExpression = (node, state) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
/** Evaluate an inert expression, optionally at an earlier reference capture. */
|
|
39
|
+
export const evaluateSemanticExpression = (node, state, capturePoint) => {
|
|
40
|
+
const context = {
|
|
41
|
+
state,
|
|
42
|
+
bindings: new Set(),
|
|
43
|
+
expressionDepth: 0,
|
|
44
|
+
primitiveBindingValues: primitiveBindingValuesFor(state),
|
|
45
|
+
};
|
|
46
|
+
return evaluateExpression(node, capturePoint === undefined
|
|
47
|
+
? context
|
|
48
|
+
: (captureContextAt(capturePoint, context) ?? context));
|
|
49
|
+
};
|
|
36
50
|
/** Follow module provenance through destructuring, members, and aliases. */
|
|
37
51
|
export const evaluateSemanticProvenance = (binding, state) => provenanceForBinding(binding, {
|
|
38
52
|
state,
|
|
@@ -43,6 +57,14 @@ export const evaluateSemanticProvenance = (binding, state) => provenanceForBindi
|
|
|
43
57
|
const evaluateBinding = (binding, context) => {
|
|
44
58
|
if (context.bindings.has(binding.bindingId))
|
|
45
59
|
return { status: "cycle", reason: `Alias cycle at ${binding.name}.` };
|
|
60
|
+
if (context.capturePoint !== undefined &&
|
|
61
|
+
!semanticBindingPrecedesCapture(binding, context.capturePoint, context.state.parentsByNode)) {
|
|
62
|
+
const { capturePoint: _capturePoint, ...liveContext } = context;
|
|
63
|
+
return evaluateBinding(binding, {
|
|
64
|
+
...liveContext,
|
|
65
|
+
primitiveBindingValues: primitiveBindingValuesFor(context.state),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
46
68
|
const cached = context.primitiveBindingValues.get(binding.bindingId);
|
|
47
69
|
if (cached !== undefined)
|
|
48
70
|
return cached;
|
|
@@ -69,10 +91,37 @@ const evaluateBinding = (binding, context) => {
|
|
|
69
91
|
const initializer = binding.initializers[0];
|
|
70
92
|
if (initializer === undefined)
|
|
71
93
|
return { status: "unknown", reason: "Missing binding initializer." };
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
context.bindings.add(binding.bindingId);
|
|
95
|
+
let value;
|
|
96
|
+
try {
|
|
97
|
+
const nested = nestedContext(context);
|
|
98
|
+
value = projectValue(evaluateExpression(initializer.node, nested), initializer.projection);
|
|
99
|
+
if (!isPrimitive(value)) {
|
|
100
|
+
const captureContext = primitiveCaptureContext(initializer.node, nested);
|
|
101
|
+
if (captureContext !== undefined) {
|
|
102
|
+
const captured = projectValue(evaluateExpression(initializer.node, captureContext), initializer.projection);
|
|
103
|
+
if (isPrimitive(captured))
|
|
104
|
+
value = captured;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
context.bindings.delete(binding.bindingId);
|
|
110
|
+
}
|
|
111
|
+
let projected = invalidateSemanticMutationPaths(value, binding.mutatedPaths);
|
|
112
|
+
for (const escape of binding.escapedPaths) {
|
|
113
|
+
// Escapes only invalidate object references; other lattice values survive.
|
|
114
|
+
if (projected.status !== "object" && projected.status !== "array")
|
|
115
|
+
break;
|
|
116
|
+
if (context.capturePoint !== undefined &&
|
|
117
|
+
semanticEscapeFollowsCapture(binding, context.capturePoint, escape.node, context.state.parentsByNode))
|
|
118
|
+
continue;
|
|
119
|
+
projected = invalidateSemanticEscapedPath(projected, escape.path);
|
|
120
|
+
}
|
|
121
|
+
// Point-local memoization also bounds failed speculative captures. Only a
|
|
122
|
+
// primitive result is allowed back into ordinary value evaluation.
|
|
123
|
+
if (context.capturePoint !== undefined ||
|
|
124
|
+
projected.status === "literal" ||
|
|
76
125
|
projected.status === "union" ||
|
|
77
126
|
(isSemanticResourceLimit(projected) &&
|
|
78
127
|
(projected.resourceLimit === "primitive-bytes" ||
|
|
@@ -83,9 +132,21 @@ const evaluateBinding = (binding, context) => {
|
|
|
83
132
|
const evaluateExpression = (node, context) => {
|
|
84
133
|
if (context.expressionDepth > SEMANTIC_EXPRESSION_DEPTH_LIMIT)
|
|
85
134
|
return semanticResourceLimitUnknown("expression-depth");
|
|
135
|
+
const unwrapped = unwrapJavaScriptExpression(node);
|
|
136
|
+
if (unwrapped.depth > 0) {
|
|
137
|
+
if (context.expressionDepth + unwrapped.depth >
|
|
138
|
+
SEMANTIC_EXPRESSION_DEPTH_LIMIT)
|
|
139
|
+
return semanticResourceLimitUnknown("expression-depth");
|
|
140
|
+
return evaluateExpression(unwrapped.node, {
|
|
141
|
+
...context,
|
|
142
|
+
expressionDepth: context.expressionDepth + unwrapped.depth,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
86
145
|
const literal = readExactJavaScriptLiteral(node);
|
|
87
146
|
if (literal.found)
|
|
88
|
-
return
|
|
147
|
+
return typeof literal.value === "number"
|
|
148
|
+
? primitiveSet([literal.value])
|
|
149
|
+
: { status: "literal", value: literal.value };
|
|
89
150
|
if (t.isIdentifier(node)) {
|
|
90
151
|
const binding = resolveSemanticBindingState(context.state, node, node.name);
|
|
91
152
|
return binding === undefined
|
|
@@ -114,11 +175,6 @@ const evaluateExpression = (node, context) => {
|
|
|
114
175
|
return evaluateAddition(node, context);
|
|
115
176
|
if (t.isUnaryExpression(node))
|
|
116
177
|
return evaluateUnary(node, context);
|
|
117
|
-
if ((t.isTSAsExpression(node) ||
|
|
118
|
-
t.isTSTypeAssertion(node) ||
|
|
119
|
-
t.isTSNonNullExpression(node)) &&
|
|
120
|
-
t.isExpression(node.expression))
|
|
121
|
-
return evaluateExpression(node.expression, nestedContext(context));
|
|
122
178
|
return { status: "unknown", reason: `Unsupported ${node.type} value.` };
|
|
123
179
|
};
|
|
124
180
|
const evaluateTemplate = (node, context) => {
|
|
@@ -200,14 +256,14 @@ const evaluateObject = (node, context) => {
|
|
|
200
256
|
name,
|
|
201
257
|
presence: "present",
|
|
202
258
|
value: t.isObjectProperty(property)
|
|
203
|
-
?
|
|
259
|
+
? evaluateCapturedExpression(property.value, nestedContext(context))
|
|
204
260
|
: {
|
|
205
261
|
status: "unknown",
|
|
206
262
|
reason: "Object method or accessor value is not a primitive.",
|
|
207
263
|
},
|
|
208
264
|
});
|
|
209
265
|
}
|
|
210
|
-
const properties = [...propertiesByName.values()].sort((left, right) =>
|
|
266
|
+
const properties = [...propertiesByName.values()].sort((left, right) => compareUnicodeCodePoints(left.name, right.name));
|
|
211
267
|
return unknownProperties
|
|
212
268
|
? {
|
|
213
269
|
status: "object",
|
|
@@ -244,7 +300,7 @@ const evaluateArray = (node, context) => {
|
|
|
244
300
|
items.push({
|
|
245
301
|
name: String(items.length),
|
|
246
302
|
presence: "present",
|
|
247
|
-
value:
|
|
303
|
+
value: evaluateCapturedExpression(element, nestedContext(context)),
|
|
248
304
|
});
|
|
249
305
|
}
|
|
250
306
|
return unknownItems
|
|
@@ -351,6 +407,17 @@ const projectValue = (value, projection) => {
|
|
|
351
407
|
};
|
|
352
408
|
};
|
|
353
409
|
const provenanceForBinding = (binding, context) => {
|
|
410
|
+
const provenance = provenanceForBindingValue(binding, context);
|
|
411
|
+
const assigned = binding.definitions.some(({ kind }) => kind === "assignment");
|
|
412
|
+
const conditionallyInitialized = binding.initializers.some(({ node }) => context.state.conditionalInitializers.has(node));
|
|
413
|
+
if (provenance.status !== "module" ||
|
|
414
|
+
(!assigned && !conditionallyInitialized))
|
|
415
|
+
return provenance;
|
|
416
|
+
return semanticAmbiguousProvenance(provenance.origins, assigned
|
|
417
|
+
? `Binding ${binding.name} may be reassigned.`
|
|
418
|
+
: `Binding ${binding.name} is conditionally initialized.`);
|
|
419
|
+
};
|
|
420
|
+
const provenanceForBindingValue = (binding, context) => {
|
|
354
421
|
if (context.bindings.has(binding.bindingId))
|
|
355
422
|
return semanticUnresolvedProvenance("cycle", `Alias cycle at ${binding.name}.`);
|
|
356
423
|
if (binding.directOrigins.length > 0)
|
|
@@ -364,7 +431,14 @@ const provenanceForBinding = (binding, context) => {
|
|
|
364
431
|
return semanticUnresolvedProvenance("unknown", "Missing binding initializer.");
|
|
365
432
|
if (initializer.projection.includes(null))
|
|
366
433
|
return semanticUnresolvedProvenance("unknown", "Dynamic provenance projection.");
|
|
367
|
-
|
|
434
|
+
context.bindings.add(binding.bindingId);
|
|
435
|
+
let resolved;
|
|
436
|
+
try {
|
|
437
|
+
resolved = provenanceForExpression(initializer.node, nestedContext(context));
|
|
438
|
+
}
|
|
439
|
+
finally {
|
|
440
|
+
context.bindings.delete(binding.bindingId);
|
|
441
|
+
}
|
|
368
442
|
if (resolved.status !== "module" || initializer.projection.length === 0)
|
|
369
443
|
return resolved;
|
|
370
444
|
return semanticOriginsProvenance(resolved.origins.map((origin) => ({
|
|
@@ -378,6 +452,16 @@ const provenanceForBinding = (binding, context) => {
|
|
|
378
452
|
const provenanceForExpression = (node, context) => {
|
|
379
453
|
if (context.expressionDepth > SEMANTIC_EXPRESSION_DEPTH_LIMIT)
|
|
380
454
|
return semanticUnresolvedProvenance("unknown", semanticResourceLimitReason("expression-depth"));
|
|
455
|
+
const unwrapped = unwrapJavaScriptExpression(node);
|
|
456
|
+
if (unwrapped.depth > 0) {
|
|
457
|
+
if (context.expressionDepth + unwrapped.depth >
|
|
458
|
+
SEMANTIC_EXPRESSION_DEPTH_LIMIT)
|
|
459
|
+
return semanticUnresolvedProvenance("unknown", semanticResourceLimitReason("expression-depth"));
|
|
460
|
+
return provenanceForExpression(unwrapped.node, {
|
|
461
|
+
...context,
|
|
462
|
+
expressionDepth: context.expressionDepth + unwrapped.depth,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
381
465
|
const required = semanticRequireOrigin(node, context.state);
|
|
382
466
|
if (required !== undefined)
|
|
383
467
|
return semanticOriginsProvenance([required]);
|
|
@@ -416,9 +500,14 @@ const provenanceForExpression = (node, context) => {
|
|
|
416
500
|
provenanceForExpression(left, nestedContext(context)),
|
|
417
501
|
provenanceForExpression(right, nestedContext(context)),
|
|
418
502
|
];
|
|
419
|
-
const origins = candidates.flatMap((candidate) => candidate.origins);
|
|
503
|
+
const origins = uniqueSemanticOrigins(candidates.flatMap((candidate) => candidate.origins));
|
|
504
|
+
const allModuleOrigins = candidates.every(({ status }) => status === "module");
|
|
505
|
+
if (allModuleOrigins && origins.length === 1)
|
|
506
|
+
return semanticOriginsProvenance(origins);
|
|
420
507
|
return origins.length > 0
|
|
421
|
-
? semanticAmbiguousProvenance(
|
|
508
|
+
? semanticAmbiguousProvenance(origins, allModuleOrigins
|
|
509
|
+
? "Multiple module origins."
|
|
510
|
+
: "Conditional provenance includes a non-module alternative.")
|
|
422
511
|
: semanticUnresolvedProvenance("unknown", "Conditional provenance is unresolved.");
|
|
423
512
|
}
|
|
424
513
|
return semanticLocalProvenance();
|
|
@@ -432,11 +521,61 @@ const mergeValues = (values) => {
|
|
|
432
521
|
? primitiveSet(primitives)
|
|
433
522
|
: { status: "ambiguous", reason: "Branches have incompatible values." };
|
|
434
523
|
};
|
|
435
|
-
const nestedContext = (context
|
|
524
|
+
const nestedContext = (context) => ({
|
|
436
525
|
state: context.state,
|
|
437
526
|
primitiveBindingValues: context.primitiveBindingValues,
|
|
527
|
+
...(context.capturePoint === undefined
|
|
528
|
+
? {}
|
|
529
|
+
: { capturePoint: context.capturePoint }),
|
|
438
530
|
expressionDepth: context.expressionDepth + 1,
|
|
439
|
-
bindings:
|
|
440
|
-
? context.bindings
|
|
441
|
-
: new Set([...context.bindings, bindingId]),
|
|
531
|
+
bindings: context.bindings,
|
|
442
532
|
});
|
|
533
|
+
const isPrimitive = (value) => value.status === "literal" || value.status === "union";
|
|
534
|
+
const primitiveCaptureContext = (node, context) => {
|
|
535
|
+
if (t.isObjectExpression(node) || t.isArrayExpression(node))
|
|
536
|
+
return undefined;
|
|
537
|
+
return captureContextAt(node, context);
|
|
538
|
+
};
|
|
539
|
+
const captureContextAt = (node, context) => {
|
|
540
|
+
if (context.capturePoint !== undefined ||
|
|
541
|
+
semanticCapturePosition(node, context.state.parentsByNode) === null)
|
|
542
|
+
return undefined;
|
|
543
|
+
let captures = capturedBindingValuesByState.get(context.state);
|
|
544
|
+
if (captures === undefined) {
|
|
545
|
+
captures = new WeakMap();
|
|
546
|
+
capturedBindingValuesByState.set(context.state, captures);
|
|
547
|
+
}
|
|
548
|
+
let values = captures.get(node);
|
|
549
|
+
if (values === undefined) {
|
|
550
|
+
values = new Map();
|
|
551
|
+
captures.set(node, values);
|
|
552
|
+
}
|
|
553
|
+
return { ...context, capturePoint: node, primitiveBindingValues: values };
|
|
554
|
+
};
|
|
555
|
+
const evaluateCapturedExpression = (node, context) => {
|
|
556
|
+
// A literal field captures its primitive at construction, even when its
|
|
557
|
+
// containing object is subsequently read at another capture point.
|
|
558
|
+
let values = primitiveExpressionValuesByState.get(context.state);
|
|
559
|
+
const cached = values?.get(node);
|
|
560
|
+
if (cached !== undefined)
|
|
561
|
+
return cached;
|
|
562
|
+
let value = evaluateExpression(node, context);
|
|
563
|
+
if (!isPrimitive(value)) {
|
|
564
|
+
const captureContext = primitiveCaptureContext(node, context);
|
|
565
|
+
if (captureContext !== undefined) {
|
|
566
|
+
const captured = evaluateExpression(node, captureContext);
|
|
567
|
+
if (isPrimitive(captured))
|
|
568
|
+
value = captured;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
// Never publish values evaluated at somebody else's capture point. Like
|
|
572
|
+
// binding caches, these entries are discarded whenever effects change.
|
|
573
|
+
if (context.capturePoint === undefined && isPrimitive(value)) {
|
|
574
|
+
if (values === undefined) {
|
|
575
|
+
values = new WeakMap();
|
|
576
|
+
primitiveExpressionValuesByState.set(context.state, values);
|
|
577
|
+
}
|
|
578
|
+
values.set(node, value);
|
|
579
|
+
}
|
|
580
|
+
return value;
|
|
581
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
2
|
+
import { domainToASCII, fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
/** Map-scoped source declaration and its path interpretation for matching. */
|
|
5
5
|
export const javascriptSourceMapReferenceSchema = z.strictObject({
|
|
@@ -78,7 +78,17 @@ const resolveJavaScriptSourceMapPath = (source, mapPath) => {
|
|
|
78
78
|
};
|
|
79
79
|
return { path: value, kind: relative ? "artifact-relative" : "suffix" };
|
|
80
80
|
};
|
|
81
|
+
// Reject URL delimiters/escapes before IDNA can truncate or decode the host.
|
|
82
|
+
const unusableHost = /[\0\t\n\r #/:<>?@[\\\]^|%]/u;
|
|
83
|
+
// URL/IDNA validation also rejects Unicode hosts that normalize to empty.
|
|
84
|
+
const carriesUsableHost = (host) => !unusableHost.test(host) && domainToASCII(host) !== "";
|
|
81
85
|
const windowsFileUrl = (path) => {
|
|
86
|
+
// A malformed UNC host aborts pathToFileURL() on the Node builds this
|
|
87
|
+
// package admits, so decline the reference before handing the path over
|
|
88
|
+
// rather than trusting a TypeError that never arrives.
|
|
89
|
+
if (path.startsWith("\\\\") &&
|
|
90
|
+
!carriesUsableHost(path.slice(2).split("\\")[0] ?? ""))
|
|
91
|
+
return null;
|
|
82
92
|
try {
|
|
83
93
|
return pathToFileURL(path, { windows: true });
|
|
84
94
|
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
import { parse } from "@babel/parser";
|
|
2
|
+
/**
|
|
3
|
+
* Babel plugins for one source path. Single owner for TypeScript/JSX
|
|
4
|
+
* mode selection (tsc + Babel `typescript` plugin semantics).
|
|
5
|
+
*
|
|
6
|
+
* - `dts:true` only for `.d.ts/.d.mts/.d.cts` ambient declarations;
|
|
7
|
+
* ordinary `.ts` keeps the missing-initializer diagnostic.
|
|
8
|
+
* - JSX enabled for `.tsx`, `.jsx`, `.js`, and unknown paths; disabled for
|
|
9
|
+
* plain `.ts/.cts/.mts` (angle-bracket assertions, not JSX) and for all
|
|
10
|
+
* declaration files. `.mts` (including `.d.mts`) sets
|
|
11
|
+
* `disallowAmbiguousJSXLike`, matching tsc's `.mts` mode.
|
|
12
|
+
* - `decorators-legacy` always present: without it decorated sources fail
|
|
13
|
+
* hard instead of reporting recovered syntax, losing every derived fact.
|
|
14
|
+
* - Unknown paths retain the existing JSX-capable contract (best-effort
|
|
15
|
+
* parse; failures surface via `errorRecovery`, never silent misparse).
|
|
16
|
+
*/
|
|
17
|
+
export const parserPluginsForPath = (sourcePath) => {
|
|
18
|
+
const path = sourcePath ?? "";
|
|
19
|
+
const dts = /\.d\.(?:ts|mts|cts)$/iu.test(path);
|
|
20
|
+
const isTsLike = /\.(?:ts|cts|mts)$/iu.test(path);
|
|
21
|
+
const isTsx = /\.tsx$/iu.test(path);
|
|
22
|
+
const isMts = /\.mts$/iu.test(path);
|
|
23
|
+
const typescript = [
|
|
24
|
+
"typescript",
|
|
25
|
+
{
|
|
26
|
+
dts,
|
|
27
|
+
...(isMts ? { disallowAmbiguousJSXLike: true } : {}),
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
const jsxCapable = !dts && (isTsx || !isTsLike);
|
|
31
|
+
return jsxCapable
|
|
32
|
+
? ["decorators-legacy", "jsx", typescript]
|
|
33
|
+
: ["decorators-legacy", typescript];
|
|
34
|
+
};
|
|
2
35
|
/** Parse JavaScript or TypeScript once without attaching comments to AST nodes. */
|
|
3
36
|
export const parseJavaScriptSource = (source, sourcePath) => {
|
|
4
37
|
try {
|
|
@@ -6,15 +39,7 @@ export const parseJavaScriptSource = (source, sourcePath) => {
|
|
|
6
39
|
sourceType: "unambiguous",
|
|
7
40
|
errorRecovery: true,
|
|
8
41
|
attachComment: false,
|
|
9
|
-
|
|
10
|
-
// forms, including parameter decorators. Without it a decorated
|
|
11
|
-
// TypeScript source fails to parse at all rather than reporting
|
|
12
|
-
// recovered syntax, which loses every fact derived from that source.
|
|
13
|
-
// Plain .ts artifacts admit angle-bracket type assertions instead of JSX.
|
|
14
|
-
// Unknown paths retain the existing JSX-capable parser contract.
|
|
15
|
-
plugins: sourcePath?.toLowerCase().endsWith(".ts") === true
|
|
16
|
-
? ["decorators-legacy", "typescript"]
|
|
17
|
-
: ["decorators-legacy", "jsx", "typescript"],
|
|
42
|
+
plugins: parserPluginsForPath(sourcePath),
|
|
18
43
|
});
|
|
19
44
|
}
|
|
20
45
|
catch (cause) {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
-
import {
|
|
2
|
+
import { ELECTRON_IDENTITY_LIMITATION, ELECTRON_MODULE, } from "./javascriptElectronMemberWrites.js";
|
|
3
|
+
import { completeSemanticSteps, traverseJavaScriptAstSteps, } from "./javascriptSemanticTraversal.js";
|
|
3
4
|
import { inspectElectronStaticNode } from "./electronStaticAnalysis.js";
|
|
4
5
|
import { detectVendors, failedJavaScriptStaticAnalysis, registrationKey, sortedUnique, stringValue, } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
|
-
import { addReference, addSourceMapDirectives, inspectCall, inspectRouteProperty, inspectRoleProperty, } from "./javascriptStaticAnalysisCalls.js";
|
|
6
|
+
import { addReference, addSourceMapDirectives, inspectCall, inspectRouteProperty, inspectRoleProperty, inspectRpcNode, } from "./javascriptStaticAnalysisCalls.js";
|
|
6
7
|
import { inspectBundlerRegistration, inspectEsbuildWrapper, } from "./javascriptStaticAnalysisBundler.js";
|
|
7
8
|
import { finalizeLocatedFindings } from "./javascriptStaticAnalysisFindings.js";
|
|
8
9
|
import { createJavaScriptAnalysisAccumulator, } from "./javascriptStaticAnalysisState.js";
|
|
9
|
-
import { classifyParsedJavaScriptOpenReceivers, } from "./javascriptSemanticAnalysis.js";
|
|
10
|
+
import { classifyParsedJavaScriptElectronBindingsSteps, classifyParsedJavaScriptRpcClientRootsSteps, classifyParsedJavaScriptOpenReceivers, } from "./javascriptSemanticAnalysis.js";
|
|
10
11
|
import { parseJavaScriptSource, } from "./javascriptSourceParser.js";
|
|
12
|
+
import { createJavaScriptRpcScan } from "./javascriptRpcEndpoints.js";
|
|
11
13
|
/** Parse one JavaScript artifact and recover static structure only. */
|
|
12
14
|
export const analyzeJavaScriptStaticSource = (source) => {
|
|
13
15
|
const file = parseJavaScriptSource(source);
|
|
@@ -16,21 +18,31 @@ export const analyzeJavaScriptStaticSource = (source) => {
|
|
|
16
18
|
: analyzeParsedJavaScriptStaticSource(source, file, classifyParsedJavaScriptOpenReceivers(file));
|
|
17
19
|
};
|
|
18
20
|
/** Recover static structure from an already parsed JavaScript artifact. */
|
|
19
|
-
export const analyzeParsedJavaScriptStaticSource = (source, file, openReceiverFacts) =>
|
|
21
|
+
export const analyzeParsedJavaScriptStaticSource = (source, file, openReceiverFacts) => completeSemanticSteps(analyzeParsedJavaScriptStaticSourceSteps(source, file, openReceiverFacts));
|
|
22
|
+
/** Static analysis that yields during its source traversal; results are unchanged. */
|
|
23
|
+
export function* analyzeParsedJavaScriptStaticSourceSteps(source, file, openReceiverFacts) {
|
|
20
24
|
const accumulator = createJavaScriptAnalysisAccumulator(source.length);
|
|
21
|
-
|
|
25
|
+
const electronBindings = yield* classifyParsedJavaScriptElectronBindingsSteps(file);
|
|
26
|
+
const clientRoots = yield* classifyParsedJavaScriptRpcClientRootsSteps(file);
|
|
27
|
+
yield* traverseStaticSourceSteps(file, {
|
|
28
|
+
source,
|
|
29
|
+
accumulator,
|
|
30
|
+
...(openReceiverFacts === undefined ? {} : { openReceiverFacts }),
|
|
31
|
+
electronBindings,
|
|
32
|
+
rpcScan: createJavaScriptRpcScan(source, clientRoots),
|
|
33
|
+
});
|
|
22
34
|
addSourceMapDirectives(source, file.comments ?? [], accumulator);
|
|
23
35
|
return finalizeStaticAnalysis(source, file, accumulator);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
}
|
|
37
|
+
function* traverseStaticSourceSteps(file, findings) {
|
|
38
|
+
yield* traverseJavaScriptAstSteps(file, {
|
|
27
39
|
enter: (node) => {
|
|
28
|
-
accumulator.visitedNodes += 1;
|
|
29
|
-
inspectNode(
|
|
40
|
+
findings.accumulator.visitedNodes += 1;
|
|
41
|
+
inspectNode(node, findings);
|
|
30
42
|
return undefined;
|
|
31
43
|
},
|
|
32
44
|
});
|
|
33
|
-
}
|
|
45
|
+
}
|
|
34
46
|
const finalizeStaticAnalysis = (source, file, accumulator) => {
|
|
35
47
|
const parserErrors = file.errors.length;
|
|
36
48
|
const limitations = [
|
|
@@ -44,6 +56,9 @@ const finalizeStaticAnalysis = (source, file, accumulator) => {
|
|
|
44
56
|
: [
|
|
45
57
|
"One or more static keys, expressions, or Electron boundary values were dynamic and remain unknown.",
|
|
46
58
|
]),
|
|
59
|
+
...(accumulator.references.some(({ value }) => value.specifier !== null && ELECTRON_MODULE.test(value.specifier))
|
|
60
|
+
? [ELECTRON_IDENTITY_LIMITATION]
|
|
61
|
+
: []),
|
|
47
62
|
"JavaScript syntax was parsed as data and was never evaluated.",
|
|
48
63
|
];
|
|
49
64
|
return {
|
|
@@ -70,12 +85,8 @@ const finalizeStaticAnalysis = (source, file, accumulator) => {
|
|
|
70
85
|
limitations,
|
|
71
86
|
};
|
|
72
87
|
};
|
|
73
|
-
const inspectNode = (
|
|
74
|
-
const
|
|
75
|
-
source,
|
|
76
|
-
accumulator,
|
|
77
|
-
...(openReceiverFacts === undefined ? {} : { openReceiverFacts }),
|
|
78
|
-
};
|
|
88
|
+
const inspectNode = (node, findings) => {
|
|
89
|
+
const { source, accumulator } = findings;
|
|
79
90
|
inspectElectronStaticNode(node, findings);
|
|
80
91
|
if (t.isCallExpression(node)) {
|
|
81
92
|
inspectBundlerRegistration(source, node, accumulator);
|
|
@@ -110,4 +121,5 @@ const inspectNode = (source, node, accumulator, openReceiverFacts) => {
|
|
|
110
121
|
inspectRouteProperty(node, findings);
|
|
111
122
|
inspectRoleProperty(node, findings);
|
|
112
123
|
}
|
|
124
|
+
inspectRpcNode(node, findings);
|
|
113
125
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
3
3
|
import { collectJavaScriptExports, fingerprintJavaScriptAst, } from "./javascriptAstFingerprint.js";
|
|
4
|
-
import {
|
|
4
|
+
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
5
5
|
import { addFindingOnce } from "./javascriptStaticAnalysisFindings.js";
|
|
6
6
|
import { argumentValue, calleeName, chunkRuntime, factoryRequireName, moduleFactory, modulePropertyName, range, registrationKey, sha256Text, sourceSlice, staticArrayValues, } from "./javascriptStaticAnalysisHelpers.js";
|
|
7
7
|
/** Inspect a bundler registration call and recover its module table. */
|
|
@@ -15,7 +15,7 @@ export const inspectBundlerRegistration = (source, call, accumulator) => {
|
|
|
15
15
|
const runtimeValue = runtimeMetadata(entry.elements[2]);
|
|
16
16
|
if (!t.isArrayExpression(chunkIds) || !t.isObjectExpression(table))
|
|
17
17
|
return;
|
|
18
|
-
const recovered = recoverBundlerModules(source, table, accumulator);
|
|
18
|
+
const recovered = recoverBundlerModules(source, table, runtime, accumulator);
|
|
19
19
|
const chunkKeys = staticArrayValues(chunkIds);
|
|
20
20
|
accumulator.unknownFindings += chunkKeys.unknown;
|
|
21
21
|
accumulator.unknownFindings +=
|
|
@@ -39,7 +39,7 @@ export const inspectBundlerRegistration = (source, call, accumulator) => {
|
|
|
39
39
|
unknown_entry_module_keys: runtimeValue.unknownEntryModuleKeys,
|
|
40
40
|
async_chunk_keys: asyncChunkKeys.values,
|
|
41
41
|
unknown_async_chunk_keys: runtimeValue.unknownAsyncChunkKeys + recovered.unknownAsyncChunkKeys,
|
|
42
|
-
modules: recovered.modules.sort((left, right) =>
|
|
42
|
+
modules: recovered.modules.sort((left, right) => compareUnicodeCodePoints(left.module_key, right.module_key)),
|
|
43
43
|
location: range(call),
|
|
44
44
|
};
|
|
45
45
|
addFindingOnce(accumulator, `registration\0${registrationKey(registration)}`, () => accumulator.registrations.push(registration));
|
|
@@ -55,13 +55,14 @@ export const inspectEsbuildWrapper = (source, call, accumulator) => {
|
|
|
55
55
|
const table = call.arguments[0];
|
|
56
56
|
if (wrapperKind === null || !t.isObjectExpression(table))
|
|
57
57
|
return;
|
|
58
|
-
const
|
|
58
|
+
const runtime = `esbuild-${wrapperKind}`;
|
|
59
|
+
const recovered = recoverBundlerModules(source, table, runtime, accumulator);
|
|
59
60
|
if (recovered.modules.length === 0)
|
|
60
61
|
return;
|
|
61
62
|
accumulator.unknownFindings += recovered.unknownAsyncChunkKeys;
|
|
62
63
|
const registration = {
|
|
63
64
|
bundler: "esbuild",
|
|
64
|
-
runtime
|
|
65
|
+
runtime,
|
|
65
66
|
chunk_keys: [`${wrapperKind}@${String(call.start ?? 0)}`],
|
|
66
67
|
unknown_chunk_keys: 0,
|
|
67
68
|
runtime_require_name: null,
|
|
@@ -70,17 +71,17 @@ export const inspectEsbuildWrapper = (source, call, accumulator) => {
|
|
|
70
71
|
unknown_entry_module_keys: 0,
|
|
71
72
|
async_chunk_keys: recovered.asyncChunkKeys,
|
|
72
73
|
unknown_async_chunk_keys: recovered.unknownAsyncChunkKeys,
|
|
73
|
-
modules: recovered.modules.sort((left, right) =>
|
|
74
|
+
modules: recovered.modules.sort((left, right) => compareUnicodeCodePoints(left.module_key, right.module_key)),
|
|
74
75
|
location: range(call),
|
|
75
76
|
};
|
|
76
77
|
addFindingOnce(accumulator, `registration\0${registrationKey(registration)}`, () => accumulator.registrations.push(registration));
|
|
77
78
|
};
|
|
78
|
-
const recoverBundlerModules = (source, table, accumulator) => {
|
|
79
|
+
const recoverBundlerModules = (source, table, runtime, accumulator) => {
|
|
79
80
|
const modules = [];
|
|
80
81
|
const asyncChunkKeys = [];
|
|
81
82
|
let unknownAsyncChunkKeys = 0;
|
|
82
83
|
for (const property of table.properties) {
|
|
83
|
-
const recovered = recoverBundlerModule(source, property, accumulator);
|
|
84
|
+
const recovered = recoverBundlerModule(source, property, runtime, accumulator);
|
|
84
85
|
if (recovered === null)
|
|
85
86
|
continue;
|
|
86
87
|
modules.push(recovered.module);
|
|
@@ -93,7 +94,7 @@ const recoverBundlerModules = (source, table, accumulator) => {
|
|
|
93
94
|
unknownAsyncChunkKeys,
|
|
94
95
|
};
|
|
95
96
|
};
|
|
96
|
-
const recoverBundlerModule = (source, property, accumulator) => {
|
|
97
|
+
const recoverBundlerModule = (source, property, runtime, accumulator) => {
|
|
97
98
|
const factory = moduleFactory(property);
|
|
98
99
|
if (factory === undefined)
|
|
99
100
|
return null;
|
|
@@ -109,6 +110,7 @@ const recoverBundlerModule = (source, property, accumulator) => {
|
|
|
109
110
|
start: factory.start,
|
|
110
111
|
end: factory.end,
|
|
111
112
|
key,
|
|
113
|
+
runtime,
|
|
112
114
|
requireName,
|
|
113
115
|
};
|
|
114
116
|
accumulator.moduleRangeIndex.add(moduleRange);
|
|
@@ -146,7 +148,7 @@ const runtimeMetadata = (node) => {
|
|
|
146
148
|
asyncChunkKeys: [],
|
|
147
149
|
unknownAsyncChunkKeys: 0,
|
|
148
150
|
};
|
|
149
|
-
const entries =
|
|
151
|
+
const entries = collectBundlerCallArgumentValues(node, requireName);
|
|
150
152
|
const asyncChunks = collectBundlerAsyncChunkKeys(node, requireName);
|
|
151
153
|
return {
|
|
152
154
|
requireName,
|
|
@@ -156,7 +158,6 @@ const runtimeMetadata = (node) => {
|
|
|
156
158
|
unknownAsyncChunkKeys: asyncChunks.unknown,
|
|
157
159
|
};
|
|
158
160
|
};
|
|
159
|
-
const collectBundlerEntryModuleKeys = (factory, requireName) => collectBundlerCallArgumentValues(factory, requireName);
|
|
160
161
|
const collectBundlerAsyncChunkKeys = (factory, requireName) => requireName === null
|
|
161
162
|
? { values: [], unknown: 0 }
|
|
162
163
|
: collectBundlerCallArgumentValues(factory, `${requireName}.e`);
|
|
@@ -183,7 +184,7 @@ const isBundlerFunction = (node) => t.isFunctionExpression(node) ||
|
|
|
183
184
|
t.isArrowFunctionExpression(node) ||
|
|
184
185
|
t.isObjectMethod(node);
|
|
185
186
|
const uniqueValues = (values, unknown = 0) => {
|
|
186
|
-
const unique = [...new Set(values)].sort(
|
|
187
|
+
const unique = [...new Set(values)].sort(compareUnicodeCodePoints);
|
|
187
188
|
return {
|
|
188
189
|
values: unique,
|
|
189
190
|
unknown,
|