rea-agents 6.1.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/bridge/ghidra/ReaGhidraBridge.java +32 -4
- package/bridge/hopper_bridge.py +8 -1
- package/dist/android/JadxConfiguration.js +87 -7
- package/dist/android/JadxMcpTransport.js +14 -2
- package/dist/android/JadxProvider.js +64 -36
- package/dist/android/JadxSession.js +51 -9
- package/dist/application/BinaryTargetResolver.js +68 -20
- package/dist/application/BrowserEvidence.js +3 -8
- package/dist/application/BrowserScenarioEvidence.js +4 -20
- package/dist/application/CapabilityInventory.js +43 -9
- package/dist/application/ClientConfigurationDocument.js +97 -25
- package/dist/application/ClientRegistrationStatus.js +19 -6
- package/dist/application/DirectAnalysis.js +41 -20
- package/dist/application/DirectAnalysisCleanup.js +71 -0
- package/dist/application/DirectAnalysisStatus.js +3 -7
- package/dist/application/Doctor.js +40 -53
- package/dist/application/DoctorDiagnostics.js +2 -3
- package/dist/application/EnhancedTools.js +51 -6
- package/dist/application/EvidenceBundleFiles.js +8 -3
- package/dist/application/InvestigationProviders.js +13 -5
- package/dist/application/JsonFiles.js +56 -23
- package/dist/application/LinuxHopper.js +11 -7
- package/dist/application/MacHopper.js +15 -18
- package/dist/application/RealHopperAssertions.js +0 -11
- package/dist/application/ReconstructionObligationCandidates.js +10 -3
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- package/dist/application/ReferenceSourceImportEntries.js +1 -1
- package/dist/application/RegularFileRead.js +17 -0
- package/dist/application/Setup.js +26 -23
- package/dist/application/SetupClientConfiguration.js +18 -7
- package/dist/application/SetupHost.js +20 -29
- package/dist/application/SetupPlan.js +24 -20
- package/dist/application/SetupSkill.js +57 -8
- package/dist/application/SupportedClients.js +43 -0
- package/dist/application/Uninstall.js +98 -30
- package/dist/application/UpdateMaintenance.js +13 -7
- package/dist/application/UpdateRuntime.js +12 -12
- package/dist/application/Utf8JsonInput.js +64 -0
- package/dist/application/WebScriptExportService.js +38 -5
- package/dist/application/WorkflowEvidence.js +25 -2
- package/dist/application/XrefsAddressResolution.js +45 -0
- package/dist/application/analysisView/AnalysisViewService.js +76 -0
- package/dist/application/android/AndroidAnalysisService.js +1 -1
- package/dist/application/binary/AnalysisClientCleanup.js +30 -5
- package/dist/application/binary/AnalysisProviderEvaluation.js +1 -2
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -6
- package/dist/application/binary/AnalysisSnapshotCache.js +13 -10
- package/dist/application/binary/BinarySession.js +86 -29
- package/dist/application/binary/BinarySessionComposition.js +1 -3
- package/dist/application/binary/BinarySessionExecution.js +3 -5
- package/dist/application/binary/BinarySessionOpen.js +10 -2
- package/dist/application/binary/BinarySessionRecords.js +1 -1
- package/dist/application/binary/BinarySessionStatus.js +1 -6
- package/dist/application/binary/CompositeProvider.js +4 -18
- package/dist/application/binary/LazyAnalysisProvider.js +5 -5
- package/dist/application/binary/SessionProviderRouter.js +27 -135
- package/dist/application/homebrew.js +48 -0
- package/dist/application/javascript/ElectronActiveEvidence.js +10 -14
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +5 -1
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +3 -6
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +7 -1
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +5 -9
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +19 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +11 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +9 -0
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +8 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +46 -29
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +86 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +52 -9
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +1 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -18
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -3
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +8 -6
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +3 -4
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +3 -7
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +76 -47
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -4
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +51 -25
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- package/dist/application/managed/ManagedMemberComparisonService.js +2 -1
- package/dist/application/managed/ManagedNativeVerificationService.js +2 -1
- package/dist/application/native/NativeCallRoutes.js +2 -4
- package/dist/application/process/ProcessCli.js +11 -11
- package/dist/application/process/ProcessEvidence.js +0 -1
- package/dist/artifacts/ArtifactProvider.js +53 -30
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/ArtifactReader.js +31 -0
- package/dist/artifacts/AsarArtifactReader.js +81 -17
- package/dist/artifacts/DirectoryArtifactReader.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +9 -2
- package/dist/artifacts/NativeDmgArtifactReader.js +207 -77
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- package/dist/artifacts/SafeOutputTree.js +16 -2
- package/dist/artifacts/ZipArtifactReader.js +11 -4
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +4 -2
- package/dist/artifacts/apple/DylibResolutionReader.js +17 -7
- package/dist/artifacts/apple/KeyedArchiveReader.js +68 -42
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +104 -29
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +71 -66
- package/dist/artifacts/inventory/ArtifactInventory.js +0 -1
- package/dist/artifacts/inventory/classify.js +33 -14
- package/dist/artifacts/inventory/hashStableRootArtifact.js +37 -0
- package/dist/artifacts/inventory/reader.js +3 -3
- package/dist/artifacts/inventory/scanCanonical.js +64 -34
- package/dist/artifacts/inventory/scanReader.js +12 -20
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +65 -27
- package/dist/browser/BrowserScenarioPartialObservation.js +106 -0
- package/dist/browser/CdpBrowserProvider.js +6 -6
- package/dist/browser/CdpCaptureEventHandlers.js +2 -4
- package/dist/browser/CdpCaptureEvents.js +0 -1
- package/dist/browser/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpCaptureValues.js +20 -0
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -5
- package/dist/browser/CdpElectronScriptEvents.js +2 -8
- package/dist/browser/CdpElectronScripts.js +4 -5
- package/dist/browser/CdpPageCaptureScripts.js +2 -3
- package/dist/browser/CdpSafeMetadata.js +10 -10
- package/dist/browser/CdpWebMcpDiscovery.js +16 -13
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +64 -49
- package/dist/browser/PlaywrightElectronActiveActions.js +2 -56
- package/dist/browser/PlaywrightElectronActiveProvider.js +10 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +1 -1
- package/dist/browser/PlaywrightScenarioBrowser.js +269 -66
- package/dist/browser/PlaywrightScenarioEvents.js +1 -1
- package/dist/browser/PlaywrightScenarioSession.js +41 -32
- package/dist/browser/WebSourceMapFetcher.js +32 -6
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- package/dist/browser/assets/ScriptCaptureAdapters.js +1 -1
- package/dist/browser/history/CaptureFailures.js +6 -2
- package/dist/browser/history/MitmproxyCaptureAdapter.js +4 -2
- package/dist/catalogIdentity.js +0 -1
- package/dist/cli/analysisViewCommands.js +36 -0
- package/dist/cli/artifactCommands.js +11 -12
- package/dist/cli/coreAnalysisCommands.js +3 -3
- package/dist/cli/coreBinaryCommands.js +37 -28
- package/dist/cli/coreNativeCommands.js +9 -10
- package/dist/cli/electronCommands.js +12 -13
- package/dist/cli/interactiveSetup.js +6 -6
- package/dist/cli/javascriptApplicationAnalysis.js +2 -12
- package/dist/cli/jsonOutput.js +3 -2
- package/dist/cli/managedCommands.js +7 -8
- package/dist/cli/nativeCallCommands.js +1 -2
- package/dist/cli/omittableDefaults.js +50 -0
- package/dist/cli/processCommands.js +3 -2
- package/dist/cli/setupCommands.js +16 -15
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +10 -12
- package/dist/cli.js +19 -8
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +1 -0
- package/dist/cliJsonFile.js +179 -0
- package/dist/cliJsonInput.js +60 -33
- package/dist/cliObservationOptions.js +4 -0
- package/dist/cliOutput.js +0 -38
- package/dist/composition/auxiliaryAnalysisProviders.js +30 -25
- package/dist/composition/binary.js +9 -9
- package/dist/composition/browserScenario.js +2 -1
- package/dist/composition/directAnalysis.js +20 -14
- package/dist/composition/electronScenario.js +1 -1
- package/dist/composition/optionalObservationProviders.js +12 -7
- package/dist/config/environment.js +6 -0
- package/dist/config/ghidraStartupTimeout.js +4 -9
- package/dist/config/homeDirectory.js +12 -0
- package/dist/config/mcpResponseBudget.js +9 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/config/parsers.js +19 -22
- package/dist/contracts/analysisViewToolContracts.js +56 -0
- package/dist/contracts/applicationToolContracts.js +5 -4
- package/dist/contracts/artifactComparisonExample.js +7 -7
- package/dist/contracts/artifactToolContracts.js +1 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +19 -15
- package/dist/contracts/enhancedInputs.js +2 -2
- package/dist/contracts/enhancedToolContracts.js +4 -3
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/evm/evmToolContracts.js +1 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +181 -0
- package/dist/contracts/investigationExamples.js +4 -3
- package/dist/contracts/javascript/electronToolContracts.js +3 -2
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -22
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +248 -0
- package/dist/contracts/javascript/javascriptRuntimeObservationToolContracts.js +1 -1
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/managed/managedToolContracts.js +8 -12
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +8 -8
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +1 -1
- package/dist/contracts/native/nativeToolContracts.js +2 -2
- package/dist/contracts/officialToolContracts.js +2 -1
- package/dist/contracts/promptContracts.js +2 -2
- package/dist/contracts/providerSelection.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +17 -4
- package/dist/contracts/sessionToolSchemas.js +4 -16
- package/dist/contracts/toolContracts.js +2 -0
- package/dist/contracts/toolEffects.js +1 -0
- package/dist/contracts/toolOutputSchemaGroups.js +138 -94
- package/dist/contracts/toolOutputSchemaPrimitives.js +13 -26
- package/dist/contracts/toolSchemaMetadata.js +18 -69
- package/dist/contracts/webNetworkCaptureToolContracts.js +1 -1
- package/dist/contracts/webRuntimeToolContracts.js +1 -1
- package/dist/contracts/webScriptToolContracts.js +1 -1
- package/dist/doctorRuntime.js +7 -5
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorCore.js +3 -0
- package/dist/domain/analysisErrorPresentation.js +22 -5
- package/dist/domain/analysisErrorProjection.js +24 -5
- package/dist/domain/analysisSnapshot.js +31 -31
- package/dist/domain/analysisView/analysisView.js +241 -0
- package/dist/domain/analysisView/analysisViewCoverage.js +19 -0
- package/dist/domain/analysisView/binaryLayoutView.js +159 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +238 -0
- package/dist/domain/android/androidApplication.js +1 -1
- package/dist/domain/android/androidPartialObservation.js +36 -0
- package/dist/domain/apple/appleApplication.js +1 -1
- package/dist/domain/apple/dylibResolution.js +10 -3
- package/dist/domain/apple/interfaceBuilderGraph.js +0 -1
- package/dist/domain/apple/keyedArchive.js +26 -2
- package/dist/domain/artifactComparison.js +15 -6
- package/dist/domain/artifactGraph.js +17 -4
- package/dist/domain/artifactIdentity.js +8 -8
- package/dist/domain/artifactInspection.js +8 -8
- package/dist/domain/artifactInventoryEvidence.js +9 -16
- package/dist/domain/artifactOperationError.js +3 -3
- package/dist/domain/artifactPartialObservation.js +1 -0
- package/dist/domain/artifactPathSyntax.js +49 -0
- package/dist/domain/binaryTarget.js +39 -13
- package/dist/domain/browserCaptureComparison.js +13 -49
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserNetworkEvidence.js +10 -4
- package/dist/domain/browserObservation.js +0 -1
- package/dist/domain/browserObservationSchemas.js +14 -3
- package/dist/domain/browserScenario.js +0 -1
- package/dist/domain/browserScenarioCapture.js +1 -2
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioDiff.js +0 -2
- package/dist/domain/browserScenarioDiffEvidence.js +0 -12
- package/dist/domain/browserScenarioDiffValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +6 -6
- package/dist/domain/callPath.js +15 -18
- package/dist/domain/callPathSchemas.js +2 -2
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +5 -6
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/completionLedgerGeneration.js +2 -1
- package/dist/domain/configurationErrors.js +12 -0
- package/dist/domain/conformancePackage.js +4 -3
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +19 -40
- package/dist/domain/evidenceBundle.js +58 -42
- package/dist/domain/evidenceCompletionLedger.js +2 -1
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +6 -6
- package/dist/domain/functionComparisonDimensions.js +120 -87
- package/dist/domain/functionComparisonNormalization.js +26 -36
- package/dist/domain/functionComparisonResults.js +3 -6
- package/dist/domain/functionComparisonSchemas.js +2 -8
- package/dist/domain/functionDossierEvidence.js +4 -38
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/javascript/electronActiveObservation.js +29 -71
- package/dist/domain/javascript/electronObservation.js +14 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -11
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -2
- package/dist/domain/javascript/electronStaticAnalysisNative.js +7 -4
- package/dist/domain/javascript/electronStaticAnalysisValues.js +8 -4
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +3 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +12 -8
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +6 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +41 -16
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +9 -2
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +50 -36
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -8
- package/dist/domain/javascript/javascriptAstFingerprint.js +2 -2
- package/dist/domain/javascript/javascriptAstValues.js +22 -0
- package/dist/{application/javascript/JavaScriptReturnShapeProjection.js → domain/javascript/javascriptExportReturnShapeProjection.js} +4 -4
- package/dist/domain/javascript/javascriptExportShapeComparison.js +10 -3
- package/dist/domain/javascript/javascriptExportShapeComparisonIdentity.js +6 -1
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +58 -22
- package/dist/domain/javascript/javascriptExportShapeSelection.js +7 -7
- package/dist/domain/javascript/javascriptExportShapeVariants.js +70 -16
- package/dist/domain/javascript/javascriptFeatureSeed.js +25 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -5
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -7
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeObservation.js +18 -7
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +6 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -222
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +7 -7
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +209 -11
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +2 -1
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticCalls.js +2 -1
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +4 -3
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +2 -2
- package/dist/domain/javascript/javascriptSemanticGraph.js +220 -71
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +19 -1
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +106 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +515 -74
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +44 -36
- package/dist/domain/javascript/javascriptSemanticObjects.js +79 -42
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +8 -14
- package/dist/domain/javascript/javascriptSemanticProjection.js +21 -16
- package/dist/domain/javascript/javascriptSemanticPromises.js +16 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +23 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +8 -2
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +3 -2
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +1 -1
- package/dist/domain/javascript/javascriptSemanticResources.js +1 -1
- package/dist/domain/javascript/javascriptSemanticReturns.js +55 -44
- package/dist/domain/javascript/javascriptSemanticSlots.js +72 -0
- package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +180 -76
- package/dist/domain/javascript/javascriptSourceMapPaths.js +114 -0
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +2 -1
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -16
- package/dist/domain/javascript/sourceToBundleComparison.js +19 -8
- package/dist/domain/javascript/sourceToBundleSignals.js +53 -25
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +46 -19
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +10 -6
- package/dist/domain/managed/managedApplicationGraphNodes.js +82 -57
- package/dist/domain/managed/managedArtifact.js +6 -4
- package/dist/domain/managed/managedMemberComparison.js +2 -9
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/managed/managedNativeVerification.js +0 -2
- package/dist/domain/managed/managedNativeVerificationMatch.js +9 -3
- package/dist/domain/native/binaryLayout.js +2 -3
- package/dist/domain/native/nativeApiBoundary.js +1 -1
- package/dist/domain/native/nativeCallObservation.js +3 -3
- package/dist/domain/native/nativeInstruction.js +7 -0
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/native/recordedCrash.js +2 -3
- package/dist/domain/offsetDateTime.js +17 -0
- package/dist/domain/process/processCapture.js +22 -20
- package/dist/domain/process/processCaptureCoverage.js +70 -0
- package/dist/domain/process/processCaptureExample.js +45 -1
- package/dist/domain/process/processCaptureParsing.js +1 -34
- package/dist/domain/process/processCaptureValidation.js +82 -13
- package/dist/domain/process/processComparison.js +39 -43
- package/dist/domain/process/processObservation.js +10 -2
- package/dist/domain/process/processScenario.js +24 -2
- package/dist/domain/process/processTraceComparison.js +0 -2
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +19 -15
- package/dist/domain/process/processTraceSpecification.js +4 -7
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +7 -3
- package/dist/domain/reconstructionObligationLedgerSchemas.js +2 -1
- package/dist/domain/reconstructionReadinessSchemas.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +6 -5
- package/dist/domain/reconstructionVerificationSchemas.js +2 -1
- package/dist/domain/referenceSourceGraph.js +27 -28
- package/dist/domain/referenceSourceImportParsing.js +34 -45
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +4 -3
- package/dist/domain/stringPatterns.js +6 -0
- package/dist/domain/swiftSymbolClassification.js +66 -0
- package/dist/domain/symbolAnalysis.js +83 -20
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +9 -1
- package/dist/domain/webCaptureDiff.js +71 -30
- package/dist/domain/webCaptureDiffSchemas.js +8 -11
- package/dist/domain/webEventListeners.js +3 -2
- package/dist/domain/webExecution.js +3 -2
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webRuntime.js +0 -2
- package/dist/domain/webScriptExport.js +2 -2
- package/dist/dotnet/ManagedArtifactInspector.js +2 -19
- package/dist/dotnet/ManagedMemberInspector.js +12 -18
- package/dist/dotnet/ManagedMemberInspectorCore.js +47 -44
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +1 -2
- package/dist/dotnet/ManagedMemberRows.js +75 -62
- package/dist/dotnet/ManagedMetadataInventory.js +16 -22
- package/dist/dotnet/ManagedMethodBodyReader.js +4 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +109 -94
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +12 -21
- package/dist/dotnet/ManagedReaderFailure.js +16 -0
- package/dist/dotnet/ManagedStaticProvider.js +13 -12
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- package/dist/evaluation/AgentEvaluationFixtures.js +250 -0
- package/dist/evaluation/AgentEvaluationReport.js +28 -0
- package/dist/evaluation/CodexAgentEval.js +12 -8
- package/dist/evaluation/KnownAnswerEvaluation.js +281 -0
- package/dist/evm/EvmoleInterfaceProvider.js +2 -1
- package/dist/filesystem/RegularFile.js +41 -0
- package/dist/firmware/FirmwareCommand.js +9 -5
- package/dist/firmware/FirmwareProvider.js +4 -4
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +3 -6
- package/dist/ghidra/GhidraClient.js +105 -36
- package/dist/ghidra/GhidraClientStartup.js +0 -2
- package/dist/ghidra/GhidraDoctor.js +6 -5
- package/dist/ghidra/GhidraFunctionValues.js +3 -5
- package/dist/ghidra/GhidraInstallation.js +151 -22
- package/dist/ghidra/GhidraJavaLaunch.js +6 -2
- package/dist/ghidra/GhidraLauncher.js +58 -26
- package/dist/ghidra/GhidraProvider.js +6 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +6 -0
- package/dist/ghidra/GhidraProviderClient.js +13 -3
- package/dist/ghidra/GhidraSessionError.js +2 -0
- package/dist/ghidra/GhidraSessionRoot.js +39 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +17 -10
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +8 -2
- package/dist/hopper/BridgeLauncher.js +34 -45
- package/dist/hopper/HopperAnalysisProfile.js +3 -8
- package/dist/hopper/HopperCleanup.js +56 -27
- package/dist/hopper/HopperClient.js +86 -65
- package/dist/hopper/HopperMachOImage.js +3 -2
- package/dist/hopper/HopperProvider.js +16 -18
- package/dist/hopper/HopperRegexSearch.js +3 -6
- package/dist/hopper/HopperTargetLease.js +132 -49
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -0
- package/dist/ida/IdaConfiguration.js +8 -3
- package/dist/ida/IdaInput.js +1 -7
- package/dist/ida/IdaMcpConnection.js +8 -4
- package/dist/ida/IdaOperationRunner.js +5 -3
- package/dist/ida/IdaProvider.js +8 -12
- package/dist/ida/IdaSessionClient.js +24 -20
- package/dist/ida/IdaWorkspace.js +12 -13
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +47 -14
- package/dist/inspector/V8InspectorProvider.js +97 -35
- package/dist/javascript/recovery/WakaruCommand.js +7 -2
- package/dist/javascript/recovery/WakaruExecution.js +5 -2
- package/dist/main/shutdown.js +81 -29
- package/dist/main/startup.js +9 -2
- package/dist/main/transport.js +23 -3
- package/dist/main.js +11 -18
- package/dist/native/AppleMachoSelection.js +16 -6
- package/dist/native/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/CommandRunner.js +9 -7
- package/dist/native/LldbCallTracer.js +249 -77
- package/dist/native/NativeMacOSProvider.js +32 -17
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- package/dist/native/NativeUiHelperRuntime.js +11 -2
- package/dist/native/NativeUiObservation.js +2 -2
- package/dist/native/pwntools/PwntoolsDecoder.js +2 -1
- package/dist/process/DarwinProcessRunTokenReader.js +16 -2
- package/dist/process/ExecFileOutput.js +88 -6
- package/dist/process/PrivateRuntimeRoot.js +10 -5
- package/dist/process/ProcessOwnership.js +1 -4
- package/dist/process/ProcessOwnershipObservation.js +18 -16
- package/dist/process/ProviderProcess.js +1 -3
- package/dist/process/capture/FilesystemSnapshot.js +131 -24
- package/dist/process/capture/ProcessCaptureError.js +13 -0
- package/dist/process/capture/ProcessCaptureLifecycle.js +148 -74
- package/dist/process/capture/ProcessFilesystemEffects.js +51 -6
- package/dist/process/capture/ProcessHarness.js +16 -33
- package/dist/process/capture/ProcessNormalization.js +20 -2
- package/dist/process/capture/ProcessSampling.js +25 -2
- package/dist/process/capture/TerminalRenderer.js +14 -0
- package/dist/process/snapshotEnvironment.js +14 -0
- package/dist/server/EvidenceMcpServer.js +25 -14
- package/dist/server/analysisAdmission.js +8 -0
- package/dist/server/createServer.js +71 -59
- package/dist/server/mcpClientMetadata.js +12 -5
- package/dist/server/promptCompletion.js +3 -8
- package/dist/server/registerAnalysisViewTool.js +15 -0
- package/dist/server/registerAndroidTools.js +2 -3
- package/dist/server/registerApplicationTools/compareExportShapes.js +6 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +4 -5
- package/dist/server/registerApplicationTools/coverage.js +1 -2
- package/dist/server/registerApplicationTools/helpers.js +4 -4
- package/dist/server/registerApplicationTools/obligationLedger.js +4 -5
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -4
- package/dist/server/registerApplicationTools/traceFeature.js +4 -5
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +4 -5
- package/dist/server/registerArtifactTools.js +2 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +2 -3
- package/dist/server/registerBrowserScenarioTool.js +3 -4
- package/dist/server/registerBrowserTools.js +13 -16
- package/dist/server/registerBundleComparisonTool.js +5 -6
- package/dist/server/registerCloseLifecycleTool.js +8 -7
- package/dist/server/registerElectronTools.js +10 -13
- package/dist/server/registerEnhancedTools.js +82 -77
- package/dist/server/registerEvidenceTools.js +54 -47
- package/dist/server/registerEvmTools.js +2 -3
- package/dist/server/registerFirmwareTools.js +2 -3
- package/dist/server/registerFunctionComparisonTool.js +7 -8
- package/dist/server/registerInvestigationTools.js +14 -15
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -3
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +6 -6
- package/dist/server/registerManagedTools.js +7 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +5 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +4 -5
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +6 -7
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +6 -7
- package/dist/server/registerOfficialTools.js +32 -41
- package/dist/server/registerProcessComparisonTool.js +8 -8
- package/dist/server/registerRecordedCrashTools.js +2 -3
- package/dist/server/registerSessionRecordTools.js +15 -19
- package/dist/server/registerSessionStatusTool.js +3 -4
- package/dist/server/registerSessionTools.js +19 -19
- package/dist/server/registerWebModuleTool.js +2 -3
- package/dist/server/registerWebNetworkCaptureTool.js +2 -3
- package/dist/server/registerWebRuntimeTools.js +4 -5
- package/dist/server/registerWebScriptTool.js +2 -3
- package/dist/server/registerWebSourceLocationTool.js +2 -3
- package/dist/server/toolResult.js +66 -94
- package/dist/server/toolResultEncoding.js +11 -10
- package/dist/windows/WindowsNativeLoader.js +1 -0
- package/dist/windows/WindowsOwnedProcess.js +60 -15
- package/dist/windows/WindowsPrivateRuntime.js +7 -8
- package/native/windows/README.md +3 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -30
- package/scripts/rea.mjs +3 -6
- package/skills/reverse-engineer-anything/SKILL.md +14 -13
- package/skills/reverse-engineer-anything/references/android-applications.md +6 -3
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +16 -6
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +18 -0
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/config.js +0 -1
- package/dist/contracts/browserCaptureToolInputSchema.js +0 -43
- package/dist/contracts/process/processCaptureExample.js +0 -2
- package/dist/contracts/toolOutputSchemas.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/main/reload.js +0 -12
- package/dist/main/state.js +0 -3
- package/dist/server/registerNativeTools.js +0 -6
- package/dist/server/sessionToolPolicies.js +0 -2
|
@@ -161,6 +161,15 @@ export const linkElectronRoleToAsset = (context, input) => {
|
|
|
161
161
|
}),
|
|
162
162
|
});
|
|
163
163
|
};
|
|
164
|
+
/**
|
|
165
|
+
* Disclose relationships omitted because they resolved to their own source;
|
|
166
|
+
* the application graph forbids self-referential edges.
|
|
167
|
+
*/
|
|
168
|
+
export const selfReferenceOmissions = (count, noun, owner) => count === 0
|
|
169
|
+
? []
|
|
170
|
+
: [
|
|
171
|
+
`${String(count)} ${count === 1 ? noun[0] : noun[1]} resolved back to ${owner} itself and ${count === 1 ? "was" : "were"} omitted; application graph edges cannot be self-referential.`,
|
|
172
|
+
];
|
|
164
173
|
/** Deterministic key for one recovered module inside a bundle asset. */
|
|
165
174
|
export const moduleLookupKey = (path, moduleKey) => `${path}\0${moduleKey}`;
|
|
166
175
|
/** Deterministic key for one recovered bundler chunk inside a bundle asset. */
|
|
@@ -109,16 +109,16 @@ export const addJavaScriptSourceMapOriginals = (context) => {
|
|
|
109
109
|
strategy: "source-map-original",
|
|
110
110
|
stability: "source-map-exact",
|
|
111
111
|
source_map_sha256: mapFile.sha256,
|
|
112
|
-
original_source: original.
|
|
112
|
+
original_source: original.reference.source_name,
|
|
113
|
+
source_root: original.reference.source_root,
|
|
113
114
|
source_sha256: original.content_sha256,
|
|
114
115
|
},
|
|
115
116
|
observations: [
|
|
116
117
|
{
|
|
117
|
-
label: original.
|
|
118
|
+
label: original.reference.source_name || null,
|
|
119
|
+
source_map_reference: original.reference,
|
|
118
120
|
properties: {
|
|
119
|
-
source: original.source,
|
|
120
121
|
content_available: original.content !== null,
|
|
121
|
-
source_sha256: original.content_sha256,
|
|
122
122
|
},
|
|
123
123
|
evidence: artifactObservationEvidence({
|
|
124
124
|
sha256: mapFile.sha256,
|
|
@@ -134,7 +134,10 @@ export const addJavaScriptSourceMapOriginals = (context) => {
|
|
|
134
134
|
source_node_id: mapNode.node_id,
|
|
135
135
|
target_node_id: node.node_id,
|
|
136
136
|
relation: "contains",
|
|
137
|
-
properties: {
|
|
137
|
+
properties: {
|
|
138
|
+
original_source: original.reference.source_name,
|
|
139
|
+
source_root: original.reference.source_root,
|
|
140
|
+
},
|
|
138
141
|
evidence: artifactObservationEvidence({
|
|
139
142
|
sha256: mapFile.sha256,
|
|
140
143
|
path: mapFile.path,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { addStaticInferenceEdge, artifactLocalIdentity, chunkLookupKey, createElectronRoleNode, javascriptAnalysisCoverage, linkElectronRoleToAsset, moduleLookupKey, resolveArtifactPath, selfReferenceOmissions, sourceNodeFor, } from "./JavaScriptArtifactGraphContext.js";
|
|
2
3
|
import { astObservationEvidence, staticInferenceEvidence, } from "./JavaScriptArtifactGraphEvidence.js";
|
|
3
4
|
import { resolveArtifactPathByContext } from "./JavaScriptArtifactPathResolution.js";
|
|
4
5
|
/** Project imports, workers, roles, endpoints, storage, and source-map links. */
|
|
5
6
|
export const addJavaScriptStaticFindings = (context) => {
|
|
7
|
+
const omissions = { selfReferences: 0 };
|
|
6
8
|
for (const analyzed of context.analysis.files) {
|
|
7
9
|
const { file, javascript } = analyzed;
|
|
8
10
|
const asset = context.assetNodes.get(file.path);
|
|
@@ -10,7 +12,7 @@ export const addJavaScriptStaticFindings = (context) => {
|
|
|
10
12
|
continue;
|
|
11
13
|
const coverage = javascriptAnalysisCoverage(javascript);
|
|
12
14
|
for (const value of javascript.references)
|
|
13
|
-
addReference(context, { file, asset, value, coverage });
|
|
15
|
+
addReference(context, { file, asset, value, coverage }, omissions);
|
|
14
16
|
for (const value of javascript.endpoints)
|
|
15
17
|
addEndpoint(context, { file, asset, value, coverage });
|
|
16
18
|
for (const value of javascript.storage)
|
|
@@ -20,8 +22,9 @@ export const addJavaScriptStaticFindings = (context) => {
|
|
|
20
22
|
for (const value of javascript.source_map_urls)
|
|
21
23
|
addSourceMapEdge(context, { file, asset, value, coverage });
|
|
22
24
|
}
|
|
25
|
+
return selfReferenceOmissions(omissions.selfReferences, ["static reference", "static references"], "the referencing module");
|
|
23
26
|
};
|
|
24
|
-
const addReference = (context, input) => {
|
|
27
|
+
const addReference = (context, input, omissions) => {
|
|
25
28
|
const source = sourceNodeFor(context, input.file.path, input.value.module_key) ??
|
|
26
29
|
input.asset;
|
|
27
30
|
const resolved = input.value.specifier === null
|
|
@@ -70,6 +73,13 @@ const addReference = (context, input) => {
|
|
|
70
73
|
});
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
76
|
+
// A reference that resolves to its own source, such as a bundled module
|
|
77
|
+
// requiring its own key, cannot become an edge: the application graph
|
|
78
|
+
// forbids self-referential edges and one would fail the whole analysis.
|
|
79
|
+
if (resolved?.node.node_id === source.node_id) {
|
|
80
|
+
omissions.selfReferences += 1;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
73
83
|
const target = resolved?.node ??
|
|
74
84
|
unresolvedReferenceNode(context, input.file, input.value, input.coverage);
|
|
75
85
|
addStaticInferenceEdge(context, {
|
|
@@ -190,6 +200,9 @@ const addDiscoveredRole = (context, input) => {
|
|
|
190
200
|
});
|
|
191
201
|
};
|
|
192
202
|
const addSourceMapEdge = (context, input) => {
|
|
203
|
+
const declaredUrlSha256 = createHash("sha256")
|
|
204
|
+
.update(input.value.declared_url)
|
|
205
|
+
.digest("hex");
|
|
193
206
|
const resolvedPath = resolveArtifactPathByContext({
|
|
194
207
|
declaredPath: input.value.declared_url,
|
|
195
208
|
sourcePath: input.file.path,
|
|
@@ -198,33 +211,37 @@ const addSourceMapEdge = (context, input) => {
|
|
|
198
211
|
}).resolved_path;
|
|
199
212
|
const resolvedFile = resolvedPath === null ? undefined : context.filesByPath.get(resolvedPath);
|
|
200
213
|
const resolvedNode = resolvedPath === null ? undefined : context.fileNodes.get(resolvedPath);
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
214
|
+
const isAvailable = resolvedFile?.kind === "source-map" && resolvedNode !== undefined;
|
|
215
|
+
const target = context.accumulator.addNode({
|
|
216
|
+
kind: "source-map",
|
|
217
|
+
identity: isAvailable && resolvedNode !== undefined
|
|
218
|
+
? resolvedNode.identity
|
|
219
|
+
: artifactLocalIdentity(input.file.sha256, "unresolved-source-map", declaredUrlSha256),
|
|
220
|
+
observations: [
|
|
221
|
+
{
|
|
222
|
+
label: "source map reference",
|
|
223
|
+
properties: {
|
|
224
|
+
declared_url: input.value.declared_url,
|
|
225
|
+
declared_url_sha256: declaredUrlSha256,
|
|
226
|
+
resolved_path: resolvedPath,
|
|
227
|
+
available: isAvailable,
|
|
228
|
+
},
|
|
229
|
+
evidence: staticInferenceEvidence({
|
|
230
|
+
sha256: input.file.sha256,
|
|
231
|
+
path: input.file.path,
|
|
232
|
+
range: input.value.location,
|
|
233
|
+
operation: "discover-source-map",
|
|
234
|
+
coverage: input.coverage,
|
|
235
|
+
confidence: "medium",
|
|
236
|
+
limitations: isAvailable
|
|
237
|
+
? []
|
|
238
|
+
: [
|
|
222
239
|
"The declared source map was not present in the inventoried artifact.",
|
|
223
240
|
],
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
241
|
+
}),
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
});
|
|
228
245
|
addStaticInferenceEdge(context, {
|
|
229
246
|
source: input.asset,
|
|
230
247
|
target,
|
|
@@ -233,7 +250,7 @@ const addSourceMapEdge = (context, input) => {
|
|
|
233
250
|
coverage: input.coverage,
|
|
234
251
|
relation: "maps_to",
|
|
235
252
|
properties: {
|
|
236
|
-
|
|
253
|
+
declared_url_sha256: declaredUrlSha256,
|
|
237
254
|
resolved_path: resolvedPath,
|
|
238
255
|
},
|
|
239
256
|
});
|
|
@@ -2,7 +2,6 @@ import { completeApplicationCoverage } from "../../domain/javascript/javascriptA
|
|
|
2
2
|
import { addArtifactContainsEdge, addUnavailableStaticParseScope, artifactFileNodeKind, artifactLocalIdentity, createElectronRoleNode, linkElectronRoleToAsset, } from "./JavaScriptArtifactGraphContext.js";
|
|
3
3
|
import { artifactObservationEvidence, staticInferenceEvidence, } from "./JavaScriptArtifactGraphEvidence.js";
|
|
4
4
|
import { resolveArtifactPathByContext } from "./JavaScriptArtifactPathResolution.js";
|
|
5
|
-
export { addJavaScriptBundlerNodes } from "./JavaScriptArtifactGraphBundlers.js";
|
|
6
5
|
/** Create the exact root artifact node from the inventory manifest. */
|
|
7
6
|
export const createJavaScriptArtifactRootNode = (accumulator, snapshot) => {
|
|
8
7
|
const root = snapshot.nodes.find(({ artifact_id: id }) => id === snapshot.manifest.root_artifact_id);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isBuiltin } from "node:module";
|
|
2
2
|
import { posix } from "node:path";
|
|
3
|
-
import { admitsCanonicalPathSyntax, hasScheme, looksExternal, stripQueryAndFragment, } from "../../domain/artifactPathSyntax.js";
|
|
3
|
+
import { admitsCanonicalPathSyntax, hasScheme, htmlUrlText, looksExternal, percentDecodeUrlPath, stripQueryAndFragment, } from "../../domain/artifactPathSyntax.js";
|
|
4
4
|
const EXTENSIONS = [
|
|
5
5
|
".js",
|
|
6
6
|
".cjs",
|
|
@@ -11,7 +11,6 @@ const EXTENSIONS = [
|
|
|
11
11
|
".html",
|
|
12
12
|
".node",
|
|
13
13
|
];
|
|
14
|
-
const NODE_BUILTINS = new Set(builtinModules.map((name) => name.replace(/^node:/u, "")));
|
|
15
14
|
/** Resolve one declaration under its exact syntax/metadata context. */
|
|
16
15
|
export const resolveArtifactPathByContext = (input) => resolvePackagePath(input, new Set());
|
|
17
16
|
const resolvePackagePath = (input, packageChain, mode = "full", exportsTargetUrl = false) => {
|
|
@@ -32,12 +31,16 @@ const resolvePackagePath = (input, packageChain, mode = "full", exportsTargetUrl
|
|
|
32
31
|
`The exact HTML resource ${confined} was not found among the selected application files.`,
|
|
33
32
|
],
|
|
34
33
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
// An exports target names one exact file; Node tries no extension or index.
|
|
35
|
+
const resolved = exportsTargetUrl
|
|
36
|
+
? (resolveFileCandidates(input, [confined]) ??
|
|
37
|
+
exactExportsTargetNotFound(confined))
|
|
38
|
+
: mode === "files-and-index"
|
|
39
|
+
? (resolveFileCandidates(input, [
|
|
40
|
+
...fileCandidates(confined),
|
|
41
|
+
...indexCandidates(confined),
|
|
42
|
+
]) ?? notFoundCandidate())
|
|
43
|
+
: resolveCandidate(input, confined, packageChain);
|
|
41
44
|
return outcome(input, resolved);
|
|
42
45
|
};
|
|
43
46
|
const rejectDeclaration = (input) => {
|
|
@@ -105,9 +108,7 @@ const contextualCandidate = (input, exportsTargetUrl) => {
|
|
|
105
108
|
};
|
|
106
109
|
const bareModuleCandidate = (input, declared) => {
|
|
107
110
|
const packageName = barePackageName(declared);
|
|
108
|
-
if (packageName === null ||
|
|
109
|
-
NODE_BUILTINS.has(packageName) ||
|
|
110
|
-
declared.startsWith("#"))
|
|
111
|
+
if (packageName === null || isBuiltin(declared) || declared.startsWith("#"))
|
|
111
112
|
return unresolvedOutcome(input, "external", [
|
|
112
113
|
"The bare specifier is a Node builtin, package import map, or invalid package name.",
|
|
113
114
|
]);
|
|
@@ -148,7 +149,7 @@ const hasContainerCandidate = (files, candidate, containerSha256) => [
|
|
|
148
149
|
file.container_sha256 === containerSha256));
|
|
149
150
|
});
|
|
150
151
|
const htmlCandidate = (input) => {
|
|
151
|
-
const declared = stripQueryAndFragment(input.declaredPath);
|
|
152
|
+
const declared = stripQueryAndFragment(htmlUrlText(input.declaredPath));
|
|
152
153
|
if (looksExternal(declared))
|
|
153
154
|
return unresolvedOutcome(input, "external", [
|
|
154
155
|
"External HTML references are not mapped to local artifact assets.",
|
|
@@ -156,15 +157,28 @@ const htmlCandidate = (input) => {
|
|
|
156
157
|
const rawBase = input.htmlBaseHref;
|
|
157
158
|
const base = rawBase === undefined || rawBase === null
|
|
158
159
|
? rawBase
|
|
159
|
-
: stripQueryAndFragment(rawBase);
|
|
160
|
+
: stripQueryAndFragment(htmlUrlText(rawBase));
|
|
160
161
|
if (base !== undefined && base !== null && looksExternal(base))
|
|
161
162
|
return unresolvedOutcome(input, "external", [
|
|
162
163
|
"The document base href is external, so its script reference is not a local artifact path.",
|
|
163
164
|
]);
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
// Removing URL tabs and newlines can join an encoded dot or separator that
|
|
166
|
+
// the raw declaration split, so admit the parsed URL text again.
|
|
167
|
+
if (!admitsCanonicalPathSyntax(declared))
|
|
168
|
+
return unresolvedOutcome(input, "rejected", [
|
|
169
|
+
"Encoded dot or separator bytes are rejected before artifact path resolution.",
|
|
170
|
+
]);
|
|
171
|
+
const declaredPath = percentDecodeUrlPath(declared);
|
|
172
|
+
if (declaredPath === null)
|
|
173
|
+
return unresolvedOutcome(input, "rejected", [
|
|
174
|
+
"The HTML reference path percent-decodes to NUL or to bytes that are not UTF-8.",
|
|
175
|
+
]);
|
|
176
|
+
if (declaredPath.startsWith("/"))
|
|
177
|
+
return declaredPath.slice(1);
|
|
166
178
|
if (base === undefined || base === null || base === "")
|
|
167
|
-
return
|
|
179
|
+
return declaredPath === ""
|
|
180
|
+
? input.sourcePath
|
|
181
|
+
: posix.join(posix.dirname(input.sourcePath), declaredPath);
|
|
168
182
|
// A local base href is a second untrusted path input; apply the same
|
|
169
183
|
// admission rules a declared path gets so it cannot smuggle traversal or
|
|
170
184
|
// separator syntax past canonicalization.
|
|
@@ -172,10 +186,27 @@ const htmlCandidate = (input) => {
|
|
|
172
186
|
return unresolvedOutcome(input, "rejected", [
|
|
173
187
|
"The document base href uses NUL, backslash, or encoded dot and separator bytes that are not admitted for canonical artifact paths.",
|
|
174
188
|
]);
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
189
|
+
const decodedBase = percentDecodeUrlPath(base);
|
|
190
|
+
if (decodedBase === null)
|
|
191
|
+
return unresolvedOutcome(input, "rejected", [
|
|
192
|
+
"The document base href path percent-decodes to NUL or to bytes that are not UTF-8.",
|
|
193
|
+
]);
|
|
194
|
+
const basePath = decodedBase.startsWith("/")
|
|
195
|
+
? decodedBase.slice(1)
|
|
196
|
+
: posix.join(posix.dirname(input.sourcePath), decodedBase);
|
|
197
|
+
if (declaredPath === "")
|
|
198
|
+
return emptyHtmlReference(input, decodedBase, basePath);
|
|
199
|
+
return posix.join(htmlBaseDirectory(decodedBase, basePath), declaredPath);
|
|
200
|
+
};
|
|
201
|
+
const emptyHtmlReference = (input, base, basePath) => {
|
|
202
|
+
if (!htmlBaseIsDirectory(base))
|
|
203
|
+
return basePath;
|
|
204
|
+
const confined = confineCandidate(input, basePath);
|
|
205
|
+
if (typeof confined !== "string")
|
|
206
|
+
return confined;
|
|
207
|
+
return unresolvedOutcome(input, "not-found", [
|
|
208
|
+
`The HTML reference resolves to directory ${confined || "."}, not an exact selected application file.`,
|
|
209
|
+
]);
|
|
179
210
|
};
|
|
180
211
|
/**
|
|
181
212
|
* The directory a relative HTML reference resolves against. A base path
|
|
@@ -183,13 +214,12 @@ const htmlCandidate = (input) => {
|
|
|
183
214
|
* relative reference resolves against the base URL's directory and those
|
|
184
215
|
* segments are dropped rather than stepped through.
|
|
185
216
|
*/
|
|
186
|
-
const
|
|
217
|
+
const htmlBaseIsDirectory = (base) => base.endsWith("/") ||
|
|
187
218
|
base.endsWith("/.") ||
|
|
188
219
|
base.endsWith("/..") ||
|
|
189
220
|
base === "." ||
|
|
190
|
-
base === ".."
|
|
191
|
-
|
|
192
|
-
: posix.dirname(basePath);
|
|
221
|
+
base === "..";
|
|
222
|
+
const htmlBaseDirectory = (base, basePath) => htmlBaseIsDirectory(base) ? basePath : posix.dirname(basePath);
|
|
193
223
|
const confineCandidate = (input, candidate) => {
|
|
194
224
|
const normalized = posix.normalize(candidate);
|
|
195
225
|
if (normalized === ".." ||
|
|
@@ -334,11 +364,20 @@ const packageEntry = (text, moduleKind, useExports) => {
|
|
|
334
364
|
}
|
|
335
365
|
};
|
|
336
366
|
const packageExport = (value, moduleKind) => {
|
|
367
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
368
|
+
const keys = Object.keys(value);
|
|
369
|
+
if (keys.some((key) => key.startsWith(".")) &&
|
|
370
|
+
keys.some((key) => !key.startsWith(".")))
|
|
371
|
+
return {
|
|
372
|
+
status: "rejected",
|
|
373
|
+
limitation: "The package exports configuration mixes subpath keys and condition keys.",
|
|
374
|
+
};
|
|
375
|
+
}
|
|
337
376
|
const root = typeof value === "object" && value !== null && Object.hasOwn(value, ".")
|
|
338
377
|
? Reflect.get(value, ".")
|
|
339
378
|
: value;
|
|
340
379
|
const flattened = exportTargets(root, packageExportConditions(moduleKind));
|
|
341
|
-
if (flattened.kind === "invalid")
|
|
380
|
+
if (flattened.kind === "invalid" || flattened.kind === "invalid-config")
|
|
342
381
|
return { status: "rejected", limitation: flattened.limitation };
|
|
343
382
|
const first = flattened.kind === "unmatched" ? undefined : flattened.values[0];
|
|
344
383
|
return first === undefined
|
|
@@ -384,6 +423,9 @@ const exportTargets = (value, conditions) => {
|
|
|
384
423
|
let invalid = null;
|
|
385
424
|
for (const entry of value) {
|
|
386
425
|
const nested = exportTargets(entry, conditions);
|
|
426
|
+
// Node's array fallback catches invalid targets, not invalid configuration.
|
|
427
|
+
if (nested.kind === "invalid-config")
|
|
428
|
+
return nested;
|
|
387
429
|
if (nested.kind === "invalid") {
|
|
388
430
|
invalid = nested.limitation;
|
|
389
431
|
continue;
|
|
@@ -400,6 +442,14 @@ const exportTargets = (value, conditions) => {
|
|
|
400
442
|
}
|
|
401
443
|
if (typeof value !== "object")
|
|
402
444
|
return invalidExportTarget(value, "must be a relative string, object, array, or null");
|
|
445
|
+
for (const key of Object.keys(value)) {
|
|
446
|
+
const numeric = Number(key);
|
|
447
|
+
if (String(numeric) === key && numeric >= 0 && numeric < 0xffff_ffff)
|
|
448
|
+
return {
|
|
449
|
+
kind: "invalid-config",
|
|
450
|
+
limitation: `The package exports configuration contains numeric condition key ${JSON.stringify(key)}.`,
|
|
451
|
+
};
|
|
452
|
+
}
|
|
403
453
|
for (const [condition, target] of Object.entries(value)) {
|
|
404
454
|
if (!conditions.has(condition))
|
|
405
455
|
continue;
|
|
@@ -413,11 +463,13 @@ const exportTargets = (value, conditions) => {
|
|
|
413
463
|
* Node selects an exports target by walking the declared keys in order and
|
|
414
464
|
* taking the first whose condition is active for the calling resolver.
|
|
415
465
|
* "default" is always active, and "node" plus "node-addons" are active for the
|
|
416
|
-
* built-in resolver that owns installed-package imports and requires.
|
|
466
|
+
* built-in resolver that owns installed-package imports and requires. The
|
|
467
|
+
* supported Node runtimes also activate "module-sync" for both loaders.
|
|
417
468
|
*/
|
|
418
469
|
const packageExportConditions = (moduleKind) => new Set([
|
|
419
470
|
"node",
|
|
420
471
|
"node-addons",
|
|
472
|
+
"module-sync",
|
|
421
473
|
...(moduleKind === undefined ? [] : [moduleKind]),
|
|
422
474
|
"default",
|
|
423
475
|
]);
|
|
@@ -431,6 +483,13 @@ const notFoundCandidate = () => ({
|
|
|
431
483
|
"No extension, directory package, or index candidate exists in the inventoried artifact container.",
|
|
432
484
|
],
|
|
433
485
|
});
|
|
486
|
+
const exactExportsTargetNotFound = (path) => ({
|
|
487
|
+
resolvedPath: null,
|
|
488
|
+
status: "not-found",
|
|
489
|
+
limitations: [
|
|
490
|
+
`The selected package exports target ${path} does not exist in the inventoried artifact container; exports targets are exact files, so no extension or directory index was tried.`,
|
|
491
|
+
],
|
|
492
|
+
});
|
|
434
493
|
const fileUrlPath = (value) => {
|
|
435
494
|
if (!value.startsWith("file://"))
|
|
436
495
|
return undefined;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constants } from "node:fs";
|
|
2
|
+
import { access, lstat, realpath } from "node:fs/promises";
|
|
2
3
|
import { ArtifactReaderFailure } from "../../artifacts/ArtifactReader.js";
|
|
4
|
+
import { AnalysisAccessDeniedError, AnalysisInputError, AnalysisUnsupportedTargetError, } from "../../domain/analysisErrorCore.js";
|
|
3
5
|
import { createJavaScriptArtifactReader as createReader } from "../../artifacts/javascript/JavaScriptArtifactReader.js";
|
|
4
6
|
import { analyzeAndProjectJavaScriptArtifactFiles } from "./JavaScriptArtifactAnalysis.js";
|
|
5
7
|
import { readJavaScriptArtifactFiles } from "../../artifacts/javascript/JavaScriptArtifactFiles.js";
|
|
6
8
|
import { buildImmutableJavaScriptArtifactGraphSteps } from "./JavaScriptArtifactGraphBuilder.js";
|
|
7
9
|
import { javascriptArtifactReconstructionInputSchema, } from "./JavaScriptArtifactReconstructionInput.js";
|
|
8
|
-
import { scanCanonicalArtifactInventory } from "../../artifacts/inventory/
|
|
10
|
+
import { scanCanonicalArtifactInventory } from "../../artifacts/inventory/scanCanonical.js";
|
|
9
11
|
import { summarizeElectronBoundaries } from "./ElectronBoundaryAnalysis.js";
|
|
10
12
|
import { createJavaScriptSemanticGraphProjection } from "./JavaScriptSemanticGraphBuilder.js";
|
|
11
13
|
import { checkpointJavaScriptAnalysis, completeJavaScriptAnalysisSteps, } from "./JavaScriptAnalysisControl.js";
|
|
@@ -17,9 +19,12 @@ export const reconstructJavaScriptArtifact = async (rawInput, signal, progress)
|
|
|
17
19
|
};
|
|
18
20
|
const input = javascriptArtifactReconstructionInputSchema.parse(rawInput);
|
|
19
21
|
abortIfNeeded(signal);
|
|
20
|
-
const path = await
|
|
22
|
+
const path = await resolveSelectedInput(input.input_path);
|
|
21
23
|
const format = await resolveFormat(path, input);
|
|
22
|
-
const snapshot = await scanCanonicalArtifactInventory(path, {
|
|
24
|
+
const snapshot = await scanCanonicalArtifactInventory(path, {
|
|
25
|
+
signal,
|
|
26
|
+
integrity: { mode: input.integrity_policy },
|
|
27
|
+
});
|
|
23
28
|
if (snapshot.manifest.root_format !== format)
|
|
24
29
|
throw new ArtifactReaderFailure("format", `Artifact inventory classified ${path} as ${snapshot.manifest.root_format}, not ${format}`);
|
|
25
30
|
const reader = createReader(path, format);
|
|
@@ -45,8 +50,8 @@ export const reconstructJavaScriptArtifact = async (rawInput, signal, progress)
|
|
|
45
50
|
await reportPhase("seal_javascript_application_graph", "Sealing the validated application graph");
|
|
46
51
|
const graph = await completeJavaScriptAnalysisSteps(applicationGraphSteps, signal);
|
|
47
52
|
await reportPhase("build_javascript_semantic_graph", "Binding and validating static semantic relationships");
|
|
48
|
-
const semanticGraphSteps = semanticProjection.finishImmutableSteps(snapshot.manifest.root_sha256, graph
|
|
49
|
-
await reportPhase("seal_javascript_semantic_graph", "
|
|
53
|
+
const semanticGraphSteps = semanticProjection.finishImmutableSteps(snapshot.manifest.root_sha256, graph);
|
|
54
|
+
await reportPhase("seal_javascript_semantic_graph", "Validating and sealing the semantic graph");
|
|
50
55
|
const semanticGraph = await completeJavaScriptAnalysisSteps(semanticGraphSteps, signal);
|
|
51
56
|
await checkpointJavaScriptAnalysis(signal);
|
|
52
57
|
return {
|
|
@@ -55,6 +60,7 @@ export const reconstructJavaScriptArtifact = async (rawInput, signal, progress)
|
|
|
55
60
|
root_artifact_sha256: snapshot.manifest.root_sha256,
|
|
56
61
|
inventory_manifest_id: snapshot.manifest.manifest_id,
|
|
57
62
|
inventory_graph_sha256: snapshot.manifest.graph_sha256,
|
|
63
|
+
integrity_contradictions: snapshot.integrity_contradictions,
|
|
58
64
|
graph,
|
|
59
65
|
semantic_graph: semanticGraph,
|
|
60
66
|
electron_summary: summarizeElectronBoundaries(analysis),
|
|
@@ -68,7 +74,6 @@ export const reconstructJavaScriptArtifact = async (rawInput, signal, progress)
|
|
|
68
74
|
findings: analysis.findings,
|
|
69
75
|
modules: analysis.modules,
|
|
70
76
|
parse_failures: analysis.parse_failures,
|
|
71
|
-
truncated_scopes: analysis.truncated_scopes,
|
|
72
77
|
},
|
|
73
78
|
limitations: analysis.limitations,
|
|
74
79
|
};
|
|
@@ -77,6 +82,35 @@ export const reconstructJavaScriptArtifact = async (rawInput, signal, progress)
|
|
|
77
82
|
await reader.close();
|
|
78
83
|
}
|
|
79
84
|
};
|
|
85
|
+
const OPERATION = "analyze_javascript_application";
|
|
86
|
+
/**
|
|
87
|
+
* Resolve the caller-selected input. A missing or unreadable selection is a
|
|
88
|
+
* caller or host-permission failure, not a damaged artifact.
|
|
89
|
+
*/
|
|
90
|
+
const resolveSelectedInput = async (inputPath) => {
|
|
91
|
+
try {
|
|
92
|
+
const path = await realpath(inputPath);
|
|
93
|
+
await access(path, constants.R_OK);
|
|
94
|
+
return path;
|
|
95
|
+
}
|
|
96
|
+
catch (cause) {
|
|
97
|
+
const code = cause instanceof Error && "code" in cause ? String(cause.code) : "";
|
|
98
|
+
if (code === "EACCES" || code === "EPERM")
|
|
99
|
+
throw new AnalysisAccessDeniedError(OPERATION, inputPath, code, {
|
|
100
|
+
cause,
|
|
101
|
+
});
|
|
102
|
+
if (code === "ENOENT" || code === "ENOTDIR")
|
|
103
|
+
throw new AnalysisInputError(OPERATION, { cause }, [
|
|
104
|
+
{
|
|
105
|
+
path: ["input_path"],
|
|
106
|
+
reason: "invalid_value",
|
|
107
|
+
message: `No file or directory exists at the selected input path (${code}): ${inputPath}`,
|
|
108
|
+
},
|
|
109
|
+
]);
|
|
110
|
+
throw cause;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/** The selected input's kind, checked against the caller's requested format. */
|
|
80
114
|
const resolveFormat = async (path, input) => {
|
|
81
115
|
const metadata = await lstat(path);
|
|
82
116
|
const observed = metadata.isDirectory()
|
|
@@ -85,9 +119,18 @@ const resolveFormat = async (path, input) => {
|
|
|
85
119
|
? "asar"
|
|
86
120
|
: undefined;
|
|
87
121
|
if (observed === undefined)
|
|
88
|
-
throw new
|
|
122
|
+
throw new AnalysisUnsupportedTargetError(OPERATION, input.input_path, "JavaScript application analysis accepts only a directory or an .asar file", {
|
|
123
|
+
remediationAction: "Select an extracted application directory, an app bundle, or an .asar file such as Contents/Resources/app.asar.",
|
|
124
|
+
});
|
|
89
125
|
if (input.format !== "auto" && input.format !== observed)
|
|
90
|
-
throw new
|
|
126
|
+
throw new AnalysisInputError(OPERATION, undefined, [
|
|
127
|
+
{
|
|
128
|
+
path: ["format"],
|
|
129
|
+
reason: "invalid_value",
|
|
130
|
+
message: `Requested ${input.format} input, but the selected input is ${observed === "asar" ? "an .asar file" : "a directory"}: ${input.input_path}`,
|
|
131
|
+
expected: ["auto", observed],
|
|
132
|
+
},
|
|
133
|
+
]);
|
|
91
134
|
return observed;
|
|
92
135
|
};
|
|
93
136
|
const abortIfNeeded = (signal) => {
|
|
@@ -3,4 +3,5 @@ import { z } from "zod";
|
|
|
3
3
|
export const javascriptArtifactReconstructionInputSchema = z.strictObject({
|
|
4
4
|
input_path: z.string().min(1),
|
|
5
5
|
format: z.enum(["auto", "asar", "directory"]).default("auto"),
|
|
6
|
+
integrity_policy: z.enum(["fail", "record-and-continue"]).default("fail"),
|
|
6
7
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compareUnicodeCodePoints } from "../../domain/unicodeCodePointOrder.js";
|
|
2
2
|
/** Parse one approved JSON module without evaluating JavaScript or resolving imports. */
|
|
3
3
|
export const analyzeJavaScriptJsonModule = (file) => {
|
|
4
4
|
if (!file.text.included)
|
|
@@ -26,7 +26,7 @@ export const analyzeJavaScriptJsonModule = (file) => {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
const keys = typeof value === "object" && value !== null && !Array.isArray(value)
|
|
29
|
-
? Object.keys(value).sort(
|
|
29
|
+
? Object.keys(value).sort(compareUnicodeCodePoints)
|
|
30
30
|
: [];
|
|
31
31
|
const retained = keys;
|
|
32
32
|
return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import { compareUnicodeCodePoints } from "../../domain/unicodeCodePointOrder.js";
|
|
3
3
|
import { completeApplicationCoverage, partialApplicationCoverage, } from "../../domain/javascript/javascriptApplicationEvidenceSchemas.js";
|
|
4
|
-
import { semanticCoverageResourceLimits } from "../../domain/javascript/javascriptSemanticCoverage.js";
|
|
5
|
-
import {
|
|
4
|
+
import { semanticCoverageResourceLimits, semanticResourceLimitCoverage, } from "../../domain/javascript/javascriptSemanticCoverage.js";
|
|
5
|
+
import { semanticResourceLimitReason } from "../../domain/javascript/javascriptSemanticResourceLimits.js";
|
|
6
6
|
import { addAstContainsEdge, artifactLocalIdentity, } from "./JavaScriptArtifactGraphContext.js";
|
|
7
7
|
import { astObservationEvidence, staticInferenceEvidence, } from "./JavaScriptArtifactGraphEvidence.js";
|
|
8
8
|
import { resolveArtifactPathByContext, } from "./JavaScriptArtifactPathResolution.js";
|
|
9
|
-
import { projectJavaScriptExportReturnShapes } from "
|
|
9
|
+
import { projectJavaScriptExportReturnShapes } from "../../domain/javascript/javascriptExportReturnShapeProjection.js";
|
|
10
10
|
/** Create one path-scoped source-module identity for every analyzed source file. */
|
|
11
11
|
export const addJavaScriptSourceModules = (context) => {
|
|
12
12
|
for (const analyzed of context.analysis.files) {
|
|
@@ -17,7 +17,7 @@ export const addJavaScriptSourceModules = (context) => {
|
|
|
17
17
|
continue;
|
|
18
18
|
const exports = semantic.ir.moduleLinks
|
|
19
19
|
.flatMap(({ exportedName }) => exportedName === null ? [] : [exportedName])
|
|
20
|
-
.sort(
|
|
20
|
+
.sort(compareUnicodeCodePoints);
|
|
21
21
|
const retainedExports = [...new Set(exports)];
|
|
22
22
|
const source = context.accumulator.addNode({
|
|
23
23
|
kind: "javascript-module",
|
|
@@ -264,19 +264,7 @@ const semanticCoverage = (semantic) => {
|
|
|
264
264
|
const resourceLimits = semanticCoverageResourceLimits(semantic.ir.coverage);
|
|
265
265
|
if (semantic.ir.coverage.status === "complete" && resourceLimits.length === 0)
|
|
266
266
|
return completeApplicationCoverage();
|
|
267
|
-
return partialApplicationCoverage(resourceLimits.
|
|
268
|
-
name: `javascript_semantic_${resourceLimit.replaceAll("-", "_")}`,
|
|
269
|
-
value: resourceLimit === "primitive-candidates"
|
|
270
|
-
? SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT
|
|
271
|
-
: resourceLimit === "primitive-bytes"
|
|
272
|
-
? SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT
|
|
273
|
-
: SEMANTIC_EXPRESSION_DEPTH_LIMIT,
|
|
274
|
-
unit: resourceLimit === "expression-depth"
|
|
275
|
-
? "depth"
|
|
276
|
-
: resourceLimit === "primitive-bytes"
|
|
277
|
-
? "bytes"
|
|
278
|
-
: "items",
|
|
279
|
-
})), semantic.ir.coverage.omittedCount);
|
|
267
|
+
return partialApplicationCoverage(semanticResourceLimitCoverage(resourceLimits), semantic.ir.coverage.omittedCount);
|
|
280
268
|
};
|
|
281
269
|
const moduleFormat = (path, ir) => {
|
|
282
270
|
const extension = posix.extname(path).toLowerCase();
|
|
@@ -18,11 +18,11 @@ export const observeJavaScriptRuntime = async (provider, input, options = {}) =>
|
|
|
18
18
|
if (!ready.ok)
|
|
19
19
|
return ready;
|
|
20
20
|
const result = await ready.value.observe(input, options);
|
|
21
|
+
if (!result.ok)
|
|
22
|
+
return result;
|
|
21
23
|
if (options.signal?.aborted === true)
|
|
22
24
|
return err(new AnalysisCancelledError("observe_javascript_runtime"));
|
|
23
|
-
return result.
|
|
24
|
-
? ok(createJavaScriptRuntimeObservationEvidence("observe_javascript_runtime", input, result.value, ready.value.identity()))
|
|
25
|
-
: result;
|
|
25
|
+
return ok(createJavaScriptRuntimeObservationEvidence("observe_javascript_runtime", input, result.value, ready.value.identity()));
|
|
26
26
|
};
|
|
27
27
|
const requireProvider = (provider, operation) => provider === undefined
|
|
28
28
|
? err(new AnalysisCapabilityUnavailableError("rea-v8-inspector", operation, "V8 Inspector observation provider is not configured"))
|