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
|
@@ -15,7 +15,7 @@ export const inspectElectronNativeNode = (node, context) => {
|
|
|
15
15
|
inspectReExport(node, context);
|
|
16
16
|
};
|
|
17
17
|
const inspectImport = (node, context) => {
|
|
18
|
-
if (!isNativeSpecifier(node.source.value))
|
|
18
|
+
if (!isNativeSpecifier(node.source.value, "import"))
|
|
19
19
|
return;
|
|
20
20
|
const members = node.specifiers.map((specifier) => {
|
|
21
21
|
if (t.isImportDefaultSpecifier(specifier))
|
|
@@ -29,13 +29,14 @@ const inspectImport = (node, context) => {
|
|
|
29
29
|
node,
|
|
30
30
|
specifier: node.source.value,
|
|
31
31
|
kind: "import",
|
|
32
|
+
moduleKind: "import",
|
|
32
33
|
members,
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
36
|
const inspectNamedExport = (node, context) => {
|
|
36
37
|
if (node.source === null ||
|
|
37
38
|
node.source === undefined ||
|
|
38
|
-
!isNativeSpecifier(node.source.value))
|
|
39
|
+
!isNativeSpecifier(node.source.value, "import"))
|
|
39
40
|
return;
|
|
40
41
|
const members = node.specifiers.map((specifier) => {
|
|
41
42
|
if (t.isExportSpecifier(specifier))
|
|
@@ -47,17 +48,20 @@ const inspectNamedExport = (node, context) => {
|
|
|
47
48
|
node,
|
|
48
49
|
specifier: node.source.value,
|
|
49
50
|
kind: "re-export",
|
|
51
|
+
moduleKind: "import",
|
|
50
52
|
members,
|
|
51
53
|
});
|
|
52
54
|
};
|
|
53
55
|
const inspectExportAll = (node, context) => {
|
|
54
|
-
if (node.source === undefined ||
|
|
56
|
+
if (node.source === undefined ||
|
|
57
|
+
!isNativeSpecifier(node.source.value, "import"))
|
|
55
58
|
return;
|
|
56
59
|
addBinding({
|
|
57
60
|
context,
|
|
58
61
|
node,
|
|
59
62
|
specifier: node.source.value,
|
|
60
63
|
kind: "re-export",
|
|
64
|
+
moduleKind: "import",
|
|
61
65
|
members: ["*"],
|
|
62
66
|
});
|
|
63
67
|
};
|
|
@@ -70,6 +74,7 @@ const inspectRequireBinding = (node, context) => {
|
|
|
70
74
|
node,
|
|
71
75
|
specifier: required.specifier,
|
|
72
76
|
kind: "require",
|
|
77
|
+
moduleKind: "require",
|
|
73
78
|
members: required.member === null ? bindingMembers(node.id) : [required.member],
|
|
74
79
|
});
|
|
75
80
|
};
|
|
@@ -82,6 +87,7 @@ const inspectReExport = (node, context) => {
|
|
|
82
87
|
node,
|
|
83
88
|
specifier: required.specifier,
|
|
84
89
|
kind: "re-export",
|
|
90
|
+
moduleKind: "require",
|
|
85
91
|
members: [required.member ?? exportedMember(node.left) ?? "*"],
|
|
86
92
|
});
|
|
87
93
|
};
|
|
@@ -98,6 +104,7 @@ const addBinding = (input) => {
|
|
|
98
104
|
value: {
|
|
99
105
|
specifier,
|
|
100
106
|
binding_kind: kind,
|
|
107
|
+
module_kind: input.moduleKind,
|
|
101
108
|
members,
|
|
102
109
|
module_key: null,
|
|
103
110
|
location: range(node),
|
|
@@ -122,7 +129,7 @@ const nativeRequire = (node) => {
|
|
|
122
129
|
!name.includes("__webpack_require__"))
|
|
123
130
|
return undefined;
|
|
124
131
|
const specifier = stringValue(argumentNode(node.arguments[0]));
|
|
125
|
-
return specifier !== undefined && isNativeSpecifier(specifier)
|
|
132
|
+
return specifier !== undefined && isNativeSpecifier(specifier, "require")
|
|
126
133
|
? { specifier, member: null }
|
|
127
134
|
: undefined;
|
|
128
135
|
};
|
|
@@ -151,7 +158,9 @@ const exportedMember = (node) => {
|
|
|
151
158
|
return name.slice("exports.".length);
|
|
152
159
|
return undefined;
|
|
153
160
|
};
|
|
154
|
-
const isNativeSpecifier = (specifier) => {
|
|
155
|
-
const path =
|
|
161
|
+
const isNativeSpecifier = (specifier, moduleKind) => {
|
|
162
|
+
const path = moduleKind === "require"
|
|
163
|
+
? specifier
|
|
164
|
+
: (specifier.split("#", 1)[0]?.split("?", 1)[0] ?? "");
|
|
156
165
|
return path.toLowerCase().endsWith(".node");
|
|
157
166
|
};
|
package/dist/domain/errors.js
CHANGED
|
@@ -26,8 +26,6 @@ const ANALYSIS_ERROR_TAGS = [
|
|
|
26
26
|
"ConfigurationError",
|
|
27
27
|
"NoBinaryOpenError",
|
|
28
28
|
"BinaryTargetError",
|
|
29
|
-
"PermissionRequiredError",
|
|
30
|
-
"ReplayPlanStaleError",
|
|
31
29
|
];
|
|
32
30
|
/** Base class for expected analysis, provider, and session failures. */
|
|
33
31
|
export class AnalysisError extends Error {
|
|
@@ -162,10 +160,20 @@ export class BrowserObservationError extends AnalysisError {
|
|
|
162
160
|
operation;
|
|
163
161
|
reason;
|
|
164
162
|
_tag = "BrowserObservationError";
|
|
163
|
+
cleanupIncomplete;
|
|
164
|
+
cleanupResources;
|
|
165
|
+
userCategory;
|
|
165
166
|
constructor(operation, reason, options) {
|
|
166
167
|
super(`Browser observation ${operation} failed: ${reason}`, options);
|
|
167
168
|
this.operation = operation;
|
|
168
169
|
this.reason = reason;
|
|
170
|
+
this.cleanupIncomplete = reason === "cleanup_failed";
|
|
171
|
+
this.cleanupResources =
|
|
172
|
+
reason === "cleanup_failed" ? ["browser_transport"] : [];
|
|
173
|
+
this.userCategory =
|
|
174
|
+
reason === "cancelled" || options?.cause instanceof AnalysisCancelledError
|
|
175
|
+
? "cancelled"
|
|
176
|
+
: undefined;
|
|
169
177
|
}
|
|
170
178
|
}
|
|
171
179
|
/** Artifact inventory or extraction failed a typed safety boundary. */
|
|
@@ -314,29 +322,3 @@ export class BinaryTargetError extends AnalysisError {
|
|
|
314
322
|
this.path = path;
|
|
315
323
|
}
|
|
316
324
|
}
|
|
317
|
-
/** Exact denied authority used by both CLI and MCP remediation. */
|
|
318
|
-
export class PermissionRequiredError extends AnalysisError {
|
|
319
|
-
_tag = "PermissionRequiredError";
|
|
320
|
-
requested;
|
|
321
|
-
missing;
|
|
322
|
-
ceiling;
|
|
323
|
-
remediation;
|
|
324
|
-
constructor(context) {
|
|
325
|
-
super(`Permission required for ${context.requested.capability}`);
|
|
326
|
-
this.requested = context.requested;
|
|
327
|
-
this.missing = context.missing;
|
|
328
|
-
this.ceiling = context.ceiling;
|
|
329
|
-
this.remediation = context.remediation;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
/** Approved replay commitment no longer matches the immediately rebuilt plan. */
|
|
333
|
-
export class ReplayPlanStaleError extends AnalysisError {
|
|
334
|
-
approvedDigest;
|
|
335
|
-
actualDigest;
|
|
336
|
-
_tag = "ReplayPlanStaleError";
|
|
337
|
-
constructor(approvedDigest, actualDigest) {
|
|
338
|
-
super("Controlled replay plan changed before execution");
|
|
339
|
-
this.approvedDigest = approvedDigest;
|
|
340
|
-
this.actualDigest = actualDigest;
|
|
341
|
-
}
|
|
342
|
-
}
|
package/dist/domain/evidence.js
CHANGED
|
@@ -3,7 +3,8 @@ import canonicalize from "canonicalize";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { analysisProfileSchema, } from "./analysisProfile.js";
|
|
5
5
|
import { jsonValueSchema } from "./jsonValue.js";
|
|
6
|
-
|
|
6
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
7
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
8
|
/** Provider identity schema shared by evidence-bearing persistence formats. */
|
|
8
9
|
export const providerSchema = z.object({
|
|
9
10
|
id: z.string().min(1),
|
|
@@ -19,6 +20,7 @@ const subjectSchema = z.object({
|
|
|
19
20
|
"mach-o",
|
|
20
21
|
"elf",
|
|
21
22
|
"pe",
|
|
23
|
+
"dos-mz",
|
|
22
24
|
"zip",
|
|
23
25
|
"ipa",
|
|
24
26
|
"apk",
|
|
@@ -72,7 +74,7 @@ const executionEnvironmentSchema = z.object({
|
|
|
72
74
|
});
|
|
73
75
|
const evidenceBaseSchema = z
|
|
74
76
|
.object({
|
|
75
|
-
evidence_id:
|
|
77
|
+
evidence_id: prefixedDigestSchema("ev"),
|
|
76
78
|
subject: subjectSchema.nullable(),
|
|
77
79
|
provider: providerSchema,
|
|
78
80
|
predicate_type: z.string().min(1),
|
|
@@ -85,7 +87,7 @@ const evidenceBaseSchema = z
|
|
|
85
87
|
environment: executionEnvironmentSchema.nullable(),
|
|
86
88
|
limitations: z.array(z.string()),
|
|
87
89
|
locations: z.array(evidenceLocationSchema),
|
|
88
|
-
evidence_links: z.array(
|
|
90
|
+
evidence_links: z.array(prefixedDigestSchema("ev")),
|
|
89
91
|
})
|
|
90
92
|
.strict();
|
|
91
93
|
/** Object envelope used to specialize caller-visible Evidence result schemas. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
5
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
5
6
|
const claimIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
|
|
6
7
|
/** Terminal outcome recorded for one verifier claim. */
|
|
7
8
|
export const evidenceCompletionStatusSchema = z.enum([
|
|
@@ -27,7 +28,7 @@ const completionSummarySchema = z.strictObject({
|
|
|
27
28
|
complete: z.boolean(),
|
|
28
29
|
});
|
|
29
30
|
const completionLedgerObjectSchema = z.strictObject({
|
|
30
|
-
ledger_id:
|
|
31
|
+
ledger_id: prefixedDigestSchema("ecl"),
|
|
31
32
|
records: z.array(evidenceCompletionRecordSchema).min(1),
|
|
32
33
|
summary: completionSummarySchema,
|
|
33
34
|
});
|
|
@@ -23,27 +23,33 @@ export const functionMatch = (left, right) => {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
export const normalizeCfg = (blocks) => {
|
|
26
|
-
const parsed =
|
|
27
|
-
|
|
28
|
-
start
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (ordered.some(({ start, end }) => (end ?? 0n) <= (start ?? 0n)))
|
|
26
|
+
const parsed = [];
|
|
27
|
+
for (const block of blocks) {
|
|
28
|
+
const start = parseAddress(block.start);
|
|
29
|
+
const end = parseAddress(block.end);
|
|
30
|
+
if (start === null || end === null || end <= start)
|
|
31
|
+
return null;
|
|
32
|
+
parsed.push({ block, start, end });
|
|
33
|
+
}
|
|
34
|
+
const ordered = parsed.sort((left, right) => left.start < right.start ? -1 : left.start > right.start ? 1 : 0);
|
|
35
|
+
if (new Set(ordered.map(({ start }) => start)).size !== ordered.length)
|
|
37
36
|
return null;
|
|
38
|
-
const indices = new Map(ordered.map(({
|
|
37
|
+
const indices = new Map(ordered.map(({ start }, index) => [start, index]));
|
|
39
38
|
const graph = [];
|
|
40
39
|
for (const { block, start, end } of ordered) {
|
|
41
|
-
const successors =
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const successors = [];
|
|
41
|
+
for (const address of block.successors) {
|
|
42
|
+
const parsedAddress = parseAddress(address);
|
|
43
|
+
if (parsedAddress === null)
|
|
44
|
+
return null;
|
|
45
|
+
const index = indices.get(parsedAddress);
|
|
46
|
+
if (index === undefined)
|
|
47
|
+
return null;
|
|
48
|
+
successors.push(index);
|
|
49
|
+
}
|
|
44
50
|
graph.push({
|
|
45
|
-
size: String(
|
|
46
|
-
successors: successors.sort((left, right) =>
|
|
51
|
+
size: String(end - start),
|
|
52
|
+
successors: successors.sort((left, right) => left - right),
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
55
|
return graph;
|
|
@@ -132,7 +138,7 @@ export const combineCoverage = (left, right) => {
|
|
|
132
138
|
};
|
|
133
139
|
};
|
|
134
140
|
export const project = (collection, mapper) => collection.items.map(mapper);
|
|
135
|
-
export const isAutoName = (name) => /^(?:sub_[0-9a-f]+|fcn\.)
|
|
141
|
+
export const isAutoName = (name) => /^(?:sub_[0-9a-f]+|fcn\.[0-9a-f]+)$/iu.test(name);
|
|
136
142
|
const parseAddress = (value) => /^0x[0-9a-f]+$/iu.test(value) ? BigInt(value) : null;
|
|
137
143
|
const relativeAddress = (value, base) => {
|
|
138
144
|
const parsed = parseAddress(value);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import canonicalize from "canonicalize";
|
|
1
|
+
import { canonicalDigest, canonicalJson as encodeCanonicalJson, } from "./comparisonSemantics.js";
|
|
3
2
|
export const dimensionResult = (input) => {
|
|
4
3
|
const context = {
|
|
5
4
|
dimension: input.dimension,
|
|
@@ -56,9 +55,6 @@ export const summarize = (dimensions) => ({
|
|
|
56
55
|
unknown: dimensions.filter(({ status }) => status === "unknown").length,
|
|
57
56
|
});
|
|
58
57
|
export const canonicalJson = (value) => {
|
|
59
|
-
|
|
60
|
-
if (encoded === undefined)
|
|
61
|
-
throw new TypeError("Function comparison could not canonicalize data");
|
|
62
|
-
return encoded;
|
|
58
|
+
return encodeCanonicalJson(value, "Function comparison");
|
|
63
59
|
};
|
|
64
|
-
const digest = (value) =>
|
|
60
|
+
const digest = (value) => canonicalDigest(value, "Function comparison");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { evidenceSchema } from "./evidence.js";
|
|
3
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
4
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
3
5
|
const comparisonStatusSchema = z.enum([
|
|
4
6
|
"unchanged",
|
|
5
7
|
"changed",
|
|
@@ -16,8 +18,7 @@ const dimensionNameSchema = z.enum([
|
|
|
16
18
|
"strings_names",
|
|
17
19
|
"cfg",
|
|
18
20
|
]);
|
|
19
|
-
const evidenceIdSchema =
|
|
20
|
-
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
21
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
21
22
|
/** Inputs for explicit function-to-function comparison. */
|
|
22
23
|
export const functionComparisonInputSchema = z.strictObject({
|
|
23
24
|
left: evidenceSchema,
|
|
@@ -38,6 +38,103 @@ const segmentSchema = z.object({
|
|
|
38
38
|
const unavailableAnalysisFactSchema = z
|
|
39
39
|
.object({ available: z.literal(false), reason: z.string() })
|
|
40
40
|
.strict();
|
|
41
|
+
/** Complete observed function-body ranges; every range endpoint is inclusive. */
|
|
42
|
+
export const functionBodySchema = z.discriminatedUnion("available", [
|
|
43
|
+
unavailableAnalysisFactSchema,
|
|
44
|
+
z
|
|
45
|
+
.strictObject({
|
|
46
|
+
available: z.literal(true),
|
|
47
|
+
provenance: z.string().min(1),
|
|
48
|
+
ranges: z.array(z.strictObject({
|
|
49
|
+
start: z.string(),
|
|
50
|
+
end: z
|
|
51
|
+
.string()
|
|
52
|
+
.describe("Inclusive last address of this observed body range."),
|
|
53
|
+
})),
|
|
54
|
+
total_bytes: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
55
|
+
span_bytes: z
|
|
56
|
+
.number()
|
|
57
|
+
.int()
|
|
58
|
+
.min(0)
|
|
59
|
+
.max(Number.MAX_SAFE_INTEGER)
|
|
60
|
+
.nullable(),
|
|
61
|
+
non_contiguous: z.boolean(),
|
|
62
|
+
contains_entry: z.boolean(),
|
|
63
|
+
})
|
|
64
|
+
.superRefine((body, context) => {
|
|
65
|
+
let total = 0n;
|
|
66
|
+
const bounds = new Map();
|
|
67
|
+
const closedSpaces = new Set();
|
|
68
|
+
let previousSpace = null;
|
|
69
|
+
for (const range of body.ranges) {
|
|
70
|
+
const start = addressCoordinate(range.start);
|
|
71
|
+
const end = addressCoordinate(range.end);
|
|
72
|
+
if (start === null ||
|
|
73
|
+
end === null ||
|
|
74
|
+
start.space !== end.space ||
|
|
75
|
+
end.offset < start.offset) {
|
|
76
|
+
context.addIssue({
|
|
77
|
+
code: "custom",
|
|
78
|
+
message: "Function body range has invalid inclusive endpoints",
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (previousSpace !== null && previousSpace !== start.space)
|
|
83
|
+
closedSpaces.add(previousSpace);
|
|
84
|
+
const previous = bounds.get(start.space);
|
|
85
|
+
if (closedSpaces.has(start.space) ||
|
|
86
|
+
(previous !== undefined && start.offset <= previous.end + 1n)) {
|
|
87
|
+
context.addIssue({
|
|
88
|
+
code: "custom",
|
|
89
|
+
message: "Function body ranges must be ordered, disjoint and maximal within each address space",
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
bounds.set(start.space, {
|
|
94
|
+
start: previous?.start ?? start.offset,
|
|
95
|
+
end: end.offset,
|
|
96
|
+
});
|
|
97
|
+
previousSpace = start.space;
|
|
98
|
+
total += end.offset - start.offset + 1n;
|
|
99
|
+
}
|
|
100
|
+
const onlyBounds = bounds.size === 1 ? [...bounds.values()][0] : undefined;
|
|
101
|
+
const span = bounds.size === 0
|
|
102
|
+
? 0n
|
|
103
|
+
: onlyBounds === undefined
|
|
104
|
+
? null
|
|
105
|
+
: onlyBounds.end - onlyBounds.start + 1n;
|
|
106
|
+
const reportedSpan = body.span_bytes === null ? null : BigInt(body.span_bytes);
|
|
107
|
+
if (total !== BigInt(body.total_bytes) ||
|
|
108
|
+
span !== reportedSpan ||
|
|
109
|
+
body.non_contiguous !== body.ranges.length > 1)
|
|
110
|
+
context.addIssue({
|
|
111
|
+
code: "custom",
|
|
112
|
+
message: "Function body counts, enclosing span or contiguity disagree with inclusive ranges",
|
|
113
|
+
});
|
|
114
|
+
}),
|
|
115
|
+
]);
|
|
116
|
+
const unknownFunctionBody = () => functionBodySchema.default({
|
|
117
|
+
available: false,
|
|
118
|
+
reason: "The provider did not report complete function body ranges.",
|
|
119
|
+
});
|
|
120
|
+
/** Check the declared entry membership against complete, inclusive body ranges. */
|
|
121
|
+
export const functionBodyEntryAgrees = (body, address) => {
|
|
122
|
+
if (!body.available)
|
|
123
|
+
return true;
|
|
124
|
+
const entry = addressCoordinate(address);
|
|
125
|
+
if (entry === null)
|
|
126
|
+
return false;
|
|
127
|
+
const contains = body.ranges.some((range) => {
|
|
128
|
+
const start = addressCoordinate(range.start);
|
|
129
|
+
const end = addressCoordinate(range.end);
|
|
130
|
+
return (start !== null &&
|
|
131
|
+
end !== null &&
|
|
132
|
+
start.space === entry.space &&
|
|
133
|
+
entry.offset >= start.offset &&
|
|
134
|
+
entry.offset <= end.offset);
|
|
135
|
+
});
|
|
136
|
+
return contains === body.contains_entry;
|
|
137
|
+
};
|
|
41
138
|
export const procedureClassificationSchema = z
|
|
42
139
|
.object({
|
|
43
140
|
external: z.boolean(),
|
|
@@ -51,8 +148,16 @@ export const procedureIdentitySchema = z
|
|
|
51
148
|
address: z.string(),
|
|
52
149
|
name: z.string(),
|
|
53
150
|
classification: procedureClassificationSchema.nullable().default(null),
|
|
151
|
+
body: unknownFunctionBody(),
|
|
54
152
|
})
|
|
55
|
-
.strict()
|
|
153
|
+
.strict()
|
|
154
|
+
.superRefine((identity, context) => {
|
|
155
|
+
if (!functionBodyEntryAgrees(identity.body, identity.address))
|
|
156
|
+
context.addIssue({
|
|
157
|
+
code: "custom",
|
|
158
|
+
message: "Function body entry membership disagrees with procedure identity",
|
|
159
|
+
});
|
|
160
|
+
});
|
|
56
161
|
export const localVariableSchema = z
|
|
57
162
|
.object({
|
|
58
163
|
description: z.string(),
|
|
@@ -102,15 +207,10 @@ const referenceEdgeSchema = z
|
|
|
102
207
|
.strict();
|
|
103
208
|
export const functionDossierSchema = z
|
|
104
209
|
.object({
|
|
105
|
-
procedure:
|
|
106
|
-
.object({
|
|
107
|
-
address: z.string(),
|
|
108
|
-
name: z.string(),
|
|
109
|
-
classification: procedureClassificationSchema.nullable().default(null),
|
|
210
|
+
procedure: procedureIdentitySchema.safeExtend({
|
|
110
211
|
signature: z.string().nullable(),
|
|
111
212
|
locals: z.array(localVariableSchema),
|
|
112
|
-
})
|
|
113
|
-
.strict(),
|
|
213
|
+
}),
|
|
114
214
|
pseudocode: z.string(),
|
|
115
215
|
assembly: z.array(z.string()),
|
|
116
216
|
comments: z.array(z
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { isAbsolute } from "node:path";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
|
4
3
|
import { javaScriptSemanticGraphSchema } from "./javascriptSemanticGraph.js";
|
|
4
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
5
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
5
6
|
const countSchema = z.number().int().min(0);
|
|
6
|
-
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
7
7
|
/** Public target-free request for static JavaScript application analysis. */
|
|
8
8
|
export const analyzeJavaScriptApplicationInputSchema = z.strictObject({
|
|
9
|
-
input_path: z
|
|
10
|
-
.string()
|
|
11
|
-
.min(1)
|
|
12
|
-
.refine(isAbsolute, "JavaScript application input path must be absolute"),
|
|
9
|
+
input_path: z.string().min(1),
|
|
13
10
|
format: z.enum(["auto", "asar", "directory"]).default("auto"),
|
|
14
11
|
});
|
|
15
12
|
/** Compact counts for the high-level Electron architecture/security surface. */
|
|
@@ -54,7 +51,7 @@ export const javascriptApplicationAnalysisResultSchema = z
|
|
|
54
51
|
input_path: z.string().min(1),
|
|
55
52
|
format: z.enum(["asar", "directory"]),
|
|
56
53
|
root_artifact_sha256: digestSchema,
|
|
57
|
-
inventory_manifest_id:
|
|
54
|
+
inventory_manifest_id: prefixedDigestSchema("agm"),
|
|
58
55
|
inventory_graph_sha256: digestSchema,
|
|
59
56
|
graph: javascriptApplicationGraphSchema,
|
|
60
57
|
summary: electronBoundarySummarySchema,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
3
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
3
4
|
const boundedTextSchema = z.string().min(1);
|
|
4
5
|
const boundedKeySchema = z.string().min(1);
|
|
5
6
|
const unsafePathSegments = new Set(["", ".", ".."]);
|
|
@@ -59,7 +60,7 @@ const unavailableFactSchema = z.strictObject({
|
|
|
59
60
|
const availableArtifactSchema = z
|
|
60
61
|
.strictObject({
|
|
61
62
|
available: z.literal(true),
|
|
62
|
-
artifact_id:
|
|
63
|
+
artifact_id: prefixedDigestSchema("art"),
|
|
63
64
|
sha256: digestSchema,
|
|
64
65
|
})
|
|
65
66
|
.superRefine((artifact, context) => {
|
|
@@ -229,7 +230,7 @@ const applicationGraphEvidenceBaseSchema = z.strictObject({
|
|
|
229
230
|
extractor: applicationExtractorSchema,
|
|
230
231
|
coverage: applicationCoverageSchema,
|
|
231
232
|
limitations: z.array(boundedTextSchema),
|
|
232
|
-
evidence_ids: z.array(
|
|
233
|
+
evidence_ids: z.array(prefixedDigestSchema("ev")),
|
|
233
234
|
});
|
|
234
235
|
const checkAuthorityState = (evidence, context) => {
|
|
235
236
|
if (evidence.authority === "static-relationship-inference" &&
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { applicationCoverageSchema, applicationGraphEvidenceSchema, applicationNodeIdentitySchema, } from "./javascriptApplicationEvidenceSchemas.js";
|
|
3
3
|
import { jsonValueSchema } from "./jsonValue.js";
|
|
4
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
4
5
|
const boundedTextSchema = z.string().min(1);
|
|
5
6
|
/** Node kinds admitted by JavaScript Application Graph. */
|
|
6
7
|
export const JAVASCRIPT_APPLICATION_NODE_KINDS = [
|
|
@@ -67,7 +68,7 @@ const applicationNodeObservationInputSchema = z.strictObject({
|
|
|
67
68
|
});
|
|
68
69
|
/** One immutable, evidence-bearing observation attached to an entity. */
|
|
69
70
|
export const applicationNodeObservationSchema = applicationNodeObservationInputSchema.extend({
|
|
70
|
-
observation_id:
|
|
71
|
+
observation_id: prefixedDigestSchema("jag_observation"),
|
|
71
72
|
identifier_strategy: z.strictObject({
|
|
72
73
|
strategy: z.literal("semantic-content-sha256"),
|
|
73
74
|
stability: z.literal("observation-exact"),
|
|
@@ -81,22 +82,22 @@ export const applicationNodeInputSchema = z.strictObject({
|
|
|
81
82
|
});
|
|
82
83
|
/** One stable application entity with one or more bounded observations. */
|
|
83
84
|
export const applicationNodeSchema = z.strictObject({
|
|
84
|
-
node_id:
|
|
85
|
+
node_id: prefixedDigestSchema("jag_node"),
|
|
85
86
|
kind: applicationNodeKindSchema,
|
|
86
87
|
identity: applicationNodeIdentitySchema,
|
|
87
88
|
observations: z.array(applicationNodeObservationSchema).min(1),
|
|
88
89
|
});
|
|
89
90
|
/** One directed relationship before its semantic identifier is derived. */
|
|
90
91
|
export const applicationEdgeInputSchema = z.strictObject({
|
|
91
|
-
source_node_id:
|
|
92
|
-
target_node_id:
|
|
92
|
+
source_node_id: prefixedDigestSchema("jag_node"),
|
|
93
|
+
target_node_id: prefixedDigestSchema("jag_node"),
|
|
93
94
|
relation: applicationRelationSchema,
|
|
94
95
|
properties: applicationPropertiesSchema,
|
|
95
96
|
evidence: applicationGraphEvidenceSchema,
|
|
96
97
|
});
|
|
97
98
|
/** One directed, evidence-bearing application relationship. */
|
|
98
99
|
export const applicationEdgeSchema = applicationEdgeInputSchema.extend({
|
|
99
|
-
edge_id:
|
|
100
|
+
edge_id: prefixedDigestSchema("jag_edge"),
|
|
100
101
|
identifier_strategy: z.strictObject({
|
|
101
102
|
strategy: z.literal("semantic-content-sha256"),
|
|
102
103
|
stability: z.literal("relationship-exact"),
|
|
@@ -105,7 +106,7 @@ export const applicationEdgeSchema = applicationEdgeInputSchema.extend({
|
|
|
105
106
|
/** Graph content before its top-level semantic identifier is derived. */
|
|
106
107
|
export const javascriptApplicationGraphInputSchema = z.strictObject({
|
|
107
108
|
schema: z.literal("JavaScriptApplicationGraph"),
|
|
108
|
-
root_node_ids: z.array(
|
|
109
|
+
root_node_ids: z.array(prefixedDigestSchema("jag_node")).min(1),
|
|
109
110
|
nodes: z.array(applicationNodeSchema).min(1),
|
|
110
111
|
edges: z.array(applicationEdgeSchema),
|
|
111
112
|
coverage: applicationCoverageSchema,
|
|
@@ -113,5 +114,5 @@ export const javascriptApplicationGraphInputSchema = z.strictObject({
|
|
|
113
114
|
});
|
|
114
115
|
/** Strict stored shape for a JavaScript Application Graph. */
|
|
115
116
|
export const javascriptApplicationGraphRecordSchema = javascriptApplicationGraphInputSchema.extend({
|
|
116
|
-
graph_id:
|
|
117
|
+
graph_id: prefixedDigestSchema("jag"),
|
|
117
118
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { emptyArraySchema } from "./emptyArraySchema.js";
|
|
2
3
|
import { evidenceSchema } from "./evidence.js";
|
|
3
4
|
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
|
|
4
5
|
import { JAVASCRIPT_APPLICATION_NODE_KINDS } from "./javascriptApplicationGraphSchemas.js";
|
|
5
|
-
|
|
6
|
-
const
|
|
6
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
8
|
+
const nodeIdSchema = prefixedDigestSchema("jag_node");
|
|
7
9
|
const textSchema = z.string().min(1);
|
|
8
10
|
/** Two authenticated application versions and their native observations. */
|
|
9
11
|
export const compareApplicationVersionsInputSchema = z
|
|
@@ -33,7 +35,7 @@ export const compareApplicationVersionsInputSchema = z
|
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
});
|
|
36
|
-
const emptyCandidateNodesSchema =
|
|
38
|
+
const emptyCandidateNodesSchema = emptyArraySchema;
|
|
37
39
|
const candidateNodesSchema = z.tuple([nodeIdSchema]).rest(nodeIdSchema);
|
|
38
40
|
const exactMatchSchema = z.strictObject({
|
|
39
41
|
status: z.literal("matched"),
|
|
@@ -87,7 +89,7 @@ const rightAmbiguousMatchSchema = z.strictObject({
|
|
|
87
89
|
candidate_right_node_ids: emptyCandidateNodesSchema,
|
|
88
90
|
});
|
|
89
91
|
const comparisonItemContextShape = {
|
|
90
|
-
item_id:
|
|
92
|
+
item_id: prefixedDigestSchema("javc_item"),
|
|
91
93
|
node_kind: z.enum(JAVASCRIPT_APPLICATION_NODE_KINDS),
|
|
92
94
|
dimensions: z.array(z.enum([
|
|
93
95
|
"content",
|
|
@@ -147,15 +149,15 @@ const comparisonCoverageSchema = z.strictObject({
|
|
|
147
149
|
/** Tiered module/entity matching plus its complete cross-version change graph. */
|
|
148
150
|
export const applicationVersionComparisonResultSchema = z
|
|
149
151
|
.strictObject({
|
|
150
|
-
comparison_id:
|
|
152
|
+
comparison_id: prefixedDigestSchema("javc"),
|
|
151
153
|
left: z.strictObject({
|
|
152
154
|
evidence_id: evidenceIdSchema,
|
|
153
|
-
graph_id:
|
|
155
|
+
graph_id: prefixedDigestSchema("jag"),
|
|
154
156
|
root_artifact_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
155
157
|
}),
|
|
156
158
|
right: z.strictObject({
|
|
157
159
|
evidence_id: evidenceIdSchema,
|
|
158
|
-
graph_id:
|
|
160
|
+
graph_id: prefixedDigestSchema("jag"),
|
|
159
161
|
root_artifact_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
160
162
|
}),
|
|
161
163
|
summary: z.strictObject({
|