rea-agents 3.2.1 → 4.0.1
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
|
@@ -4,18 +4,19 @@ import { z } from "zod";
|
|
|
4
4
|
import { artifactInventoryResultSchema, } from "./artifactGraph.js";
|
|
5
5
|
import { evidenceSchema, parseEvidence } from "./evidence.js";
|
|
6
6
|
import { jsonValueSchema } from "./jsonValue.js";
|
|
7
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
7
8
|
const textSchema = z.string().min(1);
|
|
8
|
-
const evidenceIdSchema =
|
|
9
|
-
const artifactIdSchema =
|
|
9
|
+
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
10
|
+
const artifactIdSchema = prefixedDigestSchema("art");
|
|
10
11
|
const inspectionObservationSchema = z.strictObject({
|
|
11
|
-
observation_id:
|
|
12
|
+
observation_id: prefixedDigestSchema("aio"),
|
|
12
13
|
kind: z.enum(["root-manifest", "artifact", "occurrence", "integrity"]),
|
|
13
14
|
subject: textSchema,
|
|
14
15
|
value: jsonValueSchema,
|
|
15
16
|
evidence_id: evidenceIdSchema,
|
|
16
17
|
});
|
|
17
18
|
const inspectionRelationshipSchema = z.strictObject({
|
|
18
|
-
relationship_id:
|
|
19
|
+
relationship_id: prefixedDigestSchema("air"),
|
|
19
20
|
relation: z.enum([
|
|
20
21
|
"contains",
|
|
21
22
|
"extracts",
|
|
@@ -27,21 +28,21 @@ const inspectionRelationshipSchema = z.strictObject({
|
|
|
27
28
|
]),
|
|
28
29
|
source_artifact_id: artifactIdSchema,
|
|
29
30
|
target_artifact_id: artifactIdSchema,
|
|
30
|
-
occurrence_id:
|
|
31
|
+
occurrence_id: prefixedDigestSchema("occ"),
|
|
31
32
|
logical_path: textSchema.nullable(),
|
|
32
33
|
evidence_id: evidenceIdSchema,
|
|
33
34
|
});
|
|
34
35
|
const inspectionHypothesisSchema = z.strictObject({
|
|
35
|
-
hypothesis_id:
|
|
36
|
+
hypothesis_id: prefixedDigestSchema("aih"),
|
|
36
37
|
statement: textSchema,
|
|
37
38
|
confidence: z.enum(["medium", "low"]),
|
|
38
39
|
basis_evidence_ids: z.array(evidenceIdSchema).min(1),
|
|
39
40
|
limitation: textSchema,
|
|
40
41
|
});
|
|
41
42
|
const inspectionContradictionSchema = z.strictObject({
|
|
42
|
-
contradiction_id:
|
|
43
|
+
contradiction_id: prefixedDigestSchema("aic"),
|
|
43
44
|
statement: textSchema,
|
|
44
|
-
occurrence_id:
|
|
45
|
+
occurrence_id: prefixedDigestSchema("occ"),
|
|
45
46
|
declared_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
46
47
|
observed_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
47
48
|
evidence_id: evidenceIdSchema,
|
|
@@ -57,7 +58,7 @@ const nextProbeSchema = z.strictObject({
|
|
|
57
58
|
]),
|
|
58
59
|
});
|
|
59
60
|
const unexploredBranchSchema = z.strictObject({
|
|
60
|
-
branch_id:
|
|
61
|
+
branch_id: prefixedDigestSchema("aib"),
|
|
61
62
|
reason: z.enum(["format-specific-analysis-required", "unknown-format"]),
|
|
62
63
|
detail: textSchema,
|
|
63
64
|
next_probe: nextProbeSchema.nullable(),
|
|
@@ -65,16 +66,16 @@ const unexploredBranchSchema = z.strictObject({
|
|
|
65
66
|
});
|
|
66
67
|
/** Provider-neutral inspection result with its atomic source Evidence. */
|
|
67
68
|
export const artifactInspectionResultSchema = z.strictObject({
|
|
68
|
-
inspection_id:
|
|
69
|
+
inspection_id: prefixedDigestSchema("ai"),
|
|
69
70
|
subject: z.strictObject({
|
|
70
|
-
manifest_id:
|
|
71
|
+
manifest_id: prefixedDigestSchema("agm"),
|
|
71
72
|
root_artifact_id: artifactIdSchema,
|
|
72
73
|
root_sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
73
74
|
root_format: textSchema,
|
|
74
75
|
}),
|
|
75
76
|
substeps: z
|
|
76
77
|
.array(z.strictObject({
|
|
77
|
-
substep_id:
|
|
78
|
+
substep_id: prefixedDigestSchema("ais"),
|
|
78
79
|
operation: z.literal("inventory_artifact"),
|
|
79
80
|
status: z.literal("completed"),
|
|
80
81
|
evidence_id: evidenceIdSchema,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { err, ok } from "./result.js";
|
|
2
|
+
import { mzWindowsHeaderOffset, parseDosMzHeader } from "./dosMz.js";
|
|
2
3
|
/**
|
|
3
4
|
* Parse supported executable headers without I/O. The caller supplies the host
|
|
4
5
|
* architecture used for deterministic FAT Mach-O slice selection.
|
|
5
6
|
*/
|
|
6
|
-
export const parseExecutableHeader = (bytes, hostArchitecture) => {
|
|
7
|
+
export const parseExecutableHeader = (bytes, hostArchitecture, fileSize = bytes.length) => {
|
|
7
8
|
if (bytes.length >= 4 &&
|
|
8
9
|
bytes.subarray(0, 4).equals(Buffer.from([0x7f, 0x45, 0x4c, 0x46])))
|
|
9
10
|
return parseElf(bytes);
|
|
10
11
|
if (bytes.length >= 2 && bytes[0] === 0x4d && bytes[1] === 0x5a)
|
|
11
|
-
return
|
|
12
|
+
return parseMz(bytes, fileSize);
|
|
12
13
|
if (bytes.length < 8)
|
|
13
14
|
return err("truncated or unsupported binary header");
|
|
14
15
|
const magic = bytes.readUInt32BE(0);
|
|
@@ -82,13 +83,24 @@ const parseElf = (bytes) => {
|
|
|
82
83
|
availableArchitectures: [architecture],
|
|
83
84
|
});
|
|
84
85
|
};
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
const parseMz = (bytes, fileSize) => {
|
|
87
|
+
const offset = mzWindowsHeaderOffset(bytes);
|
|
88
|
+
if (offset !== null) {
|
|
89
|
+
if (offset < 64 || offset > bytes.length - 24)
|
|
90
|
+
return err("invalid or truncated Windows executable header in MZ image");
|
|
91
|
+
const signature = bytes.toString("ascii", offset, offset + 2);
|
|
92
|
+
if (["NE", "LE", "LX"].includes(signature))
|
|
93
|
+
return err(`unsupported ${signature} executable in MZ image`);
|
|
94
|
+
return parsePeRecord(bytes.subarray(offset));
|
|
95
|
+
}
|
|
96
|
+
const parsed = parseDosMzHeader(bytes, fileSize);
|
|
97
|
+
return parsed.ok
|
|
98
|
+
? ok({
|
|
99
|
+
format: "dos-mz",
|
|
100
|
+
architecture: "x86",
|
|
101
|
+
availableArchitectures: ["x86"],
|
|
102
|
+
})
|
|
103
|
+
: parsed;
|
|
92
104
|
};
|
|
93
105
|
/** Parse a bounded PE signature, COFF record, and optional header without I/O. */
|
|
94
106
|
export const parsePeRecord = (record) => {
|
|
@@ -173,6 +185,8 @@ const peArchitecture = (machine) => {
|
|
|
173
185
|
case 0x8664:
|
|
174
186
|
return "x86_64";
|
|
175
187
|
case 0x1c0:
|
|
188
|
+
case 0x1c2:
|
|
189
|
+
case 0x1c4:
|
|
176
190
|
return "arm";
|
|
177
191
|
case 0xaa64:
|
|
178
192
|
return "arm64";
|
|
@@ -66,13 +66,13 @@ export const browserEndpointSchema = z
|
|
|
66
66
|
});
|
|
67
67
|
export const browserAllowedOriginsSchema = z
|
|
68
68
|
.array(browserOriginSchema)
|
|
69
|
-
.
|
|
70
|
-
.
|
|
69
|
+
.transform((origins) => Array.from(new Set(origins)).sort())
|
|
70
|
+
.default([]);
|
|
71
71
|
const browserInput = {
|
|
72
72
|
cdp_endpoint: browserEndpointSchema,
|
|
73
73
|
allowed_origins: browserAllowedOriginsSchema,
|
|
74
74
|
};
|
|
75
|
-
/** Public input for complete discovery
|
|
75
|
+
/** Public input for complete discovery, optionally filtered by exact origin. */
|
|
76
76
|
export const listBrowserTargetsInputSchema = z.object({
|
|
77
77
|
...browserInput,
|
|
78
78
|
});
|
|
@@ -116,7 +116,7 @@ export const sanitizedBrowserUrlSchema = z.object({
|
|
|
116
116
|
query_parameter_names: z.array(z.string()),
|
|
117
117
|
redacted: z.boolean(),
|
|
118
118
|
});
|
|
119
|
-
/**
|
|
119
|
+
/** Preserve local URL data while removing only URL userinfo credentials. */
|
|
120
120
|
export const sanitizeBrowserUrl = (value) => {
|
|
121
121
|
let parsed;
|
|
122
122
|
try {
|
|
@@ -124,38 +124,57 @@ export const sanitizeBrowserUrl = (value) => {
|
|
|
124
124
|
}
|
|
125
125
|
catch {
|
|
126
126
|
return {
|
|
127
|
-
url:
|
|
127
|
+
url: value,
|
|
128
128
|
origin: null,
|
|
129
129
|
query_parameter_names: [],
|
|
130
|
-
redacted:
|
|
130
|
+
redacted: false,
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
const hadCredentials = parsed.username !== "" || parsed.password !== "";
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
parsed.hash = "";
|
|
139
|
-
parsed.search = "";
|
|
140
|
-
for (const name of names)
|
|
141
|
-
parsed.searchParams.append(name, "[REDACTED]");
|
|
134
|
+
const names = [...parsed.searchParams.keys()];
|
|
135
|
+
const sanitizedUrl = hadCredentials
|
|
136
|
+
? removeUrlUserInfo(value, parsed)
|
|
137
|
+
: value;
|
|
142
138
|
return {
|
|
143
|
-
url:
|
|
139
|
+
url: sanitizedUrl,
|
|
144
140
|
origin: parsed.origin === "null" ? null : parsed.origin,
|
|
145
141
|
query_parameter_names: names,
|
|
146
|
-
redacted: hadCredentials
|
|
142
|
+
redacted: hadCredentials,
|
|
147
143
|
};
|
|
148
144
|
};
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
const removeUrlUserInfo = (value, parsed) => {
|
|
146
|
+
const schemeSeparator = value.indexOf("://");
|
|
147
|
+
const authorityStart = schemeSeparator < 0
|
|
148
|
+
? value.startsWith("//")
|
|
149
|
+
? 2
|
|
150
|
+
: -1
|
|
151
|
+
: schemeSeparator + 3;
|
|
152
|
+
if (authorityStart < 0)
|
|
153
|
+
return credentialFreeHref(parsed);
|
|
154
|
+
const remaining = value.slice(authorityStart);
|
|
155
|
+
const delimiter = remaining.search(/[/?#]/u);
|
|
156
|
+
const authorityEnd = delimiter < 0 ? value.length : authorityStart + delimiter;
|
|
157
|
+
const authority = value.slice(authorityStart, authorityEnd);
|
|
158
|
+
const userInfoEnd = authority.lastIndexOf("@");
|
|
159
|
+
if (userInfoEnd < 0)
|
|
160
|
+
return credentialFreeHref(parsed);
|
|
161
|
+
const candidate = `${value.slice(0, authorityStart)}${authority.slice(userInfoEnd + 1)}${value.slice(authorityEnd)}`;
|
|
151
162
|
try {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
: sanitized;
|
|
163
|
+
const candidateUrl = new URL(candidate);
|
|
164
|
+
return candidateUrl.username === "" && candidateUrl.password === ""
|
|
165
|
+
? candidate
|
|
166
|
+
: credentialFreeHref(parsed);
|
|
157
167
|
}
|
|
158
168
|
catch {
|
|
159
|
-
return
|
|
169
|
+
return credentialFreeHref(parsed);
|
|
160
170
|
}
|
|
161
171
|
};
|
|
172
|
+
const credentialFreeHref = (parsed) => {
|
|
173
|
+
parsed.username = "";
|
|
174
|
+
parsed.password = "";
|
|
175
|
+
return parsed.href;
|
|
176
|
+
};
|
|
177
|
+
/** Normalize endpoint candidates without discarding local query or fragment data. */
|
|
178
|
+
export const sanitizeEndpointCandidate = (value) => {
|
|
179
|
+
return sanitizeBrowserUrl(value).url;
|
|
180
|
+
};
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { browserCompletenessSchema } from "./browserCompleteness.js";
|
|
3
3
|
import { webTextArtifactSchema } from "./webContentArtifact.js";
|
|
4
4
|
import { jsonShapeSchema } from "./jsonShape.js";
|
|
5
|
+
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
5
6
|
const browserVersionSchema = z.object({
|
|
6
7
|
product: z.string(),
|
|
7
8
|
protocol_version: z.string(),
|
|
@@ -88,7 +89,7 @@ const browserScriptSchema = z.object({
|
|
|
88
89
|
source: browserScriptSourceSchema,
|
|
89
90
|
});
|
|
90
91
|
const browserResourceSchema = z.object({
|
|
91
|
-
resource_key:
|
|
92
|
+
resource_key: prefixedDigestSchema("res"),
|
|
92
93
|
url: z.string(),
|
|
93
94
|
origin: z.string().nullable(),
|
|
94
95
|
type: z.string(),
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { browserScenarioActionSchema,
|
|
2
|
+
import { browserScenarioActionSchema, browserScenarioBrowserSchema, browserScenarioCaptureSchema, browserScenarioEnvironmentSchema, browserScenarioSecretSchema, browserScenarioStorageSchema, browserScenarioUrlSchema, } from "./browserScenarioValues.js";
|
|
3
3
|
export { browserScenarioActionSchema, browserScenarioUrlSchema, browserScenarioValueSchema, } from "./browserScenarioValues.js";
|
|
4
4
|
export const browserScenarioInputSchema = z.strictObject({
|
|
5
|
-
browser: browserScenarioBrowserSchema.describe("Required launch/connect
|
|
5
|
+
browser: browserScenarioBrowserSchema.describe("Required launch/connect selection. Launch uses the selected executable and an owned temporary profile; connect uses one loopback CDP endpoint and target."),
|
|
6
6
|
start_url: browserScenarioUrlSchema.describe("Required initial HTTP(S) URL. Query values must be declared separately as public literals or secret references."),
|
|
7
|
-
allowed_origins: browserScenarioAllowedOriginsSchema.describe("Required exact HTTP(S) origins for the start URL and every later navigation, storage seed, and replay route."),
|
|
8
7
|
environment: browserScenarioEnvironmentSchema,
|
|
9
8
|
actions: z
|
|
10
9
|
.array(browserScenarioActionSchema)
|
|
11
10
|
.min(1)
|
|
12
11
|
.describe("Required sequence of explicit browser actions."),
|
|
13
12
|
storage: browserScenarioStorageSchema,
|
|
14
|
-
request_replay: browserScenarioRequestReplaySchema,
|
|
15
13
|
secrets: z
|
|
16
14
|
.array(browserScenarioSecretSchema)
|
|
17
15
|
.default([])
|
|
18
|
-
.describe("Optional
|
|
19
|
-
redaction: browserScenarioRedactionSchema,
|
|
16
|
+
.describe("Optional environment-variable references for values used in actions, URLs, storage, or replay, and for redacting matching observed text. Secret values are never supplied inline."),
|
|
20
17
|
capture: browserScenarioCaptureSchema,
|
|
21
18
|
});
|
|
22
19
|
const addIssue = (context, path, message) => context.addIssue({ code: "custom", path, message });
|
|
@@ -24,11 +21,6 @@ const assertUnique = (values, path, label, context) => {
|
|
|
24
21
|
if (new Set(values).size !== values.length)
|
|
25
22
|
addIssue(context, path, `${label} must be unique`);
|
|
26
23
|
};
|
|
27
|
-
const originFor = (destination) => new URL(destination.url).origin;
|
|
28
|
-
const assertAllowedDestination = (destination, allowedOrigins, path, context) => {
|
|
29
|
-
if (!allowedOrigins.has(originFor(destination)))
|
|
30
|
-
addIssue(context, path, `URL origin ${originFor(destination)} is not declared in allowed_origins`);
|
|
31
|
-
};
|
|
32
24
|
const secretReferencesInValue = (value) => (value?.source === "secret" ? [value.secret_id] : []);
|
|
33
25
|
const destinationSecretReferences = (destination) => destination.query.flatMap(({ value }) => secretReferencesInValue(value));
|
|
34
26
|
const actionSecretReferences = (action) => {
|
|
@@ -38,125 +30,33 @@ const actionSecretReferences = (action) => {
|
|
|
38
30
|
return destinationSecretReferences(action.destination);
|
|
39
31
|
return [];
|
|
40
32
|
};
|
|
41
|
-
const validateStorage = (scenario
|
|
33
|
+
const validateStorage = (scenario) => {
|
|
42
34
|
const references = [];
|
|
43
|
-
scenario.storage.cookies.forEach((cookie
|
|
44
|
-
assertAllowedDestination(cookie.destination, allowedOrigins, ["storage", "cookies", index, "destination"], context);
|
|
35
|
+
scenario.storage.cookies.forEach((cookie) => {
|
|
45
36
|
references.push(...secretReferencesInValue(cookie.value));
|
|
46
37
|
references.push(...destinationSecretReferences(cookie.destination));
|
|
47
38
|
});
|
|
48
39
|
for (const collection of ["local_storage", "session_storage"])
|
|
49
|
-
scenario.storage[collection].forEach((storage
|
|
50
|
-
if (!allowedOrigins.has(storage.origin))
|
|
51
|
-
addIssue(context, ["storage", collection, index, "origin"], `Storage origin ${storage.origin} is not declared in allowed_origins`);
|
|
40
|
+
scenario.storage[collection].forEach((storage) => {
|
|
52
41
|
for (const entry of storage.entries)
|
|
53
42
|
references.push(...secretReferencesInValue(entry.value));
|
|
54
43
|
});
|
|
55
44
|
return references;
|
|
56
45
|
};
|
|
57
|
-
const SENSITIVE_HEADERS = new Set([
|
|
58
|
-
"authorization",
|
|
59
|
-
"cookie",
|
|
60
|
-
"proxy-authorization",
|
|
61
|
-
"set-cookie",
|
|
62
|
-
]);
|
|
63
|
-
const FORBIDDEN_REPLAY_HEADERS = new Set([
|
|
64
|
-
"content-length",
|
|
65
|
-
"location",
|
|
66
|
-
"transfer-encoding",
|
|
67
|
-
]);
|
|
68
|
-
const validateRequestReplay = (scenario, allowedOrigins, context) => {
|
|
69
|
-
if (scenario.request_replay.mode === "disabled")
|
|
70
|
-
return [];
|
|
71
|
-
assertUnique(scenario.request_replay.routes.map(({ route_id: id }) => id), ["request_replay", "routes"], "Replay route IDs", context);
|
|
72
|
-
assertUnique(scenario.request_replay.routes.map(({ method, request }) => `${method} ${request.url}?${request.query
|
|
73
|
-
.map(({ name, value }) => value.source === "secret"
|
|
74
|
-
? `${name}=\${secret:${value.secret_id}}`
|
|
75
|
-
: `${name}=${value.value}`)
|
|
76
|
-
.join("&")}`), ["request_replay", "routes"], "Replay request matchers", context);
|
|
77
|
-
const references = [];
|
|
78
|
-
scenario.request_replay.routes.forEach((route, routeIndex) => {
|
|
79
|
-
assertAllowedDestination(route.request, allowedOrigins, ["request_replay", "routes", routeIndex, "request"], context);
|
|
80
|
-
references.push(...destinationSecretReferences(route.request));
|
|
81
|
-
if (route.response.kind === "redirect") {
|
|
82
|
-
assertAllowedDestination(route.response.destination, allowedOrigins, ["request_replay", "routes", routeIndex, "response", "destination"], context);
|
|
83
|
-
references.push(...destinationSecretReferences(route.response.destination));
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
assertUnique(route.response.headers.map(({ name }) => name.toLowerCase()), ["request_replay", "routes", routeIndex, "response", "headers"], "Replay response header names", context);
|
|
87
|
-
route.response.headers.forEach((header, headerIndex) => {
|
|
88
|
-
if (FORBIDDEN_REPLAY_HEADERS.has(header.name))
|
|
89
|
-
addIssue(context, [
|
|
90
|
-
"request_replay",
|
|
91
|
-
"routes",
|
|
92
|
-
routeIndex,
|
|
93
|
-
"response",
|
|
94
|
-
"headers",
|
|
95
|
-
headerIndex,
|
|
96
|
-
], `Replay header ${header.name} must be modeled by the provider`);
|
|
97
|
-
if (SENSITIVE_HEADERS.has(header.name) &&
|
|
98
|
-
header.value.source === "literal")
|
|
99
|
-
addIssue(context, [
|
|
100
|
-
"request_replay",
|
|
101
|
-
"routes",
|
|
102
|
-
routeIndex,
|
|
103
|
-
"response",
|
|
104
|
-
"headers",
|
|
105
|
-
headerIndex,
|
|
106
|
-
"value",
|
|
107
|
-
], `Credential header ${header.name} requires a declared secret`);
|
|
108
|
-
references.push(...secretReferencesInValue(header.value));
|
|
109
|
-
});
|
|
110
|
-
references.push(...secretReferencesInValue(route.response.body));
|
|
111
|
-
});
|
|
112
|
-
return references;
|
|
113
|
-
};
|
|
114
46
|
const validateSecretReferences = (scenario, references, context) => {
|
|
115
47
|
const declared = new Set(scenario.secrets.map(({ secret_id: id }) => id));
|
|
116
48
|
for (const reference of references)
|
|
117
49
|
if (!declared.has(reference))
|
|
118
50
|
addIssue(context, ["secrets"], `Secret reference ${reference} is not declared`);
|
|
119
|
-
const used = new Set(references);
|
|
120
|
-
scenario.secrets.forEach(({ secret_id: id }, index) => {
|
|
121
|
-
if (!used.has(id))
|
|
122
|
-
addIssue(context, ["secrets", index, "secret_id"], `Secret declaration ${id} is unused`);
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
const validateRedactionCoverage = (scenario, context) => {
|
|
126
|
-
const redactedQueries = new Set(scenario.redaction.query_parameter_names);
|
|
127
|
-
const destinations = [scenario.start_url];
|
|
128
|
-
for (const action of scenario.actions)
|
|
129
|
-
if (action.action === "goto")
|
|
130
|
-
destinations.push(action.destination);
|
|
131
|
-
for (const cookie of scenario.storage.cookies)
|
|
132
|
-
destinations.push(cookie.destination);
|
|
133
|
-
if (scenario.request_replay.mode === "exact")
|
|
134
|
-
for (const route of scenario.request_replay.routes) {
|
|
135
|
-
destinations.push(route.request);
|
|
136
|
-
if (route.response.kind === "redirect")
|
|
137
|
-
destinations.push(route.response.destination);
|
|
138
|
-
}
|
|
139
|
-
for (const destination of destinations)
|
|
140
|
-
for (const query of destination.query)
|
|
141
|
-
if (query.value.source === "secret" &&
|
|
142
|
-
!redactedQueries.has(query.name.toLowerCase()))
|
|
143
|
-
addIssue(context, ["redaction", "query_parameter_names"], `Secret query parameter ${query.name} must be declared for redaction`);
|
|
144
51
|
};
|
|
145
52
|
const validateBrowserScenario = (scenario, context) => {
|
|
146
|
-
const allowedOrigins = new Set(scenario.allowed_origins);
|
|
147
|
-
assertAllowedDestination(scenario.start_url, allowedOrigins, ["start_url"], context);
|
|
148
53
|
assertUnique(scenario.actions.map(({ step_id: id }) => id), ["actions"], "Action step IDs", context);
|
|
149
54
|
assertUnique(scenario.secrets.map(({ secret_id: id }) => id), ["secrets"], "Secret IDs", context);
|
|
150
55
|
assertUnique(scenario.secrets.map(({ environment_variable: name }) => name), ["secrets"], "Secret environment variables", context);
|
|
151
56
|
const references = scenario.actions.flatMap(actionSecretReferences);
|
|
152
|
-
for (const [index, action] of scenario.actions.entries())
|
|
153
|
-
if (action.action === "goto")
|
|
154
|
-
assertAllowedDestination(action.destination, allowedOrigins, ["actions", index, "destination"], context);
|
|
155
57
|
references.push(...destinationSecretReferences(scenario.start_url));
|
|
156
|
-
references.push(...validateStorage(scenario
|
|
157
|
-
references.push(...validateRequestReplay(scenario, allowedOrigins, context));
|
|
58
|
+
references.push(...validateStorage(scenario));
|
|
158
59
|
validateSecretReferences(scenario, references, context);
|
|
159
|
-
validateRedactionCoverage(scenario, context);
|
|
160
60
|
};
|
|
161
61
|
/** Strict provider-neutral contract for one controlled browser scenario. */
|
|
162
62
|
export const browserScenarioSchema = browserScenarioInputSchema.superRefine(validateBrowserScenario);
|
|
@@ -13,7 +13,6 @@ export const browserScenarioCaptureSchema = z
|
|
|
13
13
|
}),
|
|
14
14
|
scenario: z.strictObject({
|
|
15
15
|
start_origin: z.string().min(1),
|
|
16
|
-
allowed_origins: z.array(z.string().min(1)).min(1),
|
|
17
16
|
action_count: z.number().int().min(1),
|
|
18
17
|
secret_references: z.array(z.string().min(1)),
|
|
19
18
|
}),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { emptyArraySchema } from "./emptyArraySchema.js";
|
|
3
4
|
import { sanitizedBrowserUrlSchema } from "./browserObservation.js";
|
|
4
5
|
import { webScreenshotArtifactSchema } from "./webScreenshot.js";
|
|
5
|
-
|
|
6
|
+
import { digestSchema } from "./../domain/digests.js";
|
|
6
7
|
const textArtifactSchema = z
|
|
7
8
|
.strictObject({
|
|
8
9
|
sha256: digestSchema,
|
|
@@ -199,14 +200,14 @@ export const browserScenarioCompletenessSchema = z.discriminatedUnion("status",
|
|
|
199
200
|
z.strictObject({
|
|
200
201
|
status: z.literal("complete"),
|
|
201
202
|
equality_eligible: z.literal(true),
|
|
202
|
-
missing_sections:
|
|
203
|
-
truncated_sections:
|
|
203
|
+
missing_sections: emptyArraySchema,
|
|
204
|
+
truncated_sections: emptyArraySchema,
|
|
204
205
|
}),
|
|
205
206
|
z.strictObject({
|
|
206
207
|
status: z.literal("incomplete"),
|
|
207
208
|
equality_eligible: z.literal(false),
|
|
208
209
|
missing_sections: z.array(completenessSectionSchema).min(1),
|
|
209
|
-
truncated_sections:
|
|
210
|
+
truncated_sections: emptyArraySchema,
|
|
210
211
|
}),
|
|
211
212
|
z.strictObject({
|
|
212
213
|
status: z.literal("truncated"),
|
|
@@ -153,9 +153,7 @@ const missingFailures = (side, stepIds) => stepIds.map((stepId) => ({
|
|
|
153
153
|
}));
|
|
154
154
|
const captureContextsMatch = (before, after) => before.browser.product === after.browser.product &&
|
|
155
155
|
before.browser.version === after.browser.version &&
|
|
156
|
-
before.scenario.start_origin === after.scenario.start_origin
|
|
157
|
-
digestCanonicalJson([...before.scenario.allowed_origins].sort()) ===
|
|
158
|
-
digestCanonicalJson([...after.scenario.allowed_origins].sort());
|
|
156
|
+
before.scenario.start_origin === after.scenario.start_origin;
|
|
159
157
|
const compareStepArtifacts = (input) => {
|
|
160
158
|
const common = {
|
|
161
159
|
beforeStep: input.beforeStep,
|