rea-agents 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +51 -19
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +22 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +70 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +66 -31
- package/dist/application/DirectAnalysis.js +2 -2
- package/dist/application/DirectAnalysisCleanup.js +1 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +5 -3
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/JsonFiles.js +6 -5
- package/dist/{cliJsonFile.js → application/JsonInputFile.js} +108 -35
- package/dist/application/LinuxHopper.js +4 -12
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +9 -3
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +93 -7
- package/dist/application/Setup.js +54 -6
- package/dist/application/SetupClientConfiguration.js +116 -16
- package/dist/application/SetupHost.js +102 -24
- package/dist/application/SetupPlan.js +5 -8
- package/dist/application/SetupSkill.js +58 -39
- package/dist/application/SupportedClients.js +290 -65
- package/dist/application/Uninstall.js +158 -10
- package/dist/application/UpdateMaintenance.js +17 -21
- package/dist/application/Utf8JsonInput.js +7 -0
- package/dist/application/WebScriptExportService.js +131 -65
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/BinarySession.js +2 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +19 -6
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationService.js +22 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -30
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +67 -19
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +19 -16
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +258 -235
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +115 -26
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -1
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -4
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +199 -61
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +20 -15
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +176 -102
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +29 -22
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +32 -13
- package/dist/artifacts/extraction/ArtifactExtraction.js +110 -86
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +110 -43
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +75 -32
- package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +62 -25
- package/dist/artifacts/inventory/scanReader.js +38 -11
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +15 -9
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +5 -0
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +32 -10
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +60 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +69 -7
- package/dist/browser/PlaywrightScenarioSession.js +127 -54
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +3 -3
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreBinaryCommands.js +0 -5
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +6 -1
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +17 -1
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +11 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/utilityCommands.js +66 -18
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +6 -0
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +2 -2
- package/dist/cliObservationOptions.js +3 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/directAnalysis.js +12 -4
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +10 -10
- package/dist/contracts/javascript/electronToolContracts.js +15 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionToolContracts.js +2 -2
- package/dist/contracts/sessionToolSchemas.js +6 -2
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +5 -3
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -6
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +2 -1
- package/dist/domain/analysisView/analysisView.js +52 -2
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +2 -2
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +35 -7
- package/dist/domain/artifactGraph.js +5 -3
- package/dist/domain/artifactIdentity.js +30 -2
- package/dist/domain/artifactInspection.js +3 -43
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +11 -12
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/evidence.js +2 -1
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -13
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -20
- package/dist/domain/javascript/electronStaticAnalysisNative.js +70 -40
- package/dist/domain/javascript/electronStaticAnalysisValues.js +16 -0
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +6 -6
- package/dist/domain/javascript/javascriptApplicationGraph.js +79 -18
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +58 -31
- package/dist/domain/javascript/javascriptAstValues.js +32 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -1
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +8 -11
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +190 -33
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +42 -41
- package/dist/domain/javascript/javascriptSemanticGraph.js +69 -23
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -10
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +40 -7
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +341 -87
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +7 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +52 -14
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
- package/dist/domain/javascript/javascriptSemanticQuery.js +27 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +13 -23
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +19 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -19
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +8 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonShape.js +63 -52
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/managed/managedApplicationGraph.js +37 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +32 -22
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +91 -1
- package/dist/domain/process/processCaptureExample.js +24 -0
- package/dist/domain/process/processCaptureValidation.js +79 -0
- package/dist/domain/process/processScenario.js +59 -7
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/referenceSourceGraph.js +25 -16
- package/dist/domain/referenceSourceImportParsing.js +6 -3
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/webBundleAnalyzerInspection.js +14 -2
- package/dist/domain/webCaptureDiff.js +102 -4
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +4 -2
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +55 -24
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +33 -1
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +76 -4
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +1 -1
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +80 -39
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +8 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +3 -1
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/NativeMacOSProvider.js +91 -16
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +96 -39
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +28 -4
- package/dist/process/capture/ProcessCaptureLifecycle.js +350 -59
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessHarness.js +194 -26
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +97 -25
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +32 -3
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +49 -18
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +33 -5
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +22 -1
|
@@ -3,7 +3,7 @@ import { compareUnicodeCodePoints, compositeKey, } from "../unicodeCodePointOrde
|
|
|
3
3
|
import { stripQueryAndFragment } from "../artifactPathSyntax.js";
|
|
4
4
|
import { addLocatedFinding } from "./javascriptStaticAnalysisFindings.js";
|
|
5
5
|
import { argumentNode, calleeName, range, stringValue, } from "./javascriptStaticAnalysisHelpers.js";
|
|
6
|
-
import { propertyName,
|
|
6
|
+
import { propertyName, semanticStaticPropertyKey, } from "./javascriptAstValues.js";
|
|
7
7
|
/** Inspect JavaScript-side imports and re-exports of native .node addons. */
|
|
8
8
|
export const inspectElectronNativeNode = (node, context) => {
|
|
9
9
|
if (t.isImportDeclaration(node))
|
|
@@ -20,12 +20,12 @@ export const inspectElectronNativeNode = (node, context) => {
|
|
|
20
20
|
const inspectImport = (node, context) => {
|
|
21
21
|
if (!isNativeSpecifier(node.source.value, "import"))
|
|
22
22
|
return;
|
|
23
|
-
const members = node.specifiers.
|
|
23
|
+
const members = node.specifiers.flatMap((specifier) => {
|
|
24
24
|
if (t.isImportDefaultSpecifier(specifier))
|
|
25
|
-
return "default";
|
|
25
|
+
return ["default"];
|
|
26
26
|
if (t.isImportNamespaceSpecifier(specifier))
|
|
27
|
-
return
|
|
28
|
-
return propertyName(specifier.imported)
|
|
27
|
+
return [];
|
|
28
|
+
return [propertyName(specifier.imported)];
|
|
29
29
|
});
|
|
30
30
|
addBinding({
|
|
31
31
|
context,
|
|
@@ -34,6 +34,8 @@ const inspectImport = (node, context) => {
|
|
|
34
34
|
kind: "import",
|
|
35
35
|
moduleKind: "import",
|
|
36
36
|
members,
|
|
37
|
+
namespaceAccess: node.specifiers.some((value) => t.isImportNamespaceSpecifier(value)),
|
|
38
|
+
dynamicMemberAccess: false,
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
const inspectNamedExport = (node, context) => {
|
|
@@ -41,10 +43,12 @@ const inspectNamedExport = (node, context) => {
|
|
|
41
43
|
node.source === undefined ||
|
|
42
44
|
!isNativeSpecifier(node.source.value, "import"))
|
|
43
45
|
return;
|
|
44
|
-
const members = node.specifiers.
|
|
46
|
+
const members = node.specifiers.flatMap((specifier) => {
|
|
45
47
|
if (t.isExportSpecifier(specifier))
|
|
46
|
-
return propertyName(specifier.local);
|
|
47
|
-
|
|
48
|
+
return [propertyName(specifier.local)];
|
|
49
|
+
if (t.isExportDefaultSpecifier(specifier))
|
|
50
|
+
return ["default"];
|
|
51
|
+
return [];
|
|
48
52
|
});
|
|
49
53
|
addBinding({
|
|
50
54
|
context,
|
|
@@ -53,6 +57,8 @@ const inspectNamedExport = (node, context) => {
|
|
|
53
57
|
kind: "re-export",
|
|
54
58
|
moduleKind: "import",
|
|
55
59
|
members,
|
|
60
|
+
namespaceAccess: node.specifiers.some((value) => t.isExportNamespaceSpecifier(value)),
|
|
61
|
+
dynamicMemberAccess: false,
|
|
56
62
|
});
|
|
57
63
|
};
|
|
58
64
|
const inspectExportAll = (node, context) => {
|
|
@@ -65,7 +71,9 @@ const inspectExportAll = (node, context) => {
|
|
|
65
71
|
specifier: node.source.value,
|
|
66
72
|
kind: "re-export",
|
|
67
73
|
moduleKind: "import",
|
|
68
|
-
members: [
|
|
74
|
+
members: [],
|
|
75
|
+
namespaceAccess: true,
|
|
76
|
+
dynamicMemberAccess: false,
|
|
69
77
|
});
|
|
70
78
|
};
|
|
71
79
|
const inspectRequireBinding = (node, context) => {
|
|
@@ -78,7 +86,7 @@ const inspectRequireBinding = (node, context) => {
|
|
|
78
86
|
specifier: required.specifier,
|
|
79
87
|
kind: "require",
|
|
80
88
|
moduleKind: "require",
|
|
81
|
-
|
|
89
|
+
...(required.hasMemberAccess ? required.access : bindingMembers(node.id)),
|
|
82
90
|
});
|
|
83
91
|
};
|
|
84
92
|
const inspectReExport = (node, context) => {
|
|
@@ -91,26 +99,32 @@ const inspectReExport = (node, context) => {
|
|
|
91
99
|
specifier: required.specifier,
|
|
92
100
|
kind: "re-export",
|
|
93
101
|
moduleKind: "require",
|
|
94
|
-
|
|
102
|
+
...required.access,
|
|
95
103
|
});
|
|
96
104
|
};
|
|
97
105
|
const addBinding = (input) => {
|
|
98
106
|
const { context, node, specifier, kind } = input;
|
|
99
|
-
const
|
|
100
|
-
...new Set(input.members.filter((member) => member !== "")),
|
|
101
|
-
].sort(compareUnicodeCodePoints);
|
|
102
|
-
const members = unique.length === 0 ? ["*"] : unique;
|
|
107
|
+
const members = [...new Set(input.members)].sort(compareUnicodeCodePoints);
|
|
103
108
|
addLocatedFinding(context, {
|
|
104
109
|
collection: context.accumulator.nativeAddonBindings,
|
|
105
110
|
// Members are a variable-length source-derived list: compositeKey keeps
|
|
106
111
|
// ["a\0b"] distinct from ["a", "b"] instead of collapsing one binding.
|
|
107
|
-
key: compositeKey([
|
|
112
|
+
key: compositeKey([
|
|
113
|
+
"native-addon-binding",
|
|
114
|
+
kind,
|
|
115
|
+
specifier,
|
|
116
|
+
members,
|
|
117
|
+
input.namespaceAccess,
|
|
118
|
+
input.dynamicMemberAccess,
|
|
119
|
+
]),
|
|
108
120
|
node,
|
|
109
121
|
value: {
|
|
110
122
|
specifier,
|
|
111
123
|
binding_kind: kind,
|
|
112
124
|
module_kind: input.moduleKind,
|
|
113
125
|
members,
|
|
126
|
+
namespace_access: input.namespaceAccess,
|
|
127
|
+
dynamic_member_access: input.dynamicMemberAccess,
|
|
114
128
|
module_key: null,
|
|
115
129
|
location: range(node),
|
|
116
130
|
},
|
|
@@ -118,12 +132,14 @@ const addBinding = (input) => {
|
|
|
118
132
|
};
|
|
119
133
|
const nativeRequire = (node) => {
|
|
120
134
|
let member = null;
|
|
135
|
+
let hasMemberAccess = false;
|
|
121
136
|
while (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
|
|
122
137
|
if (!t.isNode(node.object))
|
|
123
138
|
return undefined;
|
|
124
|
-
const property =
|
|
125
|
-
|
|
126
|
-
|
|
139
|
+
const property = semanticStaticPropertyKey(node.property, node.computed);
|
|
140
|
+
// Walking inward leaves the first member consumed from the addon itself.
|
|
141
|
+
member = property;
|
|
142
|
+
hasMemberAccess = true;
|
|
127
143
|
node = node.object;
|
|
128
144
|
}
|
|
129
145
|
if (!t.isCallExpression(node))
|
|
@@ -135,33 +151,47 @@ const nativeRequire = (node) => {
|
|
|
135
151
|
return undefined;
|
|
136
152
|
const specifier = stringValue(argumentNode(node.arguments[0]));
|
|
137
153
|
return specifier !== undefined && isNativeSpecifier(specifier, "require")
|
|
138
|
-
? {
|
|
154
|
+
? {
|
|
155
|
+
specifier,
|
|
156
|
+
hasMemberAccess,
|
|
157
|
+
access: {
|
|
158
|
+
members: member === null ? [] : [member],
|
|
159
|
+
namespaceAccess: !hasMemberAccess,
|
|
160
|
+
dynamicMemberAccess: hasMemberAccess && member === null,
|
|
161
|
+
},
|
|
162
|
+
}
|
|
139
163
|
: undefined;
|
|
140
164
|
};
|
|
141
165
|
const bindingMembers = (pattern) => {
|
|
142
|
-
if (t.isIdentifier(pattern))
|
|
143
|
-
return ["*"];
|
|
144
166
|
if (!t.isObjectPattern(pattern))
|
|
145
|
-
return [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
167
|
+
return { members: [], namespaceAccess: true, dynamicMemberAccess: false };
|
|
168
|
+
const members = [];
|
|
169
|
+
let namespaceAccess = false;
|
|
170
|
+
let dynamicMemberAccess = false;
|
|
171
|
+
for (const property of pattern.properties) {
|
|
172
|
+
if (t.isRestElement(property)) {
|
|
173
|
+
namespaceAccess = true;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const key = semanticStaticPropertyKey(property.key, property.computed);
|
|
177
|
+
if (key === null)
|
|
178
|
+
dynamicMemberAccess = true;
|
|
179
|
+
else
|
|
180
|
+
members.push(key);
|
|
181
|
+
}
|
|
182
|
+
return { members, namespaceAccess, dynamicMemberAccess };
|
|
151
183
|
};
|
|
152
184
|
const isModuleExport = (node) => {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return name.slice("exports.".length);
|
|
164
|
-
return undefined;
|
|
185
|
+
const keys = [];
|
|
186
|
+
while (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
|
|
187
|
+
keys.unshift(semanticStaticPropertyKey(node.property, node.computed));
|
|
188
|
+
node = node.object;
|
|
189
|
+
}
|
|
190
|
+
if (!t.isIdentifier(node))
|
|
191
|
+
return false;
|
|
192
|
+
return node.name === "exports"
|
|
193
|
+
? keys.length > 0
|
|
194
|
+
: node.name === "module" && keys[0] === "exports";
|
|
165
195
|
};
|
|
166
196
|
const isNativeSpecifier = (specifier, moduleKind) => {
|
|
167
197
|
const path = moduleKind === "require" ? specifier : stripQueryAndFragment(specifier);
|
|
@@ -2,6 +2,22 @@ import * as t from "@babel/types";
|
|
|
2
2
|
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
3
3
|
import { readExactJavaScriptLiteral, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
4
4
|
import { sourceSlice } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
|
+
/** Resolve a callee only when its root has a proven Electron module identity. */
|
|
6
|
+
export const electronCalleePath = (callee, context) => {
|
|
7
|
+
const members = [];
|
|
8
|
+
let root = callee;
|
|
9
|
+
while (t.isMemberExpression(root) || t.isOptionalMemberExpression(root)) {
|
|
10
|
+
const member = semanticStaticPropertyName(root.property, root.computed);
|
|
11
|
+
if (member === "" || !t.isNode(root.object))
|
|
12
|
+
return undefined;
|
|
13
|
+
members.push(member);
|
|
14
|
+
root = root.object;
|
|
15
|
+
}
|
|
16
|
+
const exported = context.electronBindings?.get(root.start ?? -1);
|
|
17
|
+
return exported === undefined
|
|
18
|
+
? undefined
|
|
19
|
+
: [...exported, ...members.toReversed()];
|
|
20
|
+
};
|
|
5
21
|
/** Preserve one literal value or the exact inert expression. */
|
|
6
22
|
export const electronStaticValue = (source, node) => {
|
|
7
23
|
const literal = literalValue(node);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Shared operational defaults for the isolated source-analysis boundary. */
|
|
3
|
+
export const JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS = {
|
|
4
|
+
heapMb: 1024,
|
|
5
|
+
timeoutMs: 300_000,
|
|
6
|
+
};
|
|
7
|
+
/** Project observed execution limits without inventing unmeasured values. */
|
|
8
|
+
export const javaScriptAnalysisCoverageLimits = (limits) => {
|
|
9
|
+
const result = [];
|
|
10
|
+
for (const key of [
|
|
11
|
+
"worker_heap_limit_bytes",
|
|
12
|
+
"worker_timeout_ms",
|
|
13
|
+
"parent_result_budget_bytes",
|
|
14
|
+
"semantic_result_budget_bytes",
|
|
15
|
+
"transfer_record_bytes",
|
|
16
|
+
"transfer_file_bytes",
|
|
17
|
+
]) {
|
|
18
|
+
const value = limits?.[key];
|
|
19
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0)
|
|
20
|
+
continue;
|
|
21
|
+
result.push({
|
|
22
|
+
name: `javascript_analysis_${key}`,
|
|
23
|
+
value,
|
|
24
|
+
unit: key.endsWith("_ms") ? "milliseconds" : "bytes",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
/** Optional operational choices; omission keeps them out of Evidence parameters. */
|
|
30
|
+
export const javaScriptAnalysisResourceControlsSchema = z.strictObject({
|
|
31
|
+
max_heap_mb: z
|
|
32
|
+
.number()
|
|
33
|
+
.int()
|
|
34
|
+
.min(128)
|
|
35
|
+
.max(16_384)
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("Maximum V8 old-space heap in MiB for the isolated JavaScript source analyzer; defaults to 1024. This does not change the CLI/MCP process heap."),
|
|
38
|
+
analysis_timeout_ms: z
|
|
39
|
+
.number()
|
|
40
|
+
.int()
|
|
41
|
+
.min(1)
|
|
42
|
+
.max(2_147_483_647)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Maximum startup, analysis and transfer time per JavaScript source, in milliseconds; defaults to 300000. On timeout, return collected partial Evidence and stop the analysis."),
|
|
45
|
+
});
|
|
@@ -4,13 +4,16 @@ import { javaScriptSemanticGraphSchema, isValidatedImmutableJavaScriptSemanticGr
|
|
|
4
4
|
import { digestSchema } from "../digests.js";
|
|
5
5
|
import { prefixedDigestSchema } from "../digests.js";
|
|
6
6
|
import { integrityContradictionSchema } from "../artifactGraph.js";
|
|
7
|
+
import { artifactIntegrityPolicySchema } from "../artifactIntegrityPolicy.js";
|
|
7
8
|
import { localPathStringSchema } from "../localPath.js";
|
|
9
|
+
import { javaScriptAnalysisResourceControlsSchema } from "./javascriptAnalysisResourceControls.js";
|
|
8
10
|
const countSchema = z.number().int().min(0);
|
|
9
11
|
/** Public target-free request for static JavaScript application analysis. */
|
|
10
12
|
export const analyzeJavaScriptApplicationInputSchema = z.strictObject({
|
|
11
13
|
input_path: localPathStringSchema,
|
|
12
14
|
format: z.enum(["auto", "asar", "directory"]).default("auto"),
|
|
13
|
-
integrity_policy:
|
|
15
|
+
integrity_policy: artifactIntegrityPolicySchema,
|
|
16
|
+
...javaScriptAnalysisResourceControlsSchema.shape,
|
|
14
17
|
});
|
|
15
18
|
/** Compact counts for the high-level Electron architecture/security surface. */
|
|
16
19
|
const electronBoundarySummarySchema = z.strictObject({
|
|
@@ -21,7 +21,9 @@ export const buildJavaScriptApplicationChangeGraph = (input) => {
|
|
|
21
21
|
...input.left.edges,
|
|
22
22
|
...input.right.edges,
|
|
23
23
|
]).filter(({ source_node_id: source, target_node_id: target }) => retained.has(source) && retained.has(target));
|
|
24
|
-
const
|
|
24
|
+
const leftById = new Map(input.left.nodes.map((node) => [node.node_id, node]));
|
|
25
|
+
const rightById = new Map(input.right.nodes.map((node) => [node.node_id, node]));
|
|
26
|
+
const comparisonEdges = input.items.flatMap((item) => changedFromEdge(item, input, retained, leftById, rightById));
|
|
25
27
|
const candidateEdges = uniqueEdges([...sourceEdges, ...comparisonEdges]);
|
|
26
28
|
const rootNodeIds = preferredRoots.filter((nodeId) => retained.has(nodeId));
|
|
27
29
|
const fallbackRoot = mergedNodes[0]?.node_id;
|
|
@@ -62,7 +64,7 @@ const nodeCandidates = (input) => {
|
|
|
62
64
|
output.set(node.node_id, [...(output.get(node.node_id) ?? []), node]);
|
|
63
65
|
return output;
|
|
64
66
|
};
|
|
65
|
-
const changedFromEdge = (item, input, retained) => {
|
|
67
|
+
const changedFromEdge = (item, input, retained, leftById, rightById) => {
|
|
66
68
|
const left = item.left_node_id;
|
|
67
69
|
const right = item.right_node_id;
|
|
68
70
|
if (item.match.status !== "matched" ||
|
|
@@ -73,7 +75,7 @@ const changedFromEdge = (item, input, retained) => {
|
|
|
73
75
|
!retained.has(left) ||
|
|
74
76
|
!retained.has(right))
|
|
75
77
|
return [];
|
|
76
|
-
const evidence = comparisonEvidence(item, input);
|
|
78
|
+
const evidence = comparisonEvidence(item, input, leftById.get(left), rightById.get(right));
|
|
77
79
|
return [
|
|
78
80
|
createJavaScriptApplicationEdge({
|
|
79
81
|
source_node_id: right,
|
|
@@ -90,9 +92,7 @@ const changedFromEdge = (item, input, retained) => {
|
|
|
90
92
|
}),
|
|
91
93
|
];
|
|
92
94
|
};
|
|
93
|
-
const comparisonEvidence = (item, input) => {
|
|
94
|
-
const right = input.right.nodes.find(({ node_id: id }) => id === item.right_node_id);
|
|
95
|
-
const left = input.left.nodes.find(({ node_id: id }) => id === item.left_node_id);
|
|
95
|
+
const comparisonEvidence = (item, input, left, right) => {
|
|
96
96
|
const source = right?.observations[0]?.evidence ?? left?.observations[0]?.evidence;
|
|
97
97
|
const complete = input.left.coverage.status === "complete" &&
|
|
98
98
|
input.right.coverage.status === "complete";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { arrayContainerSchema, parseElementSteps, } from "../zodCollectionSteps.js";
|
|
3
|
+
import { canonicalJsonDigestSteps } from "../canonicalJsonDigestSteps.js";
|
|
2
4
|
import { canonicalJson } from "../comparisonSemantics.js";
|
|
3
5
|
import { digestCanonicalValue } from "../canonicalDigest.js";
|
|
4
6
|
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
5
7
|
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
|
6
|
-
import { freezeOwnedJsonSnapshotSteps } from "../immutableJson.js";
|
|
8
|
+
import { freezeJsonSnapshot, freezeOwnedJsonSnapshotSteps, } from "../immutableJson.js";
|
|
7
9
|
import { applicationEdgeInputSchema, applicationEdgeSchema, applicationNodeInputSchema, applicationNodeObservationSchema, applicationNodeSchema, javascriptApplicationGraphInputSchema, javascriptApplicationGraphRecordSchema, } from "./javascriptApplicationGraphSchemas.js";
|
|
8
10
|
const OBSERVATION_IDENTIFIER_STRATEGY = {
|
|
9
11
|
strategy: "semantic-content-sha256",
|
|
@@ -160,7 +162,12 @@ const checkNode = (node, index, context) => {
|
|
|
160
162
|
path: ["nodes", index, "identity"],
|
|
161
163
|
});
|
|
162
164
|
};
|
|
163
|
-
const
|
|
165
|
+
const checkGraphContent = (graph, context) => {
|
|
166
|
+
const steps = checkGraphContentSteps(graph, context);
|
|
167
|
+
while (steps.next().done !== true)
|
|
168
|
+
;
|
|
169
|
+
};
|
|
170
|
+
function* checkGraphContentSteps(graph, context) {
|
|
164
171
|
sortedUniqueIssue(graph.root_node_ids, ["root_node_ids"], "Root nodes", context);
|
|
165
172
|
sortedUniqueIssue(graph.nodes.map(({ node_id: id }) => id), ["nodes"], "Nodes", context);
|
|
166
173
|
sortedUniqueIssue(graph.edges.map(({ edge_id: id }) => id), ["edges"], "Edges", context);
|
|
@@ -180,9 +187,14 @@ const checkGraphInvariants = (graph, context) => {
|
|
|
180
187
|
message: "Root identifier must name a graph node",
|
|
181
188
|
path: ["root_node_ids"],
|
|
182
189
|
});
|
|
183
|
-
for (const [index, node] of graph.nodes.entries())
|
|
190
|
+
for (const [index, node] of graph.nodes.entries()) {
|
|
191
|
+
if (index % 64 === 0)
|
|
192
|
+
yield;
|
|
184
193
|
checkNode(node, index, context);
|
|
194
|
+
}
|
|
185
195
|
for (const [index, edge] of graph.edges.entries()) {
|
|
196
|
+
if (index % 64 === 0)
|
|
197
|
+
yield;
|
|
186
198
|
const { edge_id: identifier, ...semantic } = edge;
|
|
187
199
|
if (identifier !== edgeId(semantic))
|
|
188
200
|
context.addIssue({
|
|
@@ -213,6 +225,9 @@ const checkGraphInvariants = (graph, context) => {
|
|
|
213
225
|
});
|
|
214
226
|
checkEvidenceNormalization(edge.evidence, ["edges", index, "evidence"], context);
|
|
215
227
|
}
|
|
228
|
+
}
|
|
229
|
+
const checkGraphInvariants = (graph, context) => {
|
|
230
|
+
checkGraphContent(graph, context);
|
|
216
231
|
const { graph_id: identifier, ...semantic } = graph;
|
|
217
232
|
if (identifier !==
|
|
218
233
|
`jag_${digestCanonicalValue(semantic, "JavaScript Application Graph")}`)
|
|
@@ -224,9 +239,14 @@ const checkGraphInvariants = (graph, context) => {
|
|
|
224
239
|
};
|
|
225
240
|
/** Strict JavaScript Application Graph with verified commitments. */
|
|
226
241
|
export const javascriptApplicationGraphSchema = javascriptApplicationGraphRecordSchema.superRefine(checkGraphInvariants);
|
|
242
|
+
const javascriptApplicationGraphContentSchema = javascriptApplicationGraphInputSchema.superRefine(checkGraphContent);
|
|
227
243
|
/** Build one normalized application entity and derive all semantic IDs. */
|
|
228
244
|
export const createJavaScriptApplicationNode = (input) => {
|
|
229
245
|
const parsed = applicationNodeInputSchema.parse(input);
|
|
246
|
+
// These properties are newly parsed and exclusively owned. Authenticate
|
|
247
|
+
// them before the observation/node schemas and final graph validate again.
|
|
248
|
+
for (const observation of parsed.observations)
|
|
249
|
+
freezeJsonSnapshot(observation.properties);
|
|
230
250
|
const identity = normalizeIdentity(parsed.identity);
|
|
231
251
|
const identifier = nodeId({ kind: parsed.kind, identity });
|
|
232
252
|
const observations = parsed.observations
|
|
@@ -252,6 +272,7 @@ export const createJavaScriptApplicationNode = (input) => {
|
|
|
252
272
|
/** Build one normalized directed relationship and derive its semantic ID. */
|
|
253
273
|
export const createJavaScriptApplicationEdge = (input) => {
|
|
254
274
|
const parsed = applicationEdgeInputSchema.parse(input);
|
|
275
|
+
freezeJsonSnapshot(parsed.properties);
|
|
255
276
|
const semantic = {
|
|
256
277
|
...parsed,
|
|
257
278
|
evidence: normalizeEvidence(parsed.evidence),
|
|
@@ -264,26 +285,66 @@ export const createJavaScriptApplicationEdge = (input) => {
|
|
|
264
285
|
};
|
|
265
286
|
/** Normalize a complete graph and derive its top-level semantic ID. */
|
|
266
287
|
export const createJavaScriptApplicationGraph = (input) => {
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
edges: [...parsed.edges].sort((left, right) => compareUnicodeCodePoints(left.edge_id, right.edge_id)),
|
|
273
|
-
coverage: {
|
|
274
|
-
...parsed.coverage,
|
|
275
|
-
limits: normalizeLimits(parsed.coverage.limits),
|
|
276
|
-
},
|
|
277
|
-
limitations: uniqueSorted(parsed.limitations),
|
|
288
|
+
const semantic = normalizeGraphInput(javascriptApplicationGraphInputSchema.parse(input));
|
|
289
|
+
const content = javascriptApplicationGraphContentSchema.parse(semantic);
|
|
290
|
+
return {
|
|
291
|
+
...content,
|
|
292
|
+
graph_id: `jag_${digestCanonicalValue(content, "JavaScript Application Graph")}`,
|
|
278
293
|
};
|
|
279
|
-
return javascriptApplicationGraphSchema.parse({
|
|
280
|
-
...semantic,
|
|
281
|
-
graph_id: `jag_${digestCanonicalValue(semantic, "JavaScript Application Graph")}`,
|
|
282
|
-
});
|
|
283
294
|
};
|
|
295
|
+
const normalizeGraphInput = (parsed) => ({
|
|
296
|
+
...parsed,
|
|
297
|
+
root_node_ids: uniqueSorted(parsed.root_node_ids),
|
|
298
|
+
nodes: [...parsed.nodes].sort((left, right) => compareUnicodeCodePoints(left.node_id, right.node_id)),
|
|
299
|
+
edges: [...parsed.edges].sort((left, right) => compareUnicodeCodePoints(left.edge_id, right.edge_id)),
|
|
300
|
+
coverage: {
|
|
301
|
+
...parsed.coverage,
|
|
302
|
+
limits: normalizeLimits(parsed.coverage.limits),
|
|
303
|
+
},
|
|
304
|
+
limitations: uniqueSorted(parsed.limitations),
|
|
305
|
+
});
|
|
284
306
|
const validatedImmutableApplicationGraphs = new WeakSet();
|
|
285
307
|
/** Clone and validate synchronously, then return steps to seal the owned graph. */
|
|
286
308
|
export const createImmutableJavaScriptApplicationGraphSteps = (input) => sealValidatedApplicationGraphSteps(createJavaScriptApplicationGraph(input));
|
|
309
|
+
const applicationGraphShape = javascriptApplicationGraphInputSchema.shape;
|
|
310
|
+
const applicationGraphContainerSchema = javascriptApplicationGraphInputSchema.extend({
|
|
311
|
+
nodes: arrayContainerSchema(applicationGraphShape.nodes),
|
|
312
|
+
edges: arrayContainerSchema(applicationGraphShape.edges),
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* Seal a graph whose input the caller transfers: the caller neither retains nor
|
|
316
|
+
* mutates any part of it afterwards. Only the graph's own fields are validated
|
|
317
|
+
* synchronously; nodes and edges are validated, checked, hashed and frozen in
|
|
318
|
+
* steps, because doing so at once held the event loop for large applications.
|
|
319
|
+
*/
|
|
320
|
+
export const sealTransferredJavaScriptApplicationGraphSteps = (input) => parseAndSealApplicationGraphSteps(applicationGraphContainerSchema.parse(input));
|
|
321
|
+
function* parseAndSealApplicationGraphSteps(container) {
|
|
322
|
+
const issues = [];
|
|
323
|
+
const parsed = {
|
|
324
|
+
...container,
|
|
325
|
+
nodes: yield* parseElementSteps(applicationGraphShape.nodes.element, container.nodes, ["nodes"], issues),
|
|
326
|
+
edges: yield* parseElementSteps(applicationGraphShape.edges.element, container.edges, ["edges"], issues),
|
|
327
|
+
};
|
|
328
|
+
if (issues.length > 0)
|
|
329
|
+
throw new z.ZodError(issues);
|
|
330
|
+
const content = normalizeGraphInput(parsed);
|
|
331
|
+
let invalid = false;
|
|
332
|
+
yield* checkGraphContentSteps(content, {
|
|
333
|
+
addIssue: () => {
|
|
334
|
+
invalid = true;
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
// An invalid owned graph is a construction defect; report it with the exact
|
|
338
|
+
// issues the content schema produces.
|
|
339
|
+
if (invalid) {
|
|
340
|
+
javascriptApplicationGraphContentSchema.parse(content);
|
|
341
|
+
throw new TypeError("Application graph checks disagree with its schema");
|
|
342
|
+
}
|
|
343
|
+
return yield* sealValidatedApplicationGraphSteps({
|
|
344
|
+
...content,
|
|
345
|
+
graph_id: `jag_${yield* canonicalJsonDigestSteps(content)}`,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
287
348
|
function* sealValidatedApplicationGraphSteps(graph) {
|
|
288
349
|
yield* freezeOwnedJsonSnapshotSteps(graph);
|
|
289
350
|
validatedImmutableApplicationGraphs.add(graph);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Forecast static-fact expansion into observations, nodes and relationships. */
|
|
2
|
+
export const estimateJavaScriptStaticApplicationProjection = (facts, checkpointBytes, sourcePath) => {
|
|
3
|
+
// A finding can produce a node, a separate observation and several edges.
|
|
4
|
+
// Allow for identifiers, locations, authority, coverage and schema copies,
|
|
5
|
+
// independently of the producer's compact checkpoint representation.
|
|
6
|
+
const findings = facts.references.length +
|
|
7
|
+
facts.endpoints.length +
|
|
8
|
+
facts.storage.length +
|
|
9
|
+
facts.role_paths.length +
|
|
10
|
+
facts.source_map_urls.length +
|
|
11
|
+
facts.electron.browser_windows.length +
|
|
12
|
+
facts.electron.context_bridge_apis.length +
|
|
13
|
+
facts.electron.ipc.length +
|
|
14
|
+
facts.electron.sender_validations.length +
|
|
15
|
+
facts.electron.utility_processes.length +
|
|
16
|
+
facts.electron.native_addon_bindings.length;
|
|
17
|
+
let records = findings * 8;
|
|
18
|
+
let repeatedBytes = 0;
|
|
19
|
+
for (const registration of facts.bundler_registrations) {
|
|
20
|
+
records +=
|
|
21
|
+
3 +
|
|
22
|
+
registration.modules.length * 3 +
|
|
23
|
+
registration.entry_module_keys.length * 3 +
|
|
24
|
+
registration.async_chunk_keys.length * 3;
|
|
25
|
+
// Every module observation and containment edge repeats its chunk keys.
|
|
26
|
+
repeatedBytes +=
|
|
27
|
+
Buffer.byteLength(JSON.stringify(registration.chunk_keys)) *
|
|
28
|
+
registration.modules.length *
|
|
29
|
+
2;
|
|
30
|
+
}
|
|
31
|
+
for (const binding of facts.electron.native_addon_bindings)
|
|
32
|
+
records += binding.members.length * 3;
|
|
33
|
+
const metadataBytes = 2048 + Buffer.byteLength(sourcePath) * 4;
|
|
34
|
+
return (checkpointBytes * 4 + repeatedBytes + records * metadataBytes) * 8;
|
|
35
|
+
};
|
|
@@ -12,7 +12,12 @@ export const classifyJavaScriptApplicationVersions = (matching, context) => {
|
|
|
12
12
|
`pair:${left.node_id}:${right.node_id}`,
|
|
13
13
|
]));
|
|
14
14
|
const fullContext = {
|
|
15
|
-
|
|
15
|
+
leftGraph: context.leftGraph,
|
|
16
|
+
rightGraph: context.rightGraph,
|
|
17
|
+
leftEvidenceId: context.leftEvidenceId,
|
|
18
|
+
rightEvidenceId: context.rightEvidenceId,
|
|
19
|
+
leftNativeEvidenceByDigest: indexNativeEvidence(context.leftNativeEvidence),
|
|
20
|
+
rightNativeEvidenceByDigest: indexNativeEvidence(context.rightNativeEvidence),
|
|
16
21
|
pairByLeft,
|
|
17
22
|
pairByRight,
|
|
18
23
|
leftRelationships: indexRelationships(context.leftGraph),
|
|
@@ -258,19 +263,30 @@ const itemEvidenceLinks = (left, right, context) => [
|
|
|
258
263
|
...new Set([
|
|
259
264
|
context.leftEvidenceId,
|
|
260
265
|
context.rightEvidenceId,
|
|
261
|
-
...nativeLinks(left, context.
|
|
262
|
-
...nativeLinks(right, context.
|
|
266
|
+
...nativeLinks(left, context.leftNativeEvidenceByDigest),
|
|
267
|
+
...nativeLinks(right, context.rightNativeEvidenceByDigest),
|
|
263
268
|
]),
|
|
264
269
|
].sort(compareUnicodeCodePoints);
|
|
265
|
-
const nativeLinks = (node,
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
const nativeLinks = (node, evidenceByDigest) => {
|
|
271
|
+
const identity = node === undefined ? null : contentIdentity(node);
|
|
272
|
+
if (identity === null)
|
|
273
|
+
return [];
|
|
274
|
+
const digest = identity.replace(/^content:/u, "");
|
|
275
|
+
return evidenceByDigest.get(digest) ?? [];
|
|
276
|
+
};
|
|
277
|
+
const indexNativeEvidence = (evidence) => {
|
|
278
|
+
const evidenceByDigest = new Map();
|
|
279
|
+
for (const { evidence_id: id, subject } of evidence) {
|
|
280
|
+
const digest = subject?.digest.sha256;
|
|
281
|
+
if (digest === undefined)
|
|
282
|
+
continue;
|
|
283
|
+
const ids = evidenceByDigest.get(digest);
|
|
284
|
+
if (ids === undefined)
|
|
285
|
+
evidenceByDigest.set(digest, [id]);
|
|
286
|
+
else
|
|
287
|
+
ids.push(id);
|
|
288
|
+
}
|
|
289
|
+
return evidenceByDigest;
|
|
274
290
|
};
|
|
275
291
|
const pairLimitations = (pair, status) => [
|
|
276
292
|
...(pair.basis === "structural-fingerprint"
|
|
@@ -153,7 +153,15 @@ const semanticValue = (node, properties) => {
|
|
|
153
153
|
exactString(properties.api_key) ??
|
|
154
154
|
nonEmptyString(properties.api_name));
|
|
155
155
|
if (node.kind === "native-export")
|
|
156
|
-
return (joined(properties.specifier,
|
|
156
|
+
return (joined(properties.specifier, compositeKey([
|
|
157
|
+
stringList(properties.requested_members),
|
|
158
|
+
typeof properties.namespace_access === "boolean"
|
|
159
|
+
? properties.namespace_access
|
|
160
|
+
: null,
|
|
161
|
+
typeof properties.dynamic_member_access === "boolean"
|
|
162
|
+
? properties.dynamic_member_access
|
|
163
|
+
: null,
|
|
164
|
+
])) ?? firstLabel(node));
|
|
157
165
|
if ([
|
|
158
166
|
"electron-main",
|
|
159
167
|
"electron-preload",
|