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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { sanitizeEndpointCandidate } from "./browserObservation.js";
|
|
3
3
|
import { addFindingOnce, addLocatedFinding, moduleAtOffset, } from "./javascriptStaticAnalysisFindings.js";
|
|
4
|
-
import { STATIC_ROUTE_CALL_NAMES, argumentValue, calleeName, endpointArgument as endpointArgumentHelper, prefixedArgument,
|
|
4
|
+
import { STATIC_ROUTE_CALL_NAMES, argumentValue, calleeName, endpointArgument as endpointArgumentHelper, prefixedArgument, semanticStaticPropertyName, range, rangeForOffsets, sourceSlice, staticPath, staticPathResolutionContext, storageKind, stringValue, } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
5
|
/** Inspect one call or new expression for references, endpoints, storage, and roles. */
|
|
6
6
|
export const inspectCall = (source, node, context) => {
|
|
7
7
|
const { accumulator } = context;
|
|
@@ -113,7 +113,7 @@ const inspectEndpointCall = (node, name, first, context) => {
|
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
115
|
export const inspectRouteProperty = (node, context) => {
|
|
116
|
-
const key =
|
|
116
|
+
const key = semanticStaticPropertyName(node.key, node.computed);
|
|
117
117
|
if ((key === "path" || key === "route") && t.isStringLiteral(node.value))
|
|
118
118
|
addEndpoint(context, {
|
|
119
119
|
node,
|
|
@@ -123,7 +123,7 @@ export const inspectRouteProperty = (node, context) => {
|
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
125
|
export const inspectRoleProperty = (node, context) => {
|
|
126
|
-
if (
|
|
126
|
+
if (semanticStaticPropertyName(node.key, node.computed) !== "preload")
|
|
127
127
|
return;
|
|
128
128
|
const path = staticPath(node.value);
|
|
129
129
|
if (path === undefined)
|
|
@@ -192,9 +192,12 @@ const addEndpoint = (context, input) => addLocatedFinding(context, {
|
|
|
192
192
|
},
|
|
193
193
|
});
|
|
194
194
|
export const addSourceMapDirectives = (source, accumulator) => {
|
|
195
|
-
|
|
195
|
+
// Minifiers emit either `//# sourceMappingURL=` or the block form
|
|
196
|
+
// `/*# sourceMappingURL=app.js.map */`. Matching only the line form silently
|
|
197
|
+
// dropped the block form, so a real footer produced no mapping at all.
|
|
198
|
+
for (const match of source.matchAll(/(?:\/\/|\/\*)[#@]\s*sourceMappingURL\s*=\s*([^\s*]+)/gu)) {
|
|
196
199
|
const declared = match[1];
|
|
197
|
-
if (declared === undefined)
|
|
200
|
+
if (declared === undefined || declared.length === 0)
|
|
198
201
|
continue;
|
|
199
202
|
const start = match.index;
|
|
200
203
|
const location = rangeForOffsets(source, start, start + match[0].length);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { posix } from "node:path";
|
|
3
3
|
import * as t from "@babel/types";
|
|
4
|
-
import {
|
|
5
|
-
export { propertyName } from "./javascriptAstValues.js";
|
|
4
|
+
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
|
|
5
|
+
export { propertyName, semanticStaticPropertyName, } from "./javascriptAstValues.js";
|
|
6
6
|
/** Explicit result for source text that Babel cannot parse. */
|
|
7
7
|
export const failedJavaScriptStaticAnalysis = () => ({
|
|
8
8
|
parse_status: "failed",
|
|
@@ -35,7 +35,8 @@ export const chunkRuntime = (call) => {
|
|
|
35
35
|
if (!t.isMemberExpression(call.callee) &&
|
|
36
36
|
!t.isOptionalMemberExpression(call.callee))
|
|
37
37
|
return undefined;
|
|
38
|
-
if (
|
|
38
|
+
if (semanticStaticPropertyName(call.callee.property, call.callee.computed) !==
|
|
39
|
+
"push")
|
|
39
40
|
return undefined;
|
|
40
41
|
return findChunkRuntime(call.callee.object);
|
|
41
42
|
};
|
|
@@ -43,7 +44,7 @@ const findChunkRuntime = (node) => {
|
|
|
43
44
|
if (t.isIdentifier(node) && /(?:webpack|rspack)Chunk/iu.test(node.name))
|
|
44
45
|
return node.name;
|
|
45
46
|
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
|
|
46
|
-
const property =
|
|
47
|
+
const property = semanticStaticPropertyName(node.property, node.computed);
|
|
47
48
|
if (/(?:webpack|rspack)Chunk/iu.test(property))
|
|
48
49
|
return property;
|
|
49
50
|
return t.isNode(node.object) ? findChunkRuntime(node.object) : undefined;
|
|
@@ -72,7 +73,7 @@ export const modulePropertyName = (property) => t.isObjectMethod(property) || t.
|
|
|
72
73
|
!t.isStringLiteral(property.key) &&
|
|
73
74
|
!t.isNumericLiteral(property.key)
|
|
74
75
|
? `[computed@${String(property.start ?? -1)}]`
|
|
75
|
-
:
|
|
76
|
+
: semanticStaticPropertyName(property.key, property.computed) ||
|
|
76
77
|
`[unknown@${String(property.start ?? -1)}]`
|
|
77
78
|
: `[unknown@${String(property.start ?? -1)}]`;
|
|
78
79
|
/** Read the factory-local bundler require parameter when declared. */
|
|
@@ -186,7 +187,7 @@ const isFileIdentity = (node) => {
|
|
|
186
187
|
t.isMetaProperty(node.object) &&
|
|
187
188
|
node.object.meta.name === "import" &&
|
|
188
189
|
node.object.property.name === "meta" &&
|
|
189
|
-
|
|
190
|
+
semanticStaticPropertyName(node.property, node.computed) === "url")
|
|
190
191
|
return true;
|
|
191
192
|
if (!t.isCallExpression(node))
|
|
192
193
|
return false;
|
|
@@ -229,11 +230,19 @@ const calleeNameAt = (node) => {
|
|
|
229
230
|
return "import";
|
|
230
231
|
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
|
|
231
232
|
const object = t.isNode(node.object) ? calleeNameAt(node.object) : "";
|
|
232
|
-
|
|
233
|
+
// A dynamic key commits no name: `target[method]()` must not be reported as
|
|
234
|
+
// `target.method`, which would fabricate a runtime call shape.
|
|
235
|
+
const property = memberPropertyName(node);
|
|
233
236
|
return object === "" ? property : `${object}.${property}`;
|
|
234
237
|
}
|
|
235
238
|
return "";
|
|
236
239
|
};
|
|
240
|
+
/** Read a member property only when its syntax commits an exact name. */
|
|
241
|
+
const memberPropertyName = (node) => node.computed &&
|
|
242
|
+
!t.isStringLiteral(node.property) &&
|
|
243
|
+
!t.isNumericLiteral(node.property)
|
|
244
|
+
? `[computed@${String(node.property.start ?? -1)}]`
|
|
245
|
+
: semanticStaticPropertyName(node.property, node.computed);
|
|
237
246
|
/** Return a string literal value without evaluating an expression. */
|
|
238
247
|
export const stringValue = (node) => (t.isStringLiteral(node) ? node.value : undefined);
|
|
239
248
|
/** Return a string or numeric argument literal. */
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { jsonValueSchema } from "./jsonValue.js";
|
|
3
|
+
/** Select one archive within the active bundle and optionally one named root. */
|
|
4
|
+
export const keyedArchiveInputSchema = z.strictObject({
|
|
5
|
+
path: z.string().min(1).default("."),
|
|
6
|
+
root: z.string().optional(),
|
|
7
|
+
offset: z.number().int().min(0).default(0),
|
|
8
|
+
limit: z.number().int().min(1).max(20_000).default(20_000),
|
|
9
|
+
});
|
|
10
|
+
const linkSchema = z.strictObject({
|
|
11
|
+
source: z.number().int().nonnegative().nullable(),
|
|
12
|
+
path: z.array(z.union([z.string(), z.number().int().nonnegative()])),
|
|
13
|
+
target: z.number().int().nonnegative().nullable(),
|
|
14
|
+
status: z.enum(["resolved", "nil", "unresolved", "malformed"]),
|
|
15
|
+
raw: jsonValueSchema,
|
|
16
|
+
});
|
|
17
|
+
/** Archive object identity is its original $objects index, never a recursive copy. */
|
|
18
|
+
export const keyedArchiveResultSchema = z.strictObject({
|
|
19
|
+
target_sha256: z.string(),
|
|
20
|
+
archive_path: z.string(),
|
|
21
|
+
archive_sha256: z.string(),
|
|
22
|
+
archive_format: z.enum(["binary-plist", "xml-plist"]),
|
|
23
|
+
roots: z.record(z.string(), jsonValueSchema),
|
|
24
|
+
objects: z.array(z.strictObject({
|
|
25
|
+
id: z.number().int().nonnegative(),
|
|
26
|
+
kind: z.enum([
|
|
27
|
+
"nil",
|
|
28
|
+
"scalar",
|
|
29
|
+
"array",
|
|
30
|
+
"dictionary",
|
|
31
|
+
"class-descriptor",
|
|
32
|
+
"archived-object",
|
|
33
|
+
]),
|
|
34
|
+
class_id: z.number().int().nonnegative().nullable(),
|
|
35
|
+
class_name: z.string().nullable(),
|
|
36
|
+
status: z.enum(["observed", "unknown-class", "unresolved-class", "nil"]),
|
|
37
|
+
value: jsonValueSchema,
|
|
38
|
+
})),
|
|
39
|
+
references: z.array(linkSchema),
|
|
40
|
+
total_objects: z.number().int().nonnegative(),
|
|
41
|
+
total_references: z.number().int().nonnegative(),
|
|
42
|
+
offset: z.number().int().nonnegative(),
|
|
43
|
+
next_offset: z.number().int().nonnegative().nullable(),
|
|
44
|
+
truncated: z.boolean(),
|
|
45
|
+
limitations: z.array(z.string()),
|
|
46
|
+
});
|
|
47
|
+
const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value)
|
|
48
|
+
? value
|
|
49
|
+
: undefined;
|
|
50
|
+
const uid = (value) => {
|
|
51
|
+
const object = record(value);
|
|
52
|
+
if (object === undefined || Object.keys(object).length !== 1)
|
|
53
|
+
return undefined;
|
|
54
|
+
return Object.hasOwn(object, "UID") ? object.UID : object["CF$UID"];
|
|
55
|
+
};
|
|
56
|
+
/** Interpret serialized Foundation references without instantiating archive classes. */
|
|
57
|
+
export const projectKeyedArchive = (value, selection) => {
|
|
58
|
+
const archive = record(jsonValueSchema.parse(value));
|
|
59
|
+
if (archive?.$archiver !== "NSKeyedArchiver" ||
|
|
60
|
+
!Array.isArray(archive.$objects))
|
|
61
|
+
throw new TypeError("Expected NSKeyedArchiver with an $objects array");
|
|
62
|
+
const table = archive.$objects;
|
|
63
|
+
if (table.length > 200_000)
|
|
64
|
+
throw new RangeError("Archive exceeds 200000 object-table entries");
|
|
65
|
+
const top = record(archive.$top);
|
|
66
|
+
if (top === undefined || Object.keys(top).length === 0)
|
|
67
|
+
throw new TypeError("Keyed archive has no $top roots");
|
|
68
|
+
if (selection.root !== undefined && !Object.hasOwn(top, selection.root))
|
|
69
|
+
throw new TypeError(`Archive root does not exist: ${selection.root}`);
|
|
70
|
+
const roots = selection.root === undefined
|
|
71
|
+
? top
|
|
72
|
+
: { [selection.root]: top[selection.root] ?? null };
|
|
73
|
+
const references = [];
|
|
74
|
+
const scan = (source, initial) => {
|
|
75
|
+
const pending = [
|
|
76
|
+
{ value: initial, path: [] },
|
|
77
|
+
];
|
|
78
|
+
let visited = 0;
|
|
79
|
+
while (pending.length > 0) {
|
|
80
|
+
const item = pending.pop();
|
|
81
|
+
if (item === undefined)
|
|
82
|
+
break;
|
|
83
|
+
if (++visited > 200_000 || item.path.length > 128)
|
|
84
|
+
throw new RangeError("Archive exceeds 200000 values per object or 128 nesting levels");
|
|
85
|
+
const target = uid(item.value);
|
|
86
|
+
if (target !== undefined) {
|
|
87
|
+
const valid = typeof target === "number" &&
|
|
88
|
+
Number.isSafeInteger(target) &&
|
|
89
|
+
target >= 0;
|
|
90
|
+
const index = valid ? target : null;
|
|
91
|
+
references.push({
|
|
92
|
+
source,
|
|
93
|
+
path: item.path,
|
|
94
|
+
target: index,
|
|
95
|
+
raw: item.value,
|
|
96
|
+
status: index === null
|
|
97
|
+
? "malformed"
|
|
98
|
+
: index >= table.length
|
|
99
|
+
? "unresolved"
|
|
100
|
+
: index === 0 && table[0] === "$null"
|
|
101
|
+
? "nil"
|
|
102
|
+
: "resolved",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else if (Array.isArray(item.value)) {
|
|
106
|
+
for (let index = item.value.length - 1; index >= 0; index--) {
|
|
107
|
+
const child = item.value[index];
|
|
108
|
+
if (child !== undefined)
|
|
109
|
+
pending.push({ value: child, path: [...item.path, index] });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const fields = record(item.value);
|
|
114
|
+
if (fields !== undefined)
|
|
115
|
+
for (const key of Object.keys(fields).sort().reverse()) {
|
|
116
|
+
const child = fields[key];
|
|
117
|
+
if (child !== undefined)
|
|
118
|
+
pending.push({ value: child, path: [...item.path, key] });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (references.length > 200_000)
|
|
122
|
+
throw new RangeError("Archive exceeds 200000 reference edges");
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
scan(null, roots);
|
|
126
|
+
const objects = table.map((value, id) => {
|
|
127
|
+
scan(id, value);
|
|
128
|
+
const fields = record(value);
|
|
129
|
+
const classUid = uid(fields?.$class);
|
|
130
|
+
const classId = typeof classUid === "number" &&
|
|
131
|
+
Number.isSafeInteger(classUid) &&
|
|
132
|
+
classUid >= 0
|
|
133
|
+
? classUid
|
|
134
|
+
: null;
|
|
135
|
+
const descriptor = classId === null ? undefined : record(table[classId]);
|
|
136
|
+
const className = typeof descriptor?.$classname === "string" ? descriptor.$classname : null;
|
|
137
|
+
const isNil = id === 0 && value === "$null";
|
|
138
|
+
return {
|
|
139
|
+
id,
|
|
140
|
+
kind: isNil
|
|
141
|
+
? "nil"
|
|
142
|
+
: Array.isArray(value)
|
|
143
|
+
? "array"
|
|
144
|
+
: fields === undefined
|
|
145
|
+
? "scalar"
|
|
146
|
+
: typeof fields.$classname === "string"
|
|
147
|
+
? "class-descriptor"
|
|
148
|
+
: Object.hasOwn(fields, "$class")
|
|
149
|
+
? "archived-object"
|
|
150
|
+
: "dictionary",
|
|
151
|
+
class_id: classId,
|
|
152
|
+
class_name: className,
|
|
153
|
+
status: isNil
|
|
154
|
+
? "nil"
|
|
155
|
+
: fields !== undefined && Object.hasOwn(fields, "$class")
|
|
156
|
+
? className === null
|
|
157
|
+
? "unresolved-class"
|
|
158
|
+
: "unknown-class"
|
|
159
|
+
: "observed",
|
|
160
|
+
value,
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
const end = Math.min(objects.length, selection.offset + selection.limit);
|
|
164
|
+
const page = objects.slice(selection.offset, end);
|
|
165
|
+
const ids = new Set(page.map(({ id }) => id));
|
|
166
|
+
return {
|
|
167
|
+
roots,
|
|
168
|
+
objects: page,
|
|
169
|
+
references: references.filter(({ source }) => source === null || ids.has(source)),
|
|
170
|
+
total_objects: objects.length,
|
|
171
|
+
total_references: references.length,
|
|
172
|
+
offset: selection.offset,
|
|
173
|
+
next_offset: end < objects.length ? end : null,
|
|
174
|
+
truncated: page.length !== objects.length,
|
|
175
|
+
limitations: [
|
|
176
|
+
"Archive classes are never instantiated. Class names and serialized fields are observed; class-specific semantics are unknown.",
|
|
177
|
+
"Conditional references serialized as UID 0 cannot be distinguished from ordinary nil references. Missing fields remain absent in the raw serialized value.",
|
|
178
|
+
"Root selection selects the named $top entry; object pagination retains original indices and does not recursively expand references.",
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
};
|
|
@@ -6,8 +6,9 @@ import { createJavaScriptApplicationGraph, javascriptApplicationGraphSchema, } f
|
|
|
6
6
|
import { managedArtifactInspectionSchema, managedMemberInspectionSchema, managedNativeBoundaryInspectionSchema, } from "./managedArtifact.js";
|
|
7
7
|
import { assessManagedGraphOmissions, managedGraphEvidenceCoverage, managedGraphResultCoverage, } from "./managedApplicationGraphCoverage.js";
|
|
8
8
|
import { addArtifactNode, addArtifactIdentityNodes, addBoundaryNodes, addMemberNodes, } from "./managedApplicationGraphNodes.js";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
10
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
11
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
11
12
|
const textSchema = z.string().min(1);
|
|
12
13
|
/** Authenticated managed Evidence records projected into the application graph. */
|
|
13
14
|
export const projectManagedApplicationGraphInputSchema = z
|
|
@@ -27,7 +28,7 @@ export const projectManagedApplicationGraphInputSchema = z
|
|
|
27
28
|
});
|
|
28
29
|
/** Managed-code projection result containing a validated application graph. */
|
|
29
30
|
export const managedApplicationGraphResultSchema = z.strictObject({
|
|
30
|
-
projection_id:
|
|
31
|
+
projection_id: prefixedDigestSchema("magp"),
|
|
31
32
|
root_artifact_sha256: digestSchema,
|
|
32
33
|
source_evidence: z.strictObject({
|
|
33
34
|
managed_artifact_evidence_id: evidenceIdSchema.nullable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
3
3
|
const tokenSchema = z.string().regex(/^0x[0-9a-f]{8}$/u);
|
|
4
4
|
const offsetSchema = z.number().int().min(0);
|
|
5
5
|
/** A 16-byte CLI metadata GUID without RFC 4122 version/variant restrictions. */
|
|
@@ -266,6 +266,7 @@ const managedParseIssueSchema = z.object({
|
|
|
266
266
|
"invalid-heap-index",
|
|
267
267
|
"invalid-string",
|
|
268
268
|
"invalid-blob",
|
|
269
|
+
"unsupported-signature",
|
|
269
270
|
"invalid-guid",
|
|
270
271
|
"invalid-resource",
|
|
271
272
|
]),
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { emptyArraySchema } from "./emptyArraySchema.js";
|
|
2
3
|
import { evidenceSchema } from "./evidence.js";
|
|
3
4
|
import { cliMetadataGuidSchema, } from "./managedArtifact.js";
|
|
4
5
|
import { buildComparisonCoverage, buildComparisonMatching, buildComparisonSummary, comparisonLimitations, sideManifest, } from "./managedMemberComparisonCoverage.js";
|
|
5
6
|
import { buildFieldItems, buildMethodItems, } from "./managedMemberComparisonItems.js";
|
|
6
7
|
import { keyMembers, sha256 } from "./managedMemberComparisonMatch.js";
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
9
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
10
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
9
11
|
const tokenSchema = z.string().regex(/^0x[0-9a-f]{8}$/u);
|
|
10
12
|
const boundedTextSchema = z.string().min(1);
|
|
11
13
|
/** Two authenticated managed member observations. */
|
|
@@ -24,6 +26,7 @@ export const compareManagedMembersInputSchema = z
|
|
|
24
26
|
});
|
|
25
27
|
const concreteMatchBasisSchema = z.enum([
|
|
26
28
|
"exact-il-signature",
|
|
29
|
+
"exact-signature",
|
|
27
30
|
"structural-method-shape",
|
|
28
31
|
"field-signature",
|
|
29
32
|
]);
|
|
@@ -32,15 +35,15 @@ const matchedComparisonSchema = z.strictObject({
|
|
|
32
35
|
status: z.literal("matched"),
|
|
33
36
|
basis: concreteMatchBasisSchema,
|
|
34
37
|
confidence: z.enum(["exact", "high"]),
|
|
35
|
-
candidate_left_tokens:
|
|
36
|
-
candidate_right_tokens:
|
|
38
|
+
candidate_left_tokens: emptyArraySchema,
|
|
39
|
+
candidate_right_tokens: emptyArraySchema,
|
|
37
40
|
});
|
|
38
41
|
const unmatchedComparisonSchema = z.strictObject({
|
|
39
42
|
status: z.literal("unmatched"),
|
|
40
43
|
basis: z.literal("none"),
|
|
41
44
|
confidence: z.literal("unknown"),
|
|
42
|
-
candidate_left_tokens:
|
|
43
|
-
candidate_right_tokens:
|
|
45
|
+
candidate_left_tokens: emptyArraySchema,
|
|
46
|
+
candidate_right_tokens: emptyArraySchema,
|
|
44
47
|
});
|
|
45
48
|
const ambiguousComparisonSchema = z.strictObject({
|
|
46
49
|
status: z.literal("ambiguous"),
|
|
@@ -59,7 +62,7 @@ const memberIdentitySchema = z.strictObject({
|
|
|
59
62
|
const comparisonItemSchema = (base, identity) => z.union([
|
|
60
63
|
z.strictObject({
|
|
61
64
|
...base,
|
|
62
|
-
status: z.enum(["unchanged", "changed"]),
|
|
65
|
+
status: z.enum(["unchanged", "changed", "unknown"]),
|
|
63
66
|
left: identity,
|
|
64
67
|
right: identity,
|
|
65
68
|
match: matchedComparisonSchema,
|
|
@@ -92,7 +95,7 @@ const comparisonItemContextShape = {
|
|
|
92
95
|
};
|
|
93
96
|
const methodComparisonItemSchema = comparisonItemSchema({
|
|
94
97
|
...comparisonItemContextShape,
|
|
95
|
-
item_id:
|
|
98
|
+
item_id: prefixedDigestSchema("mmc_method"),
|
|
96
99
|
dimensions: z.array(z.enum([
|
|
97
100
|
"signature",
|
|
98
101
|
"cil",
|
|
@@ -101,19 +104,20 @@ const methodComparisonItemSchema = comparisonItemSchema({
|
|
|
101
104
|
"field-shape",
|
|
102
105
|
"exception-shape",
|
|
103
106
|
"availability",
|
|
107
|
+
"body-coverage",
|
|
104
108
|
])),
|
|
105
109
|
}, memberIdentitySchema);
|
|
106
110
|
const fieldComparisonItemSchema = comparisonItemSchema({
|
|
107
111
|
...comparisonItemContextShape,
|
|
108
|
-
item_id:
|
|
112
|
+
item_id: prefixedDigestSchema("mmc_field"),
|
|
109
113
|
}, memberIdentitySchema.omit({ normalized_il_sha256: true }));
|
|
110
114
|
/** Obfuscation-resistant, execution-free managed member comparison. */
|
|
111
115
|
export const managedMemberComparisonResultSchema = z.strictObject({
|
|
112
|
-
comparison_id:
|
|
116
|
+
comparison_id: prefixedDigestSchema("mmc"),
|
|
113
117
|
algorithm: z.strictObject({
|
|
114
118
|
name: z.literal("rea-managed-member-comparison"),
|
|
115
119
|
token_identity: z.literal("build-local"),
|
|
116
|
-
name_matching: z.literal("
|
|
120
|
+
name_matching: z.literal("exact-signature-fallback"),
|
|
117
121
|
}),
|
|
118
122
|
left: z.strictObject({
|
|
119
123
|
evidence_id: evidenceIdSchema,
|
|
@@ -142,6 +146,7 @@ export const managedMemberComparisonResultSchema = z.strictObject({
|
|
|
142
146
|
}),
|
|
143
147
|
matching: z.strictObject({
|
|
144
148
|
exact_il_signature: z.number().int().min(0),
|
|
149
|
+
exact_signature: z.number().int().min(0),
|
|
145
150
|
structural_method_shape: z.number().int().min(0),
|
|
146
151
|
field_signature: z.number().int().min(0),
|
|
147
152
|
ambiguous: z.number().int().min(0),
|
|
@@ -157,7 +162,7 @@ export const managedMemberComparisonResultSchema = z.strictObject({
|
|
|
157
162
|
evidence_links: z.array(evidenceIdSchema).length(2),
|
|
158
163
|
limitations: z.array(boundedTextSchema),
|
|
159
164
|
});
|
|
160
|
-
/** Compare
|
|
165
|
+
/** Compare managed members with constrained exact and structural identities. */
|
|
161
166
|
export const compareManagedMembers = (left, right) => {
|
|
162
167
|
const leftCoverage = {
|
|
163
168
|
sourceComplete: left.result.coverage.state === "complete",
|
|
@@ -192,7 +197,7 @@ export const compareManagedMembers = (left, right) => {
|
|
|
192
197
|
algorithm: {
|
|
193
198
|
name: "rea-managed-member-comparison",
|
|
194
199
|
token_identity: "build-local",
|
|
195
|
-
name_matching: "
|
|
200
|
+
name_matching: "exact-signature-fallback",
|
|
196
201
|
},
|
|
197
202
|
left: sideManifest(left),
|
|
198
203
|
right: sideManifest(right),
|
|
@@ -33,6 +33,7 @@ export const buildComparisonSummary = (items) => ({
|
|
|
33
33
|
});
|
|
34
34
|
export const buildComparisonMatching = (methodItems, fieldItems) => ({
|
|
35
35
|
exact_il_signature: methodItems.filter(({ match }) => match.basis === "exact-il-signature").length,
|
|
36
|
+
exact_signature: methodItems.filter(({ match }) => match.basis === "exact-signature").length,
|
|
36
37
|
structural_method_shape: methodItems.filter(({ match }) => match.basis === "structural-method-shape").length,
|
|
37
38
|
field_signature: fieldItems.filter(({ match }) => match.basis === "field-signature").length,
|
|
38
39
|
ambiguous: methodItems.filter(({ match }) => match.status === "ambiguous").length +
|
|
@@ -42,7 +43,7 @@ export const buildComparisonMatching = (methodItems, fieldItems) => ({
|
|
|
42
43
|
export const comparisonLimitations = (left, right) => {
|
|
43
44
|
const limitations = [
|
|
44
45
|
"Metadata tokens are build-local coordinates; matched pairs are remaps, not persistent identities.",
|
|
45
|
-
"
|
|
46
|
+
"Methods pair by exact CIL/signature, then declared type, name, and signature, then structural shape; names alone are never a matching basis.",
|
|
46
47
|
];
|
|
47
48
|
if (left.coverage.state !== "complete" || right.coverage.state !== "complete")
|
|
48
49
|
limitations.push("At least one managed member observation is partial.");
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import canonicalize from "canonicalize";
|
|
2
2
|
import { sha256, } from "./managedMemberComparisonMatch.js";
|
|
3
|
-
const
|
|
3
|
+
const methodDimensions = (left, right) => {
|
|
4
4
|
const dimensions = [];
|
|
5
5
|
if (left.signature.raw_sha256 !== right.signature.raw_sha256)
|
|
6
6
|
dimensions.push("signature");
|
|
7
|
+
const leftBodyComplete = left.body.status === "present" && left.body.truncated_instructions === 0;
|
|
8
|
+
const rightBodyComplete = right.body.status === "present" && right.body.truncated_instructions === 0;
|
|
9
|
+
const bothAbsent = left.body.status === "absent" && right.body.status === "absent";
|
|
10
|
+
if ((left.body.status === "absent" && rightBodyComplete) ||
|
|
11
|
+
(right.body.status === "absent" && leftBodyComplete))
|
|
12
|
+
dimensions.push("availability");
|
|
13
|
+
if (bothAbsent)
|
|
14
|
+
return { dimensions, bodyUnknown: false };
|
|
15
|
+
if (!leftBodyComplete || !rightBodyComplete)
|
|
16
|
+
return { dimensions, bodyUnknown: true };
|
|
7
17
|
if (left.body.normalized_il_sha256 !== right.body.normalized_il_sha256)
|
|
8
18
|
dimensions.push("cil");
|
|
9
19
|
if (canonicalize(left.body.opcode_counts) !==
|
|
@@ -16,9 +26,7 @@ const changedMethodDimensions = (left, right) => {
|
|
|
16
26
|
if (canonicalize(left.body.exception_regions) !==
|
|
17
27
|
canonicalize(right.body.exception_regions))
|
|
18
28
|
dimensions.push("exception-shape");
|
|
19
|
-
|
|
20
|
-
dimensions.push("availability");
|
|
21
|
-
return dimensions;
|
|
29
|
+
return { dimensions, bodyUnknown: false };
|
|
22
30
|
};
|
|
23
31
|
const callShape = (anchors) => JSON.stringify(anchors
|
|
24
32
|
.filter(({ operand_kind }) => operand_kind === "method")
|
|
@@ -115,14 +123,22 @@ const fieldOnlyItem = (member, context) => {
|
|
|
115
123
|
export const buildMethodItems = (matches, context) => {
|
|
116
124
|
const items = [];
|
|
117
125
|
for (const pair of matches.pairs) {
|
|
118
|
-
const dimensions =
|
|
126
|
+
const { dimensions: observedDimensions, bodyUnknown } = methodDimensions(pair.left.item, pair.right.item);
|
|
127
|
+
const dimensions = bodyUnknown
|
|
128
|
+
? [...observedDimensions, "body-coverage"]
|
|
129
|
+
: observedDimensions;
|
|
130
|
+
const observedChange = observedDimensions.length > 0;
|
|
119
131
|
items.push({
|
|
120
132
|
item_id: `mmc_method_${sha256({
|
|
121
133
|
left: pair.left.item.token,
|
|
122
134
|
right: pair.right.item.token,
|
|
123
135
|
basis: pair.basis,
|
|
124
136
|
})}`,
|
|
125
|
-
status:
|
|
137
|
+
status: observedChange
|
|
138
|
+
? "changed"
|
|
139
|
+
: bodyUnknown
|
|
140
|
+
? "unknown"
|
|
141
|
+
: "unchanged",
|
|
126
142
|
left: methodIdentity(pair.left.item),
|
|
127
143
|
right: methodIdentity(pair.right.item),
|
|
128
144
|
match: {
|
|
@@ -134,7 +150,11 @@ export const buildMethodItems = (matches, context) => {
|
|
|
134
150
|
},
|
|
135
151
|
dimensions,
|
|
136
152
|
evidence_links: [context.leftEvidenceId, context.rightEvidenceId],
|
|
137
|
-
limitations:
|
|
153
|
+
limitations: bodyUnknown
|
|
154
|
+
? [
|
|
155
|
+
"Method body facets are unknown because at least one side has unavailable or partial body data.",
|
|
156
|
+
]
|
|
157
|
+
: [],
|
|
138
158
|
});
|
|
139
159
|
}
|
|
140
160
|
for (const ambiguous of matches.ambiguous) {
|
|
@@ -19,7 +19,15 @@ const keyMethod = (item) => ({
|
|
|
19
19
|
item.body.normalized_il_sha256,
|
|
20
20
|
])
|
|
21
21
|
: null,
|
|
22
|
-
|
|
22
|
+
signatureKey: item.signature.parse_status === "decoded"
|
|
23
|
+
? stableKey([
|
|
24
|
+
"method-signature",
|
|
25
|
+
item.declaring_type,
|
|
26
|
+
item.name,
|
|
27
|
+
item.signature.raw_sha256,
|
|
28
|
+
])
|
|
29
|
+
: null,
|
|
30
|
+
structuralKey: item.signature.parse_status === "decoded" && item.body.status === "present"
|
|
23
31
|
? stableKey([
|
|
24
32
|
"method-structural",
|
|
25
33
|
item.signature.kind,
|
|
@@ -53,6 +61,7 @@ const keyField = (item) => ({
|
|
|
53
61
|
exactKey: item.signature.parse_status === "decoded"
|
|
54
62
|
? stableKey(["field-exact", item.signature.raw_sha256])
|
|
55
63
|
: null,
|
|
64
|
+
signatureKey: null,
|
|
56
65
|
structuralKey: stableKey([
|
|
57
66
|
"field-structural",
|
|
58
67
|
item.signature.kind,
|
|
@@ -65,7 +74,16 @@ const matchMethods = (left, right) => matchByKeys({
|
|
|
65
74
|
left,
|
|
66
75
|
right,
|
|
67
76
|
exactBasis: "exact-il-signature",
|
|
68
|
-
fallbackBases: [
|
|
77
|
+
fallbackBases: [
|
|
78
|
+
{
|
|
79
|
+
basis: "exact-signature",
|
|
80
|
+
key: ({ signatureKey }) => signatureKey,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
basis: "structural-method-shape",
|
|
84
|
+
key: ({ structuralKey }) => structuralKey,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
69
87
|
});
|
|
70
88
|
const matchFields = (left, right) => matchByKeys({
|
|
71
89
|
left,
|
|
@@ -80,10 +98,7 @@ const matchByKeys = ({ left, right, exactBasis, fallbackBases, }) => {
|
|
|
80
98
|
const ambiguous = [];
|
|
81
99
|
const rounds = [
|
|
82
100
|
{ basis: exactBasis, key: ({ exactKey }) => exactKey },
|
|
83
|
-
...fallbackBases
|
|
84
|
-
basis,
|
|
85
|
-
key: ({ structuralKey }) => structuralKey,
|
|
86
|
-
})),
|
|
101
|
+
...fallbackBases,
|
|
87
102
|
];
|
|
88
103
|
for (const round of rounds) {
|
|
89
104
|
const leftGroups = groupBy(left.filter((item) => !usedLeft.has(item)), round.key);
|
|
@@ -104,6 +119,7 @@ const matchByKeys = ({ left, right, exactBasis, fallbackBases, }) => {
|
|
|
104
119
|
right: rightItem,
|
|
105
120
|
basis: round.basis,
|
|
106
121
|
confidence: round.basis === "exact-il-signature" ||
|
|
122
|
+
round.basis === "exact-signature" ||
|
|
107
123
|
round.basis === "field-signature"
|
|
108
124
|
? "exact"
|
|
109
125
|
: "high",
|
|
@@ -65,7 +65,7 @@ export const collectNativeSymbols = (observations) => {
|
|
|
65
65
|
}
|
|
66
66
|
return { symbols, accepted, unsupported };
|
|
67
67
|
};
|
|
68
|
-
const normalizeSymbol = (value) => value.replace(/^_+/u, "")
|
|
68
|
+
const normalizeSymbol = (value) => value.replace(/^_+/u, "");
|
|
69
69
|
const sameSymbolName = (left, right) => normalizeSymbol(left) === normalizeSymbol(right);
|
|
70
70
|
const normalizeModule = (value) => basename(value)
|
|
71
71
|
.toLowerCase()
|
|
@@ -111,7 +111,7 @@ const matchPinvoke = (managed, symbols, supportedNativeEvidence) => {
|
|
|
111
111
|
},
|
|
112
112
|
};
|
|
113
113
|
const candidates = [first, ...remaining];
|
|
114
|
-
const exact = candidates.find((symbol) =>
|
|
114
|
+
const exact = candidates.find((symbol) => managed.import_name === symbol.name &&
|
|
115
115
|
moduleCompatible(managed.import_scope_name, symbol));
|
|
116
116
|
const decorated = candidates.find((symbol) => moduleCompatible(managed.import_scope_name, symbol));
|
|
117
117
|
const selected = exact ?? decorated ?? first;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { emptyArraySchema } from "./emptyArraySchema.js";
|
|
2
3
|
import { evidenceSchema } from "./evidence.js";
|
|
3
4
|
import { cliMetadataGuidSchema } from "./managedArtifact.js";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
6
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
6
8
|
const tokenSchema = z.string().regex(/^0x[0-9a-f]{8}$/u);
|
|
7
9
|
const textSchema = z.string().min(1);
|
|
8
10
|
const nativeSymbolSchema = z.strictObject({
|
|
@@ -15,7 +17,7 @@ const nativeSymbolSchema = z.strictObject({
|
|
|
15
17
|
source: z.enum(["macho-export", "function-dossier"]),
|
|
16
18
|
});
|
|
17
19
|
const pinvokeVerificationContextShape = {
|
|
18
|
-
item_id:
|
|
20
|
+
item_id: prefixedDigestSchema("mnv_pinvoke"),
|
|
19
21
|
managed: z.strictObject({
|
|
20
22
|
token: tokenSchema,
|
|
21
23
|
member_token: tokenSchema.nullable(),
|
|
@@ -64,7 +66,7 @@ export const pinvokeVerificationSchema = z.discriminatedUnion("status", [
|
|
|
64
66
|
basis: z.enum(["no-native-candidate", "unsupported-native-evidence"]),
|
|
65
67
|
confidence: z.literal("unknown"),
|
|
66
68
|
matched_native: z.null(),
|
|
67
|
-
candidates:
|
|
69
|
+
candidates: emptyArraySchema,
|
|
68
70
|
}),
|
|
69
71
|
z.strictObject({
|
|
70
72
|
...pinvokeVerificationContextShape,
|
|
@@ -107,7 +109,7 @@ const verificationCoverageSchema = z.strictObject({
|
|
|
107
109
|
/** Provider-neutral managed/native verification result. */
|
|
108
110
|
export const managedNativeVerificationResultSchema = z
|
|
109
111
|
.strictObject({
|
|
110
|
-
verification_id:
|
|
112
|
+
verification_id: prefixedDigestSchema("mnv"),
|
|
111
113
|
algorithm: z.strictObject({
|
|
112
114
|
name: z.literal("rea-managed-native-verification"),
|
|
113
115
|
token_identity: z.literal("build-local"),
|