rea-agents 3.2.1 → 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
package/dist/doctorRuntime.js
CHANGED
|
@@ -2,12 +2,9 @@ import { systemDoctorHost, } from "./application/Doctor.js";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { inspectSystemGhidraProvider } from "./ghidra/GhidraDoctor.js";
|
|
4
4
|
import { selectLinuxPrivateDisplayStrategy } from "./hopper/LinuxPrivateDisplayProbe.js";
|
|
5
|
-
import { parseConfig } from "./config.js";
|
|
6
|
-
import { SystemJavaScriptReplayHost } from "./replay/SystemJavaScriptReplayHost.js";
|
|
7
5
|
/** Compose provider diagnostics at the outer CLI adapter boundary. */
|
|
8
6
|
export const createSystemDoctorHost = () => systemDoctorHost({
|
|
9
7
|
providerInspections: async () => [await inspectSystemGhidraProvider()],
|
|
10
|
-
javascriptReplayCheck: inspectJavaScriptReplay,
|
|
11
8
|
linuxDemoRuntimeCheck: inspectLinuxPrivateDisplay,
|
|
12
9
|
});
|
|
13
10
|
const HOPPER_DEMO_HELPER_PATH = fileURLToPath(new URL("../scripts/hopper-demo-x11.py", import.meta.url));
|
|
@@ -48,41 +45,3 @@ const inspectLinuxPrivateDisplay = async () => {
|
|
|
48
45
|
: "Inspect the private-display diagnostic, correct the reported local condition, and rerun rea doctor --provider hopper.",
|
|
49
46
|
};
|
|
50
47
|
};
|
|
51
|
-
const inspectJavaScriptReplay = async () => {
|
|
52
|
-
const config = parseConfig(process.env);
|
|
53
|
-
if (!config.ok)
|
|
54
|
-
return {
|
|
55
|
-
name: "javascript-replay",
|
|
56
|
-
ok: false,
|
|
57
|
-
classification: "config_drift",
|
|
58
|
-
detail: config.error.message,
|
|
59
|
-
remediation: "Fix the reported REA_JAVASCRIPT_REPLAY_* configuration.",
|
|
60
|
-
};
|
|
61
|
-
if (config.value.javascriptReplayPolicy.status === "disabled")
|
|
62
|
-
return {
|
|
63
|
-
name: "javascript-replay",
|
|
64
|
-
ok: true,
|
|
65
|
-
classification: "healthy",
|
|
66
|
-
detail: "disabled by default; no extracted-module execution path is admitted",
|
|
67
|
-
};
|
|
68
|
-
try {
|
|
69
|
-
await new SystemJavaScriptReplayHost().probe(config.value.javascriptReplayPolicy);
|
|
70
|
-
return {
|
|
71
|
-
name: "javascript-replay",
|
|
72
|
-
ok: true,
|
|
73
|
-
classification: "healthy",
|
|
74
|
-
detail: "Linux namespace, seccomp, and delegated cgroup probes passed",
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
catch (cause) {
|
|
78
|
-
return {
|
|
79
|
-
name: "javascript-replay",
|
|
80
|
-
ok: false,
|
|
81
|
-
classification: process.platform === "linux"
|
|
82
|
-
? "missing_dependency"
|
|
83
|
-
: "unsupported_host",
|
|
84
|
-
detail: cause instanceof Error ? cause.message : "sandbox probe failed",
|
|
85
|
-
remediation: "Install and configure compatible Bubblewrap and systemd user cgroup delegation, or disable controlled replay.",
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalysisInputError, ArtifactOperationError, BinaryTargetError, BrowserObservationError, ConfigurationError, EvidenceFileError, EvidenceIntegrityError, HopperRemoteError, HopperProcessError, HopperStartError, HopperTimeoutError, NoBinaryOpenError,
|
|
1
|
+
import { AnalysisInputError, ArtifactOperationError, BinaryTargetError, BrowserObservationError, ConfigurationError, EvidenceFileError, EvidenceIntegrityError, HopperRemoteError, HopperProcessError, HopperStartError, HopperTimeoutError, NoBinaryOpenError, ProviderSelectionError, UnknownRegistryError, } from "./errors.js";
|
|
2
2
|
export const analysisErrorRemediationAction = (error) => {
|
|
3
3
|
if (error instanceof HopperTimeoutError)
|
|
4
4
|
return error.providerState === "busy"
|
|
@@ -16,25 +16,9 @@ export const analysisErrorRemediationAction = (error) => {
|
|
|
16
16
|
return "Correct the listed arguments and retry.";
|
|
17
17
|
if (error instanceof UnknownRegistryError && error.reason === "not-found")
|
|
18
18
|
return "Check that the unknown_id belongs to this session, then retry.";
|
|
19
|
-
if (error instanceof ReplayPlanStaleError)
|
|
20
|
-
return "Review the rebuilt replay plan and explicitly approve its new digest.";
|
|
21
|
-
if (error instanceof PermissionRequiredError) {
|
|
22
|
-
switch (error.remediation) {
|
|
23
|
-
case "configure":
|
|
24
|
-
return "Add the exact missing scope beneath the administrator ceiling, then retry.";
|
|
25
|
-
case "elicit":
|
|
26
|
-
return "Approve the exact missing scope, then retry the operation.";
|
|
27
|
-
case "restart":
|
|
28
|
-
return "Add the exact missing scope to the administrator configuration, then restart the registered MCP server or client.";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
19
|
return analysisErrorUserMessage(error);
|
|
32
20
|
};
|
|
33
21
|
export const analysisErrorCategory = (error) => {
|
|
34
|
-
if (error instanceof ReplayPlanStaleError)
|
|
35
|
-
return "integrity_mismatch";
|
|
36
|
-
if (error instanceof PermissionRequiredError)
|
|
37
|
-
return "permission_required";
|
|
38
22
|
if (error instanceof ProviderSelectionError &&
|
|
39
23
|
error.reason === "provider_unavailable")
|
|
40
24
|
return "unavailable";
|
|
@@ -44,7 +28,7 @@ export const analysisErrorCategory = (error) => {
|
|
|
44
28
|
return browserErrorCategory(error.reason);
|
|
45
29
|
if (error instanceof HopperRemoteError &&
|
|
46
30
|
error.diagnosticType === "authorization")
|
|
47
|
-
return "
|
|
31
|
+
return "unavailable";
|
|
48
32
|
if (error instanceof HopperProcessError || error instanceof HopperStartError)
|
|
49
33
|
return "unavailable";
|
|
50
34
|
if (error instanceof ArtifactOperationError)
|
|
@@ -69,7 +53,7 @@ const artifactErrorCategory = (reason) => {
|
|
|
69
53
|
return "truncated";
|
|
70
54
|
if (reason === "cancelled")
|
|
71
55
|
return "cancelled";
|
|
72
|
-
if (reason === "
|
|
56
|
+
if (reason === "unavailable")
|
|
73
57
|
return "unavailable";
|
|
74
58
|
return "execution_failure";
|
|
75
59
|
};
|
|
@@ -86,10 +70,6 @@ const STATIC_ERROR_CATEGORIES = {
|
|
|
86
70
|
BinaryTargetError: "unavailable",
|
|
87
71
|
};
|
|
88
72
|
export const analysisErrorUserMessage = (error) => {
|
|
89
|
-
if (error instanceof ReplayPlanStaleError)
|
|
90
|
-
return "The controlled replay plan changed before execution. Refresh the current state and try again.";
|
|
91
|
-
if (error instanceof PermissionRequiredError)
|
|
92
|
-
return "This operation needs additional local permission. Review the requested scope and remediation.";
|
|
93
73
|
if (error instanceof AnalysisInputError)
|
|
94
74
|
return "Analysis input is invalid. Check the arguments and try again.";
|
|
95
75
|
const hopperMessage = hopperErrorUserMessage(error);
|
|
@@ -184,10 +164,8 @@ const artifactMessage = (reason) => {
|
|
|
184
164
|
return "Artifact is too large to process safely. Narrow the requested path or use a smaller artifact.";
|
|
185
165
|
if (reason === "path")
|
|
186
166
|
return "Artifact contains an unsafe or conflicting internal path. Inspect the reported path and correct the artifact before retrying.";
|
|
187
|
-
if (reason === "policy")
|
|
188
|
-
return "Artifact integrity continuation is disabled by policy. Configure REA_ARTIFACT_INTEGRITY_CONTINUE_ENABLED=true and retry only if continuing after mismatches is approved.";
|
|
189
167
|
if (reason === "unavailable")
|
|
190
|
-
return "Artifact processing is unavailable for the current target or
|
|
168
|
+
return "Artifact processing is unavailable for the current target or host. Check artifact support and required tools.";
|
|
191
169
|
if (reason === "format" || reason === "integrity")
|
|
192
170
|
return "Artifact is invalid or has changed. Get a fresh copy and try again.";
|
|
193
171
|
return "Artifact could not be read or written. Check file access and try again.";
|
|
@@ -225,8 +203,6 @@ const KNOWN_ERROR_TAGS = {
|
|
|
225
203
|
ConfigurationError: true,
|
|
226
204
|
NoBinaryOpenError: true,
|
|
227
205
|
BinaryTargetError: true,
|
|
228
|
-
PermissionRequiredError: true,
|
|
229
|
-
ReplayPlanStaleError: true,
|
|
230
206
|
};
|
|
231
207
|
export const assertKnownAnalysisErrorTag = (tag) => {
|
|
232
208
|
if (KNOWN_ERROR_TAGS[tag] !== true)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisInputError, AnalysisTimeoutError, ArtifactOperationError, BinaryTargetError, BrowserObservationError, EvidenceFileError, EvidenceReferenceError, HopperCancelledError, HopperProcessError, HopperRemoteError, HopperTimeoutError,
|
|
1
|
+
import { AnalysisCancelledError, AnalysisCapabilityUnavailableError, AnalysisInputError, AnalysisTimeoutError, ArtifactOperationError, BinaryTargetError, BrowserObservationError, EvidenceFileError, EvidenceReferenceError, HopperCancelledError, HopperProcessError, HopperRemoteError, HopperTimeoutError, ProviderAdapterError, ProviderSelectionError, UnknownRegistryError, } from "./errors.js";
|
|
2
2
|
import { analysisErrorCategory, analysisErrorRemediationAction, analysisErrorUserMessage, assertKnownAnalysisErrorTag, } from "./analysisErrorPresentation.js";
|
|
3
3
|
/** Project expected failures into exhaustive, secret-safe caller fields. */
|
|
4
4
|
export const projectAnalysisError = (error) => {
|
|
@@ -12,11 +12,6 @@ export const projectAnalysisError = (error) => {
|
|
|
12
12
|
retryable: RETRYABLE_CODES.has(code),
|
|
13
13
|
remediation: {
|
|
14
14
|
action: analysisErrorRemediationAction(error),
|
|
15
|
-
restart_required: error instanceof PermissionRequiredError &&
|
|
16
|
-
error.remediation === "restart",
|
|
17
|
-
...(error instanceof PermissionRequiredError
|
|
18
|
-
? { elicitation_supported: error.remediation === "elicit" }
|
|
19
|
-
: {}),
|
|
20
15
|
},
|
|
21
16
|
...(details === undefined ? {} : { details }),
|
|
22
17
|
};
|
|
@@ -24,10 +19,6 @@ export const projectAnalysisError = (error) => {
|
|
|
24
19
|
const errorCode = (error) => {
|
|
25
20
|
if (error.cleanupIncomplete)
|
|
26
21
|
return "cleanup_incomplete";
|
|
27
|
-
if (error instanceof ReplayPlanStaleError)
|
|
28
|
-
return "plan_stale";
|
|
29
|
-
if (error instanceof PermissionRequiredError)
|
|
30
|
-
return "permission_required";
|
|
31
22
|
if (error instanceof ProviderSelectionError)
|
|
32
23
|
return error.reason === "provider_unavailable"
|
|
33
24
|
? "provider_unavailable"
|
|
@@ -81,8 +72,6 @@ const processCaptureCode = (error) => {
|
|
|
81
72
|
return "cleanup_incomplete";
|
|
82
73
|
if (error.userCategory === "cancelled")
|
|
83
74
|
return "cancelled";
|
|
84
|
-
if (error.userCategory === "permission_required")
|
|
85
|
-
return "permission_required";
|
|
86
75
|
return "process_capture_failed";
|
|
87
76
|
};
|
|
88
77
|
const STATIC_ERROR_CODES = {
|
|
@@ -109,10 +98,8 @@ const staticErrorCode = (tag) => {
|
|
|
109
98
|
case "ArtifactOperationError":
|
|
110
99
|
case "BrowserObservationError":
|
|
111
100
|
case "EvidenceFileError":
|
|
112
|
-
case "PermissionRequiredError":
|
|
113
101
|
case "ProcessCaptureError":
|
|
114
102
|
case "ProviderSelectionError":
|
|
115
|
-
case "ReplayPlanStaleError":
|
|
116
103
|
case "UnknownRegistryError":
|
|
117
104
|
throw new TypeError(`Unhandled specialized analysis error: ${tag}`);
|
|
118
105
|
default:
|
|
@@ -143,19 +130,6 @@ const requestErrorDetails = (error) => {
|
|
|
143
130
|
expected: error.expected,
|
|
144
131
|
actual: error.actual,
|
|
145
132
|
};
|
|
146
|
-
if (error instanceof ReplayPlanStaleError)
|
|
147
|
-
return {
|
|
148
|
-
approved_plan_digest: error.approvedDigest,
|
|
149
|
-
actual_plan_digest: error.actualDigest,
|
|
150
|
-
application_code_admitted: false,
|
|
151
|
-
};
|
|
152
|
-
if (error instanceof PermissionRequiredError)
|
|
153
|
-
return {
|
|
154
|
-
capability: error.requested.capability,
|
|
155
|
-
requested: scopeDetails(error.requested),
|
|
156
|
-
missing: missingScopeDetails(error.missing),
|
|
157
|
-
ceiling: error.ceiling === null ? null : scopeDetails(error.ceiling),
|
|
158
|
-
};
|
|
159
133
|
return undefined;
|
|
160
134
|
};
|
|
161
135
|
const artifactStateErrorDetails = (error) => {
|
|
@@ -208,8 +182,22 @@ const providerErrorDetails = (error) => {
|
|
|
208
182
|
? {}
|
|
209
183
|
: { diagnostics: error.diagnostics }),
|
|
210
184
|
};
|
|
211
|
-
if (error instanceof BrowserObservationError)
|
|
212
|
-
|
|
185
|
+
if (error instanceof BrowserObservationError) {
|
|
186
|
+
const primaryReason = primaryBrowserFailureReason(error);
|
|
187
|
+
return {
|
|
188
|
+
operation: error.operation,
|
|
189
|
+
reason: error.reason,
|
|
190
|
+
...(error.cleanupIncomplete
|
|
191
|
+
? {
|
|
192
|
+
cleanup: "incomplete",
|
|
193
|
+
resources: [...error.cleanupResources],
|
|
194
|
+
...(primaryReason === undefined
|
|
195
|
+
? {}
|
|
196
|
+
: { primary_reason: primaryReason }),
|
|
197
|
+
}
|
|
198
|
+
: {}),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
213
201
|
if (error instanceof HopperRemoteError)
|
|
214
202
|
return {
|
|
215
203
|
stage: "analysis",
|
|
@@ -233,6 +221,22 @@ const providerErrorDetails = (error) => {
|
|
|
233
221
|
};
|
|
234
222
|
return undefined;
|
|
235
223
|
};
|
|
224
|
+
const primaryBrowserFailureReason = (error) => {
|
|
225
|
+
if (!(error.cause instanceof AggregateError))
|
|
226
|
+
return undefined;
|
|
227
|
+
const primary = error.cause.errors[0];
|
|
228
|
+
if (primary instanceof BrowserObservationError)
|
|
229
|
+
return primary.reason;
|
|
230
|
+
if (primary instanceof AnalysisCancelledError)
|
|
231
|
+
return "cancelled";
|
|
232
|
+
if (primary instanceof AnalysisTimeoutError)
|
|
233
|
+
return "timeout";
|
|
234
|
+
if (typeof primary === "object" && primary !== null && "_tag" in primary)
|
|
235
|
+
return typeof primary._tag === "string"
|
|
236
|
+
? primary._tag
|
|
237
|
+
: "execution_failure";
|
|
238
|
+
return "execution_failure";
|
|
239
|
+
};
|
|
236
240
|
const lifecycleErrorDetails = (error) => {
|
|
237
241
|
if (error instanceof AnalysisCancelledError)
|
|
238
242
|
return { operation: error.operation, cleanup: "complete" };
|
|
@@ -260,27 +264,6 @@ const lifecycleErrorDetails = (error) => {
|
|
|
260
264
|
return { path: error.path };
|
|
261
265
|
return undefined;
|
|
262
266
|
};
|
|
263
|
-
const scopeDetails = (scope) => ({
|
|
264
|
-
capability: scope.capability,
|
|
265
|
-
roots: [...scope.roots],
|
|
266
|
-
executables: [...scope.executables],
|
|
267
|
-
environment_names: [...scope.environment_names],
|
|
268
|
-
...(scope.origins === undefined ? {} : { origins: [...scope.origins] }),
|
|
269
|
-
network: scope.network,
|
|
270
|
-
mount: scope.mount,
|
|
271
|
-
});
|
|
272
|
-
const missingScopeDetails = (scope) => ({
|
|
273
|
-
...(scope.roots === undefined ? {} : { roots: [...scope.roots] }),
|
|
274
|
-
...(scope.executables === undefined
|
|
275
|
-
? {}
|
|
276
|
-
: { executables: [...scope.executables] }),
|
|
277
|
-
...(scope.environment_names === undefined
|
|
278
|
-
? {}
|
|
279
|
-
: { environment_names: [...scope.environment_names] }),
|
|
280
|
-
...(scope.origins === undefined ? {} : { origins: [...scope.origins] }),
|
|
281
|
-
...(scope.network === undefined ? {} : { network: scope.network }),
|
|
282
|
-
...(scope.mount === undefined ? {} : { mount: scope.mount }),
|
|
283
|
-
});
|
|
284
267
|
const RETRYABLE_CODES = new Set([
|
|
285
268
|
"invalid_request",
|
|
286
269
|
"provider_timeout",
|
|
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { jsonObjectSchema } from "./jsonValue.js";
|
|
5
|
-
|
|
5
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
6
6
|
/** Concrete provider identity committed by an analysis profile. */
|
|
7
7
|
export const committedProviderSchema = z.object({
|
|
8
8
|
id: z.string().min(1),
|
|
@@ -5,13 +5,15 @@ import { analysisProfileSchema, analysisProfilesEqual, committedProviderSchema,
|
|
|
5
5
|
import { evidenceBundleForTarget, evidenceBundleSchema, parseEvidenceBundle, } from "./evidenceBundle.js";
|
|
6
6
|
import { evidenceLocationSchema, } from "./evidence.js";
|
|
7
7
|
import { jsonObjectSchema, jsonValueSchema, } from "./jsonValue.js";
|
|
8
|
-
|
|
8
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
9
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
9
10
|
const architectureSchema = z.enum(["x86", "x86_64", "arm", "arm64"]);
|
|
10
11
|
const formatSchema = z.enum([
|
|
11
12
|
"analysis-database",
|
|
12
13
|
"mach-o",
|
|
13
14
|
"elf",
|
|
14
15
|
"pe",
|
|
16
|
+
"dos-mz",
|
|
15
17
|
"zip",
|
|
16
18
|
"ipa",
|
|
17
19
|
"apk",
|
|
@@ -62,7 +64,7 @@ const bindingSchema = z
|
|
|
62
64
|
});
|
|
63
65
|
});
|
|
64
66
|
const entrySchema = z.object({
|
|
65
|
-
query_id:
|
|
67
|
+
query_id: prefixedDigestSchema("query"),
|
|
66
68
|
operation: z.string().min(1),
|
|
67
69
|
parameters: jsonObjectSchema,
|
|
68
70
|
execution: z.object({
|
|
@@ -167,6 +169,8 @@ export const parseAnalysisSnapshot = (input) => {
|
|
|
167
169
|
if (JSON.stringify(evidenceBundleForTarget(parsed.evidence_bundle, parsed.target.sha256)) !== JSON.stringify(parsed.evidence_bundle))
|
|
168
170
|
throw new TypeError("Analysis snapshot evidence contains records for another target");
|
|
169
171
|
const ids = new Set();
|
|
172
|
+
const boundEntries = [];
|
|
173
|
+
const index = createEvidenceIndex(parsed);
|
|
170
174
|
for (const entry of parsed.entries) {
|
|
171
175
|
if (entry.execution.provider.id !== parsed.binding.provider.id ||
|
|
172
176
|
entry.execution.provider.name !== parsed.binding.provider.name ||
|
|
@@ -178,11 +182,81 @@ export const parseAnalysisSnapshot = (input) => {
|
|
|
178
182
|
if (ids.has(entry.query_id))
|
|
179
183
|
throw new TypeError("Analysis snapshot contains duplicate queries");
|
|
180
184
|
ids.add(entry.query_id);
|
|
185
|
+
if (!entryHasMatchingEvidence(entry, parsed, index)) {
|
|
186
|
+
if (entryHasCorrespondingEvidence(entry, parsed, index))
|
|
187
|
+
throw new TypeError(`Analysis snapshot entry ${entry.operation} differs from its Evidence record`);
|
|
188
|
+
// Older snapshots may contain cache entries without profile-bound Evidence.
|
|
189
|
+
// Keep their Evidence bundle, but never replay those unbound values.
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
boundEntries.push(entry);
|
|
181
193
|
}
|
|
182
194
|
const sorted = [...parsed.entries].sort((left, right) => left.query_id.localeCompare(right.query_id));
|
|
183
195
|
if (JSON.stringify(parsed.entries) !== JSON.stringify(sorted))
|
|
184
196
|
throw new TypeError("Analysis snapshot entries are not canonical");
|
|
185
|
-
return parsed;
|
|
197
|
+
return { ...parsed, entries: boundEntries };
|
|
186
198
|
};
|
|
199
|
+
const createEvidenceIndex = (snapshot) => {
|
|
200
|
+
const matching = new Set();
|
|
201
|
+
const corresponding = new Set();
|
|
202
|
+
for (const evidence of snapshot.evidence_bundle.records) {
|
|
203
|
+
if (!isCorrespondingEvidence(evidence, snapshot))
|
|
204
|
+
continue;
|
|
205
|
+
const query = evidenceQueryKey(evidence);
|
|
206
|
+
corresponding.add(query);
|
|
207
|
+
matching.add(canonicalJson({
|
|
208
|
+
query,
|
|
209
|
+
normalized_result: evidence.normalized_result,
|
|
210
|
+
raw_result: evidence.raw_result,
|
|
211
|
+
limitations: evidence.limitations,
|
|
212
|
+
locations: evidence.locations,
|
|
213
|
+
subject: evidence.subject === null
|
|
214
|
+
? null
|
|
215
|
+
: {
|
|
216
|
+
local_path: evidence.subject.local_path,
|
|
217
|
+
sha256: evidence.subject.digest.sha256,
|
|
218
|
+
format: evidence.subject.format,
|
|
219
|
+
architecture: evidence.subject.architecture,
|
|
220
|
+
},
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
const result = { matching, corresponding };
|
|
224
|
+
return result;
|
|
225
|
+
};
|
|
226
|
+
const entryHasMatchingEvidence = (entry, snapshot, index) => index.matching.has(entryEvidenceKey(entry, snapshot.binding));
|
|
227
|
+
const entryHasCorrespondingEvidence = (entry, snapshot, index) => index.corresponding.has(entryQueryKey(entry, snapshot.binding));
|
|
228
|
+
const isCorrespondingEvidence = (evidence, snapshot) => evidence.predicate_type === "rea.analysis" &&
|
|
229
|
+
evidence.confidence === "observed" &&
|
|
230
|
+
evidence.authority === "shipped-artifact" &&
|
|
231
|
+
evidence.subject?.digest.sha256 === snapshot.target.sha256 &&
|
|
232
|
+
"analysis_profile" in evidence &&
|
|
233
|
+
analysisProfilesEqual(evidence.analysis_profile, snapshot.binding.analysis_profile);
|
|
234
|
+
const evidenceQueryKey = (evidence) => canonicalJson({
|
|
235
|
+
operation: evidence.operation,
|
|
236
|
+
parameters: evidence.parameters,
|
|
237
|
+
provider: evidence.provider,
|
|
238
|
+
analysis_profile: "analysis_profile" in evidence ? evidence.analysis_profile : null,
|
|
239
|
+
});
|
|
240
|
+
const entryQueryKey = (entry, binding) => canonicalJson({
|
|
241
|
+
operation: entry.operation,
|
|
242
|
+
parameters: entry.parameters,
|
|
243
|
+
provider: entry.execution.provider,
|
|
244
|
+
analysis_profile: binding.analysis_profile,
|
|
245
|
+
});
|
|
246
|
+
const entryEvidenceKey = (entry, binding) => canonicalJson({
|
|
247
|
+
query: entryQueryKey(entry, binding),
|
|
248
|
+
normalized_result: entry.execution.result,
|
|
249
|
+
raw_result: entry.execution.raw_result,
|
|
250
|
+
limitations: entry.execution.limitations,
|
|
251
|
+
locations: entry.execution.locations,
|
|
252
|
+
subject: entry.execution.subject === null
|
|
253
|
+
? null
|
|
254
|
+
: {
|
|
255
|
+
local_path: entry.execution.subject.path,
|
|
256
|
+
sha256: entry.execution.subject.sha256,
|
|
257
|
+
format: entry.execution.subject.format,
|
|
258
|
+
architecture: entry.execution.subject.architecture,
|
|
259
|
+
},
|
|
260
|
+
});
|
|
187
261
|
/** Serialize a validated snapshot with byte-stable canonical entry ordering. */
|
|
188
262
|
export const serializeAnalysisSnapshot = (snapshot) => `${canonicalJson(parseAnalysisSnapshot(snapshot))}\n`;
|
|
@@ -3,12 +3,13 @@ import canonicalize from "canonicalize";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { parseArtifactInventoryEvidence } from "./artifactInventoryEvidence.js";
|
|
5
5
|
import { evidenceSchema } from "./evidence.js";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
7
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
8
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
8
9
|
const pathSchema = z.string().min(1);
|
|
9
10
|
const componentSchema = z.strictObject({
|
|
10
11
|
path: pathSchema,
|
|
11
|
-
artifact_id:
|
|
12
|
+
artifact_id: prefixedDigestSchema("art"),
|
|
12
13
|
sha256: digestSchema,
|
|
13
14
|
format: z.string().min(1),
|
|
14
15
|
});
|
|
@@ -18,7 +19,7 @@ export const androidApplicationProjectionInputSchema = z.strictObject({
|
|
|
18
19
|
});
|
|
19
20
|
/** Deterministic, execution-free Android application inventory projection. */
|
|
20
21
|
export const androidApplicationProjectionResultSchema = z.strictObject({
|
|
21
|
-
projection_id:
|
|
22
|
+
projection_id: prefixedDigestSchema("adp"),
|
|
22
23
|
root_sha256: digestSchema,
|
|
23
24
|
root_format: z.literal("apk"),
|
|
24
25
|
source_evidence_ids: z.array(evidenceIdSchema).min(1),
|
|
@@ -3,12 +3,13 @@ import canonicalize from "canonicalize";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { parseArtifactInventoryEvidence } from "./artifactInventoryEvidence.js";
|
|
5
5
|
import { evidenceSchema } from "./evidence.js";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
7
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
8
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
8
9
|
const pathSchema = z.string().min(1);
|
|
9
10
|
const componentSchema = z.strictObject({
|
|
10
11
|
path: pathSchema,
|
|
11
|
-
artifact_id:
|
|
12
|
+
artifact_id: prefixedDigestSchema("art"),
|
|
12
13
|
sha256: digestSchema,
|
|
13
14
|
format: z.string().min(1),
|
|
14
15
|
});
|
|
@@ -18,7 +19,7 @@ export const appleApplicationProjectionInputSchema = z.strictObject({
|
|
|
18
19
|
});
|
|
19
20
|
/** Deterministic, execution-free Apple application inventory projection. */
|
|
20
21
|
export const appleApplicationProjectionResultSchema = z.strictObject({
|
|
21
|
-
projection_id:
|
|
22
|
+
projection_id: prefixedDigestSchema("aap"),
|
|
22
23
|
root_sha256: digestSchema,
|
|
23
24
|
root_format: z.literal("ipa"),
|
|
24
25
|
source_evidence_ids: z.array(evidenceIdSchema).min(1),
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { jsonValueSchema } from "./jsonValue.js";
|
|
3
|
+
import { AnalysisOutputError } from "./errors.js";
|
|
4
|
+
/** Caller-controlled page bounds for compiled Apple asset metadata. */
|
|
5
|
+
export const appleAssetCatalogInputSchema = z.strictObject({
|
|
6
|
+
offset: z.number().int().min(0).default(0),
|
|
7
|
+
limit: z.number().int().min(1).max(10_000).default(1_000),
|
|
8
|
+
});
|
|
9
|
+
const catalogSchema = z.strictObject({
|
|
10
|
+
path: z.string().min(1),
|
|
11
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
12
|
+
record_count: z.number().int().nonnegative(),
|
|
13
|
+
});
|
|
14
|
+
const recordSchema = z.strictObject({
|
|
15
|
+
catalog_path: z.string().min(1),
|
|
16
|
+
catalog_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
17
|
+
index: z.number().int().nonnegative(),
|
|
18
|
+
kind: z.enum(["catalog", "rendition"]),
|
|
19
|
+
asset_name: z.string().nullable(),
|
|
20
|
+
rendition_name: z.string().nullable(),
|
|
21
|
+
metadata: z.record(z.string(), jsonValueSchema),
|
|
22
|
+
});
|
|
23
|
+
const resourceKeyMatchSchema = z.strictObject({
|
|
24
|
+
source_node_id: z.string().min(1),
|
|
25
|
+
source_path: z.string().min(1),
|
|
26
|
+
source_archive_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
27
|
+
field: z.string().min(1),
|
|
28
|
+
key: z.string().min(1),
|
|
29
|
+
status: z.enum(["matched", "ambiguous", "unmatched"]),
|
|
30
|
+
renditions: z.array(z.strictObject({
|
|
31
|
+
catalog_path: z.string().min(1),
|
|
32
|
+
catalog_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
33
|
+
record_index: z.number().int().nonnegative(),
|
|
34
|
+
rendition_name: z.string().nullable(),
|
|
35
|
+
})),
|
|
36
|
+
});
|
|
37
|
+
/** Normalized result returned by asset catalog inspection. */
|
|
38
|
+
export const appleAssetCatalogResultSchema = z.strictObject({
|
|
39
|
+
target_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
40
|
+
catalogs: z.array(catalogSchema),
|
|
41
|
+
total_records: z.number().int().nonnegative(),
|
|
42
|
+
offset: z.number().int().nonnegative(),
|
|
43
|
+
limit: z.number().int().positive(),
|
|
44
|
+
records: z.array(recordSchema),
|
|
45
|
+
resource_key_matches: z.array(resourceKeyMatchSchema),
|
|
46
|
+
next_offset: z.number().int().nonnegative().nullable(),
|
|
47
|
+
truncated: z.boolean(),
|
|
48
|
+
limitations: z.array(z.string()),
|
|
49
|
+
});
|
|
50
|
+
/** Parse assetutil JSON records without discarding format-specific metadata. */
|
|
51
|
+
export const parseAppleAssetCatalogRecords = (value) => {
|
|
52
|
+
if (!Array.isArray(value))
|
|
53
|
+
throw new AnalysisOutputError("inspect_asset_catalog", "assetutil output must be a JSON array");
|
|
54
|
+
return value.map((record, index) => {
|
|
55
|
+
const parsed = z.record(z.string(), jsonValueSchema).safeParse(record);
|
|
56
|
+
if (!parsed.success)
|
|
57
|
+
throw new AnalysisOutputError("inspect_asset_catalog", `assetutil record ${index} is not a JSON object`, { cause: parsed.error });
|
|
58
|
+
return parsed.data;
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/** Project catalog records and apply stable global pagination. */
|
|
62
|
+
export const projectAppleAssetCatalogPage = (input) => {
|
|
63
|
+
const all = input.catalogs.flatMap((catalog) => catalog.records.map((metadata, index) => ({
|
|
64
|
+
catalog_path: catalog.path,
|
|
65
|
+
catalog_sha256: catalog.sha256,
|
|
66
|
+
index,
|
|
67
|
+
kind: typeof metadata.RenditionName === "string" ||
|
|
68
|
+
typeof metadata.Name === "string"
|
|
69
|
+
? "rendition"
|
|
70
|
+
: "catalog",
|
|
71
|
+
asset_name: typeof metadata.Name === "string" ? metadata.Name : null,
|
|
72
|
+
rendition_name: typeof metadata.RenditionName === "string"
|
|
73
|
+
? metadata.RenditionName
|
|
74
|
+
: null,
|
|
75
|
+
metadata,
|
|
76
|
+
})));
|
|
77
|
+
const records = all.slice(input.offset, input.offset + input.limit);
|
|
78
|
+
const next = input.offset + records.length;
|
|
79
|
+
const recordsByAssetName = new Map();
|
|
80
|
+
for (const record of all) {
|
|
81
|
+
if (record.kind !== "rendition" || record.asset_name === null)
|
|
82
|
+
continue;
|
|
83
|
+
const matches = recordsByAssetName.get(record.asset_name) ?? [];
|
|
84
|
+
matches.push(record);
|
|
85
|
+
recordsByAssetName.set(record.asset_name, matches);
|
|
86
|
+
}
|
|
87
|
+
const resourceKeyMatches = (input.resourceReferences ?? []).map((source) => {
|
|
88
|
+
const matches = recordsByAssetName.get(source.key) ?? [];
|
|
89
|
+
return {
|
|
90
|
+
source_node_id: source.sourceNodeId,
|
|
91
|
+
source_path: source.sourcePath,
|
|
92
|
+
source_archive_sha256: source.sourceArchiveSha256,
|
|
93
|
+
field: source.field,
|
|
94
|
+
key: source.key,
|
|
95
|
+
status: matches.length === 0
|
|
96
|
+
? "unmatched"
|
|
97
|
+
: matches.length === 1
|
|
98
|
+
? "matched"
|
|
99
|
+
: "ambiguous",
|
|
100
|
+
renditions: matches.map((record) => ({
|
|
101
|
+
catalog_path: record.catalog_path,
|
|
102
|
+
catalog_sha256: record.catalog_sha256,
|
|
103
|
+
record_index: record.index,
|
|
104
|
+
rendition_name: record.rendition_name,
|
|
105
|
+
})),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
return appleAssetCatalogResultSchema.parse({
|
|
109
|
+
target_sha256: input.targetSha256,
|
|
110
|
+
catalogs: input.catalogs.map(({ path, sha256, records: catalogRecords }) => ({
|
|
111
|
+
path,
|
|
112
|
+
sha256,
|
|
113
|
+
record_count: catalogRecords.length,
|
|
114
|
+
})),
|
|
115
|
+
total_records: all.length,
|
|
116
|
+
offset: input.offset,
|
|
117
|
+
limit: input.limit,
|
|
118
|
+
records,
|
|
119
|
+
resource_key_matches: resourceKeyMatches,
|
|
120
|
+
next_offset: next < all.length ? next : null,
|
|
121
|
+
truncated: input.offset > 0 || next < all.length,
|
|
122
|
+
limitations: [
|
|
123
|
+
"Rendition metadata is reported as emitted by the installed assetutil version; private fields and platform-specific interpretations are not normalized.",
|
|
124
|
+
"Asset catalog inspection does not decode or extract rendition image bytes.",
|
|
125
|
+
],
|
|
126
|
+
});
|
|
127
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import canonicalize from "canonicalize";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import {} from "./artifactGraph.js";
|
|
4
3
|
import { evidenceSchema } from "./evidence.js";
|
|
5
4
|
import { parseArtifactInventoryEvidence, } from "./artifactInventoryEvidence.js";
|
|
6
|
-
|
|
5
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
6
|
+
import { canonicalJson } from "./comparisonSemantics.js";
|
|
7
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
7
8
|
const comparisonStatusSchema = z.enum([
|
|
8
9
|
"unchanged",
|
|
9
10
|
"added",
|
|
@@ -62,8 +63,8 @@ const artifactChangeSchema = z.object({
|
|
|
62
63
|
/** Deterministic artifact comparison with every change returned inline. */
|
|
63
64
|
export const artifactComparisonResultSchema = z.object({
|
|
64
65
|
status: comparisonStatusSchema,
|
|
65
|
-
left_manifest_id:
|
|
66
|
-
right_manifest_id:
|
|
66
|
+
left_manifest_id: prefixedDigestSchema("agm"),
|
|
67
|
+
right_manifest_id: prefixedDigestSchema("agm"),
|
|
67
68
|
summary: z.object({
|
|
68
69
|
unchanged: z.number().int().min(0),
|
|
69
70
|
added: z.number().int().min(0),
|
|
@@ -234,12 +235,6 @@ const metadataChanged = (input, left, right) => left.media_type !== right.media_
|
|
|
234
235
|
JSON.stringify(left.limitations) !== JSON.stringify(right.limitations) ||
|
|
235
236
|
JSON.stringify(input.leftOccurrence?.limitations) !==
|
|
236
237
|
JSON.stringify(input.rightOccurrence?.limitations);
|
|
237
|
-
const canonicalJson = (value) => {
|
|
238
|
-
const encoded = canonicalize(value);
|
|
239
|
-
if (encoded === undefined)
|
|
240
|
-
throw new TypeError("Artifact comparison could not canonicalize graph data");
|
|
241
|
-
return encoded;
|
|
242
|
-
};
|
|
243
238
|
const nodeFor = (occurrence, nodes) => occurrence?.artifact_id === null || occurrence?.artifact_id === undefined
|
|
244
239
|
? undefined
|
|
245
240
|
: nodes.get(occurrence.artifact_id);
|
|
@@ -282,7 +277,8 @@ const summarize = (left, right, changes, covered) => {
|
|
|
282
277
|
counts[change.classification] += 1;
|
|
283
278
|
return {
|
|
284
279
|
unchanged: covered
|
|
285
|
-
? Math.max(0,
|
|
280
|
+
? Math.max(0, left.occurrences.length -
|
|
281
|
+
counts.removed -
|
|
286
282
|
counts.changed -
|
|
287
283
|
counts.contradiction -
|
|
288
284
|
counts.unknown)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
2
3
|
const sha256Schema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
3
|
-
const artifactIdSchema =
|
|
4
|
-
const occurrenceIdSchema =
|
|
5
|
-
const edgeIdSchema =
|
|
6
|
-
const manifestIdSchema =
|
|
7
|
-
const extractionIdSchema =
|
|
8
|
-
const contradictionIdSchema =
|
|
4
|
+
const artifactIdSchema = prefixedDigestSchema("art");
|
|
5
|
+
const occurrenceIdSchema = prefixedDigestSchema("occ");
|
|
6
|
+
const edgeIdSchema = prefixedDigestSchema("edge");
|
|
7
|
+
const manifestIdSchema = prefixedDigestSchema("agm");
|
|
8
|
+
const extractionIdSchema = prefixedDigestSchema("aex");
|
|
9
|
+
const contradictionIdSchema = prefixedDigestSchema("ic");
|
|
9
10
|
const boundedRelativePathSchema = z
|
|
10
11
|
.string()
|
|
11
12
|
.min(1)
|
|
@@ -40,6 +41,7 @@ const artifactFormatSchema = z.enum([
|
|
|
40
41
|
"mach-o",
|
|
41
42
|
"elf",
|
|
42
43
|
"pe",
|
|
44
|
+
"dos-mz",
|
|
43
45
|
"hopper",
|
|
44
46
|
"analysis-database",
|
|
45
47
|
"ipa",
|