rea-agents 6.3.0 → 6.4.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 +7 -4
- package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
- package/bridge/ghidra/ReaGhidraBridge.java +597 -209
- package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
- package/dist/adb/AdbConfiguration.js +88 -0
- package/dist/adb/AdbDeviceOutput.js +186 -0
- package/dist/adb/AdbProvider.js +1190 -0
- package/dist/adb/AdbShellOutput.js +309 -0
- package/dist/android/AndroidTargetSnapshot.js +104 -22
- package/dist/android/JadxConfiguration.js +44 -24
- package/dist/android/JadxProvider.js +51 -19
- package/dist/apktool/ApktoolConfiguration.js +84 -0
- package/dist/apktool/ApktoolDecodeOutput.js +59 -0
- package/dist/apktool/ApktoolProvider.js +506 -0
- package/dist/application/AnalysisProvider.js +8 -2
- package/dist/application/AppBundleExecutable.js +27 -22
- package/dist/application/BinaryTargetResolver.js +22 -2
- package/dist/application/CapabilityInventory.js +11 -1
- package/dist/application/ClientConfigurationDocument.js +70 -0
- package/dist/application/ClientConfigurationFiles.js +91 -0
- package/dist/application/ClientRegistrationEnvironment.js +35 -0
- package/dist/application/ClientRegistrationStatus.js +66 -31
- package/dist/application/DirectAnalysis.js +2 -2
- package/dist/application/DirectAnalysisCleanup.js +1 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +5 -3
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleCommands.js +6 -12
- package/dist/application/GeminiClientSettings.js +139 -0
- package/dist/application/HermesClientHome.js +115 -0
- package/dist/application/HopperDownload.js +39 -0
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/JsonFiles.js +6 -5
- package/dist/{cliJsonFile.js → application/JsonInputFile.js} +108 -35
- package/dist/application/LinuxHopper.js +4 -12
- package/dist/application/MacHopper.js +172 -149
- package/dist/application/MipsElfAbiFlags.js +140 -0
- package/dist/application/ProviderOperationExecution.js +31 -0
- package/dist/application/ReconstructionObligationCandidates.js +9 -3
- package/dist/application/ReferenceSourceImport.js +76 -29
- package/dist/application/ReferenceSourceImportEntries.js +18 -9
- package/dist/application/ReferenceSourceImportPolicy.js +99 -23
- package/dist/application/ReferenceSourceImportTypes.js +30 -22
- package/dist/application/ReferenceSourceVcsAdapter.js +145 -30
- package/dist/application/RegularFileRead.js +93 -7
- package/dist/application/Setup.js +54 -6
- package/dist/application/SetupClientConfiguration.js +116 -16
- package/dist/application/SetupHost.js +102 -24
- package/dist/application/SetupPlan.js +5 -8
- package/dist/application/SetupSkill.js +58 -39
- package/dist/application/SupportedClients.js +290 -65
- package/dist/application/Uninstall.js +158 -10
- package/dist/application/UpdateMaintenance.js +17 -21
- package/dist/application/Utf8JsonInput.js +7 -0
- package/dist/application/WebScriptExportService.js +131 -65
- package/dist/application/WebSourceLocationService.js +3 -0
- package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
- package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
- package/dist/application/analysisView/AnalysisViewService.js +40 -2
- package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
- package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
- package/dist/application/binary/AnalysisClientCleanup.js +0 -24
- package/dist/application/binary/BinarySession.js +2 -1
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +2 -1
- package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
- package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +2 -1
- package/dist/application/evm/EvmInterfaceService.js +3 -0
- package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
- package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
- package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +19 -6
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +3 -3
- package/dist/application/javascript/JavaScriptApplicationService.js +22 -11
- package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +171 -30
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +14 -16
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +67 -19
- package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +11 -5
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +19 -16
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +92 -10
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +258 -235
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +115 -26
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +4 -1
- package/dist/application/javascript/JavaScriptModuleRelationships.js +6 -4
- package/dist/application/javascript/JavaScriptRecoveryService.js +3 -0
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +199 -61
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
- package/dist/application/jeb/JebAnalysisPort.js +1 -0
- package/dist/application/jeb/JebAnalysisService.js +13 -0
- package/dist/application/managed/ManagedApplicationGraphService.js +1 -1
- package/dist/application/native/NativeUiActionTrace.js +16 -8
- package/dist/application/native/NativeValueTrace.js +23 -6
- package/dist/application/process/ProcessCli.js +25 -20
- package/dist/artifacts/ArtifactPaths.js +129 -8
- package/dist/artifacts/ArtifactProvider.js +20 -15
- package/dist/artifacts/ArtifactReader.js +23 -0
- package/dist/artifacts/ArtifactResourceScope.js +100 -0
- package/dist/artifacts/AsarArtifactReader.js +176 -102
- package/dist/artifacts/AsarHeader.js +24 -0
- package/dist/artifacts/DirectoryArtifactReader.js +168 -65
- package/dist/artifacts/MachOSliceArtifactReader.js +116 -39
- package/dist/artifacts/NativeDmgArtifactReader.js +29 -22
- package/dist/artifacts/SafeOutputTree.js +245 -70
- package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
- package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
- package/dist/artifacts/ZipArtifactReader.js +77 -27
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +58 -18
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +62 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +32 -13
- package/dist/artifacts/extraction/ArtifactExtraction.js +110 -86
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +110 -43
- package/dist/artifacts/inventory/ArtifactInventory.js +5 -4
- package/dist/artifacts/inventory/classify.js +75 -32
- package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
- package/dist/artifacts/inventory/reader.js +13 -5
- package/dist/artifacts/inventory/scanCanonical.js +62 -25
- package/dist/artifacts/inventory/scanReader.js +38 -11
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +15 -9
- package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
- package/dist/browser/BrowserScenarioPartialObservation.js +8 -2
- package/dist/browser/BrowserScenarioSecrets.js +52 -37
- package/dist/browser/CdpBrowserProvider.js +5 -0
- package/dist/browser/CdpCaptureDocuments.js +40 -6
- package/dist/browser/CdpCaptureDomSvg.js +210 -0
- package/dist/browser/CdpCaptureEventBodyShapes.js +4 -8
- package/dist/browser/CdpCaptureEventHandlers.js +26 -9
- package/dist/browser/CdpCaptureEvents.js +4 -9
- package/dist/browser/CdpConnection.js +22 -5
- package/dist/browser/CdpPageCapture.js +1 -1
- package/dist/browser/CdpTargetSession.js +30 -34
- package/dist/browser/CdpWebMcpDiscovery.js +32 -10
- package/dist/browser/ElectronFileScope.js +99 -9
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +60 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +11 -6
- package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +69 -7
- package/dist/browser/PlaywrightScenarioSession.js +127 -54
- package/dist/browser/PlaywrightScenarioStorage.js +507 -0
- package/dist/browser/PngVisualDiff.js +198 -29
- package/dist/browser/WebSourceMapFetcher.js +3 -3
- package/dist/browser/assets/LocalWebScriptArtifacts.js +3 -1
- package/dist/browser/assets/PublishWebScripts.js +75 -20
- package/dist/browser/assets/WebArtifactReads.js +23 -1
- package/dist/browser/assets/WebSourceLocationArtifacts.js +1 -0
- package/dist/browser/execution/CdpExecutionCapture.js +3 -3
- package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
- package/dist/browser/history/HarCapture.js +14 -0
- package/dist/browser/history/HarCaptureProcess.js +2 -10
- package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
- package/dist/browser/modules/WebModuleArtifacts.js +1 -0
- package/dist/cli/adbCommands.js +337 -0
- package/dist/cli/analysisViewCommands.js +39 -1
- package/dist/cli/apktoolCommands.js +53 -0
- package/dist/cli/artifactCommands.js +8 -11
- package/dist/cli/binaryDiagnosticsCommands.js +19 -1
- package/dist/cli/browserAdvancedCommands.js +65 -36
- package/dist/cli/coreBinaryCommands.js +0 -5
- package/dist/cli/coreNativeCommands.js +1 -14
- package/dist/cli/electronCommands.js +6 -1
- package/dist/cli/evmCommands.js +13 -4
- package/dist/cli/firmwareCommands.js +7 -2
- package/dist/cli/javascriptApplicationAnalysis.js +17 -1
- package/dist/cli/javascriptRecoveryCommands.js +22 -15
- package/dist/cli/jebCommands.js +99 -0
- package/dist/cli/jsonOutput.js +11 -4
- package/dist/cli/referenceSourceImportStatus.js +7 -0
- package/dist/cli/setupCommands.js +15 -3
- package/dist/cli/utilityCommands.js +66 -18
- package/dist/cli/webScriptCommands.js +20 -1
- package/dist/cli/webSourceLocationCommands.js +21 -9
- package/dist/cli.js +6 -0
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +32 -0
- package/dist/cliJsonInput.js +2 -2
- package/dist/cliObservationOptions.js +3 -0
- package/dist/composition/adb.js +3 -0
- package/dist/composition/apktool.js +3 -0
- package/dist/composition/binaryDiagnostics.js +4 -0
- package/dist/composition/directAnalysis.js +12 -4
- package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
- package/dist/composition/jeb.js +6 -0
- package/dist/config/environment.js +10 -0
- package/dist/config/ghidraLanguageOverride.js +9 -0
- package/dist/config/mcpInputSchemaProfile.js +27 -0
- package/dist/config/parseConfig.js +28 -1
- package/dist/contracts/adb/adbToolContracts.js +353 -0
- package/dist/contracts/advertisedInputExamples.js +48 -0
- package/dist/contracts/analysisDetail.js +10 -0
- package/dist/contracts/analysisViewToolContracts.js +17 -2
- package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
- package/dist/contracts/artifactToolContracts.js +8 -5
- package/dist/contracts/browserToolContracts.js +1 -1
- package/dist/contracts/compactInputSchema.js +256 -0
- package/dist/contracts/functionWorkflowToolContracts.js +1 -1
- package/dist/contracts/inputSchemaPresentation.js +10 -10
- package/dist/contracts/javascript/electronToolContracts.js +15 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +1 -1
- package/dist/contracts/jeb/jebToolContracts.js +64 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +25 -3
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/sessionToolContracts.js +2 -2
- package/dist/contracts/sessionToolSchemas.js +6 -2
- package/dist/contracts/toolContractExamples.js +6 -0
- package/dist/contracts/toolContractTypes.js +3 -0
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +167 -0
- package/dist/contracts/toolOutputSchemaGroups.js +5 -3
- package/dist/contracts/toolSchemaMetadata.js +82 -7
- package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
- package/dist/domain/analysisErrorCleanup.js +29 -0
- package/dist/domain/analysisErrorPresentation.js +18 -6
- package/dist/domain/analysisErrorProjection.js +4 -1
- package/dist/domain/analysisSnapshot.js +2 -1
- package/dist/domain/analysisView/analysisView.js +52 -2
- package/dist/domain/analysisView/binaryLayoutView.js +2 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +2 -0
- package/dist/domain/analysisView/nativeFunctionView.js +155 -0
- package/dist/domain/android/androidApplication.js +25 -20
- package/dist/domain/apktool/apktoolResourceAnalysis.js +77 -0
- package/dist/domain/apple/appleApplication.js +40 -23
- package/dist/domain/apple/appleBundleAnatomy.js +95 -28
- package/dist/domain/apple/dyldPaths.js +9 -1
- package/dist/domain/apple/dylibResolution.js +2 -2
- package/dist/domain/apple/interfaceBuilderGraph.js +22 -19
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +10 -1
- package/dist/domain/artifactComparison.js +35 -7
- package/dist/domain/artifactGraph.js +5 -3
- package/dist/domain/artifactIdentity.js +30 -2
- package/dist/domain/artifactInspection.js +3 -43
- package/dist/domain/artifactIntegrityPolicy.js +10 -0
- package/dist/domain/artifactInventoryEvidence.js +11 -12
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/binaryTarget.js +16 -0
- package/dist/domain/binaryTargetTypes.js +8 -1
- package/dist/domain/browserObservationSchemas.js +8 -4
- package/dist/domain/canonicalJsonDigestSteps.js +34 -12
- package/dist/domain/compactStringIdentity.js +9 -0
- package/dist/domain/evidence.js +2 -1
- package/dist/domain/evidenceRecordSummary.js +144 -0
- package/dist/domain/inputIssueProjection.js +16 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +12 -13
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +11 -20
- package/dist/domain/javascript/electronStaticAnalysisNative.js +70 -40
- package/dist/domain/javascript/electronStaticAnalysisValues.js +16 -0
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +45 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +6 -6
- package/dist/domain/javascript/javascriptApplicationGraph.js +79 -18
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +35 -0
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +9 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +58 -31
- package/dist/domain/javascript/javascriptAstValues.js +32 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +50 -0
- package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -1
- package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +1 -3
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +8 -11
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +190 -33
- package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +8 -1
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
- package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +42 -41
- package/dist/domain/javascript/javascriptSemanticGraph.js +69 -23
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -10
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +40 -7
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +341 -87
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
- package/dist/domain/javascript/javascriptSemanticObjects.js +7 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +52 -14
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
- package/dist/domain/javascript/javascriptSemanticQuery.js +27 -29
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +13 -23
- package/dist/domain/javascript/javascriptSemanticState.js +22 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +19 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +47 -19
- package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +29 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +8 -6
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +49 -5
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/jeb/jebAnalysis.js +114 -0
- package/dist/domain/jsonShape.js +63 -52
- package/dist/domain/jsonValue.js +3 -0
- package/dist/domain/managed/managedApplicationGraph.js +37 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +8 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +32 -22
- package/dist/domain/managed/managedArtifact.js +1 -0
- package/dist/domain/managed/managedInspectionEvidence.js +13 -0
- package/dist/domain/native/nativeAotPe.js +1408 -0
- package/dist/domain/native/nativeInstruction.js +21 -0
- package/dist/domain/native/nativeMetadataRecovery.js +79 -6
- package/dist/domain/native/peResources.js +94 -0
- package/dist/domain/nativeConvention.js +33 -0
- package/dist/domain/process/processCapture.js +91 -1
- package/dist/domain/process/processCaptureExample.js +24 -0
- package/dist/domain/process/processCaptureValidation.js +79 -0
- package/dist/domain/process/processScenario.js +59 -7
- package/dist/domain/propertyListKeys.js +3 -1
- package/dist/domain/referenceSourceGraph.js +25 -16
- package/dist/domain/referenceSourceImportParsing.js +6 -3
- package/dist/domain/referenceSourcePathIdentity.js +22 -0
- package/dist/domain/referenceSourceRequireBindings.js +137 -0
- package/dist/domain/webBundleAnalyzerInspection.js +14 -2
- package/dist/domain/webCaptureDiff.js +102 -4
- package/dist/domain/webScriptExportError.js +10 -4
- package/dist/domain/webScriptExportPlan.js +7 -13
- package/dist/domain/zipPackageFormat.js +4 -1
- package/dist/domain/zodCollectionSteps.js +24 -0
- package/dist/dotnet/ManagedArtifactInspector.js +55 -43
- package/dist/dotnet/ManagedDecodeBudget.js +80 -0
- package/dist/dotnet/ManagedMemberInspector.js +13 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +2 -2
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +4 -2
- package/dist/dotnet/ManagedMemberRows.js +9 -4
- package/dist/dotnet/ManagedMetadataHeaps.js +15 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +20 -11
- package/dist/dotnet/ManagedMetadataLayout.js +10 -4
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -3
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +3 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +49 -34
- package/dist/dotnet/ManagedPeReader.js +41 -25
- package/dist/dotnet/ManagedReaderFailure.js +2 -1
- package/dist/dotnet/ManagedStaticProvider.js +55 -24
- package/dist/evaluation/AgentEvaluationReport.js +9 -5
- package/dist/evaluation/CodexAgentEval.js +43 -13
- package/dist/evm/EvmoleFailures.js +0 -2
- package/dist/evm/EvmoleInterfaceProvider.js +67 -2
- package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
- package/dist/filesystem/OwnedFileHandle.js +36 -0
- package/dist/filesystem/RegularFile.js +33 -1
- package/dist/filesystem/StableFileHash.js +46 -0
- package/dist/filesystem/readFileHandleChunks.js +26 -0
- package/dist/firmware/FirmwareCommand.js +25 -3
- package/dist/firmware/FirmwareFiles.js +23 -8
- package/dist/firmware/FirmwareProvider.js +156 -32
- package/dist/firmware/FirmwarePublication.js +24 -3
- package/dist/firmware/FirmwareRelease.js +1 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +55 -4
- package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
- package/dist/ghidra/GhidraClient.js +76 -4
- package/dist/ghidra/GhidraDiagnostics.js +11 -8
- package/dist/ghidra/GhidraFunctionValues.js +26 -2
- package/dist/ghidra/GhidraInstallation.js +1 -1
- package/dist/ghidra/GhidraInventoryValues.js +23 -1
- package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
- package/dist/ghidra/GhidraLauncher.js +80 -39
- package/dist/ghidra/GhidraLoadImageAttest.js +49 -2
- package/dist/ghidra/GhidraMipsProfile.js +79 -0
- package/dist/ghidra/GhidraProvider.js +57 -9
- package/dist/ghidra/GhidraProviderCapabilities.js +18 -8
- package/dist/ghidra/GhidraProviderClient.js +282 -21
- package/dist/ghidra/GhidraSessionValues.js +9 -2
- package/dist/hopper/HopperAnalysisProfile.js +2 -0
- package/dist/hopper/HopperClient.js +15 -6
- package/dist/hopper/HopperMachOImage.js +2 -0
- package/dist/hopper/HopperProvider.js +13 -2
- package/dist/ida/IdaOperationRunner.js +8 -2
- package/dist/ida/IdaProvider.js +7 -0
- package/dist/ida/IdaSessionClient.js +3 -1
- package/dist/ida/IdaWorkspace.js +4 -2
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +326 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +520 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +63 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +521 -0
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +116 -0
- package/dist/javascript/recovery/RecoveryFiles.js +18 -7
- package/dist/javascript/recovery/WakaruCommand.js +22 -9
- package/dist/javascript/recovery/WakaruExecution.js +11 -7
- package/dist/javascript/recovery/WakaruProvider.js +139 -16
- package/dist/javascript/recovery/WakaruPublication.js +14 -4
- package/dist/javascript/recovery/WakaruRelease.js +10 -3
- package/dist/javascript/recovery/WakaruReport.js +12 -7
- package/dist/javascript/recovery/WakaruVersion.js +24 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +16 -3
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +63 -7
- package/dist/javascript/sourceMaps/SourceMapFormat.js +15 -4
- package/dist/jeb/JebMcpConnection.js +179 -0
- package/dist/jeb/JebMcpEndpoint.js +40 -0
- package/dist/jeb/JebProvider.js +299 -0
- package/dist/mcpDoctor.js +15 -6
- package/dist/native/AppleDispatchCoverage.js +25 -12
- package/dist/native/AppleDispatchMetadata.js +14 -7
- package/dist/native/AppleMachoFixups.js +71 -15
- package/dist/native/AppleMachoSelection.js +23 -3
- package/dist/native/NativeMacOSProvider.js +91 -16
- package/dist/native/NativeMachoInspection.js +11 -7
- package/dist/native/NativeUiHelperRuntime.js +6 -1
- package/dist/native/NativeUiObservation.js +4 -3
- package/dist/native/pe/PeResourceLayout.js +120 -0
- package/dist/native/pe/PeResourceParser.js +286 -0
- package/dist/native/pe/PeResourcesProvider.js +63 -0
- package/dist/process/BoundedFileBytes.js +30 -7
- package/dist/process/DarwinProcessRunTokenReader.js +8 -3
- package/dist/process/OwnedCommand.js +4 -3
- package/dist/process/ProcessOwnership.js +104 -112
- package/dist/process/ProcessOwnershipObservation.js +96 -39
- package/dist/process/ProcessOwnershipProcessTree.js +4 -4
- package/dist/process/ProcessRunTokenObservations.js +48 -0
- package/dist/process/ProviderDiagnosticRedaction.js +17 -0
- package/dist/process/ProviderProcess.js +4 -3
- package/dist/process/capture/FilesystemSnapshot.js +28 -4
- package/dist/process/capture/ProcessCaptureLifecycle.js +350 -59
- package/dist/process/capture/ProcessCaptureProgress.js +62 -0
- package/dist/process/capture/ProcessHarness.js +194 -26
- package/dist/process/capture/ProcessNormalization.js +3 -1
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +5 -2
- package/dist/process/capture/TerminalRenderer.js +24 -7
- package/dist/reference/ReferenceSourceReader.js +22 -5
- package/dist/reference/ReferenceSourceReaderEntries.js +114 -51
- package/dist/reference/ReferenceSourceReaderErrors.js +12 -0
- package/dist/reference/ReferenceSourceReaderFile.js +50 -10
- package/dist/reference/ReferenceSourceReaderValidate.js +4 -4
- package/dist/server/EvidenceMcpServer.js +36 -1
- package/dist/server/admittedToolOperation.js +9 -0
- package/dist/server/contractToolHandler.js +21 -0
- package/dist/server/createServer.js +97 -25
- package/dist/server/registerAdbTools.js +36 -0
- package/dist/server/registerAnalysisViewTool.js +4 -9
- package/dist/server/registerAndroidTools.js +3 -12
- package/dist/server/registerApktoolTools.js +14 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
- package/dist/server/registerApplicationTools/compareVersions.js +3 -2
- package/dist/server/registerApplicationTools/coverage.js +3 -2
- package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +3 -2
- package/dist/server/registerApplicationTools/traceFeature.js +3 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
- package/dist/server/registerArtifactComparisonTool.js +5 -2
- package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
- package/dist/server/registerBrowserScenarioTool.js +10 -7
- package/dist/server/registerBrowserTools.js +12 -9
- package/dist/server/registerBundleComparisonTool.js +16 -2
- package/dist/server/registerCloseLifecycleTool.js +32 -3
- package/dist/server/registerElectronTools.js +28 -10
- package/dist/server/registerEvmTools.js +4 -9
- package/dist/server/registerFirmwareTools.js +3 -11
- package/dist/server/registerFunctionComparisonTool.js +5 -2
- package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -6
- package/dist/server/registerJebTools.js +16 -0
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
- package/dist/server/registerPeResourcesTool.js +9 -0
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerRecordedCrashTools.js +4 -9
- package/dist/server/registerSessionRecordTools.js +2 -1
- package/dist/server/registerSessionTools.js +49 -18
- package/dist/server/registerWebModuleTool.js +4 -9
- package/dist/server/registerWebNetworkCaptureTool.js +4 -9
- package/dist/server/registerWebRuntimeTools.js +6 -5
- package/dist/server/registerWebScriptTool.js +6 -3
- package/dist/server/registerWebSourceLocationTool.js +4 -9
- package/dist/server/toolResult.js +21 -2
- package/dist/windows/WindowsPrivateRuntime.js +12 -5
- package/install.sh +7 -4
- package/licenses/nativeaot-parser-MIT.txt +28 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +33 -5
- package/scripts/rea.mjs +16 -1
- package/skills/reverse-engineer-anything/SKILL.md +52 -51
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +8 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +92 -13
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +22 -1
|
@@ -3,12 +3,13 @@ import canonicalize from "canonicalize";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
|
|
5
5
|
import { analysisProfileSchema, analysisProfilesEqual, committedProviderSchema, } from "./analysisProfile.js";
|
|
6
|
+
import { BINARY_ARCHITECTURES, } from "./binaryTargetTypes.js";
|
|
6
7
|
import { evidenceBundleForTarget, evidenceBundleSchema, parseEvidenceBundle, } from "./evidenceBundle.js";
|
|
7
8
|
import { evidenceLocationSchema, } from "./evidence.js";
|
|
8
9
|
import { jsonObjectSchema, jsonValueSchema, } from "./jsonValue.js";
|
|
9
10
|
import { digestSchema } from "./../domain/digests.js";
|
|
10
11
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
11
|
-
const architectureSchema = z.enum(
|
|
12
|
+
const architectureSchema = z.enum(BINARY_ARCHITECTURES);
|
|
12
13
|
const formatSchema = z.enum([
|
|
13
14
|
"analysis-database",
|
|
14
15
|
"mach-o",
|
|
@@ -6,10 +6,12 @@ import { evidenceSchema } from "../evidence.js";
|
|
|
6
6
|
import { jsonObjectSchema, jsonValueSchema } from "../jsonValue.js";
|
|
7
7
|
import { err, ok } from "../result.js";
|
|
8
8
|
import { binaryLayoutSchema } from "../native/binaryLayout.js";
|
|
9
|
+
import { functionDossierSchema } from "../hopperValues.js";
|
|
9
10
|
import { parseOwnedJavaScriptApplicationAnalysisSteps, } from "../javascript/javascriptApplicationAnalysis.js";
|
|
10
11
|
import { analysisInputErrorFromIssues } from "../inputIssueProjection.js";
|
|
11
12
|
import { projectBinaryLayoutView } from "./binaryLayoutView.js";
|
|
12
13
|
import { projectJavaScriptApplicationView } from "./javascriptApplicationView.js";
|
|
14
|
+
import { projectNativeFunctionView } from "./nativeFunctionView.js";
|
|
13
15
|
/** Public name of the selected-view workflow. */
|
|
14
16
|
export const INSPECT_ANALYSIS_VIEW_OPERATION = "inspect_analysis_view";
|
|
15
17
|
const summaryViewSchema = z.strictObject({ kind: z.literal("summary") });
|
|
@@ -57,12 +59,40 @@ const pageViewSchema = z.strictObject({
|
|
|
57
59
|
offset: z.number().int().nonnegative(),
|
|
58
60
|
limit: z.number().int().positive(),
|
|
59
61
|
});
|
|
62
|
+
/** Bounded native function facets of already authenticated analyze_function Evidence. */
|
|
63
|
+
const nativeViewSchema = z.strictObject({
|
|
64
|
+
kind: z.literal("native"),
|
|
65
|
+
facet: z.enum([
|
|
66
|
+
"procedure",
|
|
67
|
+
"pseudocode",
|
|
68
|
+
"assembly",
|
|
69
|
+
"basic_blocks",
|
|
70
|
+
"comments",
|
|
71
|
+
"callers",
|
|
72
|
+
"callees",
|
|
73
|
+
"incoming_references",
|
|
74
|
+
"outgoing_references",
|
|
75
|
+
"unresolved_calls",
|
|
76
|
+
"referenced_strings",
|
|
77
|
+
"referenced_names",
|
|
78
|
+
"native_api",
|
|
79
|
+
"value_flow_summary",
|
|
80
|
+
"value_flow_operations",
|
|
81
|
+
"value_flow_def_use",
|
|
82
|
+
"value_flow_effects",
|
|
83
|
+
"value_flow_parameters",
|
|
84
|
+
"value_flow_parameter_uses",
|
|
85
|
+
]),
|
|
86
|
+
offset: z.number().int().nonnegative().default(0),
|
|
87
|
+
limit: z.number().int().positive().default(64),
|
|
88
|
+
});
|
|
60
89
|
/** Caller-selected projection of already completed analysis Evidence. */
|
|
61
90
|
export const analysisViewRequestSchema = z.discriminatedUnion("kind", [
|
|
62
91
|
summaryViewSchema,
|
|
63
92
|
facetViewSchema,
|
|
64
93
|
itemViewSchema,
|
|
65
94
|
pageViewSchema,
|
|
95
|
+
nativeViewSchema,
|
|
66
96
|
]);
|
|
67
97
|
/** Inline Evidence or an exact same-session retained reference. */
|
|
68
98
|
export const analysisViewSourceSchema = z.discriminatedUnion("kind", [
|
|
@@ -88,7 +118,9 @@ const coverageSchema = z.strictObject({
|
|
|
88
118
|
exhausted: z.boolean(),
|
|
89
119
|
});
|
|
90
120
|
const artifactSchema = z.strictObject({
|
|
91
|
-
path: z
|
|
121
|
+
path: z
|
|
122
|
+
.string()
|
|
123
|
+
.describe("Exact recorded artifact path, including an empty string."),
|
|
92
124
|
sha256: digestSchema,
|
|
93
125
|
});
|
|
94
126
|
const layoutSummarySchema = z.strictObject({
|
|
@@ -127,6 +159,7 @@ const viewResultBase = {
|
|
|
127
159
|
parent_operation: z.enum([
|
|
128
160
|
"inspect_binary_layout",
|
|
129
161
|
"analyze_javascript_application",
|
|
162
|
+
"analyze_function",
|
|
130
163
|
]),
|
|
131
164
|
parent_digest: digestSchema,
|
|
132
165
|
view_digest: digestSchema,
|
|
@@ -161,6 +194,13 @@ export const analysisViewResultSchema = z.discriminatedUnion("kind", [
|
|
|
161
194
|
items: z.array(jsonValueSchema),
|
|
162
195
|
...viewResultBase,
|
|
163
196
|
}),
|
|
197
|
+
z.strictObject({
|
|
198
|
+
kind: z.literal("native"),
|
|
199
|
+
view: nativeViewSchema,
|
|
200
|
+
procedure_address: z.string().nullable(),
|
|
201
|
+
item: jsonValueSchema,
|
|
202
|
+
...viewResultBase,
|
|
203
|
+
}),
|
|
164
204
|
]);
|
|
165
205
|
/** Construct a typed input failure for one selected-view constraint. */
|
|
166
206
|
export const analysisViewInputError = (issues) => new AnalysisInputError(INSPECT_ANALYSIS_VIEW_OPERATION, undefined, issues);
|
|
@@ -189,7 +229,7 @@ const parseJavaScriptParent = (input) => {
|
|
|
189
229
|
})), { source: { normalized_result: input } }, { cause }));
|
|
190
230
|
}
|
|
191
231
|
};
|
|
192
|
-
const unsupportedParent = (parent) => new AnalysisUnsupportedTargetError(INSPECT_ANALYSIS_VIEW_OPERATION, parentArtifactPath(parent), `Parent Evidence operation ${JSON.stringify(parent.operation)} is not inspect_binary_layout or
|
|
232
|
+
const unsupportedParent = (parent) => new AnalysisUnsupportedTargetError(INSPECT_ANALYSIS_VIEW_OPERATION, parentArtifactPath(parent), `Parent Evidence operation ${JSON.stringify(parent.operation)} is not inspect_binary_layout, analyze_javascript_application or analyze_function.`);
|
|
193
233
|
const parentArtifactPath = (parent) => {
|
|
194
234
|
if (typeof parent.normalizedResult === "object" &&
|
|
195
235
|
parent.normalizedResult !== null &&
|
|
@@ -237,5 +277,15 @@ export const projectAnalysisView = (parent, view) => {
|
|
|
237
277
|
const projected = projectJavaScriptApplicationView(parent, analysis.value, view);
|
|
238
278
|
return projected.ok ? ok(sealAnalysisView(projected.value)) : projected;
|
|
239
279
|
}
|
|
280
|
+
if (parent.operation === "analyze_function") {
|
|
281
|
+
const native = functionDossierSchema.safeParse(parent.normalizedResult);
|
|
282
|
+
if (!native.success)
|
|
283
|
+
return err(analysisInputErrorFromIssues(INSPECT_ANALYSIS_VIEW_OPERATION, native.error.issues.map((issue) => ({
|
|
284
|
+
...issue,
|
|
285
|
+
path: ["source", "normalized_result", ...issue.path],
|
|
286
|
+
})), { source: { normalized_result: parent.normalizedResult } }, { cause: native.error }));
|
|
287
|
+
const projected = projectNativeFunctionView(parent, native.data, view);
|
|
288
|
+
return projected.ok ? ok(sealAnalysisView(projected.value)) : projected;
|
|
289
|
+
}
|
|
240
290
|
return err(unsupportedParent(parent));
|
|
241
291
|
};
|
|
@@ -96,6 +96,8 @@ const layoutSummary = (layout) => ({
|
|
|
96
96
|
/** Project one layout view without re-running the decoder. */
|
|
97
97
|
export const projectBinaryLayoutView = (parent, layout, view) => {
|
|
98
98
|
const shared = parentFields(parent, layout);
|
|
99
|
+
if (view.kind === "native")
|
|
100
|
+
return err(layoutIncompatible("Native views require analyze_function Evidence."));
|
|
99
101
|
if (view.kind === "summary")
|
|
100
102
|
return ok({
|
|
101
103
|
kind: "summary",
|
|
@@ -176,6 +176,8 @@ const selectModule = (modules, selector) => {
|
|
|
176
176
|
export const projectJavaScriptApplicationView = (parent, analysis, view) => {
|
|
177
177
|
const shared = parentFields(parent, analysis);
|
|
178
178
|
const modules = moduleEntries(analysis.graph.nodes);
|
|
179
|
+
if (view.kind === "native")
|
|
180
|
+
return err(jsIncompatible("Native views require analyze_function Evidence."));
|
|
179
181
|
if (view.kind === "summary")
|
|
180
182
|
return ok({
|
|
181
183
|
kind: "summary",
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { uniqueSorted } from "../canonicalOrdering.js";
|
|
2
|
+
import { jsonValueSchema } from "../jsonValue.js";
|
|
3
|
+
import { err, ok } from "../result.js";
|
|
4
|
+
import { analysisViewInputError, } from "./analysisView.js";
|
|
5
|
+
import { completeWithinViewCoverage, pageViewCoverage, } from "./analysisViewCoverage.js";
|
|
6
|
+
const viewError = (message) => analysisViewInputError([
|
|
7
|
+
{ path: ["view"], reason: "invalid_value", message },
|
|
8
|
+
]);
|
|
9
|
+
const parentFields = (parent, dossier, artifact) => {
|
|
10
|
+
const flow = dossier.native_value_flow;
|
|
11
|
+
const api = dossier.native_api;
|
|
12
|
+
const unknowns = [];
|
|
13
|
+
if (flow === null)
|
|
14
|
+
unknowns.push("native_value_flow was not recorded");
|
|
15
|
+
else if (!flow.available)
|
|
16
|
+
unknowns.push("native_value_flow unavailable: " + flow.reason);
|
|
17
|
+
else if (flow.truncated)
|
|
18
|
+
unknowns.push("native_value_flow is truncated; omitted observations remain unknown");
|
|
19
|
+
if (api === null)
|
|
20
|
+
unknowns.push("native_api was not recorded");
|
|
21
|
+
else if (!api.available)
|
|
22
|
+
unknowns.push("native_api unavailable: " + api.reason, ...api.residual_unknowns);
|
|
23
|
+
return {
|
|
24
|
+
parent_evidence_id: parent.evidenceId,
|
|
25
|
+
parent_operation: "analyze_function",
|
|
26
|
+
parent_digest: parent.evidenceId.slice(3),
|
|
27
|
+
procedure_address: dossier.procedure.address,
|
|
28
|
+
artifact,
|
|
29
|
+
limitations: uniqueSorted([
|
|
30
|
+
...parent.limitations,
|
|
31
|
+
...dossier.limitations,
|
|
32
|
+
...(flow?.limitations ?? []),
|
|
33
|
+
...(api?.available ? api.limitations : []),
|
|
34
|
+
]),
|
|
35
|
+
unknowns: uniqueSorted(unknowns),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const pseudocodePage = (body, offset, limit) => {
|
|
39
|
+
const start = Math.min(offset, body.length);
|
|
40
|
+
const high = (n) => n >= 0xd800 && n <= 0xdbff;
|
|
41
|
+
const low = (n) => n >= 0xdc00 && n <= 0xdfff;
|
|
42
|
+
if (start > 0 &&
|
|
43
|
+
start < body.length &&
|
|
44
|
+
high(body.charCodeAt(start - 1)) &&
|
|
45
|
+
low(body.charCodeAt(start)))
|
|
46
|
+
return err(viewError("Pseudocode offset splits a UTF-16 surrogate pair."));
|
|
47
|
+
let end = Math.min(start + limit, body.length);
|
|
48
|
+
if (end > start &&
|
|
49
|
+
end < body.length &&
|
|
50
|
+
high(body.charCodeAt(end - 1)) &&
|
|
51
|
+
low(body.charCodeAt(end)))
|
|
52
|
+
end--;
|
|
53
|
+
if (end === start && start < body.length)
|
|
54
|
+
return err(viewError("Increase pseudocode limit to include the next complete Unicode character."));
|
|
55
|
+
return ok({
|
|
56
|
+
item: { text: body.slice(start, end), unit: "utf16-code-units" },
|
|
57
|
+
coverage: pageViewCoverage(start, end - start, body.length),
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const nativeRows = (dossier, facet) => {
|
|
61
|
+
const sourceFlow = dossier.native_value_flow;
|
|
62
|
+
const flow = sourceFlow?.available ? sourceFlow : undefined;
|
|
63
|
+
return {
|
|
64
|
+
assembly: dossier.assembly,
|
|
65
|
+
basic_blocks: dossier.basic_blocks,
|
|
66
|
+
comments: dossier.comments,
|
|
67
|
+
callers: dossier.callers,
|
|
68
|
+
callees: dossier.callees,
|
|
69
|
+
incoming_references: dossier.incoming_references,
|
|
70
|
+
outgoing_references: dossier.outgoing_references,
|
|
71
|
+
unresolved_calls: dossier.unresolved_calls,
|
|
72
|
+
referenced_strings: dossier.referenced_strings,
|
|
73
|
+
referenced_names: dossier.referenced_names,
|
|
74
|
+
value_flow_operations: flow?.operations,
|
|
75
|
+
value_flow_def_use: flow?.def_use,
|
|
76
|
+
value_flow_effects: flow?.effects,
|
|
77
|
+
value_flow_parameters: flow?.parameters,
|
|
78
|
+
value_flow_parameter_uses: flow?.parameter_uses,
|
|
79
|
+
}[facet];
|
|
80
|
+
};
|
|
81
|
+
/** Project bounded native function facets from complete retained Evidence without reanalysis. */
|
|
82
|
+
export const projectNativeFunctionView = (parent, dossier, view) => {
|
|
83
|
+
if (view.kind !== "native")
|
|
84
|
+
return err(viewError("analyze_function Evidence requires a native view."));
|
|
85
|
+
const artifact = parent.artifact;
|
|
86
|
+
if (!artifact)
|
|
87
|
+
return err(analysisViewInputError([
|
|
88
|
+
{
|
|
89
|
+
path: ["source", "subject"],
|
|
90
|
+
reason: "invalid_value",
|
|
91
|
+
message: "Native function Evidence requires an artifact-bound subject.",
|
|
92
|
+
},
|
|
93
|
+
]));
|
|
94
|
+
const common = parentFields(parent, dossier, artifact);
|
|
95
|
+
const singleton = (item) => ({
|
|
96
|
+
kind: "native",
|
|
97
|
+
view,
|
|
98
|
+
item: jsonValueSchema.parse(item),
|
|
99
|
+
coverage: completeWithinViewCoverage(1, 1),
|
|
100
|
+
...common,
|
|
101
|
+
});
|
|
102
|
+
const flow = dossier.native_value_flow;
|
|
103
|
+
if (view.facet === "procedure" ||
|
|
104
|
+
view.facet === "native_api" ||
|
|
105
|
+
view.facet === "value_flow_summary") {
|
|
106
|
+
if (view.offset !== 0)
|
|
107
|
+
return err(viewError("Singleton native facets require offset 0."));
|
|
108
|
+
if (view.facet === "procedure")
|
|
109
|
+
return ok(singleton(dossier.procedure));
|
|
110
|
+
if (view.facet === "native_api")
|
|
111
|
+
return ok(singleton(dossier.native_api ?? { available: false, reason: "not recorded" }));
|
|
112
|
+
const status = flow === null
|
|
113
|
+
? { available: false, reason: "not recorded" }
|
|
114
|
+
: !flow.available
|
|
115
|
+
? { available: false, reason: flow.reason }
|
|
116
|
+
: {
|
|
117
|
+
available: true,
|
|
118
|
+
provenance: flow.provenance,
|
|
119
|
+
truncated: flow.truncated,
|
|
120
|
+
omitted_operations_lower_bound: flow.omitted_operations_lower_bound,
|
|
121
|
+
known_omitted_inputs: flow.known_omitted_inputs,
|
|
122
|
+
known_omitted_edges: flow.known_omitted_edges,
|
|
123
|
+
operations: flow.operations.length,
|
|
124
|
+
def_use: flow.def_use.length,
|
|
125
|
+
effects: flow.effects.length,
|
|
126
|
+
parameters: flow.parameters.length,
|
|
127
|
+
parameter_uses: flow.parameter_uses.length,
|
|
128
|
+
};
|
|
129
|
+
return ok(singleton(status));
|
|
130
|
+
}
|
|
131
|
+
if (view.facet === "pseudocode") {
|
|
132
|
+
const page = pseudocodePage(dossier.pseudocode, view.offset, view.limit);
|
|
133
|
+
return page.ok
|
|
134
|
+
? ok({ kind: "native", view, ...page.value, ...common })
|
|
135
|
+
: page;
|
|
136
|
+
}
|
|
137
|
+
const rows = nativeRows(dossier, view.facet);
|
|
138
|
+
if (rows === undefined)
|
|
139
|
+
return ok(singleton({
|
|
140
|
+
available: false,
|
|
141
|
+
// Only value-flow facets inherit the value-flow failure reason; an
|
|
142
|
+
// older dossier simply has no unresolved_calls record.
|
|
143
|
+
reason: view.facet.startsWith("value_flow_") && flow?.available === false
|
|
144
|
+
? flow.reason
|
|
145
|
+
: "not recorded",
|
|
146
|
+
}));
|
|
147
|
+
const items = rows.slice(view.offset, view.offset + view.limit);
|
|
148
|
+
return ok({
|
|
149
|
+
kind: "native",
|
|
150
|
+
view,
|
|
151
|
+
item: jsonValueSchema.parse(items),
|
|
152
|
+
coverage: pageViewCoverage(view.offset, items.length, rows.length),
|
|
153
|
+
...common,
|
|
154
|
+
});
|
|
155
|
+
};
|
|
@@ -6,6 +6,7 @@ import { evidenceSchema } from "../evidence.js";
|
|
|
6
6
|
import { digestSchema } from "../digests.js";
|
|
7
7
|
import { prefixedDigestSchema } from "../digests.js";
|
|
8
8
|
import { bridgeCandidateCoverageSchema, projectCartesianCandidates, } from "../bridgeCandidateProjection.js";
|
|
9
|
+
import { nativeRuntimeConvention } from "../nativeConvention.js";
|
|
9
10
|
const evidenceIdSchema = prefixedDigestSchema("ev");
|
|
10
11
|
const pathSchema = z.string().min(1);
|
|
11
12
|
const componentSchema = z.strictObject({
|
|
@@ -65,7 +66,7 @@ export const projectAndroidApplication = (input) => {
|
|
|
65
66
|
const parsed = androidApplicationProjectionInputSchema.parse(input);
|
|
66
67
|
const { evidence, inventory } = parseArtifactInventoryEvidence(parsed.inventory_evidence);
|
|
67
68
|
if (inventory.manifest.root_format !== "apk")
|
|
68
|
-
throw new TypeError(
|
|
69
|
+
throw new TypeError(`Android application projection requires APK inventory Evidence; the inventory root format is ${inventory.manifest.root_format}. APK is chosen for a ZIP archive whose name ends in .apk.`);
|
|
69
70
|
const nodes = new Map(inventory.nodes.map((node) => [node.artifact_id, node]));
|
|
70
71
|
const all = inventory.occurrences
|
|
71
72
|
.filter((occurrence) => occurrence.artifact_id !== null && occurrence.logical_path !== ".")
|
|
@@ -90,6 +91,13 @@ export const projectAndroidApplication = (input) => {
|
|
|
90
91
|
"Manifest, resource, signing, and bytecode semantics require a dedicated Android provider; this projection reports exact inventory paths and hashes only.",
|
|
91
92
|
"Runtime families are inferred from inventory formats and paths; filename suffixes do not establish valid DEX or JVM class bytes.",
|
|
92
93
|
"Bridge candidates are path-based hypotheses, not decoded JNI declarations or observed runtime calls.",
|
|
94
|
+
"A bridge basis is inferred from the native path and is repeated for every managed component.",
|
|
95
|
+
"ZIP inventory cannot see the APK Signing Block, so an empty signing array does not mean the APK is unsigned.",
|
|
96
|
+
...(all.some(({ path }) => path === "AndroidManifest.xml")
|
|
97
|
+
? []
|
|
98
|
+
: [
|
|
99
|
+
"No root AndroidManifest.xml occurrence was observed. The APK family comes from the .apk suffix of a ZIP archive, so these bytes may not be an APK.",
|
|
100
|
+
]),
|
|
93
101
|
...(bridgeProjection.coverage.status === "partial"
|
|
94
102
|
? [
|
|
95
103
|
`Bridge candidate pairs exceeded the projection safety budget; ${bridgeProjection.coverage.omitted_candidates} hypotheses are omitted. Component arrays still include every component from the supplied inventory pages.`,
|
|
@@ -120,32 +128,29 @@ export const projectAndroidApplication = (input) => {
|
|
|
120
128
|
});
|
|
121
129
|
};
|
|
122
130
|
const classify = (all) => ({
|
|
123
|
-
manifests: all.filter(({ path
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
jvm_classes: all.filter(({ path, format }) => format === "jvm-class" || /(?:^|\/)[^/]+\.class$/iu.test(path)),
|
|
131
|
+
manifests: all.filter(({ path }) => /(?:^|\/)AndroidManifest\.xml$/u.test(path)),
|
|
132
|
+
resources: all.filter(({ path }) => /(?:^|\/)resources\.arsc$/u.test(path)),
|
|
133
|
+
dex: all.filter(({ path }) => /(?:^|\/)[^/]+\.dex$/iu.test(path)),
|
|
134
|
+
jvm_classes: all.filter(({ path }) => /(?:^|\/)[^/]+\.class$/iu.test(path)),
|
|
128
135
|
native_libraries: all.filter(({ path, format }) => format === "elf" || /(?:^|\/)lib\/[^/]+\/[^/]+\.so$/iu.test(path)),
|
|
129
136
|
javascript: all.filter(({ format }) => format === "javascript-bundle"),
|
|
130
137
|
signing: all.filter(({ path }) => /^META-INF\/[^/]+\.(?:MF|RSA|DSA|EC|SF)$/iu.test(path)),
|
|
131
138
|
});
|
|
132
139
|
const runtimeFamilies = (all) => {
|
|
133
|
-
const paths = all.map(({ path }) => path.toLowerCase());
|
|
134
140
|
const families = new Set();
|
|
135
|
-
if (all.some(({ path
|
|
141
|
+
if (all.some(({ path }) => path.toLowerCase().endsWith(".dex")))
|
|
136
142
|
families.add("dalvik-art");
|
|
137
|
-
if (all.some(({ path
|
|
143
|
+
if (all.some(({ path }) => path.toLowerCase().endsWith(".class")))
|
|
138
144
|
families.add("java-kotlin");
|
|
139
145
|
if (all.some(({ format }) => format === "elf"))
|
|
140
146
|
families.add("native");
|
|
141
147
|
if (all.some(({ format }) => format === "javascript-bundle"))
|
|
142
148
|
families.add("javascript");
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
families.add("unity");
|
|
149
|
+
for (const { path } of all) {
|
|
150
|
+
const convention = nativeRuntimeConvention(path);
|
|
151
|
+
if (convention !== null)
|
|
152
|
+
families.add(convention);
|
|
153
|
+
}
|
|
149
154
|
return [...families].sort(compare);
|
|
150
155
|
};
|
|
151
156
|
const bridgeCandidates = (managed, native) => {
|
|
@@ -159,14 +164,14 @@ const bridgeCandidates = (managed, native) => {
|
|
|
159
164
|
});
|
|
160
165
|
};
|
|
161
166
|
const bridgeBasis = (path) => {
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
167
|
+
const convention = nativeRuntimeConvention(path);
|
|
168
|
+
if (convention === "react-native")
|
|
164
169
|
return "react-native-convention";
|
|
165
|
-
if (
|
|
170
|
+
if (convention === "flutter")
|
|
166
171
|
return "flutter-convention";
|
|
167
|
-
if (
|
|
172
|
+
if (convention === "unity")
|
|
168
173
|
return "unity-convention";
|
|
169
|
-
if (/lib\/[^/]+\/lib[^/]+\.so$/
|
|
174
|
+
if (/(?:^|\/)lib\/[^/]+\/lib[^/]+\.so$/iu.test(path))
|
|
170
175
|
return "jni-library-convention";
|
|
171
176
|
return "managed-and-native-content";
|
|
172
177
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { localPathStringSchema } from "../localPath.js";
|
|
3
|
+
import { digestSchema } from "../digests.js";
|
|
4
|
+
/** Upper bound for one decoded resource projection in one response. */
|
|
5
|
+
const MAX_MANIFEST_BYTES = 512 * 1024;
|
|
6
|
+
const MAX_STRINGS = 2_000;
|
|
7
|
+
/**
|
|
8
|
+
* Caller intent for Apktool-backed resource decoding. Apktool is
|
|
9
|
+
* bring-your-own: REA never installs it, and decoding happens in a
|
|
10
|
+
* provider-owned workspace that is removed after the facts are projected.
|
|
11
|
+
*/
|
|
12
|
+
export const apktoolInputSchemas = {
|
|
13
|
+
inspect_apktool_client: z.strictObject({}),
|
|
14
|
+
decode_android_resources: z.strictObject({
|
|
15
|
+
path: localPathStringSchema.describe("Local APK file to decode"),
|
|
16
|
+
include_strings: z
|
|
17
|
+
.boolean()
|
|
18
|
+
.default(true)
|
|
19
|
+
.describe(`Project res/values/strings.xml entries (bounded to ${String(MAX_STRINGS)} entries)`),
|
|
20
|
+
locale: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(2)
|
|
23
|
+
.max(16)
|
|
24
|
+
.regex(/^(?:[a-z]{2,3}(?:-(?:r?[A-Z]{2}|r?[0-9]{3}))?|b\+[a-z]{2,3}(?:\+[A-Za-z0-9]{2,8})*)$/u, "Locale must look like de, pt-BR, pt-rBR, or b+zh+Hans+CN")
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Project strings from res/values-<locale>/strings.xml instead of the default table"),
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
/** Validate operation and input together so their types remain correlated. */
|
|
30
|
+
export const apktoolRequestSchema = z.discriminatedUnion("operation", [
|
|
31
|
+
z.strictObject({
|
|
32
|
+
operation: z.literal("inspect_apktool_client"),
|
|
33
|
+
input: apktoolInputSchemas.inspect_apktool_client,
|
|
34
|
+
}),
|
|
35
|
+
z.strictObject({
|
|
36
|
+
operation: z.literal("decode_android_resources"),
|
|
37
|
+
input: apktoolInputSchemas.decode_android_resources,
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
40
|
+
const client = z.strictObject({
|
|
41
|
+
command: z.string().min(1),
|
|
42
|
+
command_source: z.enum(["environment", "path"]),
|
|
43
|
+
apktool_version: z.string().min(1).nullable(),
|
|
44
|
+
});
|
|
45
|
+
/** Portable Apktool observations with explicit coverage limitations. */
|
|
46
|
+
export const apktoolResultSchemas = {
|
|
47
|
+
inspect_apktool_client: z.strictObject({
|
|
48
|
+
client,
|
|
49
|
+
}),
|
|
50
|
+
decode_android_resources: z.strictObject({
|
|
51
|
+
client,
|
|
52
|
+
target: z.strictObject({
|
|
53
|
+
path: localPathStringSchema,
|
|
54
|
+
bytes: z.number().int().nonnegative(),
|
|
55
|
+
sha256: digestSchema,
|
|
56
|
+
}),
|
|
57
|
+
metadata: z.strictObject({
|
|
58
|
+
version_name: z.string().nullable(),
|
|
59
|
+
version_code: z
|
|
60
|
+
.string()
|
|
61
|
+
.nullable()
|
|
62
|
+
.describe("Version code exactly as apktool.yml prints it, e.g. '45' or '45.1'"),
|
|
63
|
+
min_sdk_version: z.string().nullable(),
|
|
64
|
+
target_sdk_version: z.string().nullable(),
|
|
65
|
+
package_name: z.string().nullable(),
|
|
66
|
+
}),
|
|
67
|
+
manifest: z.string().nullable(),
|
|
68
|
+
strings: z.array(z.strictObject({
|
|
69
|
+
name: z.string().min(1),
|
|
70
|
+
value: z.string(),
|
|
71
|
+
})),
|
|
72
|
+
locale: z.string().nullable(),
|
|
73
|
+
locales: z.array(z.string().min(1)),
|
|
74
|
+
decoded_file_count: z.number().int().nonnegative(),
|
|
75
|
+
coverage: z.enum(["complete", "partial"]),
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { appleBundleSchema, appleComponentSchema, applicationRoots, detectBundles, isMachOFormat, isSidecar, isWithin, platformsOf, } from "./appleBundleAnatomy.js";
|
|
4
|
+
import { anatomyNameIs, anatomyTailMatches, appleBundleSchema, appleComponentSchema, applicationRoots, detectBundles, isMachOFormat, isSidecar, isWithin, platformsOf, } from "./appleBundleAnatomy.js";
|
|
5
|
+
import { isSwiftRuntimeLibrary, nativeRuntimeConvention, } from "../nativeConvention.js";
|
|
5
6
|
import { parseArtifactInventoryEvidence } from "../artifactInventoryEvidence.js";
|
|
6
7
|
import { evidenceSchema } from "../evidence.js";
|
|
7
8
|
import { digestSchema } from "../digests.js";
|
|
@@ -166,48 +167,61 @@ const appleRootFormat = (format) => {
|
|
|
166
167
|
};
|
|
167
168
|
const classifyComponents = (entries, all, roots) => {
|
|
168
169
|
const withinApp = (path) => roots.some((root) => isWithin(path, root));
|
|
169
|
-
const
|
|
170
|
+
const matching = (predicate) => entries.flatMap(({ path, kind, component }) => kind === "file" &&
|
|
170
171
|
component !== undefined &&
|
|
171
172
|
!isSidecar(path) &&
|
|
172
173
|
withinApp(path) &&
|
|
173
|
-
|
|
174
|
+
predicate(path)
|
|
174
175
|
? [component]
|
|
175
176
|
: []);
|
|
177
|
+
const lastSegment = (path) => path.split("/").at(-1) ?? "";
|
|
176
178
|
return {
|
|
177
|
-
bundle_metadata: all.filter(({ path }) =>
|
|
179
|
+
bundle_metadata: all.filter(({ path }) => anatomyNameIs(lastSegment(path), "Info.plist")),
|
|
178
180
|
executables: all.filter(({ path, format }) => withinApp(path) && isMachOFormat(format)),
|
|
179
181
|
frameworks: all.filter(({ path }) => /\.framework\//u.test(path)),
|
|
180
182
|
native_libraries: all.filter(({ path }) => /\.(?:dylib|so)$/iu.test(path)),
|
|
181
183
|
javascript: all.filter(({ format }) => format === "javascript-bundle"),
|
|
182
|
-
signing: all.filter(({ path }) =>
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
signing: all.filter(({ path }) => anatomyTailMatches(path, ["_CodeSignature", "CodeResources"]) ||
|
|
185
|
+
anatomyNameIs(lastSegment(path), "embedded.mobileprovision") ||
|
|
186
|
+
anatomyNameIs(lastSegment(path), "embedded.provisionprofile")),
|
|
187
|
+
privileged_helpers: matching((path) => anatomyTailMatches(path, ["Contents", "Library", "LaunchServices", "*"])),
|
|
188
|
+
launchd_plists: matching((path) => path.endsWith(".plist") &&
|
|
189
|
+
(anatomyTailMatches(path, [
|
|
190
|
+
"Contents",
|
|
191
|
+
"Library",
|
|
192
|
+
"LaunchAgents",
|
|
193
|
+
"*",
|
|
194
|
+
]) ||
|
|
195
|
+
anatomyTailMatches(path, [
|
|
196
|
+
"Contents",
|
|
197
|
+
"Library",
|
|
198
|
+
"LaunchDaemons",
|
|
199
|
+
"*",
|
|
200
|
+
]))).map((component) => ({
|
|
185
201
|
...component,
|
|
186
|
-
domain: component.path
|
|
202
|
+
domain: component.path
|
|
203
|
+
.split("/")
|
|
204
|
+
.some((segment) => anatomyNameIs(segment, "LaunchDaemons"))
|
|
187
205
|
? "daemon"
|
|
188
206
|
: "agent",
|
|
189
207
|
})),
|
|
190
|
-
helpers:
|
|
208
|
+
helpers: matching((path) => anatomyTailMatches(path, ["Contents", "Helpers", "*"])),
|
|
191
209
|
};
|
|
192
210
|
};
|
|
193
211
|
const deduplicateComponents = (values) => [...new Map(values.map((value) => [value.path, value])).values()].sort((left, right) => compare(left.path, right.path));
|
|
194
212
|
const identifyRuntimeFamilies = (all) => {
|
|
195
|
-
const paths = all.map(({ path }) => path.toLowerCase());
|
|
196
213
|
const families = new Set();
|
|
197
214
|
if (all.some(({ format }) => ["mach-o", "mach-o-universal"].includes(format)))
|
|
198
215
|
families.add("native");
|
|
199
|
-
if (
|
|
216
|
+
if (all.some(({ path }) => isSwiftRuntimeLibrary(path)))
|
|
200
217
|
families.add("swift-objective-c");
|
|
201
218
|
if (all.some(({ format }) => format === "javascript-bundle"))
|
|
202
219
|
families.add("javascript");
|
|
203
|
-
|
|
204
|
-
path
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
families.add("flutter");
|
|
209
|
-
if (paths.some((path) => path.includes("unityframework.framework")))
|
|
210
|
-
families.add("unity");
|
|
220
|
+
for (const { path } of all) {
|
|
221
|
+
const convention = nativeRuntimeConvention(path);
|
|
222
|
+
if (convention !== null)
|
|
223
|
+
families.add(convention);
|
|
224
|
+
}
|
|
211
225
|
return [...families].sort(compare);
|
|
212
226
|
};
|
|
213
227
|
/** Pair scripts and native code within matching application-root groups. */
|
|
@@ -243,12 +257,12 @@ const identifyBridgeCandidates = (scripts, native, roots) => {
|
|
|
243
257
|
});
|
|
244
258
|
};
|
|
245
259
|
const bridgeBasis = (path) => {
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
260
|
+
const convention = nativeRuntimeConvention(path);
|
|
261
|
+
if (convention === "react-native")
|
|
248
262
|
return "react-native-convention";
|
|
249
|
-
if (
|
|
263
|
+
if (convention === "flutter")
|
|
250
264
|
return "flutter-convention";
|
|
251
|
-
if (
|
|
265
|
+
if (convention === "unity")
|
|
252
266
|
return "unity-convention";
|
|
253
267
|
return "javascript-and-native-content";
|
|
254
268
|
};
|
|
@@ -293,7 +307,10 @@ const projectionLimitations = (facts) => [
|
|
|
293
307
|
: []),
|
|
294
308
|
"Bundle roles follow path conventions. Read each info_plist_path with inspect_plist for CFBundleExecutable, identifiers, and declared services.",
|
|
295
309
|
"Bundle identifiers and signing claims require dedicated plist and CMS parsing; this projection reports only exact paths and hashes.",
|
|
310
|
+
"Runtime families are inferred from inventory formats and bounded framework path conventions, not observed runtime loading.",
|
|
311
|
+
"Generic framework and dylib paths do not establish Swift or Objective-C; this inventory projection does not decode language metadata.",
|
|
296
312
|
"Bridge candidates are path-based hypotheses, not observed runtime calls.",
|
|
313
|
+
"A bridge basis is inferred from the native path and is repeated for every managed component.",
|
|
297
314
|
];
|
|
298
315
|
const compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
299
316
|
const digest = (value) => {
|