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,6 +1,6 @@
|
|
|
1
1
|
import { createEvidence } from "../domain/evidence.js";
|
|
2
2
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
3
|
-
import {
|
|
3
|
+
import { digestCanonicalJson } from "../domain/browserScenarioNormalization.js";
|
|
4
4
|
/** Create Evidence without retaining arbitrary runtime argument values. */
|
|
5
5
|
export const createElectronActiveEvidence = (input, result, provider) => createEvidence(undefined, provider, {
|
|
6
6
|
predicateType: "rea.electron-active-scenario",
|
|
@@ -10,41 +10,24 @@ export const createElectronActiveEvidence = (input, result, provider) => createE
|
|
|
10
10
|
confidence: "observed",
|
|
11
11
|
authority: "controlled-replay",
|
|
12
12
|
environment: {
|
|
13
|
-
id: `${result.application.electron_version}
|
|
14
|
-
platform:
|
|
15
|
-
architecture:
|
|
13
|
+
id: `${result.application.electron_version}@unknown`,
|
|
14
|
+
platform: "unknown",
|
|
15
|
+
architecture: "unknown",
|
|
16
16
|
isolation: "none",
|
|
17
17
|
},
|
|
18
|
-
limitations:
|
|
18
|
+
limitations: [
|
|
19
|
+
...result.limitations,
|
|
20
|
+
"Application host platform and architecture were not observed.",
|
|
21
|
+
],
|
|
19
22
|
});
|
|
20
23
|
const scenarioProjection = (input) => ({
|
|
21
24
|
executable_path: input.executable_path,
|
|
22
25
|
application_path: input.application_path,
|
|
23
26
|
application_root: input.application_root,
|
|
24
|
-
args:
|
|
27
|
+
args: [...input.args],
|
|
25
28
|
actions: input.actions.map(({ step_id, kind }) => ({ step_id, kind })),
|
|
26
29
|
});
|
|
27
30
|
const parameters = (input) => ({
|
|
28
31
|
...scenarioProjection(input),
|
|
29
|
-
scenario_sha256:
|
|
32
|
+
scenario_sha256: digestCanonicalJson(scenarioProjection(input)),
|
|
30
33
|
});
|
|
31
|
-
const redactArguments = (arguments_) => {
|
|
32
|
-
let redactNext = false;
|
|
33
|
-
return arguments_.map((argument) => {
|
|
34
|
-
if (redactNext) {
|
|
35
|
-
redactNext = false;
|
|
36
|
-
return "<redacted>";
|
|
37
|
-
}
|
|
38
|
-
if (sensitiveFlag.test(argument)) {
|
|
39
|
-
redactNext = true;
|
|
40
|
-
return argument;
|
|
41
|
-
}
|
|
42
|
-
return redactArgument(argument);
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const sensitiveFlag = /^--?(?:password|token|secret|api[-_]?key|authorization|cookie)$/iu;
|
|
46
|
-
const redactArgument = (argument) => {
|
|
47
|
-
if (/^--?(?:password|token|secret|api[-_]?key|authorization|cookie)=/iu.test(argument))
|
|
48
|
-
return `${argument.slice(0, argument.indexOf("=") + 1)}<redacted>`;
|
|
49
|
-
return argument;
|
|
50
|
-
};
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dirname } from "node:path";
|
|
2
2
|
import { realpath } from "node:fs/promises";
|
|
3
|
-
import { digestJson } from "./JavaScriptReplayPlanning.js";
|
|
4
3
|
import { AnalysisCapabilityUnavailableError, AnalysisInputError, } from "../domain/errors.js";
|
|
5
|
-
import { isPathContained } from "../domain/permissionPolicy.js";
|
|
6
4
|
import { err } from "../domain/result.js";
|
|
7
5
|
import { createElectronActiveEvidence } from "./ElectronActiveEvidence.js";
|
|
8
6
|
const OPERATION = "capture_electron_scenario";
|
|
9
7
|
const PROVIDER_ID = "rea-playwright-electron-active";
|
|
10
8
|
const canonicalizeInput = async (input) => {
|
|
11
9
|
try {
|
|
12
|
-
const [executablePath, applicationPath
|
|
10
|
+
const [executablePath, applicationPath] = await Promise.all([
|
|
13
11
|
realpath(input.executable_path),
|
|
14
12
|
realpath(input.application_path),
|
|
15
|
-
realpath(input.application_root),
|
|
16
13
|
]);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
path: ["application_path"],
|
|
21
|
-
reason: "invalid_value",
|
|
22
|
-
message: "application_path must remain beneath application_root after symlink resolution",
|
|
23
|
-
},
|
|
24
|
-
]));
|
|
14
|
+
const applicationRoot = input.application_root === undefined
|
|
15
|
+
? dirname(applicationPath)
|
|
16
|
+
: await realpath(input.application_root);
|
|
25
17
|
return {
|
|
26
18
|
ok: true,
|
|
27
19
|
value: {
|
|
@@ -42,37 +34,18 @@ const canonicalizeInput = async (input) => {
|
|
|
42
34
|
]));
|
|
43
35
|
}
|
|
44
36
|
};
|
|
45
|
-
|
|
37
|
+
/** Canonicalize request paths and execute one provider-owned Electron run. */
|
|
38
|
+
export const captureElectronScenario = async (provider, input, options = {}) => {
|
|
46
39
|
const canonical = await canonicalizeInput(input);
|
|
47
40
|
if (!canonical.ok)
|
|
48
41
|
return canonical;
|
|
49
|
-
if (authority === undefined)
|
|
50
|
-
return err(new AnalysisCapabilityUnavailableError(PROVIDER_ID, OPERATION, "active Electron observation permission policy is not configured"));
|
|
51
|
-
const authorized = await authority.authorize({
|
|
52
|
-
capability: "electron_automate",
|
|
53
|
-
roots: [canonical.value.application_root],
|
|
54
|
-
executables: [canonical.value.executable_path],
|
|
55
|
-
environment_names: [],
|
|
56
|
-
network: "external",
|
|
57
|
-
mount: false,
|
|
58
|
-
operation_identity: `${OPERATION}:${digestJson(canonical.value)}`,
|
|
59
|
-
}, "write");
|
|
60
|
-
if (!authorized.ok)
|
|
61
|
-
return err(projectPermissionFailure(authorized.error));
|
|
62
|
-
return canonical;
|
|
63
|
-
};
|
|
64
|
-
/** Authorize and execute one bounded, provider-owned Electron experiment. */
|
|
65
|
-
export const captureElectronScenario = async (provider, authority, input, options = {}) => {
|
|
66
|
-
const authorized = await authorize(authority, input);
|
|
67
|
-
if (!authorized.ok)
|
|
68
|
-
return authorized;
|
|
69
42
|
if (provider === undefined)
|
|
70
43
|
return err(new AnalysisCapabilityUnavailableError(PROVIDER_ID, OPERATION, "active Electron observation provider is not configured"));
|
|
71
|
-
const captured = await provider.capture(
|
|
44
|
+
const captured = await provider.capture(canonical.value, options);
|
|
72
45
|
return captured.ok
|
|
73
46
|
? {
|
|
74
47
|
ok: true,
|
|
75
|
-
value: createElectronActiveEvidence(
|
|
48
|
+
value: createElectronActiveEvidence(canonical.value, captured.value, provider.identity()),
|
|
76
49
|
}
|
|
77
50
|
: captured;
|
|
78
51
|
};
|
|
@@ -84,6 +84,7 @@ export const summarizeElectronBoundaries = (analysis) => {
|
|
|
84
84
|
context: "module-specifier",
|
|
85
85
|
files,
|
|
86
86
|
kind: "native-addon",
|
|
87
|
+
moduleKind: finding.module_kind,
|
|
87
88
|
})).length,
|
|
88
89
|
};
|
|
89
90
|
};
|
|
@@ -103,6 +104,7 @@ const resolvesToFile = (input) => {
|
|
|
103
104
|
sourcePath: input.file.path,
|
|
104
105
|
context: input.context,
|
|
105
106
|
files: input.files,
|
|
107
|
+
...(input.moduleKind === undefined ? {} : { moduleKind: input.moduleKind }),
|
|
106
108
|
}).resolved_path;
|
|
107
109
|
return (resolved !== null &&
|
|
108
110
|
(input.kind === undefined || input.files.get(resolved)?.kind === input.kind));
|
|
@@ -17,7 +17,7 @@ const addNativeBinding = (input) => {
|
|
|
17
17
|
const source = electronFindingSourceNode(context, file, value.module_key);
|
|
18
18
|
if (source === undefined)
|
|
19
19
|
return;
|
|
20
|
-
const resolved = resolveArtifactPath(value.specifier, file.path, context.filesByPath);
|
|
20
|
+
const resolved = resolveArtifactPath(value.specifier, file.path, context.filesByPath, value.module_kind);
|
|
21
21
|
const addon = resolved === null ? undefined : context.fileNodes.get(resolved);
|
|
22
22
|
const binding = context.accumulator.addNode({
|
|
23
23
|
kind: "native-export",
|
|
@@ -13,12 +13,17 @@ export const createElectronEvidence = (operation, input, result, provider) => cr
|
|
|
13
13
|
environment: "target" in result
|
|
14
14
|
? {
|
|
15
15
|
id: `${result.browser.product}@${result.browser.revision}`,
|
|
16
|
-
platform:
|
|
17
|
-
architecture:
|
|
16
|
+
platform: "unknown",
|
|
17
|
+
architecture: "unknown",
|
|
18
18
|
isolation: "none",
|
|
19
19
|
}
|
|
20
20
|
: null,
|
|
21
|
-
limitations:
|
|
21
|
+
limitations: [
|
|
22
|
+
...result.limitations,
|
|
23
|
+
...("target" in result
|
|
24
|
+
? ["Browser host platform and architecture were not observed."]
|
|
25
|
+
: []),
|
|
26
|
+
],
|
|
22
27
|
});
|
|
23
28
|
const parameters = (input) => ({
|
|
24
29
|
cdp_endpoint: input.cdp_endpoint,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { projectPermissionFailure } from "./PermissionFailure.js";
|
|
2
1
|
import { AnalysisCapabilityUnavailableError, } from "../domain/errors.js";
|
|
3
2
|
import { err, ok } from "../domain/result.js";
|
|
4
3
|
import { createElectronEvidence } from "./ElectronEvidence.js";
|
|
5
|
-
/**
|
|
6
|
-
export const listElectronTargets = async (provider,
|
|
7
|
-
const ready =
|
|
4
|
+
/** List local file pages exposed by the explicitly selected endpoint. */
|
|
5
|
+
export const listElectronTargets = async (provider, input, options = {}) => {
|
|
6
|
+
const ready = requireProvider(provider, "list_electron_targets");
|
|
8
7
|
if (!ready.ok)
|
|
9
8
|
return ready;
|
|
10
9
|
const result = await ready.value.listTargets(input, options);
|
|
@@ -12,9 +11,9 @@ export const listElectronTargets = async (provider, authority, input, options =
|
|
|
12
11
|
? ok(createElectronEvidence("list_electron_targets", input, result.value, ready.value.identity()))
|
|
13
12
|
: result;
|
|
14
13
|
};
|
|
15
|
-
/**
|
|
16
|
-
export const inspectElectronPage = async (provider,
|
|
17
|
-
const ready =
|
|
14
|
+
/** Inspect one local file page from the explicitly selected endpoint. */
|
|
15
|
+
export const inspectElectronPage = async (provider, input, options = {}) => {
|
|
16
|
+
const ready = requireProvider(provider, "inspect_electron_page");
|
|
18
17
|
if (!ready.ok)
|
|
19
18
|
return ready;
|
|
20
19
|
const result = await ready.value.inspectPage(input, options);
|
|
@@ -22,21 +21,6 @@ export const inspectElectronPage = async (provider, authority, input, options =
|
|
|
22
21
|
? ok(createElectronEvidence("inspect_electron_page", input, result.value, ready.value.identity()))
|
|
23
22
|
: result;
|
|
24
23
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const authorized = await authority.authorize({
|
|
29
|
-
capability: "electron_observe",
|
|
30
|
-
roots: [],
|
|
31
|
-
executables: [],
|
|
32
|
-
environment_names: [],
|
|
33
|
-
network: "loopback",
|
|
34
|
-
mount: false,
|
|
35
|
-
operation_identity: `${operation}:${"target_id" in input ? input.target_id : input.cdp_endpoint}`,
|
|
36
|
-
}, "read");
|
|
37
|
-
if (!authorized.ok)
|
|
38
|
-
return err(projectPermissionFailure(authorized.error));
|
|
39
|
-
return provider === undefined
|
|
40
|
-
? err(new AnalysisCapabilityUnavailableError("rea-cdp-electron", operation, "Electron observation provider is not configured"))
|
|
41
|
-
: ok(provider);
|
|
42
|
-
};
|
|
24
|
+
const requireProvider = (provider, operation) => provider === undefined
|
|
25
|
+
? err(new AnalysisCapabilityUnavailableError("rea-cdp-electron", operation, "Electron observation provider is not configured"))
|
|
26
|
+
: ok(provider);
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AnalysisOutputError } from "../domain/errors.js";
|
|
3
3
|
import { err, ok } from "../domain/result.js";
|
|
4
|
-
const
|
|
4
|
+
const LITERAL_SEARCH_SOURCES = [
|
|
5
5
|
["search_strings", "string"],
|
|
6
6
|
["search_procedures", "procedure"],
|
|
7
7
|
];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Trace every matching feature or string literal through provider xrefs. */
|
|
12
|
-
export const traceLiteralFeature = async (call, input, scope, signal) => {
|
|
13
|
-
const sources = scope === "feature" ? FEATURE_SEARCH_SOURCES : STRING_SEARCH_SOURCES;
|
|
14
|
-
const searched = await literalMatches(call, input, sources, signal);
|
|
8
|
+
/** Trace matching strings and procedures through provider xrefs. */
|
|
9
|
+
export const traceLiteralFeature = async (call, input, signal) => {
|
|
10
|
+
const searched = await literalMatches(call, input, LITERAL_SEARCH_SOURCES, signal);
|
|
15
11
|
if (!searched.ok)
|
|
16
12
|
return searched;
|
|
17
13
|
const traced = await traceReferences(call, {
|
|
@@ -4,7 +4,8 @@ import { AnalysisCancelledError, AnalysisOutputError, projectAnalysisError, } fr
|
|
|
4
4
|
import { addressDistance, functionDossierSchema, parseDocuments, parseFunctionDossier, parseListCount, parseRelatedAddresses, parseSegments, } from "../domain/hopperValues.js";
|
|
5
5
|
import { err, ok } from "../domain/result.js";
|
|
6
6
|
import { categorizeSwiftTypes, discoverObjcClasses, discoverObjcProtocols, } from "../domain/symbolAnalysis.js";
|
|
7
|
-
import {
|
|
7
|
+
import { inspectNativeDispatch } from "./NativeDispatchMetadataInspection.js";
|
|
8
|
+
import { traceNativeValues } from "./NativeValueTrace.js";
|
|
8
9
|
import { traceNativeUiAction } from "./NativeUiActionTrace.js";
|
|
9
10
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
10
11
|
import { invalidEnhancedInput, } from "./EnhancedToolTypes.js";
|
|
@@ -23,10 +24,14 @@ export class EnhancedTools {
|
|
|
23
24
|
}
|
|
24
25
|
/** Parse an untrusted direct-call input once, then dispatch exhaustively. */
|
|
25
26
|
execute(name, input, signal) {
|
|
26
|
-
if (name === "trace_feature" ||
|
|
27
|
-
name === "find_code_for_string" ||
|
|
28
|
-
name === "trace_call_path")
|
|
27
|
+
if (name === "trace_feature" || name === "trace_call_path")
|
|
29
28
|
return this.#executeTracing(name, input, signal);
|
|
29
|
+
if (name === "trace_native_values") {
|
|
30
|
+
const parsed = enhancedInputSchemas.trace_native_values.safeParse(input);
|
|
31
|
+
return parsed.success
|
|
32
|
+
? this.executeValidated({ name, input: parsed.data }, signal)
|
|
33
|
+
: invalidEnhancedInput(name, parsed.error);
|
|
34
|
+
}
|
|
30
35
|
if (name === "trace_native_ui_action") {
|
|
31
36
|
const parsed = enhancedInputSchemas.trace_native_ui_action.safeParse(input);
|
|
32
37
|
return parsed.success
|
|
@@ -106,11 +111,11 @@ export class EnhancedTools {
|
|
|
106
111
|
case "inspect_native_api":
|
|
107
112
|
return this.#inspectNativeApi(call.input, signal);
|
|
108
113
|
case "trace_feature":
|
|
109
|
-
return traceLiteralFeature((name, arguments_, operationSignal) => this.#call(name, arguments_, operationSignal), call.input,
|
|
110
|
-
case "find_code_for_string":
|
|
111
|
-
return traceLiteralFeature((name, arguments_, operationSignal) => this.#call(name, arguments_, operationSignal), call.input, "string", signal);
|
|
114
|
+
return traceLiteralFeature((name, arguments_, operationSignal) => this.#call(name, arguments_, operationSignal), call.input, signal);
|
|
112
115
|
case "trace_call_path":
|
|
113
116
|
return traceCallPath((name, arguments_, operationSignal) => this.#call(name, arguments_, operationSignal), call.input, signal);
|
|
117
|
+
case "trace_native_values":
|
|
118
|
+
return traceNativeValues(this.analysis, call.input, signal);
|
|
114
119
|
case "trace_native_ui_action": {
|
|
115
120
|
return traceNativeUiAction(this.analysis, call.input, signal);
|
|
116
121
|
}
|
|
@@ -123,13 +128,7 @@ export class EnhancedTools {
|
|
|
123
128
|
return invalidEnhancedInput(name, parsed.error);
|
|
124
129
|
return this.executeValidated({ name, input: parsed.data }, signal);
|
|
125
130
|
}
|
|
126
|
-
|
|
127
|
-
const parsed = enhancedInputSchemas.trace_feature.safeParse(input);
|
|
128
|
-
if (!parsed.success)
|
|
129
|
-
return invalidEnhancedInput(name, parsed.error);
|
|
130
|
-
return this.executeValidated({ name, input: parsed.data }, signal);
|
|
131
|
-
}
|
|
132
|
-
const parsed = enhancedInputSchemas.find_code_for_string.safeParse(input);
|
|
131
|
+
const parsed = enhancedInputSchemas.trace_feature.safeParse(input);
|
|
133
132
|
if (!parsed.success)
|
|
134
133
|
return invalidEnhancedInput(name, parsed.error);
|
|
135
134
|
return this.executeValidated({ name, input: parsed.data }, signal);
|
|
@@ -167,27 +166,8 @@ export class EnhancedTools {
|
|
|
167
166
|
const names = await this.#allAddressed("list_names", signal);
|
|
168
167
|
return names.ok ? ok(discoverObjcClasses(names.value, pattern)) : names;
|
|
169
168
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (!execution.ok)
|
|
173
|
-
return err(execution.error);
|
|
174
|
-
const names = z
|
|
175
|
-
.array(z.union([
|
|
176
|
-
z.strictObject({ address: z.string(), value: z.string() }),
|
|
177
|
-
z.strictObject({ address: z.string(), name: z.string() }),
|
|
178
|
-
]))
|
|
179
|
-
.safeParse(execution.value.result);
|
|
180
|
-
if (!names.success)
|
|
181
|
-
return err(new AnalysisOutputError("list_names", "provider returned an invalid inventory"));
|
|
182
|
-
return ok(nativeDispatchMetadataResultSchema.parse({
|
|
183
|
-
target_sha256: execution.value.subject?.sha256 ?? null,
|
|
184
|
-
provider: execution.value.provider,
|
|
185
|
-
analysis_profile_digest: execution.value.analysisProfile?.digest ?? null,
|
|
186
|
-
result: inspectNativeDispatchMetadata(names.data.map((entry) => ({
|
|
187
|
-
address: entry.address,
|
|
188
|
-
name: "value" in entry ? entry.value : entry.name,
|
|
189
|
-
})), maxRecords),
|
|
190
|
-
}));
|
|
169
|
+
#inspectNativeDispatchMetadata(maxRecords, signal) {
|
|
170
|
+
return inspectNativeDispatch(this.analysis, maxRecords, signal);
|
|
191
171
|
}
|
|
192
172
|
async #objcProtocols(signal) {
|
|
193
173
|
const names = await this.#allAddressed("list_names", signal);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isPathWithinRoot } from "../domain/localPath.js";
|
|
2
1
|
import { createHash } from "node:crypto";
|
|
3
2
|
import { constants as fsConstants } from "node:fs";
|
|
4
3
|
import { lstat, open, readdir, readlink } from "node:fs/promises";
|
|
@@ -65,18 +64,13 @@ export const snapshotRoots = async (scenario, signal) => {
|
|
|
65
64
|
truncated = true;
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
|
-
const safeTarget = isPathWithinRoot(root, target)
|
|
69
|
-
? relative(root, target) || "."
|
|
70
|
-
: "<outside-declared-root>";
|
|
71
|
-
if (safeTarget === "<outside-declared-root>")
|
|
72
|
-
truncated = true;
|
|
73
67
|
entries.push({
|
|
74
68
|
path: `${rootAlias}:${relativePath}`,
|
|
75
69
|
type: "symlink",
|
|
76
70
|
mode: stats.mode,
|
|
77
71
|
size: stats.size,
|
|
78
72
|
sha256: null,
|
|
79
|
-
symlink_target:
|
|
73
|
+
symlink_target: target,
|
|
80
74
|
});
|
|
81
75
|
return;
|
|
82
76
|
}
|
|
@@ -117,7 +111,12 @@ export const snapshotRoots = async (scenario, signal) => {
|
|
|
117
111
|
for (const child of children.sort())
|
|
118
112
|
await visit(root, rootAlias, join(path, child), depth + 1);
|
|
119
113
|
};
|
|
120
|
-
for (const [index, root] of scenario.
|
|
114
|
+
for (const [index, root] of scenario.filesystem_observation_paths.entries()) {
|
|
115
|
+
if ((await lstatIfPresent(root)) === undefined) {
|
|
116
|
+
truncated = true;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
121
119
|
await visit(root, `root_${String(index)}`, root, 0);
|
|
120
|
+
}
|
|
122
121
|
return { files: entries, truncated };
|
|
123
122
|
};
|
|
@@ -76,7 +76,8 @@ const managedApplicationSource = (evidence) => {
|
|
|
76
76
|
const assertApplicationSubject = (evidence, result) => {
|
|
77
77
|
if (evidence.subject === null ||
|
|
78
78
|
evidence.subject.digest.sha256 !== result.root_artifact_sha256 ||
|
|
79
|
-
evidence.subject.format !== result.format
|
|
79
|
+
evidence.subject.format !== result.format ||
|
|
80
|
+
evidence.subject.local_path !== result.input_path)
|
|
80
81
|
throw new TypeError("JavaScript application Evidence subject does not match its result");
|
|
81
82
|
};
|
|
82
83
|
const providerMatches = (evidence, provider) => evidence.provider.id === provider.id &&
|
|
@@ -41,7 +41,7 @@ export const traceApplicationFeatureEvidenceValidated = (input) => {
|
|
|
41
41
|
}, result));
|
|
42
42
|
}
|
|
43
43
|
catch (cause) {
|
|
44
|
-
return workflowFailure(operation, cause);
|
|
44
|
+
return workflowFailure(operation, cause, input);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
/** Authenticate both graphs and derive a tiered cross-version change graph. */
|
|
@@ -82,7 +82,7 @@ export const compareApplicationVersionsEvidenceValidated = (input) => {
|
|
|
82
82
|
}, result));
|
|
83
83
|
}
|
|
84
84
|
catch (cause) {
|
|
85
|
-
return workflowFailure(operation, cause);
|
|
85
|
+
return workflowFailure(operation, cause, input);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
/** Compare source and bundle inputs already parsed by a trusted adapter. */
|
|
@@ -104,7 +104,7 @@ export const compareSourceToBundleEvidenceValidated = (input) => {
|
|
|
104
104
|
}, result));
|
|
105
105
|
}
|
|
106
106
|
catch (cause) {
|
|
107
|
-
return workflowFailure(operation, cause);
|
|
107
|
+
return workflowFailure(operation, cause, input);
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
@@ -148,9 +148,33 @@ export const compareJavaScriptExportShapesEvidenceValidated = (input) => {
|
|
|
148
148
|
}, result));
|
|
149
149
|
}
|
|
150
150
|
catch (cause) {
|
|
151
|
-
return workflowFailure(operation, cause);
|
|
151
|
+
return workflowFailure(operation, cause, input);
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
const workflowFailure = (operation, cause) =>
|
|
155
|
-
? new AnalysisInputError(operation)
|
|
156
|
-
:
|
|
154
|
+
const workflowFailure = (operation, cause, input) => cause instanceof z.ZodError
|
|
155
|
+
? err(new AnalysisInputError(operation, undefined, projectInputIssues(cause.issues, input)))
|
|
156
|
+
: cause instanceof TypeError &&
|
|
157
|
+
SAFE_APPLICATION_INPUT_CONSTRAINTS.has(cause.message)
|
|
158
|
+
? err(new AnalysisInputError(operation, undefined, [
|
|
159
|
+
{ path: [], reason: "invalid_value", message: cause.message },
|
|
160
|
+
]))
|
|
161
|
+
: err(new AnalysisProtocolError("JavaScript application workflow produced an invalid result", { cause }));
|
|
162
|
+
const SAFE_APPLICATION_INPUT_CONSTRAINTS = new Set([
|
|
163
|
+
"Evidence semantic identifier does not match its record",
|
|
164
|
+
"Application workflow requires authenticated analyze_javascript_application, reconcile_javascript_runtime, or project_managed_application_graph Evidence",
|
|
165
|
+
"JavaScript application Evidence authority or confidence is invalid",
|
|
166
|
+
"JavaScript application Evidence predicate does not match its result shape",
|
|
167
|
+
"JavaScript application Evidence subject does not match its result",
|
|
168
|
+
"Runtime reconciliation Evidence authority or confidence is invalid",
|
|
169
|
+
"Runtime reconciliation result references Evidence outside its envelope",
|
|
170
|
+
"Runtime reconciliation application layer is missing",
|
|
171
|
+
"Managed application graph Evidence authority or confidence is invalid",
|
|
172
|
+
"Managed application graph result references Evidence outside its envelope",
|
|
173
|
+
"Native handoff Evidence requires an artifact subject",
|
|
174
|
+
"Native handoff Evidence must be unique",
|
|
175
|
+
...[
|
|
176
|
+
"analyze_javascript_application",
|
|
177
|
+
"reconcile_javascript_runtime",
|
|
178
|
+
"project_managed_application_graph",
|
|
179
|
+
].map((operation) => `Evidence does not match the supported ${operation} contract`),
|
|
180
|
+
]);
|
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { analyzeParsedJavaScriptStaticSource } from "../domain/javascriptStaticAnalysis.js";
|
|
3
3
|
import { analyzeParsedJavaScriptSemantics } from "../domain/javascriptSemanticAnalysis.js";
|
|
4
4
|
import { parseJavaScriptSource } from "../domain/javascriptSourceParser.js";
|
|
5
|
+
import { hasValidSourceMapContents } from "../domain/sourceMapContents.js";
|
|
5
6
|
import { failedJavaScriptStaticAnalysis } from "../domain/javascriptStaticAnalysisHelpers.js";
|
|
6
7
|
import { analyzeJavaScriptJsonModule } from "./JavaScriptJsonModules.js";
|
|
7
8
|
/** Analyze every text source from the artifact without a result quota. */
|
|
@@ -176,14 +177,15 @@ const collectSourceMapOriginals = (file, maps) => {
|
|
|
176
177
|
const names = map.sources;
|
|
177
178
|
if (!Array.isArray(names))
|
|
178
179
|
return invalidSourceMap(file, "Source map has no sources array.");
|
|
179
|
-
const contents =
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
const contents = map.sourcesContent;
|
|
181
|
+
if (!hasValidSourceMapContents(names.length, contents))
|
|
182
|
+
return invalidSourceMap(file, "Source map sourcesContent must contain one string or null entry per source.");
|
|
182
183
|
const root = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
|
|
183
184
|
for (const [index, raw] of names.entries()) {
|
|
184
185
|
if (typeof raw !== "string")
|
|
185
186
|
return invalidSourceMap(file, "Source map contains a non-string source name.");
|
|
186
|
-
const
|
|
187
|
+
const rawContent = Array.isArray(contents) ? contents[index] : undefined;
|
|
188
|
+
const content = typeof rawContent === "string" ? rawContent : null;
|
|
187
189
|
sources.push({
|
|
188
190
|
source: resolveSourceName(root, raw),
|
|
189
191
|
content,
|
|
@@ -132,6 +132,11 @@ const expectedInventory = (snapshot) => {
|
|
|
132
132
|
const node = nodes.get(occurrence.artifact_id);
|
|
133
133
|
if (node === undefined)
|
|
134
134
|
throw new ArtifactReaderFailure("integrity", `Artifact inventory node is missing: ${occurrence.logical_path}`);
|
|
135
|
+
// Inventory occurrences can have content identities for directories too.
|
|
136
|
+
// Suffixes only describe file candidates; a directory such as
|
|
137
|
+
// node_modules/@zip.js remains a graph node and must never be opened.
|
|
138
|
+
if (occurrence.entry_kind !== "file")
|
|
139
|
+
continue;
|
|
135
140
|
if (occurrence.logical_path.toLowerCase().endsWith(".asar"))
|
|
136
141
|
containers.set(occurrence.logical_path, {
|
|
137
142
|
path: occurrence.logical_path,
|