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
|
@@ -65,6 +65,7 @@ const decodePng = (artifact) => {
|
|
|
65
65
|
let header;
|
|
66
66
|
const compressed = [];
|
|
67
67
|
let sawEnd = false;
|
|
68
|
+
let transparentColor;
|
|
68
69
|
while (offset < bytes.length) {
|
|
69
70
|
if (offset + 12 > bytes.length)
|
|
70
71
|
throw new TypeError("Truncated PNG chunk");
|
|
@@ -77,6 +78,15 @@ const decodePng = (artifact) => {
|
|
|
77
78
|
const data = bytes.subarray(dataStart, dataEnd);
|
|
78
79
|
if (type === "IHDR")
|
|
79
80
|
header = parseHeader(data);
|
|
81
|
+
else if (type === "tRNS") {
|
|
82
|
+
if (header?.channels !== 3 || data.length !== 6)
|
|
83
|
+
throw new TypeError("Unsupported PNG transparency");
|
|
84
|
+
transparentColor = [
|
|
85
|
+
data.readUInt16BE(0),
|
|
86
|
+
data.readUInt16BE(2),
|
|
87
|
+
data.readUInt16BE(4),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
80
90
|
else if (type === "IDAT")
|
|
81
91
|
compressed.push(data);
|
|
82
92
|
else if (type === "IEND") {
|
|
@@ -97,7 +107,7 @@ const decodePng = (artifact) => {
|
|
|
97
107
|
return {
|
|
98
108
|
width: header.width,
|
|
99
109
|
height: header.height,
|
|
100
|
-
rgba: unfilter(raw, header.width, header.height, header.channels),
|
|
110
|
+
rgba: expandRgba(unfilter(raw, header.width, header.height, header.channels), header.channels, transparentColor),
|
|
101
111
|
};
|
|
102
112
|
};
|
|
103
113
|
const parseHeader = (data) => {
|
|
@@ -145,14 +155,22 @@ const unfilter = (raw, width, height, channels) => {
|
|
|
145
155
|
});
|
|
146
156
|
}
|
|
147
157
|
}
|
|
158
|
+
return decoded;
|
|
159
|
+
};
|
|
160
|
+
const expandRgba = (decoded, channels, transparentColor) => {
|
|
148
161
|
if (channels === 4)
|
|
149
162
|
return decoded;
|
|
150
|
-
const rgba = Buffer.alloc(
|
|
163
|
+
const rgba = Buffer.alloc((decoded.length / channels) * 4);
|
|
151
164
|
for (let source = 0, target = 0; source < decoded.length; source += 3, target += 4) {
|
|
152
165
|
rgba[target] = decoded[source] ?? 0;
|
|
153
166
|
rgba[target + 1] = decoded[source + 1] ?? 0;
|
|
154
167
|
rgba[target + 2] = decoded[source + 2] ?? 0;
|
|
155
|
-
|
|
168
|
+
// PNG tRNS keys are 16-bit values; values above 255 cannot match 8-bit samples.
|
|
169
|
+
rgba[target + 3] =
|
|
170
|
+
transparentColor !== undefined &&
|
|
171
|
+
transparentColor.every((value, channel) => decoded[source + channel] === value)
|
|
172
|
+
? 0
|
|
173
|
+
: 255;
|
|
156
174
|
}
|
|
157
175
|
return rgba;
|
|
158
176
|
};
|
|
@@ -188,5 +206,6 @@ const dimensions = ({ width, height }) => ({ width, height });
|
|
|
188
206
|
const limitations = () => [
|
|
189
207
|
"Pixel comparison does not perform OCR, semantic layout analysis, or perceptual color correction.",
|
|
190
208
|
"Only non-interlaced 8-bit RGB and RGBA PNG screenshots are accepted.",
|
|
209
|
+
"PNG tRNS transparency is accepted only as a six-byte RGB color key; tRNS on RGBA or with another length is rejected.",
|
|
191
210
|
];
|
|
192
211
|
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
@@ -8,7 +8,8 @@ export const createInspectorExclusionCounts = () => ({
|
|
|
8
8
|
export const describeInspectorTargetLimitations = () => [
|
|
9
9
|
"REA attaches to an already-running exact target and never launches, resumes, evaluates, pauses, or mutates it.",
|
|
10
10
|
"Only Runtime.enable and Debugger.enable are sent; source text, object values, EventEmitter activity, and Electron IPC are not inspected.",
|
|
11
|
-
"
|
|
11
|
+
"The selected endpoint and target ID authorize observation; discovery file locations can remain unresolved and do not prove filesystem identity.",
|
|
12
|
+
"Node discovery reports a best-effort pathname rather than an encoded file URL; lossy Windows paths and ambiguous underscores are preserved without guessing a file path.",
|
|
12
13
|
"Every target exposed by the selected Inspector endpoint is eligible for observation; target IDs and locations are not authenticated as operating-system process identity.",
|
|
13
14
|
"No runtime graph depth is traversed because passive Inspector events do not establish require/import caller edges.",
|
|
14
15
|
];
|
|
@@ -83,6 +84,11 @@ export const finalizeInspectorCapture = async ({ input, runtime, target, state,
|
|
|
83
84
|
"script unload events",
|
|
84
85
|
],
|
|
85
86
|
unknowns: [
|
|
87
|
+
...(target.location.kind === "unresolved"
|
|
88
|
+
? [
|
|
89
|
+
"The discovery-reported file location cannot be verified; loaded script locations are resolved independently from Debugger.scriptParsed.",
|
|
90
|
+
]
|
|
91
|
+
: []),
|
|
86
92
|
"Scripts collected before attachment may have been garbage-collected and therefore omitted.",
|
|
87
93
|
"A bounded observation window cannot establish that an unobserved script or behavior never occurs.",
|
|
88
94
|
"The declared Node/Electron process role is not authenticated by the Inspector protocol.",
|
|
@@ -23,7 +23,10 @@ export class V8InspectorProvider {
|
|
|
23
23
|
const allowed = [];
|
|
24
24
|
const excluded = createInspectorExclusionCounts();
|
|
25
25
|
for (const target of discovery.targets) {
|
|
26
|
-
const decision = await authorizeRuntimeTargetLocation(target.url
|
|
26
|
+
const decision = await authorizeRuntimeTargetLocation(target.url, {
|
|
27
|
+
type: target.type,
|
|
28
|
+
product: discovery.runtime.product,
|
|
29
|
+
});
|
|
27
30
|
if (!decision.allowed) {
|
|
28
31
|
excluded[decision.reason] += 1;
|
|
29
32
|
continue;
|
|
@@ -48,9 +51,14 @@ export class V8InspectorProvider {
|
|
|
48
51
|
}
|
|
49
52
|
async observe(input, options = {}) {
|
|
50
53
|
let connection;
|
|
54
|
+
let primaryFailure;
|
|
55
|
+
let failed = false;
|
|
56
|
+
let cleanupFailure;
|
|
57
|
+
let cleanupFailed = false;
|
|
58
|
+
let outcome;
|
|
51
59
|
try {
|
|
52
60
|
const discovery = await discoverV8Inspector(input.inspector_endpoint, "observe_javascript_runtime", options.signal);
|
|
53
|
-
const target = await authorizedTarget(discovery.targets, input);
|
|
61
|
+
const target = await authorizedTarget(discovery.targets, input, discovery.runtime.product);
|
|
54
62
|
if (input.runtime_kind !== undefined)
|
|
55
63
|
assertRuntimeKind(target, input.runtime_kind);
|
|
56
64
|
connection = await CdpConnection.connect(target.webSocketUrl, "observe_javascript_runtime", options.signal);
|
|
@@ -70,27 +78,72 @@ export class V8InspectorProvider {
|
|
|
70
78
|
target,
|
|
71
79
|
state,
|
|
72
80
|
});
|
|
73
|
-
|
|
81
|
+
outcome = ok(javascriptRuntimeObservationSchema.parse(result));
|
|
74
82
|
}
|
|
75
83
|
catch (cause) {
|
|
76
|
-
|
|
84
|
+
failed = true;
|
|
85
|
+
primaryFailure = cause;
|
|
86
|
+
outcome = err(providerError(cause, "observe_javascript_runtime"));
|
|
77
87
|
}
|
|
78
88
|
finally {
|
|
79
|
-
|
|
89
|
+
if (connection !== undefined)
|
|
90
|
+
try {
|
|
91
|
+
await closeInspectorConnection(connection, options.signal);
|
|
92
|
+
}
|
|
93
|
+
catch (cause) {
|
|
94
|
+
cleanupFailed = true;
|
|
95
|
+
cleanupFailure = cause;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (cleanupFailed) {
|
|
99
|
+
return err(inspectorCleanupError(primaryFailure, cleanupFailure, failed));
|
|
80
100
|
}
|
|
101
|
+
return (outcome ??
|
|
102
|
+
err(new BrowserObservationError("observe_javascript_runtime", "protocol_error")));
|
|
81
103
|
}
|
|
82
104
|
}
|
|
105
|
+
export const closeInspectorConnection = async (connection, signal) => {
|
|
106
|
+
const closing = connection.close();
|
|
107
|
+
void closing.catch(() => undefined);
|
|
108
|
+
// CdpConnection.close has its own one second transport bound. Do not make a
|
|
109
|
+
// cancelled caller wait for that fallback.
|
|
110
|
+
if (signal === undefined)
|
|
111
|
+
return await closing;
|
|
112
|
+
let onAbort;
|
|
113
|
+
const cancelled = new Promise((resolve) => {
|
|
114
|
+
onAbort = () => resolve();
|
|
115
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
116
|
+
if (signal.aborted)
|
|
117
|
+
onAbort();
|
|
118
|
+
});
|
|
119
|
+
try {
|
|
120
|
+
await Promise.race([closing, cancelled]);
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
if (onAbort !== undefined)
|
|
124
|
+
signal.removeEventListener("abort", onAbort);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
export const inspectorCleanupError = (primaryFailure, cleanupFailure, hasPrimaryFailure) => {
|
|
128
|
+
const cause = hasPrimaryFailure
|
|
129
|
+
? new AggregateError([primaryFailure, cleanupFailure], "Inspector observation and cleanup both failed")
|
|
130
|
+
: cleanupFailure;
|
|
131
|
+
return new BrowserObservationError("observe_javascript_runtime", "cleanup_failed", { cause });
|
|
132
|
+
};
|
|
83
133
|
const projectTarget = (target) => ({
|
|
84
134
|
target_id: target.id,
|
|
85
135
|
protocol_type: target.type,
|
|
86
136
|
attached: target.attached,
|
|
87
137
|
location: target.location,
|
|
88
138
|
});
|
|
89
|
-
const authorizedTarget = async (targets, input) => {
|
|
139
|
+
const authorizedTarget = async (targets, input, product) => {
|
|
90
140
|
const target = targets.find(({ id }) => id === input.target_id);
|
|
91
141
|
if (target === undefined)
|
|
92
142
|
throw new BrowserObservationError("observe_javascript_runtime", "target_not_found");
|
|
93
|
-
const decision = await authorizeRuntimeTargetLocation(target.url
|
|
143
|
+
const decision = await authorizeRuntimeTargetLocation(target.url, {
|
|
144
|
+
type: target.type,
|
|
145
|
+
product,
|
|
146
|
+
});
|
|
94
147
|
if (target.attached ||
|
|
95
148
|
!decision.allowed ||
|
|
96
149
|
decision.location.kind === "builtin")
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
1
2
|
import { AnyMap, eachMapping } from "@jridgewell/trace-mapping";
|
|
2
3
|
import { sanitizeBrowserUrl } from "../domain/browserObservation.js";
|
|
4
|
+
import { analyzeParsedJavaScriptSemantics } from "../domain/javascriptSemanticAnalysis.js";
|
|
5
|
+
import { parseJavaScriptSource } from "../domain/javascriptSourceParser.js";
|
|
6
|
+
import { hasValidSourceMapContents } from "../domain/sourceMapContents.js";
|
|
3
7
|
import { webSourceMapsSchema } from "../domain/webBundleAnalysis.js";
|
|
4
8
|
import { createWebTextArtifact } from "../domain/webContentArtifact.js";
|
|
5
9
|
/** Fetch and validate approved source maps without browser credentials. */
|
|
@@ -10,13 +14,14 @@ export const fetchWebSourceMaps = async (requests, input, signal, host = { fetch
|
|
|
10
14
|
throw signal.reason;
|
|
11
15
|
items.push(await fetchOne(request, input, signal, host));
|
|
12
16
|
}
|
|
13
|
-
const
|
|
17
|
+
const retained = items.filter(({ status }) => status === "included" || status === "partial").length;
|
|
14
18
|
return webSourceMapsSchema.parse({
|
|
15
19
|
status: items.length === 0
|
|
16
20
|
? "unavailable"
|
|
17
|
-
:
|
|
21
|
+
: retained === items.length &&
|
|
22
|
+
!items.some(({ status }) => status === "partial")
|
|
18
23
|
? "included"
|
|
19
|
-
:
|
|
24
|
+
: retained > 0
|
|
20
25
|
? "partial"
|
|
21
26
|
: "unavailable",
|
|
22
27
|
requested: requests.length,
|
|
@@ -28,12 +33,15 @@ const fetchOne = async (request, input, signal, host) => {
|
|
|
28
33
|
if (!approvedUrl(request.fetchUrl, input.allowed_origins))
|
|
29
34
|
return emptySourceMapItem(request, "policy_filtered", "Declared source-map URL is outside the approved exact origins.");
|
|
30
35
|
try {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
36
|
+
const fetched = await fetchFollowingApprovedRedirects(request.fetchUrl, input.allowed_origins, signal, host);
|
|
37
|
+
if (fetched === undefined)
|
|
33
38
|
return emptySourceMapItem(request, "policy_filtered", "A source-map redirect left the approved exact origins.");
|
|
34
|
-
|
|
39
|
+
const { response, fetchedUrl } = fetched;
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
await response.body?.cancel();
|
|
35
42
|
return emptySourceMapItem(request, "fetch_failed", `Source-map server returned HTTP ${String(response.status)}.`);
|
|
36
|
-
|
|
43
|
+
}
|
|
44
|
+
return normalizeSourceMap(request, await response.text(), fetchedUrl);
|
|
37
45
|
}
|
|
38
46
|
catch (cause) {
|
|
39
47
|
if (signal?.aborted === true)
|
|
@@ -61,18 +69,19 @@ const fetchFollowingApprovedRedirects = async (initialUrl, allowedOrigins, signa
|
|
|
61
69
|
...(signal === undefined ? {} : { signal }),
|
|
62
70
|
});
|
|
63
71
|
if (response.status < 300 || response.status >= 400)
|
|
64
|
-
return response;
|
|
72
|
+
return { response, fetchedUrl: current };
|
|
65
73
|
const location = response.headers.get("location");
|
|
66
74
|
if (location === null)
|
|
67
|
-
return response;
|
|
75
|
+
return { response, fetchedUrl: current };
|
|
76
|
+
await response.body?.cancel();
|
|
68
77
|
current = new URL(location, current).href;
|
|
69
78
|
}
|
|
70
79
|
};
|
|
71
|
-
const normalizeSourceMap = (request, text) => {
|
|
80
|
+
const normalizeSourceMap = (request, text, fetchedUrl) => {
|
|
72
81
|
if (!validSourceMapEnvelope(text))
|
|
73
82
|
return emptySourceMapItem(request, "invalid", "Source-map JSON is not a version 3 map.");
|
|
74
83
|
try {
|
|
75
|
-
const map = new AnyMap(text,
|
|
84
|
+
const map = new AnyMap(text, fetchedUrl);
|
|
76
85
|
const resolvedBySource = new Map();
|
|
77
86
|
const originalSources = map.sources.map((source, index) => {
|
|
78
87
|
const content = map.sourcesContent?.[index];
|
|
@@ -106,10 +115,16 @@ const normalizeSourceMap = (request, text) => {
|
|
|
106
115
|
...sourceMapContext(request),
|
|
107
116
|
artifact: createWebTextArtifact(text, "application/source-map+json"),
|
|
108
117
|
original_sources: originalSources,
|
|
109
|
-
original_module_edges: modules,
|
|
118
|
+
original_module_edges: modules.edges,
|
|
110
119
|
mappings,
|
|
111
120
|
};
|
|
112
|
-
return
|
|
121
|
+
return modules.incomplete.length === 0
|
|
122
|
+
? { ...parsed, status: "included", limitation: null }
|
|
123
|
+
: {
|
|
124
|
+
...parsed,
|
|
125
|
+
status: "partial",
|
|
126
|
+
limitation: `Module edges are incomplete: ${modules.incomplete.length} of ${originalSources.filter(({ artifact }) => artifact !== null).length} original sources could not be parsed in full (${modules.incomplete.join(", ")}).`,
|
|
127
|
+
};
|
|
113
128
|
}
|
|
114
129
|
catch {
|
|
115
130
|
return emptySourceMapItem(request, "invalid", "Source-map mappings could not be decoded safely.");
|
|
@@ -118,28 +133,49 @@ const normalizeSourceMap = (request, text) => {
|
|
|
118
133
|
const originalModuleEdges = (sources) => {
|
|
119
134
|
const edges = [];
|
|
120
135
|
const seen = new Set();
|
|
136
|
+
const incomplete = [];
|
|
121
137
|
for (const source of sources) {
|
|
122
138
|
if (source.artifact === null)
|
|
123
139
|
continue;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
continue;
|
|
129
|
-
const key = `${source.source}\0${detector.kind}\0${specifier}`;
|
|
130
|
-
if (seen.has(key))
|
|
131
|
-
continue;
|
|
132
|
-
seen.add(key);
|
|
133
|
-
edges.push({
|
|
134
|
-
from_source: source.source,
|
|
135
|
-
kind: detector.kind,
|
|
136
|
-
specifier,
|
|
137
|
-
resolved_source: resolveOriginalSource(specifier, source.source),
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
+
const parsed = parseJavaScriptSource(source.artifact.text);
|
|
141
|
+
if (parsed === null) {
|
|
142
|
+
incomplete.push(source.source);
|
|
143
|
+
continue;
|
|
140
144
|
}
|
|
145
|
+
// A recovered program still yields the imports it did parse, but nodes
|
|
146
|
+
// after an unrecoverable point are missing, so the edges are a subset.
|
|
147
|
+
if (parsed.errors.length > 0)
|
|
148
|
+
incomplete.push(source.source);
|
|
149
|
+
let unboundRequires;
|
|
150
|
+
t.traverseFast(parsed, (node) => {
|
|
151
|
+
const dependency = originalDependency(node);
|
|
152
|
+
if (dependency === null)
|
|
153
|
+
return;
|
|
154
|
+
const { kind, specifier } = dependency;
|
|
155
|
+
if (kind === "require" && t.isCallExpression(node)) {
|
|
156
|
+
unboundRequires ??= new Set(analyzeParsedJavaScriptSemantics(parsed)
|
|
157
|
+
.references.filter(({ name, role, resolution }) => name === "require" &&
|
|
158
|
+
role === "read" &&
|
|
159
|
+
resolution === "unbound")
|
|
160
|
+
.map(({ location }) => `${String(location.start.line)}:${String(location.start.column)}`));
|
|
161
|
+
const location = node.callee.loc?.start;
|
|
162
|
+
if (location === undefined ||
|
|
163
|
+
!unboundRequires.has(`${String(location.line)}:${String(location.column)}`))
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const key = `${source.source}\0${kind}\0${specifier}`;
|
|
167
|
+
if (seen.has(key))
|
|
168
|
+
return;
|
|
169
|
+
seen.add(key);
|
|
170
|
+
edges.push({
|
|
171
|
+
from_source: source.source,
|
|
172
|
+
kind,
|
|
173
|
+
specifier,
|
|
174
|
+
resolved_source: resolveOriginalSource(specifier, source.source),
|
|
175
|
+
});
|
|
176
|
+
});
|
|
141
177
|
}
|
|
142
|
-
return edges;
|
|
178
|
+
return { edges, incomplete };
|
|
143
179
|
};
|
|
144
180
|
const validSourceMapEnvelope = (text) => {
|
|
145
181
|
let parsed;
|
|
@@ -152,7 +188,7 @@ const validSourceMapEnvelope = (text) => {
|
|
|
152
188
|
if (!isRecord(parsed) || parsed.version !== 3)
|
|
153
189
|
return false;
|
|
154
190
|
if (typeof parsed.mappings === "string")
|
|
155
|
-
return
|
|
191
|
+
return validSourceMapLeaf(parsed);
|
|
156
192
|
if (!Array.isArray(parsed.sections))
|
|
157
193
|
return false;
|
|
158
194
|
const pending = [...parsed.sections];
|
|
@@ -166,13 +202,15 @@ const validSourceMapEnvelope = (text) => {
|
|
|
166
202
|
if (Array.isArray(map.sections))
|
|
167
203
|
for (const child of map.sections)
|
|
168
204
|
pending.push(child);
|
|
169
|
-
else if (
|
|
170
|
-
!Array.isArray(map.sources) ||
|
|
171
|
-
!Array.isArray(map.names))
|
|
205
|
+
else if (!validSourceMapLeaf(map))
|
|
172
206
|
return false;
|
|
173
207
|
}
|
|
174
208
|
return true;
|
|
175
209
|
};
|
|
210
|
+
const validSourceMapLeaf = (map) => typeof map.mappings === "string" &&
|
|
211
|
+
Array.isArray(map.sources) &&
|
|
212
|
+
Array.isArray(map.names) &&
|
|
213
|
+
hasValidSourceMapContents(map.sources.length, map.sourcesContent);
|
|
176
214
|
const approvedUrl = (value, allowedOrigins) => {
|
|
177
215
|
try {
|
|
178
216
|
const parsed = new URL(value);
|
|
@@ -200,13 +238,10 @@ const emptySourceMapItem = (request, status, limitation) => ({
|
|
|
200
238
|
});
|
|
201
239
|
const sanitizeSource = (value) => {
|
|
202
240
|
try {
|
|
203
|
-
|
|
204
|
-
return parsed.protocol === "http:" || parsed.protocol === "https:"
|
|
205
|
-
? sanitizeBrowserUrl(parsed.href).url
|
|
206
|
-
: `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
|
|
241
|
+
return sanitizeBrowserUrl(new URL(value).href).url;
|
|
207
242
|
}
|
|
208
243
|
catch {
|
|
209
|
-
return value
|
|
244
|
+
return value;
|
|
210
245
|
}
|
|
211
246
|
};
|
|
212
247
|
const resolveOriginalSource = (specifier, base) => {
|
|
@@ -221,17 +256,28 @@ const sourceMediaType = (source) => source?.endsWith(".ts") || source?.endsWith(
|
|
|
221
256
|
? "text/typescript"
|
|
222
257
|
: "text/javascript";
|
|
223
258
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
259
|
+
const originalDependency = (node) => {
|
|
260
|
+
if (t.isImportDeclaration(node) ||
|
|
261
|
+
t.isExportAllDeclaration(node) ||
|
|
262
|
+
t.isExportNamedDeclaration(node))
|
|
263
|
+
return node.source === null || node.source === undefined
|
|
264
|
+
? null
|
|
265
|
+
: { kind: "static_import", specifier: node.source.value };
|
|
266
|
+
if (t.isImportExpression(node) && t.isStringLiteral(node.source))
|
|
267
|
+
return { kind: "dynamic_import", specifier: node.source.value };
|
|
268
|
+
if (t.isCallExpression(node) &&
|
|
269
|
+
t.isIdentifier(node.callee, { name: "require" }) &&
|
|
270
|
+
t.isStringLiteral(node.arguments[0]))
|
|
271
|
+
return { kind: "require", specifier: node.arguments[0].value };
|
|
272
|
+
// `import x = require("m")` is only legal at module top level and always
|
|
273
|
+
// refers to the host loader, so it needs no unbound-`require` check. The
|
|
274
|
+
// `moduleReference` is an entity name for a local alias instead, which
|
|
275
|
+
// declares no dependency.
|
|
276
|
+
if (t.isTSImportEqualsDeclaration(node) &&
|
|
277
|
+
t.isTSExternalModuleReference(node.moduleReference))
|
|
278
|
+
return {
|
|
279
|
+
kind: "require",
|
|
280
|
+
specifier: node.moduleReference.expression.value,
|
|
281
|
+
};
|
|
282
|
+
return null;
|
|
283
|
+
};
|
|
@@ -7,6 +7,62 @@ export const registerArtifactCommands = (cli, logger) => {
|
|
|
7
7
|
registerInspectionCommand(cli, logger);
|
|
8
8
|
registerExtractionCommand(cli, logger);
|
|
9
9
|
registerInterfaceBuilderCommand(cli, logger);
|
|
10
|
+
registerAssetCatalogCommand(cli, logger);
|
|
11
|
+
cli.command(CLI_COMMANDS.inspectKeyedArchive, {
|
|
12
|
+
description: "Inspect a Foundation keyed archive as an object-reference graph",
|
|
13
|
+
args: z.object({
|
|
14
|
+
path: z.string().describe("Foundation plist archive or Apple app bundle"),
|
|
15
|
+
archive: z
|
|
16
|
+
.string()
|
|
17
|
+
.default(".")
|
|
18
|
+
.describe("Relative archive path when the target is a bundle"),
|
|
19
|
+
}),
|
|
20
|
+
options: z.object({
|
|
21
|
+
root: z.string().optional().describe("Named $top archive root"),
|
|
22
|
+
offset: z
|
|
23
|
+
.number()
|
|
24
|
+
.int()
|
|
25
|
+
.min(0)
|
|
26
|
+
.default(0)
|
|
27
|
+
.describe("First original object-table index"),
|
|
28
|
+
limit: z
|
|
29
|
+
.number()
|
|
30
|
+
.int()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(20000)
|
|
33
|
+
.default(20000)
|
|
34
|
+
.describe("Maximum object-table entries to return"),
|
|
35
|
+
}),
|
|
36
|
+
run: ({ args, options }) => logCliCommand(logger, CLI_COMMANDS.inspectKeyedArchive, () => runProviderAnalysis(args.path, "inspect_keyed_archive", {
|
|
37
|
+
path: args.archive,
|
|
38
|
+
offset: options.offset,
|
|
39
|
+
limit: options.limit,
|
|
40
|
+
...(options.root === undefined ? {} : { root: options.root }),
|
|
41
|
+
}, logger)),
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const registerAssetCatalogCommand = (cli, logger) => {
|
|
45
|
+
cli.command(CLI_COMMANDS.inspectAssetCatalog, {
|
|
46
|
+
description: "Inspect compiled Apple asset catalog metadata",
|
|
47
|
+
args: z.object({ path: z.string().describe("Apple .app bundle path") }),
|
|
48
|
+
options: z.object({
|
|
49
|
+
offset: z
|
|
50
|
+
.number()
|
|
51
|
+
.int()
|
|
52
|
+
.min(0)
|
|
53
|
+
.default(0)
|
|
54
|
+
.describe("First metadata record"),
|
|
55
|
+
limit: z
|
|
56
|
+
.number()
|
|
57
|
+
.int()
|
|
58
|
+
.min(1)
|
|
59
|
+
.max(10_000)
|
|
60
|
+
.default(1_000)
|
|
61
|
+
.describe("Maximum records to return"),
|
|
62
|
+
}),
|
|
63
|
+
alias: {},
|
|
64
|
+
run: ({ args, options }) => logCliCommand(logger, CLI_COMMANDS.inspectAssetCatalog, () => runProviderAnalysis(args.path, "inspect_asset_catalog", { offset: options.offset, limit: options.limit }, logger)),
|
|
65
|
+
});
|
|
10
66
|
};
|
|
11
67
|
const registerInterfaceBuilderCommand = (cli, logger) => {
|
|
12
68
|
cli.command(CLI_COMMANDS.decodeInterfaceBuilder, {
|
|
@@ -72,24 +128,12 @@ const registerInspectionCommand = (cli, logger) => {
|
|
|
72
128
|
.enum(["fail", "record-and-continue"])
|
|
73
129
|
.default("fail")
|
|
74
130
|
.describe("Behavior when declared artifact integrity does not match"),
|
|
75
|
-
integrityContinueApproved: z
|
|
76
|
-
.boolean()
|
|
77
|
-
.default(false)
|
|
78
|
-
.describe("Approve continuing after recorded integrity mismatches"),
|
|
79
|
-
nativeMountApproved: z
|
|
80
|
-
.boolean()
|
|
81
|
-
.default(false)
|
|
82
|
-
.describe("Approve read-only native mounting when required"),
|
|
83
131
|
}),
|
|
84
132
|
alias: {
|
|
85
133
|
integrityPolicy: "integrity-policy",
|
|
86
|
-
integrityContinueApproved: "integrity-continue-approved",
|
|
87
|
-
nativeMountApproved: "native-mount-approved",
|
|
88
134
|
},
|
|
89
135
|
run: ({ args, options }) => logCliCommand(logger, "inspect-artifact", () => runProviderAnalysis(args.path, "inspect_artifact", {
|
|
90
136
|
integrity_policy: options.integrityPolicy,
|
|
91
|
-
integrity_continue_approved: options.integrityContinueApproved,
|
|
92
|
-
native_mount_approved: options.nativeMountApproved,
|
|
93
137
|
}, logger)),
|
|
94
138
|
});
|
|
95
139
|
};
|
|
@@ -8,6 +8,116 @@ import { directAnalysisOptions, providerSelectionOption } from "./options.js";
|
|
|
8
8
|
import { runCliJavaScriptApplicationAnalysis } from "./javascriptApplicationAnalysis.js";
|
|
9
9
|
export const registerCoreAnalysisCommands = (cli, logger) => {
|
|
10
10
|
registerCoreCommands(cli, logger);
|
|
11
|
+
cli.command(CLI_COMMANDS.traceNativeValues, {
|
|
12
|
+
description: "Trace bounded native def-use and call dependencies",
|
|
13
|
+
args: z.object({
|
|
14
|
+
path: z.string().describe("Local native executable or app path"),
|
|
15
|
+
procedure: z
|
|
16
|
+
.string()
|
|
17
|
+
.describe("Explicit native procedure symbol or address"),
|
|
18
|
+
}),
|
|
19
|
+
options: z.object({
|
|
20
|
+
maxDepth: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.min(0)
|
|
24
|
+
.max(16)
|
|
25
|
+
.default(3)
|
|
26
|
+
.describe("Maximum call traversal depth"),
|
|
27
|
+
maxFunctions: z
|
|
28
|
+
.number()
|
|
29
|
+
.int()
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(64)
|
|
32
|
+
.default(16)
|
|
33
|
+
.describe("Maximum function decompilations"),
|
|
34
|
+
maxCallSites: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.min(1)
|
|
38
|
+
.max(4096)
|
|
39
|
+
.default(256)
|
|
40
|
+
.describe("Maximum static call-site resolutions"),
|
|
41
|
+
maxNodes: z
|
|
42
|
+
.number()
|
|
43
|
+
.int()
|
|
44
|
+
.min(1)
|
|
45
|
+
.max(20000)
|
|
46
|
+
.default(5000)
|
|
47
|
+
.describe("Maximum retained graph nodes"),
|
|
48
|
+
maxEdges: z
|
|
49
|
+
.number()
|
|
50
|
+
.int()
|
|
51
|
+
.min(1)
|
|
52
|
+
.max(40000)
|
|
53
|
+
.default(10000)
|
|
54
|
+
.describe("Maximum retained graph edges"),
|
|
55
|
+
offset: z
|
|
56
|
+
.number()
|
|
57
|
+
.int()
|
|
58
|
+
.min(0)
|
|
59
|
+
.default(0)
|
|
60
|
+
.describe("First graph node index"),
|
|
61
|
+
limit: z
|
|
62
|
+
.number()
|
|
63
|
+
.int()
|
|
64
|
+
.min(1)
|
|
65
|
+
.max(5000)
|
|
66
|
+
.default(1000)
|
|
67
|
+
.describe("Maximum nodes on this page"),
|
|
68
|
+
provider: providerSelectionOption,
|
|
69
|
+
}),
|
|
70
|
+
alias: {
|
|
71
|
+
maxDepth: "max-depth",
|
|
72
|
+
maxFunctions: "max-functions",
|
|
73
|
+
maxCallSites: "max-call-sites",
|
|
74
|
+
maxNodes: "max-nodes",
|
|
75
|
+
maxEdges: "max-edges",
|
|
76
|
+
},
|
|
77
|
+
run: ({ args, options }) => logCliCommand(logger, CLI_COMMANDS.traceNativeValues, () => runDirectAnalysis(args.path, "trace_native_values", {
|
|
78
|
+
procedure: args.procedure,
|
|
79
|
+
max_depth: options.maxDepth,
|
|
80
|
+
max_functions: options.maxFunctions,
|
|
81
|
+
max_call_sites: options.maxCallSites,
|
|
82
|
+
max_nodes: options.maxNodes,
|
|
83
|
+
max_edges: options.maxEdges,
|
|
84
|
+
offset: options.offset,
|
|
85
|
+
limit: options.limit,
|
|
86
|
+
}, directAnalysisOptions(logger, undefined, options.provider))),
|
|
87
|
+
});
|
|
88
|
+
cli.command(CLI_COMMANDS.inspectNativeDataType, {
|
|
89
|
+
description: "Inspect one recovered database type or typed data object",
|
|
90
|
+
args: z.object({
|
|
91
|
+
path: z.string().describe("Local native executable or app path"),
|
|
92
|
+
}),
|
|
93
|
+
options: z.object({
|
|
94
|
+
type: z.string().optional().describe("Exact database type category path"),
|
|
95
|
+
address: z.string().describe("Exact native address").optional(),
|
|
96
|
+
provider: providerSelectionOption,
|
|
97
|
+
}),
|
|
98
|
+
run: ({ args, options }) => logCliCommand(logger, CLI_COMMANDS.inspectNativeDataType, () => runDirectAnalysis(args.path, "inspect_native_data_type", {
|
|
99
|
+
...(options.type === undefined ? {} : { type: options.type }),
|
|
100
|
+
...(options.address === undefined
|
|
101
|
+
? {}
|
|
102
|
+
: { address: options.address }),
|
|
103
|
+
}, directAnalysisOptions(logger, undefined, options.provider))),
|
|
104
|
+
});
|
|
105
|
+
for (const [command, operation] of [
|
|
106
|
+
[CLI_COMMANDS.inspectNativeInstruction, "inspect_native_instruction"],
|
|
107
|
+
[CLI_COMMANDS.resolveNativeCallTargets, "resolve_native_call_targets"],
|
|
108
|
+
]) {
|
|
109
|
+
cli.command(command, {
|
|
110
|
+
description: operation === "inspect_native_instruction"
|
|
111
|
+
? "Inspect one native instruction with decoded operand facts"
|
|
112
|
+
: "Resolve one static native call site",
|
|
113
|
+
args: z.object({
|
|
114
|
+
path: z.string().describe("Local native executable or app path"),
|
|
115
|
+
address: z.string().describe("Exact native address"),
|
|
116
|
+
}),
|
|
117
|
+
options: z.object({ provider: providerSelectionOption }),
|
|
118
|
+
run: ({ args, options }) => logCliCommand(logger, command, () => runDirectAnalysis(args.path, operation, { address: args.address }, directAnalysisOptions(logger, undefined, options.provider))),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
11
121
|
registerFunctionCommand(cli, logger);
|
|
12
122
|
registerNativeApiCommand(cli, logger);
|
|
13
123
|
registerInstructionsCommand(cli, logger);
|