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,14 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { browserEndpointSchema, browserOriginSchema, } from "./browserObservation.js";
|
|
3
3
|
export const scenarioIdentifierSchema = z
|
|
4
4
|
.string()
|
|
5
5
|
.regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
|
|
6
|
-
const
|
|
7
|
-
.string()
|
|
8
|
-
.min(1)
|
|
9
|
-
.refine((value) => value.startsWith("/") ||
|
|
10
|
-
/^[A-Za-z]:[\\/]/u.test(value) ||
|
|
11
|
-
value.startsWith("\\\\"), "Expected an absolute browser executable path");
|
|
6
|
+
const browserExecutablePathSchema = z.string().trim().min(1);
|
|
12
7
|
const browserScenarioBaseUrlSchema = z
|
|
13
8
|
.string()
|
|
14
9
|
.min(1)
|
|
@@ -23,12 +18,10 @@ const browserScenarioBaseUrlSchema = z
|
|
|
23
18
|
}
|
|
24
19
|
if ((url.protocol !== "http:" && url.protocol !== "https:") ||
|
|
25
20
|
url.username !== "" ||
|
|
26
|
-
url.password !== ""
|
|
27
|
-
url.search !== "" ||
|
|
28
|
-
url.hash !== "") {
|
|
21
|
+
url.password !== "") {
|
|
29
22
|
context.addIssue({
|
|
30
23
|
code: "custom",
|
|
31
|
-
message: "Browser URLs must be HTTP(S)
|
|
24
|
+
message: "Browser URLs must be HTTP(S) and omit credentials",
|
|
32
25
|
});
|
|
33
26
|
return z.NEVER;
|
|
34
27
|
}
|
|
@@ -38,7 +31,6 @@ export const browserScenarioValueSchema = z.discriminatedUnion("source", [
|
|
|
38
31
|
z.strictObject({
|
|
39
32
|
source: z.literal("literal"),
|
|
40
33
|
value: z.string(),
|
|
41
|
-
classification: z.literal("public"),
|
|
42
34
|
}),
|
|
43
35
|
z.strictObject({
|
|
44
36
|
source: z.literal("secret"),
|
|
@@ -49,7 +41,7 @@ const queryEntrySchema = z.strictObject({
|
|
|
49
41
|
name: z.string().min(1),
|
|
50
42
|
value: browserScenarioValueSchema,
|
|
51
43
|
});
|
|
52
|
-
/** URL
|
|
44
|
+
/** URL with ordinary inline details and optional structured secret query references. */
|
|
53
45
|
export const browserScenarioUrlSchema = z.strictObject({
|
|
54
46
|
url: browserScenarioBaseUrlSchema,
|
|
55
47
|
query: z.array(queryEntrySchema).default([]),
|
|
@@ -57,17 +49,16 @@ export const browserScenarioUrlSchema = z.strictObject({
|
|
|
57
49
|
export const browserScenarioBrowserSchema = z.discriminatedUnion("mode", [
|
|
58
50
|
z.strictObject({
|
|
59
51
|
mode: z.literal("launch"),
|
|
60
|
-
executable_path:
|
|
61
|
-
headless: z
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
executable_path: browserExecutablePathSchema,
|
|
53
|
+
headless: z
|
|
54
|
+
.boolean()
|
|
55
|
+
.default(true)
|
|
56
|
+
.describe("Run without a visible browser window; defaults to true and can be disabled when the host supports a display."),
|
|
64
57
|
}),
|
|
65
58
|
z.strictObject({
|
|
66
59
|
mode: z.literal("connect"),
|
|
67
60
|
cdp_endpoint: browserEndpointSchema,
|
|
68
61
|
target_id: z.string().trim().min(1),
|
|
69
|
-
ownership: z.literal("external"),
|
|
70
|
-
cleanup: z.literal("disconnect-only"),
|
|
71
62
|
}),
|
|
72
63
|
]);
|
|
73
64
|
export const browserScenarioEnvironmentSchema = z
|
|
@@ -91,7 +82,7 @@ export const browserScenarioEnvironmentSchema = z
|
|
|
91
82
|
.default("UTC"),
|
|
92
83
|
color_scheme: z.enum(["light", "dark", "no-preference"]).default("light"),
|
|
93
84
|
reduced_motion: z.enum(["reduce", "no-preference"]).default("reduce"),
|
|
94
|
-
service_workers: z.
|
|
85
|
+
service_workers: z.enum(["allow", "block"]).default("block"),
|
|
95
86
|
})
|
|
96
87
|
.default({
|
|
97
88
|
viewport: { width: 1_280, height: 720, device_scale_factor: 1 },
|
|
@@ -126,7 +117,6 @@ const locatorSchema = z.discriminatedUnion("kind", [
|
|
|
126
117
|
"textbox",
|
|
127
118
|
]),
|
|
128
119
|
name: z.string().min(1),
|
|
129
|
-
exact: z.literal(true),
|
|
130
120
|
}),
|
|
131
121
|
z.strictObject({
|
|
132
122
|
kind: z.literal("css"),
|
|
@@ -225,94 +215,14 @@ export const browserScenarioStorageSchema = z
|
|
|
225
215
|
.default([]),
|
|
226
216
|
})
|
|
227
217
|
.default({ cookies: [], local_storage: [], session_storage: [] })
|
|
228
|
-
.describe("Optional initial cookies, local storage, or session storage. Defaults to empty; every supplied value and origin must be
|
|
229
|
-
const headerNameSchema = z
|
|
230
|
-
.string()
|
|
231
|
-
.min(1)
|
|
232
|
-
.regex(/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u)
|
|
233
|
-
.transform((value) => value.toLowerCase());
|
|
234
|
-
const replayHeaderSchema = z.strictObject({
|
|
235
|
-
name: headerNameSchema,
|
|
236
|
-
value: browserScenarioValueSchema,
|
|
237
|
-
});
|
|
238
|
-
const replayResponseSchema = z.discriminatedUnion("kind", [
|
|
239
|
-
z.strictObject({
|
|
240
|
-
kind: z.literal("response"),
|
|
241
|
-
status: z.number().int().min(100).max(599),
|
|
242
|
-
headers: z.array(replayHeaderSchema).default([]),
|
|
243
|
-
body: browserScenarioValueSchema.optional(),
|
|
244
|
-
}),
|
|
245
|
-
z.strictObject({
|
|
246
|
-
kind: z.literal("redirect"),
|
|
247
|
-
status: z.union([
|
|
248
|
-
z.literal(301),
|
|
249
|
-
z.literal(302),
|
|
250
|
-
z.literal(303),
|
|
251
|
-
z.literal(307),
|
|
252
|
-
z.literal(308),
|
|
253
|
-
]),
|
|
254
|
-
destination: browserScenarioUrlSchema,
|
|
255
|
-
}),
|
|
256
|
-
]);
|
|
257
|
-
const replayRouteSchema = z.strictObject({
|
|
258
|
-
route_id: scenarioIdentifierSchema,
|
|
259
|
-
method: z.enum(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]),
|
|
260
|
-
request: browserScenarioUrlSchema,
|
|
261
|
-
response: replayResponseSchema,
|
|
262
|
-
});
|
|
263
|
-
export const browserScenarioRequestReplaySchema = z
|
|
264
|
-
.discriminatedUnion("mode", [
|
|
265
|
-
z.strictObject({ mode: z.literal("disabled") }),
|
|
266
|
-
z.strictObject({
|
|
267
|
-
mode: z.literal("exact"),
|
|
268
|
-
unmatched: z.enum(["abort", "passthrough-approved-origins"]),
|
|
269
|
-
routes: z.array(replayRouteSchema).min(1),
|
|
270
|
-
}),
|
|
271
|
-
])
|
|
272
|
-
.default({ mode: "disabled" })
|
|
273
|
-
.describe("Optional exact request replay. Defaults to disabled; replay routes and unmatched-request behavior must be explicitly declared when enabled.");
|
|
218
|
+
.describe("Optional initial cookies, local storage, or session storage. Defaults to empty; every supplied value and origin must be declared and within the allowed origins.");
|
|
274
219
|
export const browserScenarioSecretSchema = z.strictObject({
|
|
275
220
|
secret_id: scenarioIdentifierSchema,
|
|
276
|
-
environment_variable: z
|
|
277
|
-
|
|
278
|
-
|
|
221
|
+
environment_variable: z
|
|
222
|
+
.string()
|
|
223
|
+
.min(1)
|
|
224
|
+
.refine((name) => !name.includes("=") && !name.includes("\0"), "Environment variable names cannot contain '=' or NUL"),
|
|
279
225
|
});
|
|
280
|
-
const REQUIRED_REDACTED_HEADERS = [
|
|
281
|
-
"authorization",
|
|
282
|
-
"cookie",
|
|
283
|
-
"proxy-authorization",
|
|
284
|
-
"set-cookie",
|
|
285
|
-
];
|
|
286
|
-
const normalizedNames = () => z
|
|
287
|
-
.array(z
|
|
288
|
-
.string()
|
|
289
|
-
.trim()
|
|
290
|
-
.min(1)
|
|
291
|
-
.transform((value) => value.toLowerCase()))
|
|
292
|
-
.transform((values) => [...new Set(values)].sort());
|
|
293
|
-
export const browserScenarioRedactionSchema = z
|
|
294
|
-
.strictObject({
|
|
295
|
-
secret_values: z
|
|
296
|
-
.literal("replace-with-secret-reference")
|
|
297
|
-
.default("replace-with-secret-reference"),
|
|
298
|
-
query_parameter_names: normalizedNames().default([]),
|
|
299
|
-
header_names: normalizedNames().default([...REQUIRED_REDACTED_HEADERS]),
|
|
300
|
-
})
|
|
301
|
-
.superRefine(({ header_names: names }, context) => {
|
|
302
|
-
for (const required of REQUIRED_REDACTED_HEADERS)
|
|
303
|
-
if (!names.includes(required))
|
|
304
|
-
context.addIssue({
|
|
305
|
-
code: "custom",
|
|
306
|
-
path: ["header_names"],
|
|
307
|
-
message: `Required credential header ${required} must be redacted`,
|
|
308
|
-
});
|
|
309
|
-
})
|
|
310
|
-
.default({
|
|
311
|
-
secret_values: "replace-with-secret-reference",
|
|
312
|
-
query_parameter_names: [],
|
|
313
|
-
header_names: [...REQUIRED_REDACTED_HEADERS],
|
|
314
|
-
})
|
|
315
|
-
.describe("Redaction policy. Secret values and credential headers are always redacted; list query parameter names when a secret is used in a URL.");
|
|
316
226
|
const snapshotKindSchema = z.enum([
|
|
317
227
|
"screenshot",
|
|
318
228
|
"dom",
|
|
@@ -340,4 +250,3 @@ export const browserScenarioCaptureSchema = z
|
|
|
340
250
|
})
|
|
341
251
|
.default({ after_each_step: [], at_end: ["url"], events: [] })
|
|
342
252
|
.describe("Optional retained artifacts and event families. Defaults to only a final sanitized URL; request screenshots, DOM, accessibility, history, storage, and event capture explicitly.");
|
|
343
|
-
export const browserScenarioAllowedOriginsSchema = browserAllowedOriginsSchema;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { parseEvidenceBundle, serializeEvidenceBundle, } from "./evidenceBundle.js";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
5
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
6
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
6
7
|
const classificationSchema = z.enum([
|
|
7
8
|
"added",
|
|
8
9
|
"removed",
|
|
@@ -83,7 +84,7 @@ export const compareBundles = (leftInput, rightInput, recordPairs = []) => {
|
|
|
83
84
|
changes,
|
|
84
85
|
limitations: changes.some(({ limitations }) => limitations.length > 0)
|
|
85
86
|
? [
|
|
86
|
-
"
|
|
87
|
+
"EvidenceBundle has no inventory completeness marker; one-sided membership remains unknown.",
|
|
87
88
|
]
|
|
88
89
|
: [],
|
|
89
90
|
});
|
|
@@ -121,32 +122,32 @@ const compareRecords = (left, right, pairs) => {
|
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
const common = [...leftIds].filter((id) => rightIds.has(id) && !pairedLeft.has(id) && !pairedRight.has(id));
|
|
124
|
-
const removed = [...leftIds].filter((id) => !
|
|
125
|
-
const added = [...rightIds].filter((id) => !
|
|
126
|
-
for (const [
|
|
127
|
-
[
|
|
128
|
-
[
|
|
125
|
+
const removed = [...leftIds].filter((id) => !pairedLeft.has(id) && (!rightIds.has(id) || pairedRight.has(id)));
|
|
126
|
+
const added = [...rightIds].filter((id) => !pairedRight.has(id) && (!leftIds.has(id) || pairedLeft.has(id)));
|
|
127
|
+
for (const [ids, side] of [
|
|
128
|
+
[removed, "left"],
|
|
129
|
+
[added, "right"],
|
|
129
130
|
])
|
|
130
131
|
for (const id of ids)
|
|
131
132
|
changes.push({
|
|
132
133
|
entity: "evidence",
|
|
133
134
|
key: id,
|
|
134
|
-
classification,
|
|
135
|
-
conclusion_kind: "
|
|
135
|
+
classification: "unknown",
|
|
136
|
+
conclusion_kind: "unresolved_branch",
|
|
136
137
|
left_evidence_ids: side === "left" ? [id] : [],
|
|
137
138
|
right_evidence_ids: side === "right" ? [id] : [],
|
|
138
139
|
left_digest: side === "left" ? id.slice(3) : null,
|
|
139
140
|
right_digest: side === "right" ? id.slice(3) : null,
|
|
140
141
|
limitations: [
|
|
141
|
-
"
|
|
142
|
+
"EvidenceBundle has no inventory completeness marker; one-sided membership may reflect incomplete capture.",
|
|
142
143
|
],
|
|
143
144
|
});
|
|
144
145
|
return {
|
|
145
146
|
changes,
|
|
146
147
|
summary: {
|
|
147
148
|
records_unchanged: common.length + pairs.length - changed,
|
|
148
|
-
records_added:
|
|
149
|
-
records_removed:
|
|
149
|
+
records_added: 0,
|
|
150
|
+
records_removed: 0,
|
|
150
151
|
records_changed: changed,
|
|
151
152
|
},
|
|
152
153
|
};
|
|
@@ -167,9 +168,7 @@ const compareUnknowns = (left, right) => {
|
|
|
167
168
|
const leftHistory = leftHistories.get(id);
|
|
168
169
|
const rightHistory = rightHistories.get(id);
|
|
169
170
|
if (leftHistory === undefined || rightHistory === undefined) {
|
|
170
|
-
|
|
171
|
-
summary[added ? "unknowns_added" : "unknowns_removed"] += 1;
|
|
172
|
-
changes.push(unknownChange(id, added ? "added" : "removed", leftHistory, rightHistory));
|
|
171
|
+
changes.push(unknownChange(id, "unknown", leftHistory, rightHistory));
|
|
173
172
|
continue;
|
|
174
173
|
}
|
|
175
174
|
const leftDigests = leftHistory.map(({ revision_digest: digest }) => digest);
|
|
@@ -199,7 +198,9 @@ const unknownChange = (id, classification, left, right) => ({
|
|
|
199
198
|
left_digest: left?.at(-1)?.revision_digest ?? null,
|
|
200
199
|
right_digest: right?.at(-1)?.revision_digest ?? null,
|
|
201
200
|
limitations: left === undefined || right === undefined
|
|
202
|
-
? [
|
|
201
|
+
? [
|
|
202
|
+
"EvidenceBundle has no inventory completeness marker; one-sided history membership remains unknown.",
|
|
203
|
+
]
|
|
203
204
|
: [],
|
|
204
205
|
});
|
|
205
206
|
const histories = (unknowns) => {
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { emptyArraySchema } from "./emptyArraySchema.js";
|
|
2
3
|
import { evidenceSchema } from "./evidence.js";
|
|
3
|
-
|
|
4
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
5
|
+
const addressSchema = z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^(?:(?:[A-Za-z0-9._~-]|%[0-9A-F]{2})+:)?0x(?:0|[1-9a-f][0-9a-f]*)$/u);
|
|
4
8
|
const inputAddressSchema = z
|
|
5
9
|
.string()
|
|
6
|
-
.regex(/^0[xX][0-9a-fA-F]+$/u)
|
|
7
|
-
.transform((address) =>
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
+
.regex(/^(?:(?:[A-Za-z0-9._~-]|%[0-9a-fA-F]{2})+:)?0[xX][0-9a-fA-F]+$/u)
|
|
11
|
+
.transform((address) => {
|
|
12
|
+
const separator = address.lastIndexOf(":") + 1;
|
|
13
|
+
const space = address
|
|
14
|
+
.slice(0, separator)
|
|
15
|
+
.replace(/%[0-9a-fA-F]{2}/gu, (escape) => escape.toUpperCase());
|
|
16
|
+
return `${space}0x${BigInt(address.slice(separator)).toString(16)}`;
|
|
17
|
+
});
|
|
18
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
19
|
+
/** Normalize a hexadecimal offset while preserving its optional address space. */
|
|
10
20
|
export const parseCallPathAddress = (input) => inputAddressSchema.parse(input);
|
|
11
21
|
/** Strict input for explicit call-path reconstruction from complete dossiers. */
|
|
12
22
|
export const callPathInputSchema = z.object({
|
|
@@ -67,13 +77,13 @@ export const callPathResultSchema = z.union([
|
|
|
67
77
|
status: z.literal("not_found"),
|
|
68
78
|
shortest_hops: z.null(),
|
|
69
79
|
search_scope: z.object({ exhaustive: z.literal(true) }),
|
|
70
|
-
paths:
|
|
80
|
+
paths: emptyArraySchema,
|
|
71
81
|
}),
|
|
72
82
|
z.object({
|
|
73
83
|
...resultContextShape,
|
|
74
84
|
status: z.literal("unknown"),
|
|
75
85
|
shortest_hops: z.null(),
|
|
76
86
|
search_scope: z.object({ exhaustive: z.literal(false) }),
|
|
77
|
-
paths:
|
|
87
|
+
paths: emptyArraySchema,
|
|
78
88
|
}),
|
|
79
89
|
]);
|
|
@@ -3,7 +3,8 @@ import { artifactComparisonResultSchema } from "./artifactComparison.js";
|
|
|
3
3
|
import { evidenceSchema, parseEvidence } from "./evidence.js";
|
|
4
4
|
import { functionComparisonResultSchema } from "./functionComparison.js";
|
|
5
5
|
import { comparisonStatusSchema, deriveProcessComparisonStatus, PROCESS_COMPARISON_DIMENSIONS, processCaptureComparisonSchema, } from "./processCapture.js";
|
|
6
|
-
|
|
6
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
7
8
|
/** Input for aggregating existing comparison Evidence. */
|
|
8
9
|
export const changedBehaviorInputSchema = z.object({
|
|
9
10
|
comparisons: z.array(evidenceSchema).default([]),
|
|
@@ -179,9 +180,7 @@ const processFindings = (evidence) => {
|
|
|
179
180
|
["interaction", result.interaction, "runtime"],
|
|
180
181
|
["exit", result.exit, "runtime"],
|
|
181
182
|
["filesystem", result.filesystem, "resource"],
|
|
182
|
-
["protocol", result.protocol, "protocol"],
|
|
183
183
|
["process", result.process, "runtime"],
|
|
184
|
-
["shim", result.shim, "protocol"],
|
|
185
184
|
];
|
|
186
185
|
return dimensions.flatMap(([dimension, status, scope]) => status === "unchanged"
|
|
187
186
|
? []
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import canonicalize from "canonicalize";
|
|
3
|
+
/** Whether an inventory can support a claim that an item is absent. */
|
|
4
|
+
export const absenceClaimable = (coverage) => coverage.status === "complete" &&
|
|
5
|
+
coverage.truncated !== true &&
|
|
6
|
+
(coverage.omitted_count === undefined || coverage.omitted_count === 0);
|
|
7
|
+
/** SHA-256 of canonical JSON for stable, provider-neutral comparison IDs. */
|
|
8
|
+
export const canonicalDigest = (value, context = "Comparison") => {
|
|
9
|
+
return createHash("sha256")
|
|
10
|
+
.update(canonicalJson(value, context))
|
|
11
|
+
.digest("hex");
|
|
12
|
+
};
|
|
13
|
+
/** Canonical JSON used for deterministic tie breaking and stable digests. */
|
|
14
|
+
export const canonicalJson = (value, context = "Comparison") => {
|
|
15
|
+
const encoded = canonicalize(value);
|
|
16
|
+
if (encoded === undefined)
|
|
17
|
+
throw new TypeError(`${context} could not canonicalize data`);
|
|
18
|
+
return encoded;
|
|
19
|
+
};
|
|
@@ -2,8 +2,9 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createEvidenceCompletionLedger, evidenceCompletionRecordSchema, } from "./evidenceCompletionLedger.js";
|
|
5
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
6
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
5
7
|
const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
|
|
6
|
-
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
7
8
|
const identitySchema = z.strictObject({
|
|
8
9
|
id: identifierSchema,
|
|
9
10
|
version: z.string().min(1),
|
|
@@ -93,7 +94,7 @@ const manifestClaimSchema = reportClaimSchema.omit({
|
|
|
93
94
|
evidence_ids: true,
|
|
94
95
|
});
|
|
95
96
|
const completionManifestObjectSchema = z.strictObject({
|
|
96
|
-
manifest_id:
|
|
97
|
+
manifest_id: prefixedDigestSchema("ecm"),
|
|
97
98
|
verifier: identitySchema,
|
|
98
99
|
environment: environmentSchema,
|
|
99
100
|
skill_digests: z.array(skillDigestSchema).min(1),
|
|
@@ -4,7 +4,8 @@ import { z } from "zod";
|
|
|
4
4
|
import { evidenceEnvelopeSchema } from "./evidence.js";
|
|
5
5
|
import { evidenceBundleSchema } from "./evidenceBundle.js";
|
|
6
6
|
import { err, ok } from "./result.js";
|
|
7
|
-
|
|
7
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
8
|
+
const conformancePackageIdSchema = prefixedDigestSchema("cp");
|
|
8
9
|
const scenarioIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
|
|
9
10
|
const scenarioManifestSchema = z.strictObject({
|
|
10
11
|
scenario_id: scenarioIdSchema,
|
|
@@ -265,11 +265,9 @@ function sortKeys(value) {
|
|
|
265
265
|
return value.map(sortKeys);
|
|
266
266
|
if (!isRecord(value))
|
|
267
267
|
return value;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
return sorted;
|
|
268
|
+
return Object.fromEntries(Object.keys(value)
|
|
269
|
+
.sort()
|
|
270
|
+
.map((key) => [key, sortKeys(value[key])]));
|
|
273
271
|
}
|
|
274
272
|
/**
|
|
275
273
|
* Evaluate a trust gate for one scenario by comparing expected
|
|
@@ -73,7 +73,7 @@ export const authFlowEventSchema = z.strictObject({
|
|
|
73
73
|
token_lifecycle: tokenLifecycleEventSchema.nullable(),
|
|
74
74
|
/** Correlation ID linking challenge-response pairs. */
|
|
75
75
|
correlation_id: z.string().nullable(),
|
|
76
|
-
/** Whether
|
|
76
|
+
/** Whether the capture producer marked credentials as redacted. */
|
|
77
77
|
credentials_redacted: z.boolean().default(false),
|
|
78
78
|
/** Whether the authentication succeeded. */
|
|
79
79
|
succeeded: z.boolean().default(false),
|
|
@@ -90,7 +90,7 @@ export const customProtocolCaptureSchema = z.strictObject({
|
|
|
90
90
|
auth_events: z.array(authFlowEventSchema).default([]),
|
|
91
91
|
/** Whether any frame was truncated. */
|
|
92
92
|
has_truncated: z.boolean().default(false),
|
|
93
|
-
/** Whether
|
|
93
|
+
/** Whether the capture producer detected credential content. */
|
|
94
94
|
credentials_detected: z.boolean().default(false),
|
|
95
95
|
});
|
|
96
96
|
/** Correlate a frame with process identity. */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical digest and identifier shapes.
|
|
4
|
+
*
|
|
5
|
+
* These were previously a hand-copied regex in ~30 modules: 32 local
|
|
6
|
+
* `digestSchema` definitions plus a distinct literal for each of roughly
|
|
7
|
+
* thirty `prefix_hash` identifier families. Nothing kept them in step, so a
|
|
8
|
+
* change to what counts as a digest had to be found and repeated by hand.
|
|
9
|
+
*
|
|
10
|
+
* One owner means the shape is stated once, and a new identifier family
|
|
11
|
+
* cannot accidentally invent its own spelling of "lowercase sha256".
|
|
12
|
+
*/
|
|
13
|
+
/** Lowercase hex SHA-256, as every digest in the system is emitted. */
|
|
14
|
+
export const SHA256_PATTERN = /^[a-f0-9]{64}$/u;
|
|
15
|
+
/** A bare artifact/content digest. */
|
|
16
|
+
export const digestSchema = z.string().regex(SHA256_PATTERN);
|
|
17
|
+
/**
|
|
18
|
+
* A namespaced identifier: `<prefix>_<64 lowercase hex>`. Prefixes keep
|
|
19
|
+
* identifiers from different families apart at a glance and make a
|
|
20
|
+
* mis-pasted identifier from another family fail validation rather than
|
|
21
|
+
* resolve to the wrong object.
|
|
22
|
+
*/
|
|
23
|
+
export const prefixedDigestSchema = (prefix) => z
|
|
24
|
+
.string()
|
|
25
|
+
.regex(new RegExp(`^${prefix}_[a-f0-9]{64}$`, "u"), `Expected a ${prefix}_ prefixed lowercase sha256 digest`);
|
|
26
|
+
/** True when `value` is a bare digest. */
|
|
27
|
+
export const isDigest = (value) => typeof value === "string" && SHA256_PATTERN.test(value);
|
|
28
|
+
/** True when `value` is a digest carrying `prefix`. */
|
|
29
|
+
export const isPrefixedDigest = (value, prefix) => typeof value === "string" &&
|
|
30
|
+
prefixedDigestSchema(prefix).safeParse(value).success;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { err, ok } from "./result.js";
|
|
2
|
+
/**
|
|
3
|
+
* Locate a Windows new-header declaration without interpreting a short DOS
|
|
4
|
+
* header's load-module or relocation-table bytes at 0x3c as e_lfanew. A
|
|
5
|
+
* new-header pointer must lie in a sufficiently large header and outside
|
|
6
|
+
* actual relocation records. Zero-sized legacy stubs remain eligible for
|
|
7
|
+
* PE signature validation.
|
|
8
|
+
*/
|
|
9
|
+
export const mzWindowsHeaderOffset = (bytes) => {
|
|
10
|
+
if (bytes.length < 64)
|
|
11
|
+
return null;
|
|
12
|
+
const headerBytes = bytes.readUInt16LE(8) * 16;
|
|
13
|
+
if (headerBytes !== 0 && headerBytes < 64)
|
|
14
|
+
return null;
|
|
15
|
+
const relocationCount = bytes.readUInt16LE(6);
|
|
16
|
+
const tableStart = bytes.readUInt16LE(24);
|
|
17
|
+
if (headerBytes !== 0 &&
|
|
18
|
+
relocationCount > 0 &&
|
|
19
|
+
tableStart < 64 &&
|
|
20
|
+
tableStart + relocationCount * 4 > 60)
|
|
21
|
+
return null;
|
|
22
|
+
const offset = bytes.readUInt32LE(60);
|
|
23
|
+
return offset === 0 ? null : offset;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Validate a DOS MZ load module using a bounded header/table and the actual
|
|
27
|
+
* file length. Appended overlay bytes are retained separately; they are not
|
|
28
|
+
* silently included in the initialized load module.
|
|
29
|
+
*/
|
|
30
|
+
export const parseDosMzHeader = (bytes, fileSize = bytes.length) => {
|
|
31
|
+
if (bytes.length < 28 || bytes.toString("ascii", 0, 2) !== "MZ")
|
|
32
|
+
return err("invalid or truncated DOS MZ header");
|
|
33
|
+
if (!Number.isSafeInteger(fileSize) || fileSize < bytes.length)
|
|
34
|
+
return err("invalid DOS MZ file length");
|
|
35
|
+
if (mzWindowsHeaderOffset(bytes) !== null)
|
|
36
|
+
return err("MZ declares a Windows new header; it is not a DOS-only image");
|
|
37
|
+
const lastPageBytes = bytes.readUInt16LE(2);
|
|
38
|
+
const pages = bytes.readUInt16LE(4);
|
|
39
|
+
if (pages === 0 || lastPageBytes > 511)
|
|
40
|
+
return err("invalid DOS MZ page count or final-page size");
|
|
41
|
+
const imageBytes = (pages - 1) * 512 + (lastPageBytes === 0 ? 512 : lastPageBytes);
|
|
42
|
+
const headerBytes = bytes.readUInt16LE(8) * 16;
|
|
43
|
+
if (headerBytes < 28 || headerBytes >= imageBytes)
|
|
44
|
+
return err("invalid DOS MZ header size or empty load module");
|
|
45
|
+
if (imageBytes > fileSize)
|
|
46
|
+
return err("truncated DOS MZ load module");
|
|
47
|
+
const relocationCount = bytes.readUInt16LE(6);
|
|
48
|
+
const relocationTableOffset = bytes.readUInt16LE(24);
|
|
49
|
+
const tableEnd = relocationTableOffset + relocationCount * 4;
|
|
50
|
+
if (relocationCount > 0 &&
|
|
51
|
+
(relocationTableOffset < 28 || tableEnd > headerBytes))
|
|
52
|
+
return err("DOS MZ relocation table lies outside its header");
|
|
53
|
+
if (relocationCount > 0 && tableEnd > bytes.length)
|
|
54
|
+
return err("truncated DOS MZ relocation table");
|
|
55
|
+
const moduleBytes = imageBytes - headerBytes;
|
|
56
|
+
const relocations = validateRelocations(bytes, relocationTableOffset, relocationCount, moduleBytes);
|
|
57
|
+
if (!relocations.ok)
|
|
58
|
+
return relocations;
|
|
59
|
+
const entryOffset = bytes.readUInt16LE(20);
|
|
60
|
+
const entrySegment = bytes.readUInt16LE(22);
|
|
61
|
+
if (entrySegment * 16 + entryOffset >= moduleBytes)
|
|
62
|
+
return err("DOS MZ entry point lies outside its initialized load module");
|
|
63
|
+
return ok({
|
|
64
|
+
headerBytes,
|
|
65
|
+
imageBytes,
|
|
66
|
+
moduleBytes,
|
|
67
|
+
overlayBytes: fileSize - imageBytes,
|
|
68
|
+
relocationCount,
|
|
69
|
+
relocationTableOffset,
|
|
70
|
+
entrySegment,
|
|
71
|
+
entryOffset,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const validateRelocations = (bytes, relocationTableOffset, relocationCount, moduleBytes) => {
|
|
75
|
+
for (let index = 0; index < relocationCount; index += 1) {
|
|
76
|
+
const record = relocationTableOffset + index * 4;
|
|
77
|
+
const offset = bytes.readUInt16LE(record);
|
|
78
|
+
const segment = bytes.readUInt16LE(record + 2);
|
|
79
|
+
if (segment * 16 + offset + 2 > moduleBytes)
|
|
80
|
+
return err(`DOS MZ relocation ${index} points outside its load module`);
|
|
81
|
+
}
|
|
82
|
+
return ok(undefined);
|
|
83
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { isAbsolute } from "node:path";
|
|
2
1
|
import { z } from "zod";
|
|
2
|
+
const pathInputSchema = z.string().trim().min(1);
|
|
3
3
|
const absolutePathSchema = z
|
|
4
4
|
.string()
|
|
5
5
|
.min(1)
|
|
6
|
-
.refine(
|
|
6
|
+
.refine((value) => value.startsWith("/") ||
|
|
7
|
+
/^[A-Za-z]:[\\/]/u.test(value) ||
|
|
8
|
+
value.startsWith("\\\\"), "provider path must be absolute");
|
|
7
9
|
const windowIndexSchema = z.number().int().min(0);
|
|
8
10
|
const deepLinkUrlSchema = z
|
|
9
11
|
.string()
|
|
@@ -48,9 +50,9 @@ const actionSchema = z.discriminatedUnion("kind", [
|
|
|
48
50
|
]);
|
|
49
51
|
/** Input for one explicit, provider-owned Electron runtime experiment. */
|
|
50
52
|
export const electronActiveObservationInputSchema = z.strictObject({
|
|
51
|
-
executable_path:
|
|
52
|
-
application_path:
|
|
53
|
-
application_root:
|
|
53
|
+
executable_path: pathInputSchema,
|
|
54
|
+
application_path: pathInputSchema,
|
|
55
|
+
application_root: pathInputSchema.optional(),
|
|
54
56
|
args: z.array(z.string()).default([]),
|
|
55
57
|
actions: z.array(actionSchema).default([]),
|
|
56
58
|
});
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { browserCompletenessSchema } from "./browserCompleteness.js";
|
|
3
3
|
import { browserEndpointSchema } from "./browserObservation.js";
|
|
4
4
|
import { webTextArtifactSchema } from "./webContentArtifact.js";
|
|
5
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
5
6
|
const approvedElectronInput = {
|
|
6
7
|
cdp_endpoint: browserEndpointSchema,
|
|
7
8
|
};
|
|
@@ -82,7 +83,7 @@ export const electronPageInspectionSchema = z.object({
|
|
|
82
83
|
scripts: z.object({
|
|
83
84
|
total: z.number().int().min(0),
|
|
84
85
|
items: z.array(z.object({
|
|
85
|
-
script_key:
|
|
86
|
+
script_key: prefixedDigestSchema("electron_script"),
|
|
86
87
|
frame_id: z.string().nullable().default(null),
|
|
87
88
|
file_path: z.string(),
|
|
88
89
|
cdp_hash: z.string(),
|
|
@@ -93,7 +94,7 @@ export const electronPageInspectionSchema = z.object({
|
|
|
93
94
|
})),
|
|
94
95
|
}),
|
|
95
96
|
resources: z.array(z.object({
|
|
96
|
-
resource_key:
|
|
97
|
+
resource_key: prefixedDigestSchema("electron_resource"),
|
|
97
98
|
file_path: z.string(),
|
|
98
99
|
type: z.string(),
|
|
99
100
|
mime_type: z.string(),
|