rea-agents 3.2.0 → 4.0.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 +183 -332
- package/bridge/ghidra/ReaGhidraBridge.java +561 -74
- package/bridge/hopper_bridge.py +70 -27
- package/bridge/native/ReaNativeUI.swift +157 -0
- package/dist/application/AnalysisContextQueries.js +19 -5
- package/dist/application/AnalysisSnapshotCache.js +30 -11
- package/dist/application/AppleAssetCatalogAnalysis.js +171 -0
- package/dist/application/ArtifactExtractionDestination.js +0 -12
- package/dist/application/ArtifactGraphConstruction.js +44 -11
- package/dist/application/ArtifactInventory/classify.js +7 -15
- package/dist/application/ArtifactInventory/hash.js +4 -2
- package/dist/application/ArtifactInventory/policy.js +2 -17
- package/dist/application/ArtifactInventory/reader.js +3 -3
- package/dist/application/ArtifactInventory/scanCanonical.js +2 -2
- package/dist/application/ArtifactInventory/scanReader.js +12 -4
- package/dist/application/ArtifactInventory/types.js +0 -3
- package/dist/application/BinarySession.js +28 -43
- package/dist/application/BinarySessionExecution.js +37 -1
- package/dist/application/BinaryTargetResolver.js +50 -4
- package/dist/application/BrowserEvidence.js +36 -7
- package/dist/application/BrowserObservationService.js +17 -44
- package/dist/application/BrowserScenarioCaptureService.js +2 -35
- package/dist/application/BrowserScenarioEvidence.js +13 -9
- package/dist/application/CapabilityClientRequirements.js +2 -11
- package/dist/application/CapabilityInventory.js +21 -35
- package/dist/application/ClientConfigurationDocument.js +84 -7
- package/dist/application/ClientRegistrationIdentity.js +32 -0
- package/dist/application/ClientRegistrationStatus.js +59 -6
- package/dist/application/DirectAnalysis.js +37 -58
- package/dist/application/DirectAnalysisStatus.js +4 -4
- package/dist/application/Doctor.js +89 -80
- package/dist/application/DoctorDiagnostics.js +2 -26
- package/dist/application/DoctorScope.js +8 -14
- package/dist/application/ElectronActiveEvidence.js +10 -27
- package/dist/application/ElectronActiveObservationService.js +9 -36
- package/dist/application/ElectronBoundaryAnalysis.js +2 -0
- package/dist/application/ElectronBoundaryGraphNative.js +1 -1
- package/dist/application/ElectronEvidence.js +8 -3
- package/dist/application/ElectronObservationService.js +9 -25
- package/dist/application/EnhancedLiteralTracing.js +4 -8
- package/dist/application/EnhancedTools.js +15 -35
- package/dist/application/FilesystemSnapshot.js +7 -8
- package/dist/application/JavaScriptApplicationEvidenceGraph.js +2 -1
- package/dist/application/JavaScriptApplicationWorkflowService.js +31 -7
- package/dist/application/JavaScriptArtifactAnalysis.js +6 -4
- package/dist/application/JavaScriptArtifactFiles.js +5 -0
- package/dist/application/JavaScriptArtifactPathResolution.js +179 -47
- package/dist/application/JavaScriptRuntimeObservationEvidence.js +6 -3
- package/dist/application/JavaScriptRuntimeObservationService.js +9 -25
- package/dist/application/JavaScriptRuntimeReconciliationService.js +45 -4
- package/dist/application/JavaScriptSemanticGraphAsyncProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphChildProcessProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphDataProjection.js +11 -0
- package/dist/application/JavaScriptSemanticGraphFlowProjection.js +14 -5
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +27 -6
- package/dist/application/ManagedMemberComparisonService.js +19 -6
- package/dist/application/NativeApiInspection.js +2 -0
- package/dist/application/NativeCallRoutes.js +72 -0
- package/dist/application/NativeDispatchMetadataInspection.js +33 -0
- package/dist/application/NativeUiActionTrace.js +73 -49
- package/dist/application/NativeValueTrace.js +320 -0
- package/dist/application/ProcessCaptureCapability.js +32 -5
- package/dist/application/ProcessCaptureEnvironment.js +9 -26
- package/dist/application/ProcessCaptureError.js +1 -5
- package/dist/application/ProcessCaptureJournal.js +3 -40
- package/dist/application/ProcessCaptureLifecycle.js +102 -111
- package/dist/application/ProcessCli.js +18 -25
- package/dist/application/ProcessEvidence.js +5 -7
- package/dist/application/ProcessFilesystemEffects.js +36 -0
- package/dist/application/ProcessHarness.js +41 -120
- package/dist/application/ProcessNormalization.js +2 -17
- package/dist/application/ProcessScenarioRuntimeValidation.js +76 -0
- package/dist/application/ReferenceSourceImport.js +3 -4
- package/dist/application/Setup.js +236 -84
- package/dist/application/SetupClientConfiguration.js +14 -9
- package/dist/application/SetupPlan.js +138 -86
- package/dist/application/SetupSkill.js +0 -1
- package/dist/application/SupportedClients.js +102 -21
- package/dist/application/Uninstall.js +31 -20
- package/dist/application/Update.js +93 -0
- package/dist/application/UpdateMaintenance.js +108 -0
- package/dist/application/UpdateRuntime.js +126 -0
- package/dist/application/runtime.js +13 -2
- package/dist/artifacts/ArtifactPaths.js +6 -8
- package/dist/artifacts/ArtifactProvider.js +94 -41
- package/dist/artifacts/AsarArtifactReader.js +19 -4
- package/dist/artifacts/KeyedArchiveReader.js +110 -0
- package/dist/artifacts/MachOSliceArtifactReader.js +53 -5
- package/dist/artifacts/ZipArtifactReader.js +18 -1
- package/dist/browser/BrowserScenarioSecrets.js +28 -1
- package/dist/browser/CdpBrowserProvider.js +36 -15
- package/dist/browser/CdpCaptureDocuments.js +22 -8
- package/dist/browser/CdpCaptureEventHandlers.js +14 -5
- package/dist/browser/CdpCaptureEventHelpers.js +13 -0
- package/dist/browser/CdpCaptureEvents.js +10 -1
- package/dist/browser/CdpElectronInspection.js +5 -10
- package/dist/browser/CdpElectronProvider.js +1 -5
- package/dist/browser/CdpElectronScripts.js +1 -1
- package/dist/browser/CdpEndpoint.js +3 -2
- package/dist/browser/CdpObservationSession.js +14 -10
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpPageCaptureScripts.js +1 -1
- package/dist/browser/CdpSafeMetadata.js +5 -4
- package/dist/browser/CdpScreenshot.js +16 -5
- package/dist/browser/CdpTargetSession.js +25 -4
- package/dist/browser/CdpWebMcpDiscovery.js +93 -20
- package/dist/browser/JavaScriptRuntimeScope.js +28 -2
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +9 -8
- package/dist/browser/PlaywrightElectronActiveActions.js +3 -10
- package/dist/browser/PlaywrightElectronActiveProvider.js +5 -5
- package/dist/browser/PlaywrightScenarioActions.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +13 -25
- package/dist/browser/PlaywrightScenarioBrowser.js +28 -25
- package/dist/browser/PlaywrightScenarioEvents.js +82 -93
- package/dist/browser/PlaywrightScenarioSession.js +27 -123
- package/dist/browser/PngVisualDiff.js +22 -3
- package/dist/browser/V8InspectorCaptureProjection.js +7 -1
- package/dist/browser/V8InspectorProvider.js +60 -7
- package/dist/browser/WebSourceMapFetcher.js +99 -53
- package/dist/cli/artifactCommands.js +56 -12
- package/dist/cli/coreAnalysisCommands.js +110 -0
- package/dist/cli/managedCommands.js +1 -31
- package/dist/cli/setupCommands.js +16 -14
- package/dist/cli/utilityCommands.js +61 -4
- package/dist/cli.js +5 -7
- package/dist/cliApplicationCommands.js +0 -83
- package/dist/cliBrowserAdvancedCommands.js +7 -11
- package/dist/cliBrowserCommands.js +15 -23
- package/dist/cliBrowserContext.js +3 -24
- package/dist/cliBrowserScenarioCommands.js +2 -10
- package/dist/cliCommandNames.js +82 -7
- package/dist/cliElectronCommands.js +10 -36
- package/dist/cliJavaScriptRuntimeCommands.js +6 -30
- package/dist/cliJsonInput.js +4 -2
- package/dist/cliLogging.js +16 -7
- package/dist/cliObservationOptions.js +1 -1
- package/dist/cliOutput.js +2 -4
- package/dist/cliProcessCommands.js +6 -33
- package/dist/cliSetup.js +90 -160
- package/dist/config/environment.js +2 -78
- package/dist/config/parseConfig.js +18 -109
- package/dist/config/parsers.js +0 -23
- package/dist/contracts/applicationToolContracts.js +1 -118
- package/dist/contracts/artifactToolContracts.js +11 -19
- package/dist/contracts/browserScenarioToolContracts.js +1 -5
- package/dist/contracts/browserToolContracts.js +9 -16
- package/dist/contracts/electronToolContracts.js +5 -6
- package/dist/contracts/enhancedInputs.js +3 -2
- package/dist/contracts/errorSchemas.js +16 -40
- package/dist/contracts/functionWorkflowToolContracts.js +2 -2
- package/dist/contracts/javascriptApplicationWorkflowExamples.js +2 -2
- package/dist/contracts/javascriptRuntimeObservationToolContracts.js +4 -4
- package/dist/contracts/javascriptRuntimeReconciliationExample.js +1 -1
- package/dist/contracts/managedToolContracts.js +7 -4
- package/dist/contracts/managedWorkflowExamples.js +0 -22
- package/dist/contracts/managedWorkflowToolContracts.js +16 -31
- package/dist/contracts/nativeToolContracts.js +9 -0
- package/dist/contracts/promptContracts.js +6 -6
- package/dist/contracts/sessionToolSchemas.js +3 -3
- package/dist/contracts/toolContractExamples.js +4 -3
- package/dist/contracts/toolContracts.js +18 -7
- package/dist/contracts/toolEffects.js +34 -21
- package/dist/contracts/toolOutputSchemaGroups.js +18 -5
- package/dist/contracts/toolOutputSchemaPrimitives.js +9 -6
- package/dist/contracts/toolSchemaMetadata.js +5 -8
- package/dist/doctorRuntime.js +0 -41
- package/dist/domain/analysisErrorPresentation.js +4 -28
- package/dist/domain/analysisErrorProjection.js +33 -50
- package/dist/domain/analysisProfile.js +1 -1
- package/dist/domain/analysisSnapshot.js +77 -3
- package/dist/domain/androidApplication.js +5 -4
- package/dist/domain/appleApplication.js +5 -4
- package/dist/domain/appleAssetCatalog.js +127 -0
- package/dist/domain/artifactComparison.js +7 -11
- package/dist/domain/artifactGraph.js +8 -6
- package/dist/domain/artifactInspection.js +13 -12
- package/dist/domain/binaryTarget.js +23 -9
- package/dist/domain/browserObservation.js +43 -24
- package/dist/domain/browserObservationSchemas.js +2 -1
- package/dist/domain/browserScenario.js +7 -107
- package/dist/domain/browserScenarioCapture.js +0 -1
- package/dist/domain/browserScenarioCaptureValues.js +5 -4
- package/dist/domain/browserScenarioDiff.js +1 -3
- package/dist/domain/browserScenarioValues.js +16 -107
- package/dist/domain/bundleComparison.js +18 -17
- package/dist/domain/callPathSchemas.js +17 -7
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/comparisonSemantics.js +19 -0
- package/dist/domain/completionLedgerGeneration.js +3 -2
- package/dist/domain/conformancePackage.js +2 -1
- package/dist/domain/conformanceTrustGate.js +3 -5
- package/dist/domain/customProtocolCapture.js +2 -2
- package/dist/domain/digests.js +30 -0
- package/dist/domain/dosMz.js +83 -0
- package/dist/domain/electronActiveObservation.js +7 -5
- package/dist/domain/electronObservation.js +3 -2
- package/dist/domain/electronStaticAnalysisNative.js +15 -6
- package/dist/domain/emptyArraySchema.js +3 -0
- package/dist/domain/errors.js +10 -28
- package/dist/domain/evidence.js +5 -3
- package/dist/domain/evidenceCompletionLedger.js +3 -2
- package/dist/domain/functionComparisonNormalization.js +24 -18
- package/dist/domain/functionComparisonResults.js +3 -7
- package/dist/domain/functionComparisonSchemas.js +3 -2
- package/dist/domain/hopperValues.js +108 -8
- package/dist/domain/javascriptApplicationAnalysis.js +4 -7
- package/dist/domain/javascriptApplicationEvidenceSchemas.js +4 -3
- package/dist/domain/javascriptApplicationGraphSchemas.js +8 -7
- package/dist/domain/javascriptApplicationVersionComparisonSchemas.js +9 -7
- package/dist/domain/javascriptApplicationVersionItems.js +12 -18
- package/dist/domain/javascriptAstValues.js +4 -0
- package/dist/domain/javascriptExportShapeComparison.js +1 -6
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +6 -10
- package/dist/domain/javascriptExportShapeVariants.js +15 -2
- package/dist/domain/javascriptFeatureTraceSchemas.js +8 -7
- package/dist/domain/javascriptRuntimeObservation.js +14 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +8 -0
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +4 -2
- package/dist/domain/javascriptRuntimeReconciliationResult.js +6 -4
- package/dist/domain/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +19 -18
- package/dist/domain/javascriptRuntimeStaticCandidates.js +18 -6
- package/dist/domain/javascriptSemanticAnalysis.js +57 -19
- package/dist/domain/javascriptSemanticAsyncEffects.js +39 -40
- package/dist/domain/javascriptSemanticCalls.js +46 -27
- package/dist/domain/javascriptSemanticChildProcesses.js +43 -50
- package/dist/domain/javascriptSemanticDataEffectHelpers.js +91 -18
- package/dist/domain/javascriptSemanticDataEffects.js +22 -10
- package/dist/domain/javascriptSemanticGraphSchemas.js +8 -6
- package/dist/domain/javascriptSemanticObjects.js +13 -3
- package/dist/domain/javascriptSemanticProjection.js +144 -38
- package/dist/domain/javascriptSemanticPromises.js +14 -27
- package/dist/domain/javascriptSemanticQuerySchemas.js +6 -9
- package/dist/domain/javascriptSemanticResources.js +2 -5
- package/dist/domain/javascriptSemanticState.js +4 -0
- package/dist/domain/javascriptSemanticTraceSchemas.js +2 -1
- package/dist/domain/javascriptSemanticTraversal.js +13 -5
- package/dist/domain/javascriptSemanticValues.js +10 -9
- package/dist/domain/javascriptSourceParser.js +5 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +8 -5
- package/dist/domain/javascriptStaticAnalysisHelpers.js +16 -7
- package/dist/domain/keyedArchive.js +181 -0
- package/dist/domain/managedApplicationGraph.js +4 -3
- package/dist/domain/managedArtifact.js +2 -1
- package/dist/domain/managedMemberComparison.js +18 -13
- package/dist/domain/managedMemberComparisonCoverage.js +2 -1
- package/dist/domain/managedMemberComparisonItems.js +27 -7
- package/dist/domain/managedMemberComparisonMatch.js +22 -6
- package/dist/domain/managedNativeVerificationMatch.js +2 -2
- package/dist/domain/managedNativeVerificationSchemas.js +7 -5
- package/dist/domain/managedReconstruction.js +6 -5
- package/dist/domain/nativeApiBoundary.js +7 -0
- package/dist/domain/nativeDataType.js +51 -0
- package/dist/domain/nativeInspection.js +0 -1
- package/dist/domain/nativeInstruction.js +82 -0
- package/dist/domain/nativeInvestigationGraph.js +9 -5
- package/dist/domain/nativeUiObservation.js +123 -0
- package/dist/domain/nativeValueFlow.js +17 -0
- package/dist/domain/nativeValueTrace.js +64 -0
- package/dist/domain/objcSwiftMetadata.js +39 -0
- package/dist/domain/peInspection.js +1 -0
- package/dist/domain/processCapture.js +5 -55
- package/dist/domain/processCaptureExample.js +0 -9
- package/dist/domain/processCaptureValidation.js +13 -144
- package/dist/domain/processComparison.js +3 -25
- package/dist/domain/processObservation.js +0 -29
- package/dist/domain/processScenario.js +28 -228
- package/dist/domain/processTraceDimensionProjection.js +0 -15
- package/dist/domain/processTraceEvaluation.js +0 -6
- package/dist/domain/protocolCapture.js +8 -36
- package/dist/domain/reconstructionCoverage.js +3 -2
- package/dist/domain/reconstructionObligationLedgerSchemas.js +4 -12
- package/dist/domain/reconstructionReadinessSchemas.js +4 -3
- package/dist/domain/reconstructionVerification.js +2 -1
- package/dist/domain/reconstructionVerificationSchemas.js +6 -13
- package/dist/domain/referenceSourceClassification.js +0 -110
- package/dist/domain/referenceSourceGraph.js +15 -5
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/runtimeIdentification.js +6 -5
- package/dist/domain/sourceMapContents.js +5 -0
- package/dist/domain/sourceToBundleComparison.js +3 -10
- package/dist/domain/sourceToBundleComparisonSchemas.js +7 -6
- package/dist/domain/sourceToBundleSignals.js +9 -3
- package/dist/domain/staticRuntimeCorrelation.js +5 -11
- package/dist/domain/webBundleAnalysis.js +17 -9
- package/dist/domain/webBundleAnalyzer.js +1 -1
- package/dist/domain/webCaptureDiff.js +5 -11
- package/dist/domain/webCaptureDiffSchemas.js +2 -1
- package/dist/domain/webMcpDiscovery.js +2 -1
- package/dist/dotnet/ManagedMemberInspectorCore.js +15 -7
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +57 -40
- package/dist/dotnet/ManagedMemberRows.js +2 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +15 -8
- package/dist/dotnet/ManagedPeReader.js +2 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +15 -5
- package/dist/ghidra/GhidraClient.js +38 -8
- package/dist/ghidra/GhidraFunctionValues.js +56 -20
- package/dist/ghidra/GhidraInstallation.js +7 -4
- package/dist/ghidra/GhidraInventoryValues.js +44 -9
- package/dist/ghidra/GhidraLauncher.js +18 -3
- package/dist/ghidra/GhidraProvider.js +23 -2
- package/dist/ghidra/GhidraRequestQueue.js +45 -4
- package/dist/ghidra/GhidraSessionValues.js +5 -0
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperProvider.js +29 -6
- package/dist/hopper/HopperTargetLease.js +18 -4
- package/dist/logger.js +0 -13
- package/dist/main/messages.js +0 -1
- package/dist/main/reload.js +3 -32
- package/dist/main/shutdown.js +1 -2
- package/dist/main/transport.js +0 -17
- package/dist/main.js +0 -10
- package/dist/native/AppleDispatchMetadata.js +582 -0
- package/dist/native/AppleObjcProtocols.js +88 -0
- package/dist/native/AppleSwiftVtables.js +86 -0
- package/dist/native/CommandRunner.js +1 -1
- package/dist/native/NativeHostCapabilities.js +23 -0
- package/dist/native/NativeMacOSProvider.js +61 -9
- package/dist/native/NativeMachoInspection.js +39 -6
- package/dist/native/NativeUiHelperRuntime.js +42 -0
- package/dist/native/NativeUiObservation.js +174 -0
- package/dist/native/parsers/codesign.js +4 -1
- package/dist/native/parsers/dyldInfo.js +51 -25
- package/dist/native/parsers/lipo.js +13 -4
- package/dist/native/parsers/otool.js +84 -39
- package/dist/native/parsers/plist.js +2 -1
- package/dist/process/ExecFileOutput.js +5 -1
- package/dist/process/ProcessOwnership.js +69 -33
- package/dist/process/ProcessOwnershipObservation.js +31 -12
- package/dist/process/ProviderProcess.js +4 -2
- package/dist/reference/ReferenceSourceReaderEntries.js +48 -31
- package/dist/reference/ReferenceSourceReaderErrors.js +24 -0
- package/dist/reference/ReferenceSourceReaderFile.js +11 -5
- package/dist/reference/ReferenceSourceReaderValidate.js +22 -8
- package/dist/server/createServer.js +7 -62
- package/dist/server/registerApplicationTools/helpers.js +2 -9
- package/dist/server/registerApplicationTools.js +0 -4
- package/dist/server/registerArtifactComparisonTool.js +1 -1
- package/dist/server/registerBrowserScenarioTool.js +4 -2
- package/dist/server/registerBrowserTools.js +7 -7
- package/dist/server/registerBundleComparisonTool.js +1 -1
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +10 -4
- package/dist/server/registerEnhancedTools.js +20 -12
- package/dist/server/registerEvidenceTools.js +4 -28
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools.js +6 -6
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -2
- package/dist/server/registerManagedTools.js +28 -14
- package/dist/server/registerManagedWorkflowTools.js +0 -2
- package/dist/server/registerProcessComparisonTool.js +1 -3
- package/dist/server/registerSessionRecordTools.js +9 -9
- package/dist/server/registerSessionStatusTool.js +1 -1
- package/dist/server/registerSessionTools.js +28 -57
- package/dist/server/sessionAvailabilityPolicy.js +2 -3
- package/dist/server/sessionToolPolicies.js +0 -4
- package/dist/server/toolResult.js +8 -10
- package/package.json +32 -22
- package/skills/reverse-engineer-anything/SKILL.md +15 -11
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +3 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +3 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +8 -6
- package/skills/reverse-engineer-anything/references/runtime-observation.md +15 -11
- package/dist/application/CommandShimReplay.js +0 -152
- package/dist/application/ConfiguredRoots.js +0 -19
- package/dist/application/InstrumentedJavaScriptReplayHost.js +0 -36
- package/dist/application/JavaScriptReplayPermission.js +0 -16
- package/dist/application/JavaScriptReplayPlanning.js +0 -207
- package/dist/application/JavaScriptReplayService.js +0 -274
- package/dist/application/LoopbackReplay.js +0 -389
- package/dist/application/LoopbackReplayRecorder.js +0 -129
- package/dist/application/ManagedRuntimeCorrelationService.js +0 -104
- package/dist/application/NodeRuntimeCharacterizationService.js +0 -191
- package/dist/application/PermissionAuthority.js +0 -268
- package/dist/application/PermissionConfiguration.js +0 -26
- package/dist/application/PermissionFailure.js +0 -5
- package/dist/application/ProcessCaptureAuthority.js +0 -24
- package/dist/application/ProcessCapturePermission.js +0 -13
- package/dist/application/ProcessCheckpoints.js +0 -178
- package/dist/application/ProcessReactiveCoordinator.js +0 -223
- package/dist/application/ProcessReactiveEffects.js +0 -153
- package/dist/application/ProcessReactiveHarness.js +0 -106
- package/dist/application/ProcessReactiveObservations.js +0 -105
- package/dist/application/ProjectPermissionStore.js +0 -199
- package/dist/application/RuntimeExecutableDiagnostics.js +0 -198
- package/dist/application/Upgrade.js +0 -134
- package/dist/browser/SensitiveTextCapture.js +0 -8
- package/dist/cliPolicyCommands.js +0 -185
- package/dist/config/browserScenario.js +0 -77
- package/dist/config/electronAutomation.js +0 -35
- package/dist/config/javascriptReplay.js +0 -41
- package/dist/config/managedRuntime.js +0 -25
- package/dist/config/passiveObservation.js +0 -87
- package/dist/config/permissions.js +0 -23
- package/dist/config/processCapture.js +0 -47
- package/dist/contracts/replayMachineExample.js +0 -37
- package/dist/domain/javascriptExportInstrumentation.js +0 -95
- package/dist/domain/javascriptReplay.js +0 -360
- package/dist/domain/managedRuntimeCorrelation.js +0 -181
- package/dist/domain/nodeRuntimeCharacterization.js +0 -63
- package/dist/domain/permissionPolicy.js +0 -176
- package/dist/domain/processCaptureReactiveSchema.js +0 -68
- package/dist/domain/processCaptureReactiveValidation.js +0 -180
- package/dist/domain/processReactiveCheckpointDataflow.js +0 -32
- package/dist/domain/processReactiveMatching.js +0 -196
- package/dist/domain/processReactiveRuntime.js +0 -116
- package/dist/domain/processReactiveScenario.js +0 -296
- package/dist/domain/processReactiveScenarioPreflight.js +0 -95
- package/dist/domain/processReactiveTransition.js +0 -187
- package/dist/domain/replayMachine.js +0 -320
- package/dist/domain/replayMachineRun.js +0 -168
- package/dist/domain/replayMachineRuntime.js +0 -296
- package/dist/domain/replayMachineValues.js +0 -84
- package/dist/domain/runtimeCharacterization.js +0 -84
- package/dist/replay/JavaScriptReplayWorker.js +0 -382
- package/dist/replay/JavaScriptReplayWorkerTypes.js +0 -1
- package/dist/replay/LinuxJavaScriptReplayRunner.js +0 -216
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +0 -121
- package/dist/replay/LinuxRuntimeClosure.js +0 -44
- package/dist/replay/LinuxSeccompPolicy.js +0 -40
- package/dist/replay/ReplayOutcome.js +0 -104
- package/dist/replay/ReplayProcessLifecycle.js +0 -96
- package/dist/replay/ReplaySeccompFile.js +0 -29
- package/dist/replay/ReplayWorkerProtocol.js +0 -58
- package/dist/replay/SystemJavaScriptReplayHost.js +0 -153
- package/dist/server/ProcessCaptureElicitation.js +0 -153
- package/dist/server/registerApplicationTools/characterization.js +0 -46
- package/dist/server/registerApplicationTools/controlledReplay.js +0 -31
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +0 -29
- package/dist/server/registerReplayMachineTool.js +0 -14
- package/skills/reverse-engineer-anything/references/controlled-replay.md +0 -12
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
1
|
+
import { absenceClaimable, canonicalDigest, canonicalJson, } from "./comparisonSemantics.js";
|
|
3
2
|
import { compareCodePoints, } from "./javascriptApplicationGraph.js";
|
|
4
3
|
/** Classify matched, unmatched, and ambiguous nodes without inventing absence. */
|
|
5
4
|
export const classifyJavaScriptApplicationVersions = (matching, context) => {
|
|
@@ -83,7 +82,7 @@ const leftOnlyItem = (node, candidateNodeIds, context) => {
|
|
|
83
82
|
dimensions: ["availability"],
|
|
84
83
|
limitations: [AMBIGUOUS_MATCH_LIMITATION],
|
|
85
84
|
});
|
|
86
|
-
const absenceObserved = context.rightGraph.coverage
|
|
85
|
+
const absenceObserved = absenceClaimable(context.rightGraph.coverage);
|
|
87
86
|
return itemWithId({
|
|
88
87
|
...common,
|
|
89
88
|
status: absenceObserved ? "removed" : "unknown",
|
|
@@ -118,7 +117,7 @@ const rightOnlyItem = (node, candidateNodeIds, context) => {
|
|
|
118
117
|
dimensions: ["availability"],
|
|
119
118
|
limitations: [AMBIGUOUS_MATCH_LIMITATION],
|
|
120
119
|
});
|
|
121
|
-
const absenceObserved = context.leftGraph.coverage
|
|
120
|
+
const absenceObserved = absenceClaimable(context.leftGraph.coverage);
|
|
122
121
|
return itemWithId({
|
|
123
122
|
...common,
|
|
124
123
|
status: absenceObserved ? "added" : "unknown",
|
|
@@ -180,9 +179,10 @@ const changedDimensions = (pair, context) => {
|
|
|
180
179
|
rightContent !== null &&
|
|
181
180
|
leftContent !== rightContent)
|
|
182
181
|
dimensions.push("content");
|
|
183
|
-
if (
|
|
182
|
+
if (canonicalJson(locations(pair.left)) !== canonicalJson(locations(pair.right)))
|
|
184
183
|
dimensions.push("location");
|
|
185
|
-
if (
|
|
184
|
+
if (canonicalJson(properties(pair.left)) !==
|
|
185
|
+
canonicalJson(properties(pair.right)))
|
|
186
186
|
dimensions.push("properties");
|
|
187
187
|
if (relationshipSignature(pair.left, "left", context) !==
|
|
188
188
|
relationshipSignature(pair.right, "right", context))
|
|
@@ -201,10 +201,10 @@ const contentIdentity = (node) => {
|
|
|
201
201
|
};
|
|
202
202
|
const locations = (node) => node.observations
|
|
203
203
|
.map(({ evidence }) => evidence.location.available ? evidence.location.value : evidence.location)
|
|
204
|
-
.sort((left, right) => compareCodePoints(
|
|
204
|
+
.sort((left, right) => compareCodePoints(canonicalJson(left), canonicalJson(right)));
|
|
205
205
|
const properties = (node) => node.observations
|
|
206
206
|
.map(({ label, properties: values }) => ({ label, properties: values }))
|
|
207
|
-
.sort((left, right) => compareCodePoints(
|
|
207
|
+
.sort((left, right) => compareCodePoints(canonicalJson(left), canonicalJson(right)));
|
|
208
208
|
const relationshipSignature = (node, side, context) => {
|
|
209
209
|
const graph = side === "left" ? context.leftGraph : context.rightGraph;
|
|
210
210
|
const paired = side === "left" ? context.pairByLeft : context.pairByRight;
|
|
@@ -232,7 +232,7 @@ const relationshipSignature = (node, side, context) => {
|
|
|
232
232
|
];
|
|
233
233
|
return [];
|
|
234
234
|
});
|
|
235
|
-
return
|
|
235
|
+
return canonicalJson(signatures.sort(compareCodePoints));
|
|
236
236
|
};
|
|
237
237
|
const edgeSignature = (context) => {
|
|
238
238
|
const mapped = context.paired.get(context.neighborId);
|
|
@@ -289,12 +289,6 @@ const stringProperty = (node, key) => {
|
|
|
289
289
|
];
|
|
290
290
|
return values.length === 1 ? (values[0] ?? null) : null;
|
|
291
291
|
};
|
|
292
|
-
const graphsComplete = (context) => context.leftGraph.coverage
|
|
293
|
-
context.rightGraph.coverage
|
|
294
|
-
const
|
|
295
|
-
const encoded = canonicalize(value);
|
|
296
|
-
if (encoded === undefined)
|
|
297
|
-
throw new TypeError("Application version item could not canonicalize data");
|
|
298
|
-
return encoded;
|
|
299
|
-
};
|
|
300
|
-
const digestCanonical = (value) => createHash("sha256").update(canonical(value)).digest("hex");
|
|
292
|
+
const graphsComplete = (context) => absenceClaimable(context.leftGraph.coverage) &&
|
|
293
|
+
absenceClaimable(context.rightGraph.coverage);
|
|
294
|
+
const digestCanonical = (value) => canonicalDigest(value, "Application version item");
|
|
@@ -7,3 +7,7 @@ export const propertyName = (node) => {
|
|
|
7
7
|
return String(node.value);
|
|
8
8
|
return "";
|
|
9
9
|
};
|
|
10
|
+
/** Read a property name only when its syntax commits to one exact key. */
|
|
11
|
+
export const semanticStaticPropertyName = (property, computed) => computed && !t.isStringLiteral(property) && !t.isNumericLiteral(property)
|
|
12
|
+
? ""
|
|
13
|
+
: propertyName(property);
|
|
@@ -40,11 +40,6 @@ export const compareJavaScriptExportShapes = (input) => {
|
|
|
40
40
|
coverage,
|
|
41
41
|
evidence_links: evidenceLinks,
|
|
42
42
|
limitations,
|
|
43
|
-
runtime_validation: {
|
|
44
|
-
recommended_tool: "run_controlled_replay",
|
|
45
|
-
automatically_started: false,
|
|
46
|
-
required_for: "runtime-semantics",
|
|
47
|
-
},
|
|
48
43
|
};
|
|
49
44
|
return javaScriptExportShapeComparisonResultSchema.parse({
|
|
50
45
|
...semantic,
|
|
@@ -116,7 +111,7 @@ const comparisonLimitations = (left, right, status) => uniqueSorted([
|
|
|
116
111
|
"Return shapes are inferred from inert syntax and do not prove runtime behavior.",
|
|
117
112
|
"Return variants are paired only by unique exact literal discriminants, never by source order.",
|
|
118
113
|
"Dynamic values, incomplete object coverage, and ambiguous variants remain unknown.",
|
|
119
|
-
"
|
|
114
|
+
"This static comparison cannot establish runtime semantics; run behavioral probes directly against the relevant application versions when that evidence is required.",
|
|
120
115
|
...left.limitations,
|
|
121
116
|
...right.limitations,
|
|
122
117
|
...(status === "truncated"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { evidenceSchema } from "./evidence.js";
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
4
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
5
|
+
const graphIdSchema = prefixedDigestSchema("jag");
|
|
6
|
+
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
|
6
7
|
const textSchema = z.string().min(1);
|
|
7
8
|
const selectorTextSchema = textSchema;
|
|
8
9
|
const semanticPrimitiveSchema = z.union([
|
|
@@ -209,7 +210,7 @@ const discriminantSchema = z.strictObject({
|
|
|
209
210
|
value: semanticPrimitiveSchema,
|
|
210
211
|
});
|
|
211
212
|
const comparisonChangeSchema = z.strictObject({
|
|
212
|
-
change_id:
|
|
213
|
+
change_id: prefixedDigestSchema("jesc_change"),
|
|
213
214
|
status: z.enum(["added", "removed", "changed", "unknown"]),
|
|
214
215
|
path: jsonPointerSchema,
|
|
215
216
|
discriminant: discriminantSchema.nullable(),
|
|
@@ -222,7 +223,7 @@ const comparisonChangeSchema = z.strictObject({
|
|
|
222
223
|
});
|
|
223
224
|
/** Static export-return comparison with explicit unknown semantics. */
|
|
224
225
|
export const javaScriptExportShapeComparisonResultSchema = z.strictObject({
|
|
225
|
-
comparison_id:
|
|
226
|
+
comparison_id: prefixedDigestSchema("jesc"),
|
|
226
227
|
left: selectorResultSchema,
|
|
227
228
|
right: selectorResultSchema,
|
|
228
229
|
summary: z.strictObject({
|
|
@@ -262,9 +263,4 @@ export const javaScriptExportShapeComparisonResultSchema = z.strictObject({
|
|
|
262
263
|
}),
|
|
263
264
|
evidence_links: z.array(evidenceIdSchema).length(2),
|
|
264
265
|
limitations: z.array(textSchema),
|
|
265
|
-
runtime_validation: z.strictObject({
|
|
266
|
-
recommended_tool: z.literal("run_controlled_replay"),
|
|
267
|
-
automatically_started: z.literal(false),
|
|
268
|
-
required_for: z.literal("runtime-semantics"),
|
|
269
|
-
}),
|
|
270
266
|
});
|
|
@@ -140,8 +140,8 @@ const diffPair = (left, right, discriminant, evidenceLinks) => {
|
|
|
140
140
|
const rightFields = new Map(right.fields.map((field) => [field.path, field]));
|
|
141
141
|
const paths = uniqueSorted([...leftFields.keys(), ...rightFields.keys()]);
|
|
142
142
|
return paths.flatMap((path) => {
|
|
143
|
-
const leftField = leftFields
|
|
144
|
-
const rightField = rightFields
|
|
143
|
+
const leftField = fieldAtPath(left, leftFields, path);
|
|
144
|
+
const rightField = fieldAtPath(right, rightFields, path);
|
|
145
145
|
const status = fieldChangeStatus({
|
|
146
146
|
leftShape: left,
|
|
147
147
|
rightShape: right,
|
|
@@ -170,6 +170,19 @@ const diffPair = (left, right, discriminant, evidenceLinks) => {
|
|
|
170
170
|
];
|
|
171
171
|
});
|
|
172
172
|
};
|
|
173
|
+
const fieldAtPath = (shape, fields, path) => {
|
|
174
|
+
const field = fields.get(path);
|
|
175
|
+
if (field !== undefined)
|
|
176
|
+
return field;
|
|
177
|
+
if (!shape.property_coverage.some((coverage) => coverage.path === path))
|
|
178
|
+
return undefined;
|
|
179
|
+
return {
|
|
180
|
+
path,
|
|
181
|
+
state: "unknown",
|
|
182
|
+
value: null,
|
|
183
|
+
reason: "A static container is retained at this path, but no primitive field value is projected.",
|
|
184
|
+
};
|
|
185
|
+
};
|
|
173
186
|
const fieldChangeStatus = ({ leftShape, rightShape, path, leftField, rightField, }) => {
|
|
174
187
|
if (leftField !== undefined && rightField !== undefined) {
|
|
175
188
|
if (canonicalExportShapeValue(leftField) ===
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { evidenceSchema, providerSchema } from "./evidence.js";
|
|
3
3
|
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
5
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
6
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
7
|
+
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
|
8
|
+
const edgeIdSchema = prefixedDigestSchema("jag_edge");
|
|
8
9
|
const boundedTextSchema = z.string().min(1);
|
|
9
10
|
/** Literal starting point for one application feature trace. */
|
|
10
11
|
const applicationFeatureSeedSchema = z.strictObject({
|
|
@@ -45,7 +46,7 @@ const seedMatchSchema = z.strictObject({
|
|
|
45
46
|
field: z.string().min(1),
|
|
46
47
|
});
|
|
47
48
|
const tracePathSchema = z.strictObject({
|
|
48
|
-
path_id:
|
|
49
|
+
path_id: prefixedDigestSchema("jatp"),
|
|
49
50
|
start_node_id: nodeIdSchema,
|
|
50
51
|
end_node_id: nodeIdSchema,
|
|
51
52
|
end_kind: z.string().min(1),
|
|
@@ -73,9 +74,9 @@ const nativeHandoffSchema = z.strictObject({
|
|
|
73
74
|
});
|
|
74
75
|
/** Evidence-preserving complete reachable subgraph and native-analysis handoffs. */
|
|
75
76
|
export const applicationFeatureTraceResultSchema = z.strictObject({
|
|
76
|
-
trace_id:
|
|
77
|
+
trace_id: prefixedDigestSchema("jatr"),
|
|
77
78
|
source_evidence_id: evidenceIdSchema,
|
|
78
|
-
source_graph_id:
|
|
79
|
+
source_graph_id: prefixedDigestSchema("jag"),
|
|
79
80
|
seed: applicationFeatureSeedSchema,
|
|
80
81
|
direction: z.enum(["outgoing", "incoming", "both"]),
|
|
81
82
|
seed_matches: z.array(seedMatchSchema),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { browserEndpointSchema } from "./browserObservation.js";
|
|
3
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
3
4
|
const observationTextSchema = z.string().min(1);
|
|
4
5
|
const runtimeEndpoint = {
|
|
5
6
|
inspector_endpoint: browserEndpointSchema,
|
|
@@ -44,11 +45,22 @@ export const javascriptRuntimeLocationSchema = z.discriminatedUnion("kind", [
|
|
|
44
45
|
specifier: z.string().min(1),
|
|
45
46
|
}),
|
|
46
47
|
]);
|
|
48
|
+
/** Discovery metadata can identify an endpoint target without verifying its file location. */
|
|
49
|
+
export const javascriptRuntimeUnresolvedLocationSchema = z.strictObject({
|
|
50
|
+
kind: z.literal("unresolved"),
|
|
51
|
+
reported_url: z.string().min(1),
|
|
52
|
+
reason: z.literal("unverifiable-file-location"),
|
|
53
|
+
});
|
|
54
|
+
/** Verified locations and explicitly unresolved discovery metadata. */
|
|
55
|
+
export const javascriptRuntimeTargetLocationSchema = z.union([
|
|
56
|
+
javascriptRuntimeLocationSchema,
|
|
57
|
+
javascriptRuntimeUnresolvedLocationSchema,
|
|
58
|
+
]);
|
|
47
59
|
const javascriptRuntimeTargetSchema = z.strictObject({
|
|
48
60
|
target_id: z.string().min(1),
|
|
49
61
|
protocol_type: z.string().min(1),
|
|
50
62
|
attached: z.boolean(),
|
|
51
|
-
location:
|
|
63
|
+
location: javascriptRuntimeTargetLocationSchema,
|
|
52
64
|
});
|
|
53
65
|
/** Complete V8 Inspector target inventory exposed by the selected endpoint. */
|
|
54
66
|
export const javascriptRuntimeTargetListSchema = z.strictObject({
|
|
@@ -61,7 +73,7 @@ export const javascriptRuntimeTargetListSchema = z.strictObject({
|
|
|
61
73
|
limitations: z.array(observationTextSchema),
|
|
62
74
|
});
|
|
63
75
|
const javascriptRuntimeScriptSchema = z.strictObject({
|
|
64
|
-
script_key:
|
|
76
|
+
script_key: prefixedDigestSchema("v8_script"),
|
|
65
77
|
location: javascriptRuntimeLocationSchema,
|
|
66
78
|
execution_context_key: z.string().nullable(),
|
|
67
79
|
cdp_hash: z.string().nullable(),
|
|
@@ -13,6 +13,14 @@ export const reconcileRuntimeEntities = (input) => {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
const reconcileEntity = (entity, index, layers) => {
|
|
16
|
+
if (entity.location.kind === "unresolved")
|
|
17
|
+
return unresolved(entity, {
|
|
18
|
+
status: "unknown",
|
|
19
|
+
basis: "none",
|
|
20
|
+
confidence: "unknown",
|
|
21
|
+
reason: "runtime-location-unresolved",
|
|
22
|
+
candidates: [],
|
|
23
|
+
});
|
|
16
24
|
const locations = candidatesWithLocation(entity, index, layers);
|
|
17
25
|
if (entity.sourceSha256 !== null) {
|
|
18
26
|
const content = index.byCategoryDigest.get(categoryDigestKey(entity.staticKind, entity.sourceSha256)) ?? [];
|
|
@@ -156,7 +156,9 @@ const normalizeV8Inspection = (result) => ({
|
|
|
156
156
|
type: result.target.protocol_type,
|
|
157
157
|
title: result.target.runtime_kind,
|
|
158
158
|
attached: result.target.attached,
|
|
159
|
-
...
|
|
159
|
+
...(result.target.location.kind === "unresolved"
|
|
160
|
+
? { unresolved_location: result.target.location }
|
|
161
|
+
: runtimeLocation(result.target.location)),
|
|
160
162
|
},
|
|
161
163
|
frames: [],
|
|
162
164
|
scripts: {
|
|
@@ -229,7 +231,7 @@ const assertRuntimeParameters = (evidence, expected) => {
|
|
|
229
231
|
if (!parameters.allowed_origins.includes(expected.targetOrigin))
|
|
230
232
|
throw new TypeError("Browser Evidence target is outside its recorded origin scope");
|
|
231
233
|
if (expected.sourceIncluded && !parameters.include_script_sources)
|
|
232
|
-
throw new TypeError("Runtime Evidence contains source without source-capture
|
|
234
|
+
throw new TypeError("Runtime Evidence contains source without source-capture selection");
|
|
233
235
|
return;
|
|
234
236
|
}
|
|
235
237
|
const parameters = z.object(common).passthrough().parse(evidence.parameters);
|
|
@@ -44,9 +44,11 @@ const captureSummaries = (captures, runtime) => captures.map((capture) => {
|
|
|
44
44
|
kind: capture.kind,
|
|
45
45
|
target_node_id: targetNode.node_id,
|
|
46
46
|
target_key: capture.inspection.target.target_id,
|
|
47
|
-
target_location: "
|
|
48
|
-
? capture.inspection.target.
|
|
49
|
-
: capture.inspection.target
|
|
47
|
+
target_location: "unresolved_location" in capture.inspection.target
|
|
48
|
+
? capture.inspection.target.unresolved_location
|
|
49
|
+
: "url" in capture.inspection.target
|
|
50
|
+
? capture.inspection.target.url
|
|
51
|
+
: capture.inspection.target.file_path,
|
|
50
52
|
frames: capture.inspection.frames.length,
|
|
51
53
|
scripts: capture.inspection.scripts.items.length,
|
|
52
54
|
workers: capture.inspection.workers.length,
|
|
@@ -74,7 +76,7 @@ const sourceMapAuthority = (input) => ({
|
|
|
74
76
|
(capture.kind === "browser"
|
|
75
77
|
? capture.inspection.scripts.items.filter(({ source_map_url: url }) => url !== null).length
|
|
76
78
|
: 0), 0),
|
|
77
|
-
limitation: "Source-map declarations and
|
|
79
|
+
limitation: "Source-map declarations and original-source content retain separate static authority and are not used as primary runtime byte matches.",
|
|
78
80
|
});
|
|
79
81
|
const reconciliationCoverage = (input, completion) => ({
|
|
80
82
|
status: completion.outputTruncated || completion.inputStatus === "truncated"
|
|
@@ -30,9 +30,14 @@ const projectCapture = (capture) => {
|
|
|
30
30
|
};
|
|
31
31
|
const targetEntity = (capture) => {
|
|
32
32
|
const target = capture.inspection.target;
|
|
33
|
-
const location = "
|
|
34
|
-
? {
|
|
35
|
-
|
|
33
|
+
const location = "unresolved_location" in target
|
|
34
|
+
? {
|
|
35
|
+
kind: "unresolved",
|
|
36
|
+
value: target.unresolved_location.reported_url,
|
|
37
|
+
}
|
|
38
|
+
: "url" in target
|
|
39
|
+
? { kind: "url", value: target.url }
|
|
40
|
+
: { kind: "file", value: target.file_path };
|
|
36
41
|
return runtimeEntity(capture, {
|
|
37
42
|
kind: "target",
|
|
38
43
|
nodeKind: "target",
|
|
@@ -46,7 +51,13 @@ const targetEntity = (capture) => {
|
|
|
46
51
|
label: target.title,
|
|
47
52
|
properties: {
|
|
48
53
|
runtime_type: target.type,
|
|
49
|
-
location
|
|
54
|
+
...(location.kind === "unresolved"
|
|
55
|
+
? {
|
|
56
|
+
reported_url: location.value,
|
|
57
|
+
location_kind: "unresolved",
|
|
58
|
+
location_reason: "unverifiable-file-location",
|
|
59
|
+
}
|
|
60
|
+
: { location: location.value }),
|
|
50
61
|
attached: target.attached,
|
|
51
62
|
},
|
|
52
63
|
section: "target",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { isAbsolute, resolve } from "node:path";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import { evidenceSchema } from "./evidence.js";
|
|
3
|
+
import { javascriptRuntimeUnresolvedLocationSchema } from "./javascriptRuntimeObservation.js";
|
|
4
4
|
import { compareCodePoints, javascriptApplicationGraphSchema, } from "./javascriptApplicationGraph.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
5
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
6
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
8
|
+
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
|
8
9
|
const boundedTextSchema = z.string().min(1);
|
|
9
10
|
const safePrefixSchema = z
|
|
10
11
|
.string()
|
|
@@ -14,11 +15,7 @@ const safePrefixSchema = z
|
|
|
14
15
|
value.split("/").every((part) => !["", ".", ".."].includes(part))), "Artifact prefix must be empty or a safe relative POSIX path");
|
|
15
16
|
const runtimeFileMappingSchema = z.strictObject({
|
|
16
17
|
kind: z.literal("file-root"),
|
|
17
|
-
root: z
|
|
18
|
-
.string()
|
|
19
|
-
.min(1)
|
|
20
|
-
.refine(isAbsolute, "Runtime file mapping root must be absolute")
|
|
21
|
-
.overwrite((value) => resolve(value)),
|
|
18
|
+
root: z.string().min(1),
|
|
22
19
|
artifact_prefix: safePrefixSchema.default(""),
|
|
23
20
|
});
|
|
24
21
|
const runtimeUrlMappingSchema = z.strictObject({
|
|
@@ -54,7 +51,7 @@ const runtimeLocationMappingSchema = z.discriminatedUnion("kind", [
|
|
|
54
51
|
runtimeUrlMappingSchema,
|
|
55
52
|
]);
|
|
56
53
|
const staticLayerSchema = z.strictObject({
|
|
57
|
-
role: z.enum(["application", "cache", "assets"]),
|
|
54
|
+
role: z.enum(["application", "cache", "assets"]).default("application"),
|
|
58
55
|
analysis: evidenceSchema,
|
|
59
56
|
runtime_mappings: z
|
|
60
57
|
.array(runtimeLocationMappingSchema)
|
|
@@ -101,10 +98,10 @@ export const reconcileJavaScriptRuntimeInputSchema = z
|
|
|
101
98
|
});
|
|
102
99
|
});
|
|
103
100
|
const layerSummarySchema = z.strictObject({
|
|
104
|
-
layer_id:
|
|
101
|
+
layer_id: prefixedDigestSchema("jrl"),
|
|
105
102
|
role: z.enum(["application", "cache", "assets"]),
|
|
106
103
|
evidence_id: evidenceIdSchema,
|
|
107
|
-
graph_id:
|
|
104
|
+
graph_id: prefixedDigestSchema("jag"),
|
|
108
105
|
root_artifact_sha256: digestSchema,
|
|
109
106
|
input_path: z.string().min(1),
|
|
110
107
|
format: z.enum(["asar", "directory"]),
|
|
@@ -116,7 +113,10 @@ const captureSummarySchema = z.strictObject({
|
|
|
116
113
|
kind: z.enum(["browser", "electron", "v8-inspector", "electron-active"]),
|
|
117
114
|
target_node_id: nodeIdSchema,
|
|
118
115
|
target_key: boundedTextSchema,
|
|
119
|
-
target_location: z
|
|
116
|
+
target_location: z
|
|
117
|
+
.string()
|
|
118
|
+
.min(1)
|
|
119
|
+
.or(javascriptRuntimeUnresolvedLocationSchema),
|
|
120
120
|
frames: z.number().int().min(0),
|
|
121
121
|
scripts: z.number().int().min(0),
|
|
122
122
|
workers: z.number().int().min(0),
|
|
@@ -130,12 +130,13 @@ const reconciliationReasonSchema = z.enum([
|
|
|
130
130
|
"captured-content-disagrees-with-static-location",
|
|
131
131
|
"no-static-content-match",
|
|
132
132
|
"no-authorized-location-mapping",
|
|
133
|
+
"runtime-location-unresolved",
|
|
133
134
|
"runtime-frame-unattributed",
|
|
134
135
|
"static-or-runtime-coverage-incomplete",
|
|
135
136
|
"reconciliation-limit-reached",
|
|
136
137
|
]);
|
|
137
138
|
const reconciliationItemShape = {
|
|
138
|
-
reconciliation_id:
|
|
139
|
+
reconciliation_id: prefixedDigestSchema("jrr_item"),
|
|
139
140
|
entity_kind: z.enum(["target", "frame", "script", "worker"]),
|
|
140
141
|
runtime_evidence_id: evidenceIdSchema,
|
|
141
142
|
runtime_node_id: nodeIdSchema,
|
|
@@ -152,14 +153,14 @@ const reconciliationItemShape = {
|
|
|
152
153
|
reason: reconciliationReasonSchema,
|
|
153
154
|
candidate_static_count: z.number().int().min(0),
|
|
154
155
|
candidate_static_nodes: z.array(z.strictObject({
|
|
155
|
-
static_layer_id:
|
|
156
|
+
static_layer_id: prefixedDigestSchema("jrl"),
|
|
156
157
|
static_node_id: nodeIdSchema,
|
|
157
158
|
})),
|
|
158
159
|
};
|
|
159
160
|
const reconciliationItemSchema = z.union([
|
|
160
161
|
z.strictObject({
|
|
161
162
|
...reconciliationItemShape,
|
|
162
|
-
static_layer_id:
|
|
163
|
+
static_layer_id: prefixedDigestSchema("jrl"),
|
|
163
164
|
static_node_id: nodeIdSchema,
|
|
164
165
|
status: z.literal("matched"),
|
|
165
166
|
}),
|
|
@@ -171,7 +172,7 @@ const reconciliationItemSchema = z.union([
|
|
|
171
172
|
}),
|
|
172
173
|
]);
|
|
173
174
|
const staticLoadStateSchema = z.strictObject({
|
|
174
|
-
static_layer_id:
|
|
175
|
+
static_layer_id: prefixedDigestSchema("jrl"),
|
|
175
176
|
static_node_id: nodeIdSchema,
|
|
176
177
|
kind: z.enum(["javascript-asset", "javascript-chunk", "javascript-module"]),
|
|
177
178
|
status: z.enum([
|
|
@@ -191,7 +192,7 @@ const staticLoadStateSchema = z.strictObject({
|
|
|
191
192
|
});
|
|
192
193
|
/** Deterministic static/passive-runtime reconciliation with a combined JAG. */
|
|
193
194
|
export const javascriptRuntimeReconciliationResultSchema = z.strictObject({
|
|
194
|
-
reconciliation_id:
|
|
195
|
+
reconciliation_id: prefixedDigestSchema("jrr"),
|
|
195
196
|
static_layers: z.array(layerSummarySchema).min(1),
|
|
196
197
|
runtime_captures: z.array(captureSummarySchema).min(1),
|
|
197
198
|
graph: javascriptApplicationGraphSchema,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { posix, relative } from "node:path";
|
|
2
|
-
import { isPathWithinRoot } from "./localPath.js";
|
|
1
|
+
import { posix, relative, win32 } from "node:path";
|
|
3
2
|
import { compareCodePoints, } from "./javascriptApplicationGraph.js";
|
|
4
3
|
/** Index statically reconstructed entities that can receive runtime matches. */
|
|
5
4
|
export const collectStaticRuntimeCandidates = (layers) => layers
|
|
@@ -130,12 +129,25 @@ const candidateDigests = (node) => {
|
|
|
130
129
|
];
|
|
131
130
|
};
|
|
132
131
|
const pathBelowRoot = (root, value) => {
|
|
133
|
-
const
|
|
132
|
+
const rootStyle = absoluteFilePathStyle(root);
|
|
133
|
+
if (rootStyle === null || rootStyle !== absoluteFilePathStyle(value))
|
|
134
|
+
return null;
|
|
135
|
+
const remainder = rootStyle === "windows"
|
|
136
|
+
? win32.relative(root, value)
|
|
137
|
+
: relative(root, value);
|
|
138
|
+
const portableRemainder = remainder.replaceAll("\\", "/");
|
|
134
139
|
if (remainder === "" ||
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
(rootStyle === "windows" && win32.isAbsolute(remainder)) ||
|
|
141
|
+
portableRemainder === ".." ||
|
|
142
|
+
portableRemainder.startsWith("../"))
|
|
137
143
|
return null;
|
|
138
|
-
return normalizeArtifactPath(
|
|
144
|
+
return normalizeArtifactPath(portableRemainder);
|
|
145
|
+
};
|
|
146
|
+
const absoluteFilePathStyle = (path) => {
|
|
147
|
+
if (/^[a-z]:[\\/]/iu.test(path) ||
|
|
148
|
+
/^(?:\\\\|\/\/)[^\\/]+[\\/][^\\/]+(?:[\\/]|$)/u.test(path))
|
|
149
|
+
return "windows";
|
|
150
|
+
return path.startsWith("/") ? "posix" : null;
|
|
139
151
|
};
|
|
140
152
|
const pathBelowUrlPrefix = (prefix, value) => {
|
|
141
153
|
let base;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { failedJavaScriptSemanticIr, } from "./javascriptSemanticIr.js";
|
|
3
|
-
import { collectSemanticModuleLink, collectSemanticCallable, collectSemanticReferences, immutableSemanticBindings, immutableSemanticScopes,
|
|
3
|
+
import { collectSemanticModuleLink, collectSemanticCallable, collectSemanticReferences, immutableSemanticBindings, immutableSemanticScopes, semanticStaticPropertyName, } from "./javascriptSemanticProjection.js";
|
|
4
4
|
import { currentSemanticScope, resolveSemanticBindingFromScope, semanticScopeId, semanticVariableScope, } from "./javascriptSemanticState.js";
|
|
5
5
|
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
|
6
6
|
import { collectSemanticReturns, resolveSemanticModuleCallables, } from "./javascriptSemanticReturns.js";
|
|
@@ -19,6 +19,9 @@ export const analyzeJavaScriptSemantics = (source) => {
|
|
|
19
19
|
export const analyzeParsedJavaScriptSemantics = (file) => {
|
|
20
20
|
const state = createState(file.program);
|
|
21
21
|
collectDefinitions(file.program, state);
|
|
22
|
+
traverseJavaScriptAst(file.program, {
|
|
23
|
+
enter: (node) => collectSemanticModuleLink(node, state),
|
|
24
|
+
});
|
|
22
25
|
const references = collectSemanticReferences(file.program, state);
|
|
23
26
|
const parserPartial = file.errors.length > 0;
|
|
24
27
|
const bindings = immutableSemanticBindings(state);
|
|
@@ -71,15 +74,32 @@ const collectDefinitions = (program, state) => {
|
|
|
71
74
|
const stack = [
|
|
72
75
|
currentSemanticScope(state.scopes),
|
|
73
76
|
];
|
|
74
|
-
const openedScopes = new
|
|
77
|
+
const openedScopes = new WeakMap();
|
|
75
78
|
traverseJavaScriptAst(program, {
|
|
76
79
|
enter: (node, parent) => {
|
|
77
|
-
|
|
80
|
+
let parentScope = currentSemanticScope(stack);
|
|
81
|
+
if (parent !== null &&
|
|
82
|
+
t.isWithStatement(parent) &&
|
|
83
|
+
parent.body === node) {
|
|
84
|
+
const dynamicScope = {
|
|
85
|
+
scopeId: `${semanticScopeId("block", parent)}:with`,
|
|
86
|
+
parentScopeId: parentScope.scopeId,
|
|
87
|
+
kind: "block",
|
|
88
|
+
location: range(parent),
|
|
89
|
+
bindingsComplete: false,
|
|
90
|
+
bindings: new Map(),
|
|
91
|
+
};
|
|
92
|
+
state.scopes.push(dynamicScope);
|
|
93
|
+
state.scopesById.set(dynamicScope.scopeId, dynamicScope);
|
|
94
|
+
stack.push(dynamicScope);
|
|
95
|
+
openedScopes.set(node, 1);
|
|
96
|
+
parentScope = dynamicScope;
|
|
97
|
+
}
|
|
78
98
|
bindOuterDeclaration(node, parentScope, state);
|
|
79
99
|
const nested = nestedScope(node, parent, parentScope, state);
|
|
80
100
|
if (nested !== undefined) {
|
|
81
101
|
stack.push(nested);
|
|
82
|
-
openedScopes.
|
|
102
|
+
openedScopes.set(node, (openedScopes.get(node) ?? 0) + 1);
|
|
83
103
|
}
|
|
84
104
|
const scope = currentSemanticScope(stack);
|
|
85
105
|
state.scopeByNode.set(node, scope);
|
|
@@ -91,10 +111,9 @@ const collectDefinitions = (program, state) => {
|
|
|
91
111
|
state,
|
|
92
112
|
});
|
|
93
113
|
bindInnerDeclaration(node, parent, scope, state);
|
|
94
|
-
collectSemanticModuleLink(node, state);
|
|
95
114
|
},
|
|
96
115
|
exit: (node) => {
|
|
97
|
-
|
|
116
|
+
for (let count = openedScopes.get(node) ?? 0; count > 0; count--)
|
|
98
117
|
stack.pop();
|
|
99
118
|
},
|
|
100
119
|
});
|
|
@@ -134,6 +153,16 @@ const bindInnerDeclaration = (node, parent, scope, state) => {
|
|
|
134
153
|
? parent.kind !== "const"
|
|
135
154
|
: true,
|
|
136
155
|
});
|
|
156
|
+
else if (t.isClassExpression(node) && t.isIdentifier(node.id))
|
|
157
|
+
addBinding({
|
|
158
|
+
state,
|
|
159
|
+
scope,
|
|
160
|
+
name: node.id.name,
|
|
161
|
+
kind: "class",
|
|
162
|
+
mutable: false,
|
|
163
|
+
definitionNode: node.id,
|
|
164
|
+
initializer: node,
|
|
165
|
+
});
|
|
137
166
|
else if (t.isFunction(node))
|
|
138
167
|
bindFunctionLocals(node, scope, state);
|
|
139
168
|
else if (t.isCatchClause(node) && node.param != null)
|
|
@@ -149,14 +178,22 @@ const bindInnerDeclaration = (node, parent, scope, state) => {
|
|
|
149
178
|
addAssignment(node.left, node.right, scope, state);
|
|
150
179
|
};
|
|
151
180
|
const nestedScope = (node, parent, parentScope, state) => {
|
|
181
|
+
const switchOwner = t.isSwitchCase(node) && parent !== null && t.isSwitchStatement(parent)
|
|
182
|
+
? parent
|
|
183
|
+
: undefined;
|
|
184
|
+
if (switchOwner !== undefined) {
|
|
185
|
+
const existing = state.scopesById.get(semanticScopeId("block", switchOwner));
|
|
186
|
+
if (existing !== undefined)
|
|
187
|
+
return existing;
|
|
188
|
+
}
|
|
152
189
|
const kind = scopeKind(node, parent);
|
|
153
190
|
if (kind === undefined)
|
|
154
191
|
return undefined;
|
|
155
192
|
const scope = {
|
|
156
|
-
scopeId: semanticScopeId(kind, node),
|
|
193
|
+
scopeId: semanticScopeId(kind, switchOwner ?? node),
|
|
157
194
|
parentScopeId: parentScope.scopeId,
|
|
158
195
|
kind,
|
|
159
|
-
location: range(node),
|
|
196
|
+
location: range(switchOwner ?? node),
|
|
160
197
|
bindingsComplete: true,
|
|
161
198
|
bindings: new Map(),
|
|
162
199
|
};
|
|
@@ -171,6 +208,18 @@ const scopeKind = (node, parent) => {
|
|
|
171
208
|
return "class";
|
|
172
209
|
if (t.isCatchClause(node))
|
|
173
210
|
return "catch";
|
|
211
|
+
if (t.isForStatement(node) ||
|
|
212
|
+
t.isForOfStatement(node) ||
|
|
213
|
+
t.isForInStatement(node))
|
|
214
|
+
return "block";
|
|
215
|
+
// A switch body is one lexical scope shared by all its cases, so `let` in
|
|
216
|
+
// two cases must resolve to one binding rather than collide or leak.
|
|
217
|
+
if (t.isSwitchCase(node))
|
|
218
|
+
return "block";
|
|
219
|
+
// Each `static {}` block is its own lexical scope; otherwise a `let` in two
|
|
220
|
+
// static blocks would collide in the enclosing class scope.
|
|
221
|
+
if (t.isStaticBlock(node))
|
|
222
|
+
return "static-block";
|
|
174
223
|
if (t.isBlockStatement(node) &&
|
|
175
224
|
!(parent !== null && t.isFunction(parent) && parent.body === node))
|
|
176
225
|
return "block";
|
|
@@ -225,16 +274,6 @@ const bindPattern = (input) => {
|
|
|
225
274
|
return;
|
|
226
275
|
}
|
|
227
276
|
if (t.isIdentifier(pattern)) {
|
|
228
|
-
const baseOrigin = semanticModuleOrigin(initializer, []);
|
|
229
|
-
const directOrigin = baseOrigin === undefined || projection.includes(null)
|
|
230
|
-
? undefined
|
|
231
|
-
: {
|
|
232
|
-
...baseOrigin,
|
|
233
|
-
importedPath: [
|
|
234
|
-
...baseOrigin.importedPath,
|
|
235
|
-
...projection.map((segment) => String(segment)),
|
|
236
|
-
],
|
|
237
|
-
};
|
|
238
277
|
addBinding({
|
|
239
278
|
state,
|
|
240
279
|
scope,
|
|
@@ -243,7 +282,6 @@ const bindPattern = (input) => {
|
|
|
243
282
|
mutable,
|
|
244
283
|
definitionNode: pattern,
|
|
245
284
|
initializer,
|
|
246
|
-
...(directOrigin === undefined ? {} : { directOrigin }),
|
|
247
285
|
projection,
|
|
248
286
|
});
|
|
249
287
|
return;
|