rea-agents 5.0.0 → 6.1.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 +168 -655
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +173 -47
- package/bridge/hopper_bridge.py +310 -128
- package/bridge/mitmproxy/capture.py +208 -0
- package/bridge/native/rea_lldb_tracer.py +839 -0
- package/bridge/process/ProcessRunTokenReader.swift +297 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +147 -0
- package/dist/android/JadxConfiguration.js +196 -33
- package/dist/android/JadxMcpTransport.js +4 -0
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +20 -2
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +27 -3
- package/dist/application/ClientConfigurationDocument.js +871 -6
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +97 -33
- package/dist/application/Doctor.js +4 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +13 -11
- package/dist/application/EvidenceBundleFiles.js +24 -12
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +3 -2
- package/dist/application/JsonFiles.js +50 -28
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/Setup.js +13 -1
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +5 -2
- package/dist/application/SetupPlan.js +5 -3
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +4 -3
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateRuntime.js +46 -25
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +134 -0
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +2 -2
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/WorkflowEvidence.js +82 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +21 -5
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -0
- package/dist/application/binary/AnalysisSnapshotCache.js +52 -12
- package/dist/application/binary/BinarySession.js +131 -76
- package/dist/application/binary/BinarySessionOpen.js +19 -6
- package/dist/application/binary/BinarySessionRecords.js +45 -3
- package/dist/application/binary/BinarySessionStatus.js +17 -1
- package/dist/application/binary/CompositeProvider.js +13 -0
- package/dist/application/binary/LazyAnalysisProvider.js +3 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +59 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +62 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +64 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +25 -5
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +34 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +47 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +39 -7
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +80 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +33 -12
- package/dist/application/javascript/JavaScriptModuleRelationships.js +37 -8
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +149 -72
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +27 -5
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +7 -4
- package/dist/application/managed/ManagedNativeVerificationService.js +4 -3
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +23 -15
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +8 -7
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +42 -5
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +98 -14
- package/dist/artifacts/NativeDmgArtifactReader.js +13 -6
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +22 -3
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +36 -22
- package/dist/artifacts/apple/MachoLoadCommandReader.js +355 -0
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +16 -11
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +14 -17
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +165 -12
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +34 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +32 -23
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +130 -122
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/history/CaptureFailures.js +137 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +17 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +92 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +188 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +78 -20
- package/dist/cli/electronCommands.js +21 -13
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +20 -3
- package/dist/cli/jsonOutput.js +38 -0
- package/dist/cli/nativeCallCommands.js +34 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +11 -4
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -1
- package/dist/cliJsonInput.js +35 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/config/environment.js +4 -0
- package/dist/config/ghidraStartupTimeout.js +17 -0
- package/dist/config/mcpResponseBudget.js +22 -0
- package/dist/config/parseConfig.js +2 -1
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +5 -3
- package/dist/contracts/enhancedToolContracts.js +3 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +8 -6
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +21 -3
- package/dist/contracts/officialToolContracts.js +26 -24
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/promptContracts.js +3 -3
- package/dist/contracts/sessionLifecycleInputs.js +18 -5
- package/dist/contracts/sessionStatusContract.js +8 -2
- package/dist/contracts/sessionToolContracts.js +8 -3
- package/dist/contracts/sessionToolSchemas.js +8 -4
- package/dist/contracts/toolContractExamples.js +1 -2
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -1
- package/dist/contracts/toolOutputSchemaGroups.js +33 -28
- package/dist/contracts/toolOutputSchemaPrimitives.js +19 -1
- package/dist/contracts/toolSchemaMetadata.js +69 -10
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +22 -2
- package/dist/domain/analysisErrorCore.js +61 -5
- package/dist/domain/analysisErrorPresentation.js +95 -12
- package/dist/domain/analysisErrorProjection.js +148 -19
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +17 -9
- package/dist/domain/apple/appleApplication.js +41 -14
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +478 -0
- package/dist/domain/apple/dylibResolutionFindings.js +77 -0
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -13
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +9 -1
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +19 -24
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +5 -2
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/configurationErrors.js +1 -1
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +78 -11
- package/dist/domain/evidenceBundle.js +42 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +108 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +10 -4
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +37 -6
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationGraph.js +13 -0
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +97 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +22 -5
- package/dist/domain/javascript/javascriptSemanticGraph.js +34 -5
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +25 -17
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +83 -11
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +14 -4
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -16
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +91 -3
- package/dist/domain/localPath.js +8 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -9
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeCallObservation.js +186 -0
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +143 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +39 -5
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +11 -10
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +1 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +3 -3
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +9 -46
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +19 -5
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +5 -0
- package/dist/ghidra/GhidraClient.js +47 -14
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraFunctionValues.js +10 -7
- package/dist/ghidra/GhidraInstallation.js +18 -21
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +62 -0
- package/dist/ghidra/GhidraLauncher.js +34 -16
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +15 -3
- package/dist/ghidra/GhidraProviderClient.js +23 -12
- package/dist/ghidra/GhidraSessionError.js +11 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/hopper/BridgeLauncher.js +33 -11
- package/dist/hopper/HopperAnalysisProfile.js +62 -4
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +222 -14
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +196 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +63 -9
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +137 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +3 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +8 -3
- package/dist/inspector/V8InspectorProvider.js +47 -11
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +17 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +32 -16
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +82 -84
- package/dist/native/LldbCallTracer.js +541 -0
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +194 -0
- package/dist/native/NativeMacOSProvider.js +117 -20
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
- package/dist/process/DarwinProcessRunTokenReader.js +293 -0
- package/dist/process/ExecFileOutput.js +20 -0
- package/dist/process/OwnedCommand.js +118 -0
- package/dist/process/ProcessOwnership.js +431 -51
- package/dist/process/ProcessOwnershipObservation.js +209 -27
- package/dist/process/ProviderProcess.js +68 -10
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +18 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +681 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/EvidenceMcpServer.js +146 -0
- package/dist/server/createServer.js +37 -8
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +2 -4
- package/dist/server/registerApplicationTools/helpers.js +2 -4
- package/dist/server/registerArtifactComparisonTool.js +11 -7
- package/dist/server/registerBinaryDiagnosticsTools.js +15 -0
- package/dist/server/registerBrowserScenarioTool.js +2 -4
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +2 -3
- package/dist/server/registerCloseLifecycleTool.js +8 -18
- package/dist/server/registerElectronTools.js +2 -4
- package/dist/server/registerEnhancedTools.js +18 -59
- package/dist/server/registerEvidenceTools.js +3 -5
- package/dist/server/registerEvmTools.js +15 -0
- package/dist/server/registerFirmwareTools.js +2 -4
- package/dist/server/registerFunctionComparisonTool.js +10 -6
- package/dist/server/registerInvestigationTools.js +7 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -4
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +2 -4
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +2 -4
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -4
- package/dist/server/registerOfficialTools.js +2 -4
- package/dist/server/registerProcessComparisonTool.js +72 -46
- package/dist/server/registerRecordedCrashTools.js +15 -0
- package/dist/server/registerSessionRecordTools.js +5 -6
- package/dist/server/registerSessionStatusTool.js +17 -3
- package/dist/server/registerSessionTools.js +13 -5
- package/dist/server/registerWebModuleTool.js +2 -4
- package/dist/server/registerWebNetworkCaptureTool.js +26 -0
- package/dist/server/registerWebRuntimeTools.js +3 -7
- package/dist/server/registerWebScriptTool.js +2 -4
- package/dist/server/registerWebSourceLocationTool.js +2 -4
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +3 -1
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +63 -11
- package/dist/server/toolResultEncoding.js +33 -0
- package/install.sh +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -9
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +32 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +8 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/ghidra/GhidraDefaults.js +0 -2
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Project encoded view parents; archive owners are not inferred view parents. */
|
|
2
|
-
export const projectNibViewHierarchy = (objects, retainedIds) => {
|
|
2
|
+
export const projectNibViewHierarchy = (objects, retainedIds, reserveNode = () => true, maxNodes = 20_000) => {
|
|
3
3
|
const { parents, involved, invalid } = collectNibParents(objects, retainedIds);
|
|
4
4
|
if (parents.size === 0)
|
|
5
5
|
return { hierarchy: null, omitted: invalid };
|
|
@@ -21,7 +21,10 @@ export const projectNibViewHierarchy = (objects, retainedIds) => {
|
|
|
21
21
|
const item = pending.pop();
|
|
22
22
|
if (item === undefined)
|
|
23
23
|
break;
|
|
24
|
-
if (visited.has(item.id) ||
|
|
24
|
+
if (visited.has(item.id) ||
|
|
25
|
+
item.depth > 128 ||
|
|
26
|
+
visited.size >= maxNodes ||
|
|
27
|
+
!reserveNode())
|
|
25
28
|
continue;
|
|
26
29
|
visited.add(item.id);
|
|
27
30
|
const node = { objectID: String(item.id), children: [] };
|
|
@@ -35,7 +38,7 @@ export const projectNibViewHierarchy = (objects, retainedIds) => {
|
|
|
35
38
|
};
|
|
36
39
|
};
|
|
37
40
|
/** Add encoded parent links once; conflicting legacy parents remain unknown. */
|
|
38
|
-
export const mergeNibHierarchies = (legacy, recovered) => {
|
|
41
|
+
export const mergeNibHierarchies = (legacy, recovered, reserveNode = () => true, maxNodes = 20_000) => {
|
|
39
42
|
const existing = new Map();
|
|
40
43
|
const owners = new Map();
|
|
41
44
|
const parents = new Map();
|
|
@@ -70,6 +73,10 @@ export const mergeNibHierarchies = (legacy, recovered) => {
|
|
|
70
73
|
break;
|
|
71
74
|
let target = existing.get(entry.node.objectID);
|
|
72
75
|
if (target === undefined) {
|
|
76
|
+
if (existing.size >= maxNodes || !reserveNode()) {
|
|
77
|
+
omitted += 1;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
73
80
|
target = { objectID: entry.node.objectID, children: [] };
|
|
74
81
|
existing.set(target.objectID, target);
|
|
75
82
|
entry.output.push(target);
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { decodeXmlText } from "../../domain/propertyListKeys.js";
|
|
2
|
+
const collector = () => {
|
|
3
|
+
const integers = new Map();
|
|
4
|
+
const reals = new Set();
|
|
5
|
+
let unsafeIntegerLiterals = 0;
|
|
6
|
+
let incompleteMetadata = false;
|
|
7
|
+
return {
|
|
8
|
+
integer: (literal) => {
|
|
9
|
+
if (!/^[+-]?\d+$/u.test(literal)) {
|
|
10
|
+
incompleteMetadata = true;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const exact = BigInt(literal);
|
|
14
|
+
if (exact >= BigInt(Number.MIN_SAFE_INTEGER) &&
|
|
15
|
+
exact <= BigInt(Number.MAX_SAFE_INTEGER))
|
|
16
|
+
return;
|
|
17
|
+
unsafeIntegerLiterals += 1;
|
|
18
|
+
const rounded = Number(exact);
|
|
19
|
+
integers.set(rounded, (integers.get(rounded) ?? new Set()).add(exact.toString()));
|
|
20
|
+
},
|
|
21
|
+
real: (value) => {
|
|
22
|
+
reals.add(value);
|
|
23
|
+
},
|
|
24
|
+
markIncomplete: () => {
|
|
25
|
+
incompleteMetadata = true;
|
|
26
|
+
},
|
|
27
|
+
result: (incomplete = false) => ({
|
|
28
|
+
incomplete: incomplete || incompleteMetadata,
|
|
29
|
+
integers,
|
|
30
|
+
reals,
|
|
31
|
+
unsafeIntegerLiterals,
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
// Consume quoted tag attributes and opaque comment/CDATA tokens whole.
|
|
36
|
+
const XML_TOKEN = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<(?:[^>"']|"[^"]*"|'[^']*')*>/gu;
|
|
37
|
+
const OPAQUE_ELEMENTS = new Set(["string", "key", "data", "date"]);
|
|
38
|
+
/** Observe plist number element types without interpreting strings or class code. */
|
|
39
|
+
export const xmlPlistNumberLiterals = (xml) => {
|
|
40
|
+
const output = collector();
|
|
41
|
+
const elements = [];
|
|
42
|
+
let number;
|
|
43
|
+
let cursor = 0;
|
|
44
|
+
for (const match of xml.matchAll(XML_TOKEN)) {
|
|
45
|
+
const index = match.index;
|
|
46
|
+
if (number !== undefined)
|
|
47
|
+
number.text += xml.slice(cursor, index);
|
|
48
|
+
const token = match[0];
|
|
49
|
+
cursor = index + token.length;
|
|
50
|
+
if (token.startsWith("<!--") || token.startsWith("<![CDATA[")) {
|
|
51
|
+
if (number !== undefined) {
|
|
52
|
+
number.plainText = false;
|
|
53
|
+
output.markIncomplete();
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const tag = /^<\s*(\/?)\s*([\w:-]+)/u.exec(token);
|
|
58
|
+
if (tag === null) {
|
|
59
|
+
if (number !== undefined) {
|
|
60
|
+
number.plainText = false;
|
|
61
|
+
output.markIncomplete();
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const closing = tag[1] === "/";
|
|
66
|
+
const name = tag[2];
|
|
67
|
+
if (name === undefined)
|
|
68
|
+
continue;
|
|
69
|
+
if (closing) {
|
|
70
|
+
if (number !== undefined &&
|
|
71
|
+
number.kind === name &&
|
|
72
|
+
number.depth === elements.length) {
|
|
73
|
+
if (number.plainText) {
|
|
74
|
+
const text = decodeXmlText(number.text).trim();
|
|
75
|
+
if (number.kind === "integer")
|
|
76
|
+
output.integer(text);
|
|
77
|
+
else
|
|
78
|
+
output.real(Number.parseFloat(text));
|
|
79
|
+
}
|
|
80
|
+
number = undefined;
|
|
81
|
+
}
|
|
82
|
+
elements.pop();
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
// The pinned decoder reads only the first child for integers and only text
|
|
86
|
+
// nodes for reals. Mixed content cannot establish an exact association.
|
|
87
|
+
if (number !== undefined) {
|
|
88
|
+
number.plainText = false;
|
|
89
|
+
output.markIncomplete();
|
|
90
|
+
}
|
|
91
|
+
if (/\/\s*>$/u.test(token))
|
|
92
|
+
continue;
|
|
93
|
+
if (number === undefined &&
|
|
94
|
+
(name === "integer" || name === "real") &&
|
|
95
|
+
!elements.some((parent) => OPAQUE_ELEMENTS.has(parent)))
|
|
96
|
+
number = {
|
|
97
|
+
kind: name,
|
|
98
|
+
text: "",
|
|
99
|
+
depth: elements.length + 1,
|
|
100
|
+
plainText: true,
|
|
101
|
+
};
|
|
102
|
+
elements.push(name);
|
|
103
|
+
}
|
|
104
|
+
return output.result();
|
|
105
|
+
};
|
|
106
|
+
/** Observe bounded binary number markers without changing primary decode acceptance. */
|
|
107
|
+
export const binaryPlistNumberLiterals = (bytes) => {
|
|
108
|
+
const output = collector();
|
|
109
|
+
if (bytes.length < 40 ||
|
|
110
|
+
bytes.subarray(0, 8).toString("ascii") !== "bplist00")
|
|
111
|
+
return output.result(true);
|
|
112
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
113
|
+
const trailer = bytes.length - 32;
|
|
114
|
+
const offsetWidth = bytes[trailer + 6] ?? 0;
|
|
115
|
+
if (![1, 2, 4, 8].includes(offsetWidth))
|
|
116
|
+
return output.result(true);
|
|
117
|
+
const countRaw = view.getBigUint64(trailer + 8);
|
|
118
|
+
const tableRaw = view.getBigUint64(trailer + 24);
|
|
119
|
+
const safeMaximum = BigInt(Number.MAX_SAFE_INTEGER);
|
|
120
|
+
if (countRaw === 0n || countRaw > safeMaximum || tableRaw > safeMaximum)
|
|
121
|
+
return output.result(true);
|
|
122
|
+
if (tableRaw < 8n || tableRaw >= BigInt(trailer))
|
|
123
|
+
return output.result(true);
|
|
124
|
+
const offsetTable = Number(tableRaw);
|
|
125
|
+
const capacity = Math.floor((trailer - offsetTable) / offsetWidth);
|
|
126
|
+
if (countRaw > BigInt(capacity))
|
|
127
|
+
return output.result(true);
|
|
128
|
+
const count = Number(countRaw);
|
|
129
|
+
const unsigned = (offset) => {
|
|
130
|
+
if (offset < offsetTable || offset + offsetWidth > trailer)
|
|
131
|
+
return undefined;
|
|
132
|
+
if (offsetWidth === 1)
|
|
133
|
+
return view.getUint8(offset);
|
|
134
|
+
if (offsetWidth === 2)
|
|
135
|
+
return view.getUint16(offset);
|
|
136
|
+
if (offsetWidth === 4)
|
|
137
|
+
return view.getUint32(offset);
|
|
138
|
+
const value = view.getBigUint64(offset);
|
|
139
|
+
return value > safeMaximum ? undefined : Number(value);
|
|
140
|
+
};
|
|
141
|
+
for (let index = 0; index < count; index += 1) {
|
|
142
|
+
const offset = unsigned(offsetTable + index * offsetWidth);
|
|
143
|
+
if (offset === undefined || offset < 8 || offset >= offsetTable)
|
|
144
|
+
return output.result(true);
|
|
145
|
+
const marker = bytes[offset] ?? 0;
|
|
146
|
+
const type = marker >> 4;
|
|
147
|
+
if (type !== 1 && type !== 2)
|
|
148
|
+
continue;
|
|
149
|
+
const width = 2 ** (marker & 0xf);
|
|
150
|
+
if (offset + 1 + width > offsetTable)
|
|
151
|
+
return output.result(true);
|
|
152
|
+
if (type === 1 && width === 8)
|
|
153
|
+
output.integer(view.getBigInt64(offset + 1).toString());
|
|
154
|
+
else if (type === 1 && width > 4)
|
|
155
|
+
return output.result(true);
|
|
156
|
+
else if (type === 2 && width === 4)
|
|
157
|
+
output.real(view.getFloat32(offset + 1));
|
|
158
|
+
else if (type === 2 && width === 8)
|
|
159
|
+
output.real(view.getFloat64(offset + 1));
|
|
160
|
+
else if (type === 2)
|
|
161
|
+
return output.result(true);
|
|
162
|
+
}
|
|
163
|
+
return output.result();
|
|
164
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { lstat, realpath } from "node:fs/promises";
|
|
2
|
-
import { canonicalDigest } from "
|
|
3
|
-
import { AsarArtifactReader } from "../
|
|
4
|
-
import { ArtifactPathRegistry, normalizeArtifactPath, } from "../
|
|
5
|
-
import { ArtifactReaderFailure, } from "../
|
|
6
|
-
import { DirectoryArtifactReader } from "../
|
|
7
|
-
import { SafeOutputTree } from "../
|
|
8
|
-
import { ZipArtifactReader } from "../
|
|
9
|
-
import { MachOSliceArtifactReader } from "../
|
|
10
|
-
import { artifactExtractionResultSchema, } from "
|
|
11
|
-
import { scanArtifactInventory } from "
|
|
2
|
+
import { canonicalDigest } from "../../domain/comparisonSemantics.js";
|
|
3
|
+
import { AsarArtifactReader } from "../AsarArtifactReader.js";
|
|
4
|
+
import { ArtifactPathRegistry, normalizeArtifactPath, } from "../ArtifactPaths.js";
|
|
5
|
+
import { ArtifactReaderFailure, } from "../ArtifactReader.js";
|
|
6
|
+
import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
|
7
|
+
import { SafeOutputTree } from "../SafeOutputTree.js";
|
|
8
|
+
import { ZipArtifactReader } from "../ZipArtifactReader.js";
|
|
9
|
+
import { MachOSliceArtifactReader } from "../MachOSliceArtifactReader.js";
|
|
10
|
+
import { artifactExtractionResultSchema, } from "../../domain/artifactGraph.js";
|
|
11
|
+
import { scanArtifactInventory } from "../inventory/ArtifactInventory.js";
|
|
12
12
|
/** Extract every regular inventory occurrence into an exclusively owned absent root. */
|
|
13
13
|
export const extractArtifact = async (input, signal) => {
|
|
14
14
|
const sourcePath = await realpath(input.inputPath);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { canonicalDigest } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { canonicalDigest } from "../../domain/comparisonSemantics.js";
|
|
2
|
+
import { artifactEdgeId, artifactIdForContent, occurrenceIdForLocation, } from "../../domain/artifactIdentity.js";
|
|
3
|
+
import { zipPackageFormatForPath } from "../../domain/zipPackageFormat.js";
|
|
4
|
+
import { mzWindowsHeaderOffset, parseDosMzHeader } from "../../domain/dosMz.js";
|
|
4
5
|
/** Index the first occurrence for each canonical logical path. */
|
|
5
6
|
export const indexOccurrencesByPath = (occurrences) => {
|
|
6
7
|
const byPath = new Map();
|
|
@@ -94,7 +95,7 @@ export const createRootNode = (input) => createArtifactNode({
|
|
|
94
95
|
contentState: "materialized",
|
|
95
96
|
});
|
|
96
97
|
export const createArtifactNode = (input) => ({
|
|
97
|
-
artifact_id:
|
|
98
|
+
artifact_id: artifactIdForContent(input.sha256),
|
|
98
99
|
kind: input.kind,
|
|
99
100
|
format: input.format,
|
|
100
101
|
sha256: input.sha256,
|
|
@@ -106,7 +107,11 @@ export const createArtifactNode = (input) => ({
|
|
|
106
107
|
limitations: [...(input.limitations ?? [])],
|
|
107
108
|
});
|
|
108
109
|
export const rootOccurrenceFor = (node, declaredSize) => ({
|
|
109
|
-
occurrence_id:
|
|
110
|
+
occurrence_id: occurrenceIdForLocation({
|
|
111
|
+
rootArtifactId: node.artifact_id,
|
|
112
|
+
logicalPath: ".",
|
|
113
|
+
entryKind: node.format === "directory" ? "directory" : "file",
|
|
114
|
+
}),
|
|
110
115
|
artifact_id: node.artifact_id,
|
|
111
116
|
parent_occurrence_id: null,
|
|
112
117
|
logical_path: ".",
|
|
@@ -122,11 +127,11 @@ export const rootOccurrenceFor = (node, declaredSize) => ({
|
|
|
122
127
|
export const rekeyOccurrences = (rootArtifactId, occurrences) => {
|
|
123
128
|
const replacements = new Map();
|
|
124
129
|
for (const occurrence of occurrences)
|
|
125
|
-
replacements.set(occurrence.occurrence_id,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
+
replacements.set(occurrence.occurrence_id, occurrenceIdForLocation({
|
|
131
|
+
rootArtifactId,
|
|
132
|
+
logicalPath: occurrence.logical_path,
|
|
133
|
+
entryKind: occurrence.entry_kind,
|
|
134
|
+
}));
|
|
130
135
|
for (const occurrence of occurrences) {
|
|
131
136
|
occurrence.occurrence_id =
|
|
132
137
|
replacements.get(occurrence.occurrence_id) ?? occurrence.occurrence_id;
|
|
@@ -160,7 +165,7 @@ export const createArtifactEdges = (rootArtifactId, occurrences, producer) => {
|
|
|
160
165
|
logical_path: occurrence.logical_path,
|
|
161
166
|
};
|
|
162
167
|
edges.push({
|
|
163
|
-
edge_id:
|
|
168
|
+
edge_id: artifactEdgeId(semantic),
|
|
164
169
|
...semantic,
|
|
165
170
|
producer: occurrence.entry_kind === "slice" ? (producer ?? null) : null,
|
|
166
171
|
ordinal: edges.length,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { realpath } from "node:fs/promises";
|
|
2
|
-
import { artifactInventoryResultSchema, } from "
|
|
3
|
-
import { abortIfNeeded } from "../
|
|
4
|
-
import { scanCanonicalArtifactInventory } from "./
|
|
5
|
-
export { scanCanonicalArtifactInventory } from "./
|
|
2
|
+
import { artifactInventoryResultSchema, } from "../../domain/artifactGraph.js";
|
|
3
|
+
import { abortIfNeeded } from "../ArtifactHash.js";
|
|
4
|
+
import { scanCanonicalArtifactInventory } from "./scanCanonical.js";
|
|
5
|
+
export { scanCanonicalArtifactInventory } from "./scanCanonical.js";
|
|
6
6
|
/** Inventory one local artifact and return every graph collection inline. */
|
|
7
7
|
export const inventoryArtifact = async (inputPath, options = {}) => {
|
|
8
8
|
const snapshot = await scanArtifactInventory(inputPath, options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { open } from "node:fs/promises";
|
|
2
|
-
import { classifyArtifactContent } from "
|
|
3
|
-
import { ARTIFACT_CLASSIFICATION_PREFIX_BYTES } from "
|
|
2
|
+
import { classifyArtifactContent } from "./ArtifactGraphConstruction.js";
|
|
3
|
+
import { ARTIFACT_CLASSIFICATION_PREFIX_BYTES } from "../ArtifactHash.js";
|
|
4
4
|
import { hasZipSignature, zipPackageFormatForPath, } from "../../domain/zipPackageFormat.js";
|
|
5
5
|
const classifyContainerExtension = (path) => {
|
|
6
6
|
const lower = path.toLowerCase();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AsarArtifactReader } from "
|
|
2
|
-
import { DirectoryArtifactReader } from "
|
|
3
|
-
import { MachOSliceArtifactReader } from "
|
|
4
|
-
import { NativeDmgArtifactReader } from "
|
|
5
|
-
import { ZipArtifactReader } from "
|
|
1
|
+
import { AsarArtifactReader } from "../AsarArtifactReader.js";
|
|
2
|
+
import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
|
3
|
+
import { MachOSliceArtifactReader } from "../MachOSliceArtifactReader.js";
|
|
4
|
+
import { NativeDmgArtifactReader } from "../NativeDmgArtifactReader.js";
|
|
5
|
+
import { ZipArtifactReader } from "../ZipArtifactReader.js";
|
|
6
6
|
export const createReader = async (path, format, signal) => {
|
|
7
7
|
switch (format) {
|
|
8
8
|
case "directory":
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createReadStream } from "node:fs";
|
|
2
2
|
import { lstat } from "node:fs/promises";
|
|
3
|
-
import { ArtifactReaderFailure, } from "
|
|
3
|
+
import { ArtifactReaderFailure, } from "../ArtifactReader.js";
|
|
4
4
|
import { artifactInventoryResultSchema, } from "../../domain/artifactGraph.js";
|
|
5
|
-
import { createArtifactEdges, createRootNode, indexOccurrencesByPath, materializeDirectoryNodes, rekeyOccurrences, rootOccurrenceFor, } from "
|
|
6
|
-
import {
|
|
5
|
+
import { createArtifactEdges, createRootNode, indexOccurrencesByPath, materializeDirectoryNodes, rekeyOccurrences, rootOccurrenceFor, } from "./ArtifactGraphConstruction.js";
|
|
6
|
+
import { artifactContradictionId, artifactGraphDigest, artifactManifestId, } from "../../domain/artifactIdentity.js";
|
|
7
7
|
import { classifyRoot } from "./classify.js";
|
|
8
|
-
import { hashReadable } from "
|
|
8
|
+
import { hashReadable } from "../ArtifactHash.js";
|
|
9
9
|
import { createReader, inventoryLimitations } from "./reader.js";
|
|
10
10
|
import { scanReader, } from "./scanReader.js";
|
|
11
11
|
import { STRICT_INTEGRITY_POLICY, } from "./types.js";
|
|
@@ -63,12 +63,12 @@ const buildInventorySnapshot = async (input) => {
|
|
|
63
63
|
const orderedOccurrences = sortOccurrences(input.occurrences);
|
|
64
64
|
const orderedEdges = sortEdges(edges);
|
|
65
65
|
await verifyRootDigest(path, rootDigest, signal);
|
|
66
|
-
const graphSha256 =
|
|
66
|
+
const graphSha256 = artifactGraphDigest({
|
|
67
67
|
nodes: orderedNodes,
|
|
68
68
|
occurrences: orderedOccurrences,
|
|
69
69
|
edges: orderedEdges,
|
|
70
|
-
|
|
71
|
-
}
|
|
70
|
+
contradictions: integrityContradictions,
|
|
71
|
+
});
|
|
72
72
|
const manifest = buildManifest({
|
|
73
73
|
rootNode,
|
|
74
74
|
graphSha256,
|
|
@@ -95,12 +95,12 @@ const buildIntegrityContradictions = (pending, occurrenceByPath, occurrenceById,
|
|
|
95
95
|
: occurrenceById.get(occurrence.parent_occurrence_id);
|
|
96
96
|
const parentArtifactId = parent?.artifact_id ?? rootNode.artifact_id;
|
|
97
97
|
return {
|
|
98
|
-
contradiction_id:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
98
|
+
contradiction_id: artifactContradictionId({
|
|
99
|
+
rootArtifactId: rootNode.artifact_id,
|
|
100
|
+
logicalPath: contradiction.logicalPath,
|
|
101
|
+
declaredSha256: contradiction.declaredSha256,
|
|
102
|
+
observedSha256: contradiction.observedSha256,
|
|
103
|
+
}),
|
|
104
104
|
occurrence_id: occurrence.occurrence_id,
|
|
105
105
|
parent_artifact_id: parentArtifactId,
|
|
106
106
|
logical_path: contradiction.logicalPath,
|
|
@@ -127,10 +127,7 @@ const sortNodes = (nodes) => nodes.sort((left, right) => left.artifact_id.locale
|
|
|
127
127
|
const sortOccurrences = (occurrences) => occurrences.sort((left, right) => left.logical_path.localeCompare(right.logical_path, "en"));
|
|
128
128
|
const sortEdges = (edges) => edges.sort((left, right) => left.edge_id.localeCompare(right.edge_id));
|
|
129
129
|
const buildManifest = ({ rootNode, graphSha256, orderedNodes, orderedOccurrences, orderedEdges, }) => artifactInventoryResultSchema.shape.manifest.parse({
|
|
130
|
-
manifest_id:
|
|
131
|
-
root_artifact_id: rootNode.artifact_id,
|
|
132
|
-
graph_sha256: graphSha256,
|
|
133
|
-
}, "Artifact")}`,
|
|
130
|
+
manifest_id: artifactManifestId(rootNode.artifact_id, graphSha256),
|
|
134
131
|
root_artifact_id: rootNode.artifact_id,
|
|
135
132
|
root_sha256: rootNode.sha256,
|
|
136
133
|
root_format: rootNode.format,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isAbsolute } from "node:path";
|
|
2
|
-
import { ArtifactPathRegistry, normalizeArtifactPath, } from "
|
|
3
|
-
import { ArtifactReaderFailure, } from "
|
|
4
|
-
import { AsarArtifactReader } from "
|
|
5
|
-
import { classifyArtifactContent, createArtifactNode, createOccurrence, nearestParent, } from "
|
|
2
|
+
import { ArtifactPathRegistry, normalizeArtifactPath, } from "../ArtifactPaths.js";
|
|
3
|
+
import { ArtifactReaderFailure, } from "../ArtifactReader.js";
|
|
4
|
+
import { AsarArtifactReader } from "../AsarArtifactReader.js";
|
|
5
|
+
import { classifyArtifactContent, createArtifactNode, createOccurrence, nearestParent, } from "./ArtifactGraphConstruction.js";
|
|
6
6
|
import { STRICT_INTEGRITY_POLICY, } from "./types.js";
|
|
7
|
-
import { hashReadable } from "
|
|
7
|
+
import { hashReadable } from "../ArtifactHash.js";
|
|
8
8
|
const UNAVAILABLE_UNPACKED_LIMITATION = "ASAR unpacked companion bytes were unavailable; no content hash or child artifact was produced.";
|
|
9
9
|
const emptyScan = () => ({ nodes: new Map(), occurrences: [], pendingContradictions: [] });
|
|
10
10
|
export const scanReader = async (reader, signal, integrity = STRICT_INTEGRITY_POLICY) => {
|
|
@@ -125,7 +125,11 @@ const readText = async (context, input) => {
|
|
|
125
125
|
try {
|
|
126
126
|
return {
|
|
127
127
|
included: true,
|
|
128
|
-
value: new TextDecoder("utf-8", {
|
|
128
|
+
value: new TextDecoder("utf-8", {
|
|
129
|
+
fatal: true,
|
|
130
|
+
ignoreBOM: input.expected.kind === "javascript" ||
|
|
131
|
+
input.expected.kind === "html",
|
|
132
|
+
}).decode(bytes),
|
|
129
133
|
};
|
|
130
134
|
}
|
|
131
135
|
catch (cause) {
|
|
@@ -204,7 +208,7 @@ const relevantKind = (path) => {
|
|
|
204
208
|
return "package-json";
|
|
205
209
|
if (lower.endsWith(".json"))
|
|
206
210
|
return "json";
|
|
207
|
-
if (/\.(?:cjs|mjs|js|jsx|ts|tsx)$/u.test(lower))
|
|
211
|
+
if (/\.(?:cjs|cts|mjs|mts|js|jsx|ts|tsx)$/u.test(lower))
|
|
208
212
|
return "javascript";
|
|
209
213
|
if (/\.html?$/u.test(lower))
|
|
210
214
|
return "html";
|
|
@@ -2,15 +2,31 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { constants } from "node:fs";
|
|
3
3
|
import { lstat, open } from "node:fs/promises";
|
|
4
4
|
import { ArtifactReaderFailure } from "./ArtifactReader.js";
|
|
5
|
+
const FILE_SYSTEM = {
|
|
6
|
+
lstat: (path) => lstat(path, { bigint: true }),
|
|
7
|
+
open,
|
|
8
|
+
};
|
|
9
|
+
const afterValidation = async (path, stage, read) => {
|
|
10
|
+
try {
|
|
11
|
+
return await read();
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
if (cause instanceof Error &&
|
|
15
|
+
"code" in cause &&
|
|
16
|
+
["ENOENT", "ENOTDIR", "ELOOP"].includes(String(cause.code)))
|
|
17
|
+
throw new ArtifactReaderFailure("integrity", `Artifact changed ${stage}: ${path}`, { cause });
|
|
18
|
+
throw cause;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
5
21
|
/** Read one bounded regular file and reject replacement or in-place changes. */
|
|
6
|
-
export const readStableArtifact = async (path, maximumBytes, signal) => {
|
|
22
|
+
export const readStableArtifact = async (path, maximumBytes, signal, fileSystem = FILE_SYSTEM) => {
|
|
7
23
|
signal?.throwIfAborted();
|
|
8
|
-
const before = await lstat(path
|
|
24
|
+
const before = await fileSystem.lstat(path);
|
|
9
25
|
if (!before.isFile() || before.isSymbolicLink())
|
|
10
26
|
throw new ArtifactReaderFailure("path", `Expected a regular file without a symlink: ${path}`);
|
|
11
27
|
if (before.size > BigInt(maximumBytes))
|
|
12
28
|
throw new ArtifactReaderFailure("limit", `Selected artifact exceeds ${String(maximumBytes)} bytes: ${path}`);
|
|
13
|
-
const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
29
|
+
const file = await afterValidation(path, "before open", () => fileSystem.open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK));
|
|
14
30
|
try {
|
|
15
31
|
const initial = await file.stat({ bigint: true });
|
|
16
32
|
if (!initial.isFile() ||
|
|
@@ -34,7 +50,7 @@ export const readStableArtifact = async (path, maximumBytes, signal) => {
|
|
|
34
50
|
chunks.push(bytes);
|
|
35
51
|
}
|
|
36
52
|
const after = await file.stat({ bigint: true });
|
|
37
|
-
const current = await
|
|
53
|
+
const current = await afterValidation(path, "during read", () => fileSystem.lstat(path));
|
|
38
54
|
if ([after, current].some((stat) => !stat.isFile() ||
|
|
39
55
|
stat.dev !== initial.dev ||
|
|
40
56
|
stat.ino !== initial.ino ||
|
|
@@ -44,6 +44,8 @@ export class CdpCaptureCompleteness {
|
|
|
44
44
|
if (reason === "provider_unavailable" ||
|
|
45
45
|
reason === "invalid_protocol_value")
|
|
46
46
|
this.#unavailable.add(section);
|
|
47
|
+
if (reason === "resource_budget_exhausted")
|
|
48
|
+
this.#truncated.add(section);
|
|
47
49
|
const key = `${section}\0${reason}`;
|
|
48
50
|
const existing = this.#excluded.get(key);
|
|
49
51
|
const combined = count === null || existing?.count === null
|