rea-agents 4.0.0 → 4.1.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 +93 -30
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/dist/android/AndroidTargetSnapshot.js +34 -0
- package/dist/android/JadxAnalysis.js +191 -0
- package/dist/android/JadxConfiguration.js +41 -0
- package/dist/android/JadxMcpTransport.js +145 -0
- package/dist/android/JadxProtocol.js +101 -0
- package/dist/android/JadxProvider.js +170 -0
- package/dist/android/JadxRelease.js +19 -0
- package/dist/android/JadxSession.js +97 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AnalysisProviderEvaluation.js +5 -3
- package/dist/application/AnalysisProviderRegistry.js +2 -1
- package/dist/application/AnalysisSnapshotCache.js +4 -1
- package/dist/application/AnalysisSnapshotFiles.js +1 -1
- package/dist/application/AndroidAnalysisPort.js +1 -0
- package/dist/application/AndroidAnalysisService.js +37 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
- package/dist/application/BinarySession.js +16 -3
- package/dist/application/BinarySessionExecution.js +4 -1
- package/dist/application/BinarySessionOpen.js +3 -2
- package/dist/application/BinarySessionRecords.js +9 -3
- package/dist/application/BinaryTargetResolver.js +25 -6
- package/dist/application/BrowserObservationService.js +2 -1
- package/dist/application/BrowserScenarioCaptureService.js +2 -1
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CallPathTracing.js +2 -1
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +11 -1
- package/dist/application/ClientRegistrationStatus.js +8 -1
- package/dist/application/CompositeProvider.js +1 -1
- package/dist/application/DirectAnalysis.js +23 -7
- package/dist/application/DirectAnalysisStatus.js +3 -3
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +7 -5
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +2 -2
- package/dist/application/ElectronActiveObservationService.js +2 -1
- package/dist/application/ElectronBoundaryAnalysis.js +1 -1
- package/dist/application/ElectronObservationService.js +2 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +3 -1
- package/dist/application/EvidenceBundleCommands.js +2 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/EvidenceLedger.js +2 -1
- package/dist/application/FirmwareAnalysisPort.js +1 -0
- package/dist/application/FirmwareAnalysisService.js +35 -0
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/JavaScriptApplicationService.js +50 -3
- package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
- package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
- package/dist/application/JavaScriptArtifactFiles.js +4 -2
- package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
- package/dist/application/JavaScriptJsonModules.js +3 -2
- package/dist/application/JavaScriptModuleRelationships.js +4 -2
- package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
- package/dist/application/JavaScriptSemanticTraceService.js +2 -1
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +3 -1
- package/dist/application/LinuxHopper.js +12 -4
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/ManagedApplicationGraphService.js +2 -1
- package/dist/application/ManagedMemberComparisonService.js +3 -1
- package/dist/application/ManagedNativeVerificationService.js +2 -1
- package/dist/application/ManagedReconstructionService.js +2 -1
- package/dist/application/NativeCallRoutes.js +1 -1
- package/dist/application/NativeDispatchMetadataInspection.js +1 -1
- package/dist/application/NativeUiActionTrace.js +2 -1
- package/dist/application/NativeValueTrace.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +6 -3
- package/dist/application/ProcessCli.js +9 -5
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +3 -2
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +2 -1
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImportEntries.js +2 -0
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/SessionProviderRouter.js +4 -1
- package/dist/application/Setup.js +1 -128
- package/dist/application/SetupClientConfiguration.js +17 -6
- package/dist/application/SetupHost.js +111 -0
- package/dist/application/SetupRegistrationEnvironment.js +1 -2
- package/dist/application/SetupSkill.js +9 -3
- package/dist/application/SetupTypes.js +17 -0
- package/dist/application/StoreFileLock.js +7 -2
- package/dist/application/SupportedClients.js +8 -0
- package/dist/application/Uninstall.js +9 -4
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/runtime.js +3 -1
- package/dist/artifacts/ArtifactProvider.js +3 -1
- package/dist/artifacts/DirectoryArtifactReader.js +2 -0
- package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
- package/dist/artifacts/NibArchive.js +4 -2
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
- package/dist/browser/CdpBrowserProvider.js +4 -1
- package/dist/browser/CdpCaptureDocuments.js +3 -1
- package/dist/browser/CdpCaptureEventHandlers.js +6 -2
- package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
- package/dist/browser/CdpCaptureValues.js +6 -2
- package/dist/browser/CdpConnection.js +8 -6
- package/dist/browser/CdpElectronInspection.js +3 -3
- package/dist/browser/CdpElectronProvider.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +2 -1
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpSafeMetadata.js +53 -8
- package/dist/browser/CdpScreenshot.js +1 -1
- package/dist/browser/CdpTargetSession.js +8 -5
- package/dist/browser/CdpWebMcpDiscovery.js +1 -1
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/JavaScriptRuntimeScope.js +3 -1
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
- package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
- package/dist/browser/PlaywrightScenarioEvents.js +6 -2
- package/dist/browser/PlaywrightScenarioSession.js +5 -2
- package/dist/browser/V8InspectorEndpoint.js +2 -1
- package/dist/browser/V8InspectorProvider.js +6 -1
- package/dist/browser/WebSourceMapFetcher.js +24 -11
- package/dist/cli/androidCommands.js +81 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +110 -17
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +10 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +3 -2
- package/dist/cli.js +10 -15
- package/dist/cliBrowserContext.js +1 -1
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +11 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +2 -1
- package/dist/cliJsonInput.js +26 -11
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +15 -16
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +7 -1
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +32 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmwareToolContracts.js +38 -0
- package/dist/contracts/officialToolContracts.js +66 -0
- package/dist/contracts/promptContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -0
- package/dist/contracts/sessionToolContracts.js +43 -0
- package/dist/contracts/sessionToolSchemas.js +1 -1
- package/dist/contracts/toolContractExamples.js +5 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +7 -130
- package/dist/contracts/toolEffects.js +43 -0
- package/dist/contracts/toolOutputSchemaGroups.js +4 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +60 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +24 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/androidAnalysis.js +141 -0
- package/dist/domain/appleAssetCatalog.js +1 -1
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +20 -25
- package/dist/domain/artifactOperationError.js +16 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +23 -0
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +1 -1
- package/dist/domain/browserScenarioDiff.js +1 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +3 -1
- package/dist/domain/callPath.js +47 -7
- package/dist/domain/canonicalDigest.js +65 -0
- package/dist/domain/canonicalOrdering.js +11 -0
- package/dist/domain/changedBehavior.js +8 -7
- package/dist/domain/comparisonSemantics.js +2 -4
- package/dist/domain/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/electronActiveObservation.js +3 -1
- package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
- package/dist/domain/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/electronStaticAnalysisValues.js +23 -3
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +8 -1
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +2 -1
- package/dist/domain/interfaceBuilderGraph.js +3 -1
- package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
- package/dist/domain/javascriptApplicationGraph.js +13 -22
- package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
- package/dist/domain/javascriptApplicationVersionItems.js +3 -3
- package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
- package/dist/domain/javascriptAstFingerprint.js +1 -1
- package/dist/domain/javascriptExportShapeComparison.js +1 -2
- package/dist/domain/javascriptExportShapeSelection.js +1 -1
- package/dist/domain/javascriptExportShapeVariants.js +7 -3
- package/dist/domain/javascriptFeatureSeed.js +29 -9
- package/dist/domain/javascriptFeatureTrace.js +9 -13
- package/dist/domain/javascriptFeatureTraversal.js +2 -1
- package/dist/domain/javascriptNativeHandoff.js +2 -1
- package/dist/domain/javascriptRuntimeLoadState.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
- package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
- package/dist/domain/javascriptSemanticAnalysis.js +40 -3
- package/dist/domain/javascriptSemanticCallResolution.js +2 -1
- package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascriptSemanticDataEffects.js +2 -1
- package/dist/domain/javascriptSemanticFingerprints.js +1 -1
- package/dist/domain/javascriptSemanticGraph.js +23 -28
- package/dist/domain/javascriptSemanticPrimitives.js +9 -2
- package/dist/domain/javascriptSemanticProjection.js +2 -1
- package/dist/domain/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascriptSemanticProvenance.js +1 -1
- package/dist/domain/javascriptSemanticQuery.js +7 -8
- package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
- package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
- package/dist/domain/javascriptSemanticReturns.js +2 -1
- package/dist/domain/javascriptSemanticValues.js +50 -16
- package/dist/domain/javascriptSourceParser.js +4 -2
- package/dist/domain/javascriptStaticAnalysis.js +1 -1
- package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
- package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/managedMemberComparison.js +1 -0
- package/dist/domain/managedMemberComparisonItems.js +2 -0
- package/dist/domain/managedNativeVerificationMatch.js +5 -3
- package/dist/domain/nativeDataType.js +2 -0
- package/dist/domain/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/nativeLoadImage.js +95 -0
- package/dist/domain/nativeMetadataRecovery.js +55 -0
- package/dist/domain/processCapture.js +0 -1
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +1 -1
- package/dist/domain/providerSelectionError.js +44 -0
- package/dist/domain/reconstructionUnknowns.js +1 -1
- package/dist/domain/reconstructionVerification.js +22 -8
- package/dist/domain/referenceSourceClassification.js +5 -6
- package/dist/domain/referenceSourceGraph.js +9 -17
- package/dist/domain/referenceSourceImportParsing.js +38 -23
- package/dist/domain/runtimeIdentification.js +1 -1
- package/dist/domain/runtimeVersion.js +4 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceToBundleComparison.js +5 -7
- package/dist/domain/sourceToBundleSignals.js +6 -6
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +22 -5
- package/dist/domain/webBundleAnalyzerInspection.js +20 -14
- package/dist/dotnet/ManagedMemberRows.js +1 -1
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedStaticProvider.js +3 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +258 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +223 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +5 -5
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
- package/dist/ghidra/GhidraClient.js +52 -6
- package/dist/ghidra/GhidraDiagnostics.js +3 -0
- package/dist/ghidra/GhidraDoctor.js +38 -14
- package/dist/ghidra/GhidraFunctionValues.js +10 -4
- package/dist/ghidra/GhidraInstallation.js +10 -4
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +91 -26
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +129 -13
- package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- package/dist/ghidra/GhidraSessionError.js +31 -4
- package/dist/ghidra/GhidraSessionValues.js +10 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
- package/dist/ghidra/GhidraTransport.js +12 -0
- package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +84 -0
- package/dist/hopper/BridgeLauncher.js +4 -2
- package/dist/hopper/HopperAnalysisProfile.js +7 -2
- package/dist/hopper/HopperCleanup.js +55 -9
- package/dist/hopper/HopperClient.js +14 -4
- package/dist/hopper/HopperProcessDiagnostic.js +1 -1
- package/dist/hopper/HopperProvider.js +8 -4
- package/dist/hopper/HopperRequestQueue.js +7 -3
- package/dist/hopper/HopperSessionValues.js +1 -1
- package/dist/hopper/HopperSocketConnection.js +1 -1
- package/dist/hopper/HopperTargetLease.js +23 -15
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -2
- package/dist/hopper/protocol.js +8 -8
- package/dist/ida/IdaConfiguration.js +56 -0
- package/dist/ida/IdaDoctor.js +53 -0
- package/dist/ida/IdaInput.js +62 -0
- package/dist/ida/IdaMcpConnection.js +111 -0
- package/dist/ida/IdaOperationRunner.js +299 -0
- package/dist/ida/IdaProtocolValues.js +178 -0
- package/dist/ida/IdaProvider.js +126 -0
- package/dist/ida/IdaProviderCapabilities.js +60 -0
- package/dist/ida/IdaSessionClient.js +306 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/main/shutdown.js +21 -1
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +8 -4
- package/dist/main.js +5 -2
- package/dist/native/AppleDispatchMetadata.js +31 -10
- package/dist/native/NativeMacOSProvider.js +87 -15
- package/dist/native/NativeMachoInspection.js +42 -12
- package/dist/native/NativeUiHelperRuntime.js +7 -1
- package/dist/native/NativeUiObservation.js +6 -2
- package/dist/native/parsers/demangle.js +1 -1
- package/dist/native/parsers/dyldInfo.js +3 -3
- package/dist/native/parsers/otool.js +4 -1
- package/dist/native/parsers/plist.js +11 -3
- package/dist/process/PrivateRuntimeRoot.js +13 -3
- package/dist/process/ProcessOwnership.js +5 -73
- package/dist/process/ProcessOwnershipObservation.js +62 -2
- package/dist/process/ProcessOwnershipProcessTree.js +13 -0
- package/dist/process/ProviderProcess.js +24 -7
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +25 -2
- package/dist/server/mcpProgress.js +2 -1
- package/dist/server/promptCompletion.js +3 -3
- package/dist/server/registerAndroidTools.js +30 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +5 -1
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
- package/dist/server/registerApplicationTools/compareVersions.js +5 -1
- package/dist/server/registerApplicationTools/traceFeature.js +7 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
- package/dist/server/registerEnhancedTools.js +28 -1
- package/dist/server/registerFirmwareTools.js +22 -0
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools/helpers.js +2 -1
- package/dist/server/registerManagedTools.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerSessionTools.js +3 -1
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/sessionEvidence.js +1 -1
- package/dist/server/toolResult.js +2 -1
- package/dist/windows/WindowsNativeLoader.js +108 -0
- package/dist/windows/WindowsOwnedProcess.js +168 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +4 -6
- package/native/windows/README.md +102 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -24
- package/scripts/rea.mjs +1 -1
- package/scripts/verify-windows-native-artifact.mjs +39 -0
- package/skills/reverse-engineer-anything/SKILL.md +92 -24
- package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +52 -4
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/errors.js +0 -324
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parse } from "@babel/parser";
|
|
2
|
-
import { isCallExpression, isExportAllDeclaration, isExportNamedDeclaration, isIdentifier, isImport, isImportDeclaration, isMemberExpression, isNode, isStringLiteral, isTSExternalModuleReference, isTSImportEqualsDeclaration, isTSModuleDeclaration, } from "@babel/types";
|
|
2
|
+
import { isCallExpression, isExportAllDeclaration, isExportNamedDeclaration, isIdentifier, isImport, isImportDeclaration, isImportExpression, isMemberExpression, isNode, isStringLiteral, isTSExternalModuleReference, isTSImportEqualsDeclaration, isTSModuleDeclaration, } from "@babel/types";
|
|
3
3
|
const codeSourceLanguages = new Set(["JavaScript", "TypeScript", "JSX", "TSX"]);
|
|
4
4
|
const safeModuleName = (node) => {
|
|
5
5
|
if (isStringLiteral(node))
|
|
@@ -101,7 +101,8 @@ const isRequireCallee = (callee) => {
|
|
|
101
101
|
if (isMemberExpression(callee) &&
|
|
102
102
|
isIdentifier(callee.object) &&
|
|
103
103
|
callee.object.name === "require" &&
|
|
104
|
-
(
|
|
104
|
+
((!callee.computed && isIdentifier(callee.property)) ||
|
|
105
|
+
isStringLiteral(callee.property))) {
|
|
105
106
|
const propertyName = isIdentifier(callee.property)
|
|
106
107
|
? callee.property.name
|
|
107
108
|
: isStringLiteral(callee.property)
|
|
@@ -112,19 +113,19 @@ const isRequireCallee = (callee) => {
|
|
|
112
113
|
return false;
|
|
113
114
|
};
|
|
114
115
|
const isImportCallee = (callee) => isImport(callee);
|
|
115
|
-
const
|
|
116
|
+
const collectModuleExpressions = (node, targets) => {
|
|
116
117
|
if (node === null || node === undefined)
|
|
117
118
|
return;
|
|
118
119
|
if (typeof node !== "object")
|
|
119
120
|
return;
|
|
120
121
|
if (Array.isArray(node)) {
|
|
121
122
|
for (const item of node)
|
|
122
|
-
|
|
123
|
+
collectModuleExpressions(item, targets);
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
if (!isNode(node))
|
|
126
127
|
return;
|
|
127
|
-
if (isCallExpression(node)) {
|
|
128
|
+
if (isCallExpression(node) || isImportExpression(node)) {
|
|
128
129
|
targets.push(node);
|
|
129
130
|
}
|
|
130
131
|
for (const value of Object.values(node)) {
|
|
@@ -132,7 +133,7 @@ const collectCallExpressions = (node, targets) => {
|
|
|
132
133
|
value !== undefined &&
|
|
133
134
|
typeof value === "object" &&
|
|
134
135
|
!isSourceLocation(value)) {
|
|
135
|
-
|
|
136
|
+
collectModuleExpressions(value, targets);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
};
|
|
@@ -142,10 +143,21 @@ const isSourceLocation = (value) => typeof value === "object" &&
|
|
|
142
143
|
"end" in value &&
|
|
143
144
|
!("type" in value);
|
|
144
145
|
const extractRequireAndDynamicImports = (body, from_path, relationships) => {
|
|
145
|
-
const
|
|
146
|
+
const expressions = [];
|
|
146
147
|
for (const statement of body)
|
|
147
|
-
|
|
148
|
-
for (const call of
|
|
148
|
+
collectModuleExpressions(statement, expressions);
|
|
149
|
+
for (const call of expressions) {
|
|
150
|
+
if (isImportExpression(call)) {
|
|
151
|
+
const specifier = safeModuleName(call.source);
|
|
152
|
+
appendRelationship(relationships, {
|
|
153
|
+
fromPath: from_path,
|
|
154
|
+
to: specifier ?? "<dynamic-import>",
|
|
155
|
+
kind: "imports",
|
|
156
|
+
parseState: specifier === undefined ? "partial" : "parsed",
|
|
157
|
+
...(specifier === undefined ? { resolution: "unknown" } : {}),
|
|
158
|
+
});
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
149
161
|
const first = call.arguments[0];
|
|
150
162
|
if (isRequireCallee(call.callee) && isModuleExpression(first)) {
|
|
151
163
|
const result = moduleSpecifierFromExpression(first);
|
|
@@ -193,13 +205,12 @@ const parseWithBabel = (path, source, language) => {
|
|
|
193
205
|
errorRecovery: true,
|
|
194
206
|
plugins,
|
|
195
207
|
});
|
|
196
|
-
return { ast,
|
|
208
|
+
return { ast, reasons: ast.errors.map((error) => error.message) };
|
|
197
209
|
}
|
|
198
210
|
catch (cause) {
|
|
199
211
|
return {
|
|
200
212
|
ast: undefined,
|
|
201
|
-
|
|
202
|
-
reason: cause instanceof Error ? cause.message : "Parse failed",
|
|
213
|
+
reasons: [cause instanceof Error ? cause.message : "Parse failed"],
|
|
203
214
|
};
|
|
204
215
|
}
|
|
205
216
|
};
|
|
@@ -208,24 +219,28 @@ export const parseReferenceSourceImports = (path, bytes, language) => {
|
|
|
208
219
|
if (language !== null && !codeSourceLanguages.has(language))
|
|
209
220
|
return { relationships: [], parse_failures: [] };
|
|
210
221
|
const source = new TextDecoder("utf-8", { fatal: false }).decode(bytes);
|
|
211
|
-
const { ast,
|
|
212
|
-
|
|
222
|
+
const { ast, reasons } = parseWithBabel(path, source, language);
|
|
223
|
+
const parseFailures = reasons.map((reason) => ({
|
|
224
|
+
path,
|
|
225
|
+
parser: "babel",
|
|
226
|
+
reason,
|
|
227
|
+
}));
|
|
228
|
+
if (ast === undefined) {
|
|
213
229
|
return {
|
|
214
230
|
relationships: [],
|
|
215
|
-
parse_failures:
|
|
216
|
-
{
|
|
217
|
-
path,
|
|
218
|
-
parser: "babel",
|
|
219
|
-
reason: reason ?? "Unknown parse failure",
|
|
220
|
-
},
|
|
221
|
-
],
|
|
231
|
+
parse_failures: parseFailures,
|
|
222
232
|
};
|
|
223
233
|
}
|
|
224
234
|
const relationships = [];
|
|
225
235
|
extractImportDeclarations(ast.program.body, path, relationships);
|
|
226
236
|
extractRequireAndDynamicImports(ast.program.body, path, relationships);
|
|
227
237
|
return {
|
|
228
|
-
relationships
|
|
229
|
-
|
|
238
|
+
relationships: relationships.map((relationship) => ({
|
|
239
|
+
...relationship,
|
|
240
|
+
parse_state: parseFailures.length > 0 && relationship.parse_state === "parsed"
|
|
241
|
+
? "partial"
|
|
242
|
+
: relationship.parse_state,
|
|
243
|
+
})),
|
|
244
|
+
parse_failures: parseFailures,
|
|
230
245
|
};
|
|
231
246
|
};
|
|
@@ -194,7 +194,7 @@ const familiesFor = (format, path) => {
|
|
|
194
194
|
families.add("javascript");
|
|
195
195
|
if (format === "jvm-class" || /(?:^|\/)[^/]+\.class$/iu.test(path))
|
|
196
196
|
families.add("jvm");
|
|
197
|
-
if (["elf", "mach-o", "mach-o-universal", "pe", "dos-mz"].includes(format))
|
|
197
|
+
if (["elf", "mach-o", "mach-o-universal", "pe", "dos-mz", "dos-com"].includes(format))
|
|
198
198
|
families.add("native");
|
|
199
199
|
if (format === "webassembly" || /(?:^|\/)[^/]+\.wasm$/iu.test(path))
|
|
200
200
|
families.add("webassembly");
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import { satisfies } from "semver";
|
|
2
|
+
/** Supported runtime range, kept in sync with the published package engines. */
|
|
3
|
+
export const SUPPORTED_NODE_VERSION_RANGE = "^22.19.0 || ^24.11.0 || >=26.0.0";
|
|
1
4
|
/** Return whether a Node.js version satisfies REA's tested runtime families. */
|
|
2
|
-
export const supportsNodeVersion = (version) =>
|
|
3
|
-
const [majorText = "", minorText = ""] = version.split(".");
|
|
4
|
-
const major = Number.parseInt(majorText, 10);
|
|
5
|
-
const minor = Number.parseInt(minorText, 10);
|
|
6
|
-
return ((major === 22 && minor >= 19) ||
|
|
7
|
-
(major >= 24 && (major !== 24 || minor >= 11)));
|
|
8
|
-
};
|
|
5
|
+
export const supportsNodeVersion = (version) => satisfies(version, SUPPORTED_NODE_VERSION_RANGE);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Parse JSON text, returning the failure reason instead of throwing. */
|
|
2
|
+
export const safeParseJson = (value) => {
|
|
3
|
+
try {
|
|
4
|
+
return { ok: true, value: JSON.parse(value) };
|
|
5
|
+
}
|
|
6
|
+
catch (cause) {
|
|
7
|
+
return {
|
|
8
|
+
ok: false,
|
|
9
|
+
error: cause instanceof Error ? cause.message : String(cause),
|
|
10
|
+
cause,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { compareCodePoints, uniqueSorted } from "./canonicalOrdering.js";
|
|
1
2
|
import { absenceClaimable, canonicalDigest } from "./comparisonSemantics.js";
|
|
2
3
|
import { SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS, sourceToBundleComparisonResultSchema, } from "./sourceToBundleComparisonSchemas.js";
|
|
3
4
|
import { buildSourceToBundleCandidateIndex, candidateIdsForSource, historicalSourceFiles, scoreSourceToBundleCandidate, sourceBearingNodes, } from "./sourceToBundleSignals.js";
|
|
@@ -32,7 +33,7 @@ export const compareSourceToBundle = (input) => {
|
|
|
32
33
|
};
|
|
33
34
|
return sourceToBundleComparisonResultSchema.parse({
|
|
34
35
|
...semanticResult,
|
|
35
|
-
comparison_id: `stbc_${
|
|
36
|
+
comparison_id: `stbc_${canonicalDigest(semanticResult, "Source-to-bundle comparison")}`,
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
39
|
const projectComparison = (input) => {
|
|
@@ -208,11 +209,11 @@ const markMergedMappings = (input, items) => {
|
|
|
208
209
|
return { ...semantic, mapping_id: mappingId(input, semantic) };
|
|
209
210
|
});
|
|
210
211
|
};
|
|
211
|
-
const mappingId = (input, item) => `stbc_item_${
|
|
212
|
+
const mappingId = (input, item) => `stbc_item_${canonicalDigest({
|
|
212
213
|
reference_root_sha256: input.reference.root_sha256,
|
|
213
214
|
application_graph_id: input.application.graph.graph_id,
|
|
214
215
|
...item,
|
|
215
|
-
})}`;
|
|
216
|
+
}, "Source-to-bundle comparison")}`;
|
|
216
217
|
const comparisonSummary = (items) => ({
|
|
217
218
|
unchanged: countStatus(items, "unchanged"),
|
|
218
219
|
modified: countStatus(items, "modified"),
|
|
@@ -246,7 +247,4 @@ const comparisonLimitations = (factors) => uniqueSorted([
|
|
|
246
247
|
]);
|
|
247
248
|
const hasSignal = (candidate, kind) => candidate.signals.some((signal) => signal.kind === kind);
|
|
248
249
|
const compareCandidates = (left, right) => right.score - left.score ||
|
|
249
|
-
|
|
250
|
-
const digestCanonical = (value) => canonicalDigest(value, "Source-to-bundle comparison");
|
|
251
|
-
const uniqueSorted = (values) => [...new Set(values)].sort(compareText);
|
|
252
|
-
const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
250
|
+
compareCodePoints(left.current_node_id, right.current_node_id);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
+
import { compareCodePoints } from "./canonicalOrdering.js";
|
|
2
3
|
import { SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS, } from "./sourceToBundleComparisonSchemas.js";
|
|
3
4
|
import { isDigest } from "./digests.js";
|
|
4
5
|
const RELEVANT_NODE_KINDS = new Set([
|
|
@@ -23,11 +24,11 @@ const signalWeight = (kind) => {
|
|
|
23
24
|
/** Keep source-bearing application nodes in stable identifier order. */
|
|
24
25
|
export const sourceBearingNodes = (nodes) => nodes
|
|
25
26
|
.filter(({ kind }) => RELEVANT_NODE_KINDS.has(kind))
|
|
26
|
-
.sort((left, right) =>
|
|
27
|
+
.sort((left, right) => compareCodePoints(left.node_id, right.node_id));
|
|
27
28
|
/** Keep historical source files in stable path order. */
|
|
28
29
|
export const historicalSourceFiles = (graph) => graph.entries
|
|
29
30
|
.filter((entry) => entry.kind === "file" && entry.classifications.includes("source"))
|
|
30
|
-
.sort((left, right) =>
|
|
31
|
+
.sort((left, right) => compareCodePoints(left.path, right.path));
|
|
31
32
|
/** Build deterministic candidate indices without assigning fuzzy matches. */
|
|
32
33
|
export const buildSourceToBundleCandidateIndex = (nodes) => {
|
|
33
34
|
const projections = nodes.map(projectCurrentNode);
|
|
@@ -62,7 +63,7 @@ export const candidateIdsForSource = (source, index) => {
|
|
|
62
63
|
for (const group of groups) {
|
|
63
64
|
if (group === undefined)
|
|
64
65
|
continue;
|
|
65
|
-
for (const nodeId of [...group].sort(
|
|
66
|
+
for (const nodeId of [...group].sort(compareCodePoints)) {
|
|
66
67
|
if (seen.has(nodeId))
|
|
67
68
|
continue;
|
|
68
69
|
seen.add(nodeId);
|
|
@@ -149,7 +150,7 @@ const signal = (kind, sourceValue, currentValues) => ({
|
|
|
149
150
|
kind,
|
|
150
151
|
weight: signalWeight(kind),
|
|
151
152
|
source_value: sourceValue,
|
|
152
|
-
current_values: [...new Set(currentValues)].sort(
|
|
153
|
+
current_values: [...new Set(currentValues)].sort(compareCodePoints),
|
|
153
154
|
});
|
|
154
155
|
const candidateConfidence = (signals) => {
|
|
155
156
|
const kinds = new Set(signals.map(({ kind }) => kind));
|
|
@@ -190,7 +191,7 @@ const normalizeCurrentPath = (raw) => {
|
|
|
190
191
|
};
|
|
191
192
|
const uniquePaths = (paths) => [
|
|
192
193
|
...new Map(paths.map((path) => [`${path.kind}\0${path.value}`, path])).values(),
|
|
193
|
-
].sort((left, right) =>
|
|
194
|
+
].sort((left, right) => compareCodePoints(`${left.kind}\0${left.value}`, `${right.kind}\0${right.value}`));
|
|
194
195
|
const pathSuffixes = (path) => {
|
|
195
196
|
const parts = path.split("/");
|
|
196
197
|
return parts.map((_, index) => parts.slice(index).join("/"));
|
|
@@ -200,4 +201,3 @@ const addIndexValue = (index, key, nodeId) => {
|
|
|
200
201
|
values.add(nodeId);
|
|
201
202
|
index.set(key, values);
|
|
202
203
|
};
|
|
203
|
-
const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
@@ -2,8 +2,10 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { artifactComparisonResultSchema } from "./artifactComparison.js";
|
|
5
|
+
import { uniqueSorted } from "./canonicalOrdering.js";
|
|
5
6
|
import { evidenceSchema, parseEvidence } from "./evidence.js";
|
|
6
7
|
import { functionComparisonResultSchema } from "./functionComparison.js";
|
|
8
|
+
import { PROCESS_PROVIDER, isProcessEvidenceProvider, } from "./processEvidenceProvider.js";
|
|
7
9
|
import { comparisonStatusSchema, processCaptureComparisonSchema, } from "./processCapture.js";
|
|
8
10
|
import { PROCESS_COMPARISON_DIMENSIONS } from "./processComparison.js";
|
|
9
11
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
@@ -128,8 +130,8 @@ const EXPECTED = {
|
|
|
128
130
|
],
|
|
129
131
|
compare_process_captures: [
|
|
130
132
|
"rea.process-comparison",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
PROCESS_PROVIDER.id,
|
|
134
|
+
PROCESS_PROVIDER.name,
|
|
133
135
|
],
|
|
134
136
|
};
|
|
135
137
|
/** Correlate only caller-declared static/runtime hypotheses. */
|
|
@@ -280,10 +282,11 @@ const assertComparisonIdentity = (evidence) => {
|
|
|
280
282
|
!(Array.isArray(expected[0])
|
|
281
283
|
? expected[0].includes(evidence.predicate_type)
|
|
282
284
|
: evidence.predicate_type === expected[0]) ||
|
|
283
|
-
evidence.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
(evidence.operation === "compare_process_captures"
|
|
286
|
+
? !isProcessEvidenceProvider(evidence.provider)
|
|
287
|
+
: evidence.provider.id !== expected[1] ||
|
|
288
|
+
evidence.provider.name !== expected[2] ||
|
|
289
|
+
evidence.provider.version !== "1") ||
|
|
287
290
|
evidence.confidence !== "derived" ||
|
|
288
291
|
evidence.authority !== "analyst-inference" ||
|
|
289
292
|
evidence.subject !== null ||
|
|
@@ -358,7 +361,6 @@ const assertUnique = (evidence, label) => {
|
|
|
358
361
|
if (new Set(evidence.map(({ evidence_id: id }) => id)).size !== evidence.length)
|
|
359
362
|
throw new TypeError(`Static/runtime correlation rejects duplicate ${label}`);
|
|
360
363
|
};
|
|
361
|
-
const uniqueSorted = (values) => [...new Set(values)].sort((left, right) => left.localeCompare(right, "en"));
|
|
362
364
|
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
|
|
363
365
|
const canonicalJson = (value) => {
|
|
364
366
|
const serialized = canonicalize(value);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AnalysisError } from "./analysisErrorBase.js";
|
|
2
|
+
/** Residual-unknown mutation failed a lifecycle, reference, or CAS invariant. */
|
|
3
|
+
export class UnknownRegistryError extends AnalysisError {
|
|
4
|
+
reason;
|
|
5
|
+
_tag = "UnknownRegistryError";
|
|
6
|
+
constructor(reason, options) {
|
|
7
|
+
super(`Residual unknown registry mutation failed: ${reason}`, options);
|
|
8
|
+
this.reason = reason;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { sanitizeBrowserUrl } from "./browserObservation.js";
|
|
3
|
+
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
3
4
|
/** Name of a call/new callee from its AST node. */
|
|
4
5
|
export const calleeName = (callee) => {
|
|
5
6
|
if (t.isIdentifier(callee))
|
|
@@ -24,15 +25,29 @@ export const propertyName = (value) => {
|
|
|
24
25
|
return "";
|
|
25
26
|
};
|
|
26
27
|
export const objectValue = (object, name) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
let value;
|
|
29
|
+
for (const property of object.properties) {
|
|
30
|
+
if (t.isSpreadElement(property)) {
|
|
31
|
+
value = undefined;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const key = semanticStaticPropertyName(property.key, property.computed);
|
|
35
|
+
if (key === "" && !t.isStringLiteral(property.key))
|
|
36
|
+
value = undefined;
|
|
37
|
+
else if (key === name)
|
|
38
|
+
value = t.isObjectProperty(property) ? property.value : undefined;
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
31
41
|
};
|
|
32
42
|
export const objectString = (object, name) => {
|
|
33
43
|
const value = objectValue(object, name);
|
|
34
44
|
return t.isStringLiteral(value) ? value.value : undefined;
|
|
35
45
|
};
|
|
46
|
+
/** Whether module syntax supplies a URL location without a package/import-map resolver. */
|
|
47
|
+
export const isUrlLikeModuleSpecifier = (specifier) => specifier.startsWith("/") ||
|
|
48
|
+
specifier.startsWith("./") ||
|
|
49
|
+
specifier.startsWith("../") ||
|
|
50
|
+
/^[A-Za-z][A-Za-z0-9+.-]*:/u.test(specifier);
|
|
36
51
|
export const resolveSpecifier = (specifier, base) => {
|
|
37
52
|
try {
|
|
38
53
|
const resolved = new URL(specifier, base);
|
|
@@ -40,7 +55,9 @@ export const resolveSpecifier = (specifier, base) => {
|
|
|
40
55
|
return null;
|
|
41
56
|
return sanitizeBrowserUrl(resolved.href).url;
|
|
42
57
|
}
|
|
43
|
-
catch {
|
|
58
|
+
catch (cause) {
|
|
59
|
+
// Unresolvable specifiers are represented by the null return.
|
|
60
|
+
void cause;
|
|
44
61
|
return null;
|
|
45
62
|
}
|
|
46
63
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { parse } from "@babel/parser";
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
3
|
import { sanitizeEndpointCandidate } from "./browserObservation.js";
|
|
4
|
-
import {
|
|
4
|
+
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
5
|
+
import { calleeName, endpointArgument, location, locationFields, objectString, objectValue, resolveSpecifier, isUrlLikeModuleSpecifier, stringArgument, } from "./webBundleAnalyzerAst.js";
|
|
5
6
|
export const analyzeScript = (script, accumulator) => {
|
|
6
7
|
let file;
|
|
7
8
|
try {
|
|
@@ -11,7 +12,9 @@ export const analyzeScript = (script, accumulator) => {
|
|
|
11
12
|
plugins: ["jsx", "typescript"],
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
catch {
|
|
15
|
+
catch (cause) {
|
|
16
|
+
// Unparseable scripts are counted; the failure needs no extra detail.
|
|
17
|
+
void cause;
|
|
15
18
|
accumulator.parseFailures += 1;
|
|
16
19
|
return;
|
|
17
20
|
}
|
|
@@ -65,15 +68,13 @@ const inspectCall = (script, node, accumulator) => {
|
|
|
65
68
|
node,
|
|
66
69
|
accumulator,
|
|
67
70
|
});
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
kind: "worker_import",
|
|
74
|
-
|
|
75
|
-
accumulator,
|
|
76
|
-
});
|
|
71
|
+
if (name === "importScripts" || name.endsWith(".importScripts"))
|
|
72
|
+
for (const argument of node.arguments) {
|
|
73
|
+
const specifier = stringArgument(argument);
|
|
74
|
+
if (specifier === undefined)
|
|
75
|
+
continue;
|
|
76
|
+
addEdge({ script, specifier, kind: "worker_import", node, accumulator });
|
|
77
|
+
}
|
|
77
78
|
if (routeCallNames.some((candidate) => name === candidate || name.endsWith(`.${candidate}`))) {
|
|
78
79
|
if (first !== undefined)
|
|
79
80
|
addFinding({
|
|
@@ -106,7 +107,7 @@ const inspectCall = (script, node, accumulator) => {
|
|
|
106
107
|
addWebMcpDeclaration(script, node, accumulator);
|
|
107
108
|
};
|
|
108
109
|
const inspectRouteProperty = (script, node, accumulator) => {
|
|
109
|
-
const key =
|
|
110
|
+
const key = semanticStaticPropertyName(node.key, node.computed);
|
|
110
111
|
if ((key === "path" || key === "route") && t.isStringLiteral(node.value))
|
|
111
112
|
addFinding({
|
|
112
113
|
collection: accumulator.routes,
|
|
@@ -123,7 +124,10 @@ const addEdge = (context) => {
|
|
|
123
124
|
from_script_key: context.script.script_key,
|
|
124
125
|
kind: context.kind,
|
|
125
126
|
specifier: context.specifier,
|
|
126
|
-
resolved_url:
|
|
127
|
+
resolved_url: context.kind === "worker_import" ||
|
|
128
|
+
isUrlLikeModuleSpecifier(context.specifier)
|
|
129
|
+
? resolveSpecifier(context.specifier, context.script.url)
|
|
130
|
+
: null,
|
|
127
131
|
location: location(context.script.script_key, context.node),
|
|
128
132
|
}));
|
|
129
133
|
};
|
|
@@ -152,7 +156,9 @@ const addWebMcpDeclaration = (script, node, accumulator) => {
|
|
|
152
156
|
: schema;
|
|
153
157
|
const schemaPropertyNames = t.isObjectExpression(propertyObject)
|
|
154
158
|
? propertyObject.properties.flatMap((property) => t.isObjectProperty(property)
|
|
155
|
-
? [
|
|
159
|
+
? [
|
|
160
|
+
semanticStaticPropertyName(property.key, property.computed),
|
|
161
|
+
].filter(Boolean)
|
|
156
162
|
: [])
|
|
157
163
|
: [];
|
|
158
164
|
const key = `webmcp\0${script.script_key}\0${name ?? ""}\0${schemaPropertyNames.join("\0")}`;
|
|
@@ -70,7 +70,7 @@ export const parseMethods = ({ bytes, layout, pe, ranges, }) => {
|
|
|
70
70
|
impl_flags: implFlags,
|
|
71
71
|
flags,
|
|
72
72
|
signature: signature(sig),
|
|
73
|
-
body: methodBody(bytes, pe, rva),
|
|
73
|
+
body: methodBody(bytes, pe, rva, { implFlags, flags }),
|
|
74
74
|
});
|
|
75
75
|
core.set(token, { token, name, declaringType: declared?.fullName ?? null });
|
|
76
76
|
}
|
|
@@ -80,9 +80,10 @@ export const readMetadataString = (bytes, layout, index, heapExtent) => {
|
|
|
80
80
|
if (end === maximum)
|
|
81
81
|
throw managedFailure("invalid-string", "metadata.#Strings", "String heap item has no terminator within #Strings", start);
|
|
82
82
|
try {
|
|
83
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(start, end));
|
|
83
|
+
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(start, end));
|
|
84
84
|
}
|
|
85
|
-
catch {
|
|
85
|
+
catch (cause) {
|
|
86
|
+
void cause;
|
|
86
87
|
throw managedFailure("invalid-string", "metadata.#Strings", "String heap item is not valid UTF-8", start);
|
|
87
88
|
}
|
|
88
89
|
};
|
|
@@ -201,9 +201,11 @@ const decodeFixedString = (blob) => {
|
|
|
201
201
|
if (start > blob.length - length.length)
|
|
202
202
|
return null;
|
|
203
203
|
try {
|
|
204
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(blob.subarray(start, start + length.length));
|
|
204
|
+
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(blob.subarray(start, start + length.length));
|
|
205
205
|
}
|
|
206
|
-
catch {
|
|
206
|
+
catch (cause) {
|
|
207
|
+
// Invalid UTF-8 blobs decode as null.
|
|
208
|
+
void cause;
|
|
207
209
|
return null;
|
|
208
210
|
}
|
|
209
211
|
};
|
|
@@ -38,9 +38,16 @@ const readMethodBodyHeader = (bytes, offset) => {
|
|
|
38
38
|
localSig: bytes.readUInt32LE(offset + 8),
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
/** Decode admitted managed CIL, retaining unavailable implementation metadata as partial. */
|
|
42
|
+
export const methodBody = (bytes, pe, rva, implementation = {
|
|
43
|
+
implFlags: 0,
|
|
44
|
+
flags: 0,
|
|
45
|
+
}) => {
|
|
42
46
|
if (rva === 0)
|
|
43
47
|
return emptyMethodBody(rva, "absent", null);
|
|
48
|
+
if ((implementation.implFlags & 7) !== 0 ||
|
|
49
|
+
(implementation.flags & 0x2000) !== 0)
|
|
50
|
+
return emptyMethodBody(rva, "partial", "CIL decoding is unavailable for native, runtime, unmanaged, or P/Invoke implementations");
|
|
44
51
|
try {
|
|
45
52
|
const offset = pe.rvaToOffset(rva, 1, "method.body");
|
|
46
53
|
const header = readMethodBodyHeader(bytes, offset);
|
|
@@ -4,7 +4,9 @@ import { readFile } from "node:fs/promises";
|
|
|
4
4
|
import { createAnalysisExecution, } from "../application/AnalysisProvider.js";
|
|
5
5
|
import { MANAGED_STATIC_PROVIDER } from "../application/InvestigationProviders.js";
|
|
6
6
|
import { MANAGED_TOOL_CONTRACTS, managedArtifactInputSchema, managedMemberInputSchema, managedNativeBoundaryInputSchema, } from "../contracts/managedToolContracts.js";
|
|
7
|
-
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError,
|
|
7
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, } from "../domain/analysisErrorCore.js";
|
|
8
|
+
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
|
|
9
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
8
10
|
import { err, ok } from "../domain/result.js";
|
|
9
11
|
import { inspectManagedArtifactBytes } from "./ManagedArtifactInspector.js";
|
|
10
12
|
import { inspectManagedMembersBytes } from "./ManagedMemberInspector.js";
|