rea-agents 6.2.0 → 6.3.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 +18 -20
- package/bridge/hopper_bridge.py +2 -0
- package/dist/android/JadxProvider.js +8 -2
- package/dist/android/JadxSession.js +51 -9
- package/dist/application/BinaryTargetResolver.js +63 -17
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/ClientConfigurationDocument.js +28 -0
- package/dist/application/ClientRegistrationStatus.js +19 -6
- package/dist/application/DirectAnalysis.js +12 -6
- package/dist/application/DirectAnalysisCleanup.js +0 -1
- package/dist/application/DirectAnalysisStatus.js +2 -5
- package/dist/application/Doctor.js +25 -34
- package/dist/application/DoctorDiagnostics.js +1 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/InvestigationProviders.js +4 -4
- package/dist/application/JsonFiles.js +15 -15
- package/dist/application/LinuxHopper.js +2 -1
- package/dist/application/ReconstructionObligationCandidates.js +9 -2
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -1
- package/dist/application/RegularFileRead.js +17 -0
- package/dist/application/Setup.js +18 -7
- package/dist/application/SetupClientConfiguration.js +18 -7
- package/dist/application/SetupHost.js +6 -4
- package/dist/application/SetupPlan.js +19 -15
- package/dist/application/SetupSkill.js +57 -8
- package/dist/application/SupportedClients.js +43 -0
- package/dist/application/Uninstall.js +18 -2
- package/dist/application/UpdateMaintenance.js +6 -2
- package/dist/application/Utf8JsonInput.js +64 -0
- package/dist/application/WebScriptExportService.js +13 -6
- package/dist/application/android/AndroidAnalysisService.js +1 -1
- package/dist/application/binary/AnalysisSnapshotCache.js +5 -4
- package/dist/application/binary/BinarySession.js +16 -0
- package/dist/application/binary/BinarySessionOpen.js +9 -1
- package/dist/application/javascript/ElectronActiveEvidence.js +2 -2
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +2 -2
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +5 -1
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +107 -46
- package/dist/application/javascript/JavaScriptApplicationService.js +1 -0
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +59 -45
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +0 -6
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +8 -18
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +34 -26
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +44 -12
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +6 -3
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +1 -0
- package/dist/application/javascript/JavaScriptJsonModules.js +2 -2
- package/dist/application/javascript/JavaScriptModuleRelationships.js +5 -17
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +11 -27
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +8 -6
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +7 -5
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +2 -2
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +1 -1
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +10 -7
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +15 -10
- package/dist/application/native/NativeCallRoutes.js +2 -4
- package/dist/artifacts/ArtifactProvider.js +14 -16
- package/dist/artifacts/ArtifactProviderMetadata.js +1 -4
- package/dist/artifacts/AsarArtifactReader.js +81 -17
- package/dist/artifacts/DirectoryArtifactReader.js +2 -2
- package/dist/artifacts/NativeDmgArtifactReader.js +152 -67
- package/dist/artifacts/NativeDmgOwnership.js +109 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +54 -46
- package/dist/artifacts/apple/MachoLoadCommandReader.js +36 -6
- package/dist/artifacts/extraction/ArtifactExtraction.js +29 -11
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +7 -8
- package/dist/artifacts/inventory/classify.js +33 -14
- package/dist/artifacts/inventory/hashStableRootArtifact.js +37 -0
- package/dist/artifacts/inventory/scanCanonical.js +28 -22
- package/dist/artifacts/inventory/scanReader.js +7 -11
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +65 -27
- package/dist/browser/CdpBrowserProvider.js +4 -3
- package/dist/browser/CdpCaptureStorageFingerprints.js +3 -3
- package/dist/browser/CdpElectronInspection.js +2 -2
- package/dist/browser/CdpElectronProvider.js +4 -3
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpWebMcpDiscovery.js +16 -13
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +6 -6
- package/dist/browser/PlaywrightScenarioBrowser.js +145 -42
- package/dist/browser/PlaywrightScenarioSession.js +3 -11
- package/dist/browser/WebSourceMapFetcher.js +32 -6
- package/dist/browser/assets/ScenarioScriptCapture.js +8 -12
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +13 -9
- package/dist/cli/electronCommands.js +9 -10
- package/dist/cli/javascriptApplicationAnalysis.js +2 -12
- package/dist/cli/jsonOutput.js +3 -2
- package/dist/cli/streamedJsonOutput.js +83 -4
- package/dist/cli/utilityCommands.js +2 -4
- package/dist/cli.js +5 -2
- package/dist/cliJsonFile.js +179 -0
- package/dist/cliJsonInput.js +47 -34
- package/dist/cliObservationOptions.js +4 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +5 -4
- package/dist/composition/browserScenario.js +2 -2
- package/dist/composition/directAnalysis.js +2 -3
- package/dist/contracts/artifactComparisonExample.js +5 -5
- package/dist/contracts/errorSchemas.js +3 -1
- package/dist/contracts/functionComparisonExample.js +8 -0
- package/dist/contracts/inputSchemaPresentation.js +94 -3
- package/dist/contracts/javascript/electronToolContracts.js +2 -1
- package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +3 -2
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +6 -3
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +8 -7
- package/dist/contracts/managed/managedToolContracts.js +3 -2
- package/dist/contracts/mobileApplicationGraphExamples.js +5 -5
- package/dist/contracts/native/nativeToolContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -3
- package/dist/contracts/sessionStatusContract.js +3 -2
- package/dist/contracts/sessionToolContracts.js +3 -2
- package/dist/contracts/sessionToolSchemas.js +3 -2
- package/dist/contracts/toolOutputSchemaGroups.js +2 -2
- package/dist/contracts/toolOutputSchemaPrimitives.js +2 -5
- package/dist/domain/analysisErrorBase.js +5 -0
- package/dist/domain/analysisErrorPresentation.js +4 -2
- package/dist/domain/analysisSnapshot.js +3 -1
- package/dist/domain/analysisView/analysisView.js +1 -3
- package/dist/domain/android/androidPartialObservation.js +36 -0
- package/dist/domain/apple/dylibResolution.js +1 -1
- package/dist/domain/artifactComparison.js +4 -4
- package/dist/domain/artifactGraph.js +1 -1
- package/dist/domain/artifactIdentity.js +8 -8
- package/dist/domain/artifactInspection.js +8 -8
- package/dist/domain/artifactInventoryEvidence.js +5 -5
- package/dist/domain/browserCompleteness.js +3 -2
- package/dist/domain/browserScenarioCaptureValues.js +2 -2
- package/dist/domain/browserScenarioNormalization.js +3 -3
- package/dist/domain/browserScenarioValues.js +3 -2
- package/dist/domain/callPath.js +8 -10
- package/dist/domain/canonicalDigest.js +7 -1
- package/dist/domain/canonicalOrdering.js +1 -13
- package/dist/domain/changedBehavior.js +2 -3
- package/dist/domain/comparisonSemantics.js +0 -5
- package/dist/domain/digests.js +0 -3
- package/dist/domain/evidence.js +10 -5
- package/dist/domain/evidenceBundle.js +51 -33
- package/dist/domain/firmware/firmwareAnalysis.js +4 -3
- package/dist/domain/functionComparison.js +2 -1
- package/dist/domain/functionComparisonNormalization.js +4 -3
- package/dist/domain/functionComparisonResults.js +2 -2
- package/dist/domain/functionDossierEvidence.js +2 -1
- package/dist/domain/hopperValues.js +11 -15
- package/dist/domain/javascript/electronActiveObservation.js +4 -3
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +2 -2
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +9 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +5 -3
- package/dist/domain/javascript/electronStaticAnalysisValues.js +8 -4
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +3 -1
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +12 -8
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +4 -0
- package/dist/domain/javascript/javascriptApplicationGraph.js +15 -13
- package/dist/domain/javascript/javascriptApplicationVersionComparison.js +4 -4
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +37 -22
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +45 -34
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +7 -7
- package/dist/domain/javascript/javascriptAstFingerprint.js +2 -2
- package/dist/domain/javascript/javascriptAstValues.js +22 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +3 -2
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +31 -23
- package/dist/domain/javascript/javascriptExportShapeSelection.js +2 -2
- package/dist/domain/javascript/javascriptExportShapeVariants.js +3 -2
- package/dist/domain/javascript/javascriptFeatureSeed.js +5 -3
- package/dist/domain/javascript/javascriptFeatureTrace.js +7 -6
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +17 -9
- package/dist/domain/javascript/javascriptFeatureTraversal.js +4 -4
- package/dist/domain/javascript/javascriptNativeHandoff.js +6 -6
- package/dist/domain/javascript/javascriptRuntimeObservation.js +8 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliation.js +12 -6
- package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +9 -8
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +5 -5
- package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +12 -223
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +15 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +2 -2
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +7 -6
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +200 -8
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +9 -7
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +2 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +20 -0
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -9
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +4 -11
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +2 -2
- package/dist/domain/javascript/javascriptSemanticGraph.js +142 -35
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +19 -1
- package/dist/domain/javascript/javascriptSemanticIr.js +0 -4
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +106 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +497 -113
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +41 -27
- package/dist/domain/javascript/javascriptSemanticObjects.js +2 -6
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +7 -2
- package/dist/domain/javascript/javascriptSemanticProjection.js +20 -14
- package/dist/domain/javascript/javascriptSemanticPromises.js +15 -21
- package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +23 -0
- package/dist/domain/javascript/javascriptSemanticProvenance.js +3 -3
- package/dist/domain/javascript/javascriptSemanticQuery.js +8 -2
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +3 -2
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -9
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +16 -10
- package/dist/domain/javascript/javascriptSemanticReturns.js +23 -27
- package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -1
- package/dist/domain/javascript/javascriptSemanticValues.js +135 -24
- package/dist/domain/javascript/javascriptSourceMapPaths.js +11 -1
- package/dist/domain/javascript/javascriptSourceParser.js +34 -9
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -6
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +26 -15
- package/dist/domain/javascript/sourceToBundleComparison.js +7 -5
- package/dist/domain/javascript/sourceToBundleSignals.js +7 -7
- package/dist/domain/jsonSerialization.js +109 -55
- package/dist/domain/jsonShape.js +46 -19
- package/dist/domain/localPath.js +10 -4
- package/dist/domain/managed/managedApplicationGraph.js +10 -6
- package/dist/domain/managed/managedApplicationGraphNodes.js +82 -57
- package/dist/domain/managed/managedMemberComparisonMatch.js +6 -7
- package/dist/domain/native/nativeCallObservation.js +2 -4
- package/dist/domain/native/nativeValueFlow.js +5 -11
- package/dist/domain/native/objcSwiftMetadata.js +15 -17
- package/dist/domain/process/processCapture.js +11 -10
- package/dist/domain/process/processCaptureCoverage.js +8 -5
- package/dist/domain/process/processCaptureExample.js +43 -0
- package/dist/domain/process/processCaptureValidation.js +4 -3
- package/dist/domain/process/processComparison.js +0 -23
- package/dist/domain/process/processScenario.js +3 -3
- package/dist/domain/process/processTraceEvaluation.js +4 -4
- package/dist/domain/process/processTraceSpecification.js +1 -3
- package/dist/domain/providerCleanupError.js +6 -2
- package/dist/domain/reconstructionCoverage.js +2 -1
- package/dist/domain/reconstructionUnknowns.js +4 -3
- package/dist/domain/reconstructionVerification.js +3 -2
- package/dist/domain/referenceSourceGraph.js +7 -7
- package/dist/domain/referenceSourceImportParsing.js +34 -45
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +2 -1
- package/dist/domain/swiftSymbolClassification.js +6 -1
- package/dist/domain/symbolAnalysis.js +17 -2
- package/dist/domain/unicodeCodePointOrder.js +6 -0
- package/dist/domain/webBundleAnalyzerInspection.js +9 -1
- package/dist/domain/webCaptureDiff.js +71 -29
- package/dist/domain/webCaptureDiffSchemas.js +2 -8
- package/dist/domain/webInventory.js +3 -2
- package/dist/domain/webMcpDiscovery.js +4 -3
- package/dist/domain/webScriptExport.js +1 -1
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +1 -2
- package/dist/dotnet/ManagedStaticProvider.js +10 -7
- package/dist/dotnet/ManagedStaticProviderMetadata.js +1 -4
- package/dist/filesystem/RegularFile.js +41 -0
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraClient.js +14 -4
- package/dist/ghidra/GhidraInstallation.js +111 -10
- package/dist/ghidra/GhidraLauncher.js +43 -19
- package/dist/hopper/HopperCleanup.js +1 -1
- package/dist/ida/IdaOperationRunner.js +2 -0
- package/dist/ida/IdaSessionClient.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -5
- package/dist/inspector/V8InspectorCaptureProjection.js +46 -13
- package/dist/inspector/V8InspectorProvider.js +60 -8
- package/dist/main/shutdown.js +76 -32
- package/dist/main/transport.js +1 -1
- package/dist/native/AppleObjcDispatchFacets.js +3 -3
- package/dist/native/AppleObjcProperties.js +17 -7
- package/dist/native/LldbCallTracer.js +241 -75
- package/dist/native/NativeMacOSProvider.js +10 -5
- package/dist/native/NativeMacOSProviderMetadata.js +1 -2
- package/dist/process/ProcessOwnershipObservation.js +9 -13
- package/dist/process/capture/FilesystemSnapshot.js +88 -18
- package/dist/process/capture/ProcessCaptureLifecycle.js +13 -27
- package/dist/process/capture/ProcessFilesystemEffects.js +19 -4
- package/dist/process/capture/ProcessHarness.js +8 -21
- package/dist/server/analysisAdmission.js +8 -0
- package/dist/server/createServer.js +22 -23
- package/dist/server/registerApplicationTools/compareExportShapes.js +2 -1
- package/dist/server/registerApplicationTools/helpers.js +3 -2
- package/dist/server/registerArtifactTools.js +2 -2
- package/dist/server/registerCloseLifecycleTool.js +6 -4
- package/dist/server/registerEnhancedTools.js +78 -73
- package/dist/server/registerEvidenceTools.js +54 -46
- package/dist/server/registerManagedTools.js +7 -4
- package/dist/server/registerOfficialTools.js +31 -25
- package/dist/server/registerSessionTools.js +9 -3
- package/native/windows/build/manifest.json +1 -1
- package/package.json +6 -3
- package/skills/reverse-engineer-anything/SKILL.md +5 -5
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +9 -0
- package/dist/artifacts/inventory/policy.js +0 -2
- package/dist/domain/managed/managedApplicationGraphNodeCoverage.js +0 -6
- package/dist/server/registerNativeTools.js +0 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from "node:util";
|
|
1
2
|
const schemaMaps = new Set([
|
|
2
3
|
"$defs",
|
|
3
4
|
"definitions",
|
|
@@ -83,8 +84,98 @@ const describeSchema = (schema, root, describeProperty) => {
|
|
|
83
84
|
return [key, value];
|
|
84
85
|
}));
|
|
85
86
|
};
|
|
86
|
-
|
|
87
|
+
const objectBranch = (root, branch) => {
|
|
88
|
+
// Reference siblings evaluate separately from the target in 2020-12, so a
|
|
89
|
+
// merged object could accept inputs the branch rejects.
|
|
90
|
+
const resolved = isObject(branch) && typeof branch.$ref === "string"
|
|
91
|
+
? Object.keys(branch).length === 1
|
|
92
|
+
? resolveReference(root, branch.$ref)
|
|
93
|
+
: undefined
|
|
94
|
+
: branch;
|
|
95
|
+
return isObject(resolved) &&
|
|
96
|
+
resolved.type === "object" &&
|
|
97
|
+
isObject(resolved.properties)
|
|
98
|
+
? resolved
|
|
99
|
+
: undefined;
|
|
100
|
+
};
|
|
101
|
+
const requiredProperties = (branch) => Array.isArray(branch.required)
|
|
102
|
+
? branch.required.filter((name) => typeof name === "string")
|
|
103
|
+
: [];
|
|
104
|
+
const sharedRequiredProperties = (branches) => {
|
|
105
|
+
const [first = [], ...others] = branches.map(requiredProperties);
|
|
106
|
+
return first.filter((name) => others.every((names) => names.includes(name)));
|
|
107
|
+
};
|
|
108
|
+
const inputGroup = (branch) => {
|
|
109
|
+
const required = requiredProperties(branch);
|
|
110
|
+
const optional = Object.keys(branch.properties ?? {})
|
|
111
|
+
.filter((name) => !required.includes(name))
|
|
112
|
+
.map((name) => `[${name}]`);
|
|
113
|
+
return [...required, ...optional].join(" + ");
|
|
114
|
+
};
|
|
115
|
+
// Anthropic tool input schemas reject anyOf, oneOf, and allOf at the root, and
|
|
116
|
+
// clients then drop the tool or advertise it without parameters. Present a
|
|
117
|
+
// root union of strict object groups as one object whose properties are the
|
|
118
|
+
// union of the groups. The canonical Zod schema still enforces the exact group.
|
|
119
|
+
const flattenRootObjectUnion = (root) => {
|
|
120
|
+
const { anyOf, oneOf, ...rest } = root;
|
|
121
|
+
const alternatives = Array.isArray(anyOf) ? anyOf : oneOf;
|
|
122
|
+
if (!Array.isArray(alternatives) ||
|
|
123
|
+
alternatives.length === 0 ||
|
|
124
|
+
root.properties !== undefined)
|
|
125
|
+
return root;
|
|
126
|
+
const branches = alternatives.map((branch) => objectBranch(root, branch));
|
|
127
|
+
if (!branches.every((branch) => branch !== undefined))
|
|
128
|
+
return root;
|
|
129
|
+
const variants = new Map();
|
|
130
|
+
for (const branch of branches)
|
|
131
|
+
for (const [name, schema] of Object.entries(branch.properties ?? {})) {
|
|
132
|
+
const known = variants.get(name) ?? [];
|
|
133
|
+
if (!known.some((seen) => isDeepStrictEqual(seen, schema)))
|
|
134
|
+
known.push(schema);
|
|
135
|
+
variants.set(name, known);
|
|
136
|
+
}
|
|
137
|
+
const required = sharedRequiredProperties(branches);
|
|
138
|
+
// A field unique to a group still needs that group's required partners.
|
|
139
|
+
// Counting properties alone would let optional fields pad an incomplete pair.
|
|
140
|
+
const dependencies = Object.fromEntries([...variants.keys()].flatMap((name) => {
|
|
141
|
+
const owners = branches.filter((branch) => Object.hasOwn(branch.properties ?? {}, name));
|
|
142
|
+
const partners = sharedRequiredProperties(owners).filter((partner) => partner !== name && !required.includes(partner));
|
|
143
|
+
return partners.length > 0 ? [[name, partners]] : [];
|
|
144
|
+
}));
|
|
145
|
+
const fewestRequired = Math.min(...branches.map((branch) => requiredProperties(branch).length));
|
|
146
|
+
// Groups that differ only in property values add no caller guidance.
|
|
147
|
+
const groups = [...new Set(branches.map(inputGroup))];
|
|
148
|
+
const description = [
|
|
149
|
+
typeof rest.description === "string" ? rest.description : undefined,
|
|
150
|
+
groups.length > 1
|
|
151
|
+
? `Provide a complete input group: ${groups.join("; ")}.`
|
|
152
|
+
: undefined,
|
|
153
|
+
].filter((text) => text !== undefined);
|
|
154
|
+
return {
|
|
155
|
+
...rest,
|
|
156
|
+
type: "object",
|
|
157
|
+
...(description.length > 0 ? { description: description.join(" ") } : {}),
|
|
158
|
+
properties: Object.fromEntries([...variants].map(([name, schemas]) => [
|
|
159
|
+
name,
|
|
160
|
+
schemas.length === 1 ? schemas[0] : { anyOf: schemas },
|
|
161
|
+
])),
|
|
162
|
+
...(required.length > 0 ? { required } : {}),
|
|
163
|
+
...(fewestRequired > 0 ? { minProperties: fewestRequired } : {}),
|
|
164
|
+
...(Object.keys(dependencies).length > 0
|
|
165
|
+
? {
|
|
166
|
+
[root.$schema === "http://json-schema.org/draft-07/schema#"
|
|
167
|
+
? "dependencies"
|
|
168
|
+
: "dependentRequired"]: dependencies,
|
|
169
|
+
}
|
|
170
|
+
: {}),
|
|
171
|
+
...(branches.every((branch) => branch.additionalProperties === false)
|
|
172
|
+
? { additionalProperties: false }
|
|
173
|
+
: {}),
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
/** Describe canonical input fields and present the root as one object. */
|
|
87
177
|
export const presentInputJsonSchema = (root, describeProperty) => {
|
|
88
|
-
const
|
|
89
|
-
|
|
178
|
+
const flattened = flattenRootObjectUnion(root);
|
|
179
|
+
const described = describeSchema(flattened, flattened, describeProperty);
|
|
180
|
+
return isObject(described) ? described : flattened;
|
|
90
181
|
};
|
|
@@ -54,7 +54,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
|
|
54
54
|
{
|
|
55
55
|
name: "analyze_javascript_application",
|
|
56
56
|
...toolContractMetadata("analyze_javascript_application"),
|
|
57
|
-
description: "Reconstruct one local ASAR or extracted JavaScript application as an inline application graph without executing it. Returns
|
|
57
|
+
description: "Reconstruct one local ASAR or extracted JavaScript application as an inline application graph without executing it. Returns recovered graph nodes, edges, semantic relations, integrity contradictions, limitations, and coverage. Integrity mismatches fail by default; record-and-continue retains observed bytes as untrusted and marks graph coverage partial.",
|
|
58
58
|
kind: "electron-provider",
|
|
59
59
|
inputSchema: analyzeJavaScriptApplicationInputSchema,
|
|
60
60
|
outputSchema: applicationOutputSchema,
|
|
@@ -64,6 +64,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
|
|
64
64
|
input: {
|
|
65
65
|
input_path: "/Applications/Example.app/Contents/Resources/app.asar",
|
|
66
66
|
format: "auto",
|
|
67
|
+
integrity_policy: "fail",
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
70
|
],
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createEvidence } from "../../domain/evidence.js";
|
|
2
|
-
import { reconcileJavaScriptRuntime } from "../../domain/javascript/javascriptRuntimeReconciliation.js";
|
|
2
|
+
import { parseRuntimeReconciliationInput, reconcileJavaScriptRuntime, } from "../../domain/javascript/javascriptRuntimeReconciliation.js";
|
|
3
3
|
import { JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE, JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE, } from "./javascriptRuntimeReconciliationExample.js";
|
|
4
4
|
import { createHistoricalSourceGraph } from "../../domain/referenceSourceGraph.js";
|
|
5
|
-
|
|
5
|
+
import { reconcileJavaScriptRuntimeInputSchema } from "../../domain/javascript/javascriptRuntimeReconciliationSchemas.js";
|
|
6
|
+
const reconciliation = reconcileJavaScriptRuntime(parseRuntimeReconciliationInput(reconcileJavaScriptRuntimeInputSchema.parse(JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE)));
|
|
6
7
|
const reconciliationEvidence = createEvidence(undefined, {
|
|
7
8
|
id: "rea-javascript-runtime-reconciliation",
|
|
8
9
|
name: "REA JavaScript runtime reconciliation",
|
|
@@ -4,7 +4,7 @@ import { analyzeJavaScriptSemantics } from "../../domain/javascript/javascriptSe
|
|
|
4
4
|
import { projectJavaScriptExportReturnShapes } from "../../domain/javascript/javascriptExportReturnShapeProjection.js";
|
|
5
5
|
import { completeApplicationCoverage, partialApplicationCoverage, } from "../../domain/javascript/javascriptApplicationEvidenceSchemas.js";
|
|
6
6
|
import { createJavaScriptApplicationGraph, createJavaScriptApplicationNode, } from "../../domain/javascript/javascriptApplicationGraph.js";
|
|
7
|
-
import { createJavaScriptSemanticGraph, createJavaScriptSemanticGraphNode, } from "../../domain/javascript/javascriptSemanticGraph.js";
|
|
7
|
+
import { createJavaScriptSemanticGraph, createJavaScriptSemanticGraphNode, JavaScriptSemanticEvidenceContextRegistry, } from "../../domain/javascript/javascriptSemanticGraph.js";
|
|
8
8
|
import { JAVASCRIPT_SEMANTIC_RELATION_FAMILIES } from "../../domain/javascript/javascriptSemanticGraphSchemas.js";
|
|
9
9
|
import { javascriptApplicationAnalysisResultSchema } from "../../domain/javascript/javascriptApplicationAnalysis.js";
|
|
10
10
|
// Inventory identities/counters captured from real analysis of these two sources.
|
|
@@ -15,12 +15,14 @@ const captures = {
|
|
|
15
15
|
root_artifact_sha256: "5005ebc2f35719a2fc014f19a81c669f3a1ab471b7245ef6985a111b6845a747",
|
|
16
16
|
inventory_manifest_id: "agm_f30ded9a83d43a3980417bbe63dfad569e83386f243c4d6a01af0166372cb9e6",
|
|
17
17
|
inventory_graph_sha256: "4b8aceaf67e43fd8317ec1f5fd1df5235f8fa402335accf011683e008c6bc62c",
|
|
18
|
+
integrity_contradictions: [],
|
|
18
19
|
},
|
|
19
20
|
total: {
|
|
20
21
|
input_path: "/examples/javascript-export-presence/right",
|
|
21
22
|
root_artifact_sha256: "269ae72a601ad5ac02f1c2dda6ff9accffa2d2e4f4a9e406facee0d5a78a5377",
|
|
22
23
|
inventory_manifest_id: "agm_d3ceaa1af38fb3474070ca25c0d4644282e5fb7d5824cee3e3a81391481e9fc1",
|
|
23
24
|
inventory_graph_sha256: "3e9bc926951480c35385efe5650d9d781631bd74c37a523d543b5fbe06b01ce6",
|
|
25
|
+
integrity_contradictions: [],
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
28
|
const summary = {
|
|
@@ -56,7 +58,6 @@ const statistics = {
|
|
|
56
58
|
findings: 1,
|
|
57
59
|
modules: 0,
|
|
58
60
|
parse_failures: 0,
|
|
59
|
-
truncated_scopes: 0,
|
|
60
61
|
};
|
|
61
62
|
const modulePath = "parser.mjs";
|
|
62
63
|
const limitations = [
|
|
@@ -163,6 +164,7 @@ const exampleEvidence = (property) => {
|
|
|
163
164
|
coverage: partialApplicationCoverage([], null),
|
|
164
165
|
limitations,
|
|
165
166
|
});
|
|
167
|
+
const evidenceContexts = new JavaScriptSemanticEvidenceContextRegistry();
|
|
166
168
|
const module = createJavaScriptSemanticGraphNode({
|
|
167
169
|
kind: "module",
|
|
168
170
|
identity: {
|
|
@@ -181,12 +183,13 @@ const exampleEvidence = (property) => {
|
|
|
181
183
|
state: "observed",
|
|
182
184
|
confidence: "exact",
|
|
183
185
|
},
|
|
184
|
-
});
|
|
186
|
+
}, evidenceContexts);
|
|
185
187
|
const semanticGraph = createJavaScriptSemanticGraph({
|
|
186
188
|
schema: "JavaScriptSemanticRelationGraph",
|
|
187
189
|
root_artifact_sha256: metadata.root_artifact_sha256,
|
|
188
190
|
application_graph_id: graph.graph_id,
|
|
189
191
|
root_node_ids: [module.node_id],
|
|
192
|
+
evidence_contexts: evidenceContexts.contexts,
|
|
190
193
|
nodes: [module],
|
|
191
194
|
relations: [],
|
|
192
195
|
fingerprints: [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createEvidence } from "../../domain/evidence.js";
|
|
2
2
|
import { createJavaScriptApplicationGraph, createJavaScriptApplicationNode, } from "../../domain/javascript/javascriptApplicationGraph.js";
|
|
3
3
|
import { createWebTextArtifact } from "../../domain/webContentArtifact.js";
|
|
4
|
-
import { createJavaScriptSemanticGraph, createJavaScriptSemanticGraphNode, } from "../../domain/javascript/javascriptSemanticGraph.js";
|
|
4
|
+
import { createJavaScriptSemanticGraph, createJavaScriptSemanticGraphNode, JavaScriptSemanticEvidenceContextRegistry, } from "../../domain/javascript/javascriptSemanticGraph.js";
|
|
5
5
|
import { JAVASCRIPT_SEMANTIC_RELATION_FAMILIES } from "../../domain/javascript/javascriptSemanticGraphSchemas.js";
|
|
6
6
|
const applicationSha256 = "1".repeat(64);
|
|
7
7
|
const script = createWebTextArtifact("export const example = true;\n", "text/javascript");
|
|
@@ -59,6 +59,7 @@ const graph = createJavaScriptApplicationGraph({
|
|
|
59
59
|
coverage: completeCoverage,
|
|
60
60
|
limitations: [],
|
|
61
61
|
});
|
|
62
|
+
const evidenceContexts = new JavaScriptSemanticEvidenceContextRegistry();
|
|
62
63
|
const semanticNode = createJavaScriptSemanticGraphNode({
|
|
63
64
|
kind: "module",
|
|
64
65
|
identity: {
|
|
@@ -72,12 +73,13 @@ const semanticNode = createJavaScriptSemanticGraphNode({
|
|
|
72
73
|
label: "renderer.js",
|
|
73
74
|
properties: {},
|
|
74
75
|
evidence: graphEvidence,
|
|
75
|
-
});
|
|
76
|
+
}, evidenceContexts);
|
|
76
77
|
const semanticGraph = createJavaScriptSemanticGraph({
|
|
77
78
|
schema: "JavaScriptSemanticRelationGraph",
|
|
78
79
|
root_artifact_sha256: applicationSha256,
|
|
79
80
|
application_graph_id: graph.graph_id,
|
|
80
81
|
root_node_ids: [semanticNode.node_id],
|
|
82
|
+
evidence_contexts: evidenceContexts.contexts,
|
|
81
83
|
nodes: [semanticNode],
|
|
82
84
|
relations: [],
|
|
83
85
|
fingerprints: [],
|
|
@@ -98,7 +100,8 @@ const semanticGraph = createJavaScriptSemanticGraph({
|
|
|
98
100
|
},
|
|
99
101
|
limitations: ["Semantic relations are unavailable in this minimal example."],
|
|
100
102
|
});
|
|
101
|
-
|
|
103
|
+
/** Minimal valid static application Evidence for graph workflow examples. */
|
|
104
|
+
export const JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE = createEvidence({ path: inputPath, sha256: applicationSha256, format: "directory" }, {
|
|
102
105
|
id: "rea-javascript-application",
|
|
103
106
|
name: "REA JavaScript application analyzer",
|
|
104
107
|
version: "1",
|
|
@@ -112,6 +115,7 @@ const staticEvidence = createEvidence({ path: inputPath, sha256: applicationSha2
|
|
|
112
115
|
root_artifact_sha256: applicationSha256,
|
|
113
116
|
inventory_manifest_id: `agm_${"2".repeat(64)}`,
|
|
114
117
|
inventory_graph_sha256: "3".repeat(64),
|
|
118
|
+
integrity_contradictions: [],
|
|
115
119
|
graph,
|
|
116
120
|
semantic_graph: semanticGraph,
|
|
117
121
|
summary: {
|
|
@@ -147,15 +151,12 @@ const staticEvidence = createEvidence({ path: inputPath, sha256: applicationSha2
|
|
|
147
151
|
findings: 0,
|
|
148
152
|
modules: 0,
|
|
149
153
|
parse_failures: 0,
|
|
150
|
-
truncated_scopes: 0,
|
|
151
154
|
},
|
|
152
155
|
limitations: [],
|
|
153
156
|
},
|
|
154
157
|
confidence: "derived",
|
|
155
158
|
authority: "shipped-artifact",
|
|
156
159
|
});
|
|
157
|
-
/** Minimal valid static application Evidence for graph workflow examples. */
|
|
158
|
-
export const JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE = staticEvidence;
|
|
159
160
|
const runtimeEvidence = createEvidence(undefined, {
|
|
160
161
|
id: "rea-cdp-electron",
|
|
161
162
|
name: "REA Electron file-page CDP observation provider",
|
|
@@ -215,7 +216,7 @@ const runtimeEvidence = createEvidence(undefined, {
|
|
|
215
216
|
});
|
|
216
217
|
/** Compact valid Evidence pair used by the public reconciliation contract. */
|
|
217
218
|
export const JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE = {
|
|
218
|
-
static_layers: [{ analysis:
|
|
219
|
+
static_layers: [{ analysis: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE }],
|
|
219
220
|
runtime_observations: [runtimeEvidence],
|
|
220
221
|
};
|
|
221
222
|
function browserCompleteness() {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
2
3
|
import { managedOutputSchemas } from "../toolOutputSchemaGroups.js";
|
|
3
4
|
import { toolContractMetadata } from "../toolEffects.js";
|
|
4
5
|
import { requireOutputSchema } from "../toolOutputSchemaPrimitives.js";
|
|
5
|
-
import {
|
|
6
|
+
import { localPathStringSchema } from "../../domain/localPath.js";
|
|
6
7
|
/** Exact caller boundary for execution-free PE/CLI triage and identity. */
|
|
7
8
|
export const managedTargetInputSchema = z.strictObject({
|
|
8
9
|
path: localPathStringSchema
|
|
9
|
-
.refine(
|
|
10
|
+
.refine(isAbsolute, {
|
|
10
11
|
message: "path must be an absolute local filesystem path (for example /tmp/Example.dll or C:\\Example.dll)",
|
|
11
12
|
})
|
|
12
13
|
.describe("Explicit absolute managed PE/CLI path; omit to reuse the previously selected managed target")
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { digestCanonicalValue } from "../domain/canonicalDigest.js";
|
|
2
2
|
import { createEvidence } from "../domain/evidence.js";
|
|
3
3
|
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
4
|
const inventory = (format, digit) => {
|
|
5
5
|
const sha = digit.repeat(64);
|
|
6
|
-
const artifactId = `art_${
|
|
7
|
-
const occurrenceId = `occ_${
|
|
6
|
+
const artifactId = `art_${digestCanonicalValue({ sha256: sha }, "Artifact inventory")}`;
|
|
7
|
+
const occurrenceId = `occ_${digestCanonicalValue({ root: artifactId }, "Artifact inventory")}`;
|
|
8
8
|
const nodes = [
|
|
9
9
|
{
|
|
10
10
|
artifact_id: artifactId,
|
|
@@ -35,7 +35,7 @@ const inventory = (format, digit) => {
|
|
|
35
35
|
limitations: [],
|
|
36
36
|
},
|
|
37
37
|
];
|
|
38
|
-
const graphSha256 =
|
|
38
|
+
const graphSha256 = digestCanonicalValue({
|
|
39
39
|
nodes,
|
|
40
40
|
occurrences,
|
|
41
41
|
edges: [],
|
|
@@ -43,7 +43,7 @@ const inventory = (format, digit) => {
|
|
|
43
43
|
}, "Artifact inventory");
|
|
44
44
|
return jsonValueSchema.parse({
|
|
45
45
|
manifest: {
|
|
46
|
-
manifest_id: `agm_${
|
|
46
|
+
manifest_id: `agm_${digestCanonicalValue({
|
|
47
47
|
root_artifact_id: artifactId,
|
|
48
48
|
graph_sha256: graphSha256,
|
|
49
49
|
}, "Artifact inventory")}`,
|
|
@@ -58,7 +58,7 @@ export const swiftSymbolsSchema = z
|
|
|
58
58
|
.string()
|
|
59
59
|
.min(1)
|
|
60
60
|
.regex(/^[^\n]*$/u, "Each Swift symbol must be one line.")
|
|
61
|
-
.regex(/^[^\
|
|
61
|
+
.regex(/^[^\x00]*$/u, "Swift symbols cannot contain NUL."))
|
|
62
62
|
.min(1);
|
|
63
63
|
/** Provider-neutral semantic operations backed initially by macOS utilities. */
|
|
64
64
|
export const NATIVE_TOOL_CONTRACTS = [
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { isAbsolute } from "node:path";
|
|
1
2
|
import { executableFormatHintSchema } from "../domain/dosCom.js";
|
|
2
|
-
import {
|
|
3
|
+
import { localPathStringSchema } from "../domain/localPath.js";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import { analysisProviderSelectorSchema } from "./providerSelection.js";
|
|
5
6
|
/** Caller-supplied analysis snapshot path; must name its destination absolutely. */
|
|
6
7
|
const snapshotPathSchema = localPathStringSchema
|
|
7
|
-
.refine(
|
|
8
|
+
.refine(isAbsolute, {
|
|
8
9
|
message: "snapshot_path must be an absolute local filesystem path (for example /tmp/rea/analysis.json or C:\\rea\\analysis.json)",
|
|
9
10
|
})
|
|
10
11
|
.describe("Absolute local filesystem path for the analysis snapshot; relative paths are rejected.");
|
|
11
12
|
/** Caller-supplied analysis target path; must name the target absolutely. */
|
|
12
13
|
const binaryTargetPathSchema = localPathStringSchema
|
|
13
|
-
.refine(
|
|
14
|
+
.refine(isAbsolute, {
|
|
14
15
|
message: "path must be an absolute local filesystem path (for example /tmp/fixture.bin or C:\\analysis\\fixture.bin)",
|
|
15
16
|
})
|
|
16
17
|
.describe("Absolute local filesystem path for the analysis target; relative paths are rejected.");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { localPathStringSchema } from "../domain/localPath.js";
|
|
3
4
|
/** Optional expectations used to compare the live session with its caller. */
|
|
4
5
|
export const binarySessionInputSchema = z.strictObject({
|
|
5
6
|
expected_package_version: z.string().min(1).optional(),
|
|
@@ -8,7 +9,7 @@ export const binarySessionInputSchema = z.strictObject({
|
|
|
8
9
|
.regex(/^[a-f0-9]{64}$/u)
|
|
9
10
|
.optional(),
|
|
10
11
|
expected_server_path: localPathStringSchema
|
|
11
|
-
.refine(
|
|
12
|
+
.refine(isAbsolute, {
|
|
12
13
|
message: "expected_server_path must be an absolute local filesystem path (for example /opt/rea/dist/main.js)",
|
|
13
14
|
})
|
|
14
15
|
.describe("Absolute local filesystem path expected for the running server; relative paths are rejected.")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { localPathStringSchema } from "../domain/localPath.js";
|
|
3
4
|
import { artifactComparisonInputSchema } from "../domain/artifactComparison.js";
|
|
4
5
|
import { bundleComparisonInputSchema } from "../domain/bundleComparison.js";
|
|
5
6
|
import { callPathInputSchema } from "../domain/callPathSchemas.js";
|
|
@@ -28,7 +29,7 @@ const session = (name, description, inputSchema) => ({
|
|
|
28
29
|
/** Session-owned Evidence bundle export options. */
|
|
29
30
|
export const exportEvidenceBundleInputSchema = z.strictObject({
|
|
30
31
|
path: localPathStringSchema
|
|
31
|
-
.refine(
|
|
32
|
+
.refine(isAbsolute, {
|
|
32
33
|
message: "path must be an absolute local filesystem path (for example /tmp/rea/evidence.json or C:\\rea\\evidence.json)",
|
|
33
34
|
})
|
|
34
35
|
.describe("Absolute local filesystem path for the exported evidence bundle; relative paths are rejected."),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { localPathStringSchema } from "../domain/localPath.js";
|
|
3
4
|
import { processTraceSpecificationSchema } from "../domain/process/processTraceSpecification.js";
|
|
4
5
|
import { evidenceSchema } from "../domain/evidence.js";
|
|
5
6
|
import { prefixedDigestSchema } from "./../domain/digests.js";
|
|
@@ -17,7 +18,7 @@ export const addressContextInputSchema = z.strictObject({
|
|
|
17
18
|
/** Session-owned Evidence bundle import options. */
|
|
18
19
|
export const importEvidenceBundleInputSchema = z.strictObject({
|
|
19
20
|
path: localPathStringSchema
|
|
20
|
-
.refine(
|
|
21
|
+
.refine(isAbsolute, {
|
|
21
22
|
message: "path must be an absolute local filesystem path (for example /tmp/evidence.json or C:\\rea\\evidence.json)",
|
|
22
23
|
})
|
|
23
24
|
.describe("Absolute local filesystem path for the evidence bundle to import; relative paths are rejected."),
|
|
@@ -115,8 +115,8 @@ export const officialOutputSchemas = {
|
|
|
115
115
|
procedure_references: evidenceResultOf(z.object({
|
|
116
116
|
procedure: procedureIdentitySchema,
|
|
117
117
|
direction: z.enum(["incoming", "outgoing"]),
|
|
118
|
-
reference_kinds_available: z.boolean()
|
|
119
|
-
unresolved_calls: z.array(unresolvedCallSchema)
|
|
118
|
+
reference_kinds_available: z.boolean(),
|
|
119
|
+
unresolved_calls: z.array(unresolvedCallSchema),
|
|
120
120
|
references: z.array(referenceEdgeSchema),
|
|
121
121
|
})),
|
|
122
122
|
procedure_pseudo_code: evidenceResultOf(nullableText),
|
|
@@ -405,11 +405,8 @@ export const procedureInfoOutput = evidenceResultOf(z.object({
|
|
|
405
405
|
length: z.number().min(0),
|
|
406
406
|
signature: nullableText,
|
|
407
407
|
locals: z.array(localVariableSchema),
|
|
408
|
-
classification: procedureClassificationSchema.nullable()
|
|
409
|
-
body: functionBodySchema
|
|
410
|
-
available: false,
|
|
411
|
-
reason: "The provider did not report complete function body ranges.",
|
|
412
|
-
}),
|
|
408
|
+
classification: procedureClassificationSchema.nullable(),
|
|
409
|
+
body: functionBodySchema,
|
|
413
410
|
}));
|
|
414
411
|
export const symbolDiscoveryOutput = (property) => evidenceResultOf(z.object({
|
|
415
412
|
count: z.number().int().min(0),
|
|
@@ -50,4 +50,9 @@ export class AnalysisError extends Error {
|
|
|
50
50
|
executionFailure = undefined;
|
|
51
51
|
partialObservation;
|
|
52
52
|
cleanupReport = undefined;
|
|
53
|
+
/** Retain a completed observation when a later step fails. */
|
|
54
|
+
retainPartialObservation(observation) {
|
|
55
|
+
this.partialObservation ??= observation;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
53
58
|
}
|
|
@@ -147,7 +147,7 @@ export const analysisErrorUserMessage = (error) => {
|
|
|
147
147
|
if (standardMessage !== undefined)
|
|
148
148
|
return standardMessage;
|
|
149
149
|
if (error instanceof ArtifactOperationError)
|
|
150
|
-
return artifactMessage(error.reason);
|
|
150
|
+
return artifactMessage(error.operation, error.reason);
|
|
151
151
|
if (error instanceof EvidenceReferenceError)
|
|
152
152
|
return error.reason === "missing"
|
|
153
153
|
? `Evidence ${error.evidenceId} is not retained in this session. Supply complete inline Evidence, re-run its producer, or import its bundle before using this reference.`
|
|
@@ -267,7 +267,7 @@ const START_FAILURE_TAGS = new Set([
|
|
|
267
267
|
"HopperProcessError",
|
|
268
268
|
"HopperStartError",
|
|
269
269
|
]);
|
|
270
|
-
const artifactMessage = (reason) => {
|
|
270
|
+
const artifactMessage = (operation, reason) => {
|
|
271
271
|
if (reason === "cancelled")
|
|
272
272
|
return "Artifact operation was cancelled. Start it again when ready.";
|
|
273
273
|
if (reason === "limit")
|
|
@@ -276,6 +276,8 @@ const artifactMessage = (reason) => {
|
|
|
276
276
|
return "Artifact contains an unsafe or conflicting internal path. Inspect the reported path and correct the artifact before retrying.";
|
|
277
277
|
if (reason === "unavailable")
|
|
278
278
|
return "Artifact processing is unavailable for the current target or host. Check artifact support and required tools.";
|
|
279
|
+
if (reason === "integrity" && operation === "analyze_javascript_application")
|
|
280
|
+
return "Artifact bytes contradict declared integrity. If expected, rerun analyze_javascript_application with integrity_policy=record-and-continue (CLI: --integrity-policy record-and-continue) to retain observed bytes as untrusted; otherwise get a fresh copy.";
|
|
279
281
|
if (reason === "format" || reason === "integrity")
|
|
280
282
|
return "Artifact is invalid or has changed. Get a fresh copy and try again.";
|
|
281
283
|
return "Artifact could not be read or written. Check file access and try again.";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import canonicalize from "canonicalize";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
|
|
4
5
|
import { analysisProfileSchema, analysisProfilesEqual, committedProviderSchema, } from "./analysisProfile.js";
|
|
5
6
|
import { evidenceBundleForTarget, evidenceBundleSchema, parseEvidenceBundle, } from "./evidenceBundle.js";
|
|
6
7
|
import { evidenceLocationSchema, } from "./evidence.js";
|
|
@@ -288,7 +289,8 @@ export const parseAnalysisSnapshot = (input) => {
|
|
|
288
289
|
const hasCanonicalQueryOrder = (entries) => {
|
|
289
290
|
let previous;
|
|
290
291
|
for (const { query_id: queryId } of entries) {
|
|
291
|
-
if (previous !== undefined &&
|
|
292
|
+
if (previous !== undefined &&
|
|
293
|
+
compareUnicodeCodePoints(previous, queryId) > 0)
|
|
292
294
|
return false;
|
|
293
295
|
previous = queryId;
|
|
294
296
|
}
|
|
@@ -164,12 +164,10 @@ export const analysisViewResultSchema = z.discriminatedUnion("kind", [
|
|
|
164
164
|
]);
|
|
165
165
|
/** Construct a typed input failure for one selected-view constraint. */
|
|
166
166
|
export const analysisViewInputError = (issues) => new AnalysisInputError(INSPECT_ANALYSIS_VIEW_OPERATION, undefined, issues);
|
|
167
|
-
/** SHA-256 of the canonical projected JSON, excluding this digest field. */
|
|
168
|
-
export const analysisViewDigest = (projection) => digestCanonicalValue(projection, "Analysis view");
|
|
169
167
|
/** Attach the content digest that must change when projected bytes change. */
|
|
170
168
|
export const sealAnalysisView = (projection) => analysisViewResultSchema.parse({
|
|
171
169
|
...projection,
|
|
172
|
-
view_digest:
|
|
170
|
+
view_digest: digestCanonicalValue(projection, "Analysis view"),
|
|
173
171
|
});
|
|
174
172
|
const parentDigest = (evidenceId) => evidenceId.slice(3);
|
|
175
173
|
const parseJavaScriptParent = (input) => {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { digestSchema } from "../digests.js";
|
|
3
|
+
import { jsonObjectSchema, jsonValueSchema } from "../jsonValue.js";
|
|
4
|
+
import { localPathStringSchema } from "../localPath.js";
|
|
5
|
+
const operationSchema = z.enum([
|
|
6
|
+
"inspect_android_package",
|
|
7
|
+
"search_android_classes",
|
|
8
|
+
"inspect_android_class",
|
|
9
|
+
"inspect_android_method",
|
|
10
|
+
"trace_android_references",
|
|
11
|
+
]);
|
|
12
|
+
/** JSON-safe Android provider facts collected before an analysis failure. */
|
|
13
|
+
export const androidPartialObservationSchema = z.strictObject({
|
|
14
|
+
provider_id: z.literal("jadx"),
|
|
15
|
+
operation: operationSchema,
|
|
16
|
+
target: z.strictObject({
|
|
17
|
+
selected_path: localPathStringSchema,
|
|
18
|
+
path: localPathStringSchema,
|
|
19
|
+
sha256: digestSchema,
|
|
20
|
+
format: z.literal("apk"),
|
|
21
|
+
}),
|
|
22
|
+
provider_facts: z.strictObject({
|
|
23
|
+
jar_sha256: digestSchema.nullable(),
|
|
24
|
+
bridge_sha256: digestSchema.nullable(),
|
|
25
|
+
bridge_name: z.string().min(1),
|
|
26
|
+
bridge_version: z.string().min(1),
|
|
27
|
+
server_name: z.string().nullable(),
|
|
28
|
+
server_version: z.string().nullable(),
|
|
29
|
+
engine_version: z.string().min(1).nullable(),
|
|
30
|
+
}),
|
|
31
|
+
calls: z.array(z.strictObject({
|
|
32
|
+
operation: z.string().min(1),
|
|
33
|
+
input: jsonObjectSchema,
|
|
34
|
+
response: jsonValueSchema,
|
|
35
|
+
})),
|
|
36
|
+
});
|
|
@@ -8,7 +8,7 @@ import { DYLIB_RESOLUTION_LIMITATIONS, deriveFindings, } from "./dylibResolution
|
|
|
8
8
|
* `/`, none of them `.` or `..`, without backslash or NUL. Advertised schema
|
|
9
9
|
* patterns avoid look-around, which RE2 and Rust validators reject.
|
|
10
10
|
*/
|
|
11
|
-
const ROOT_RELATIVE_PATH = /^(?:[^\x2f\\\
|
|
11
|
+
const ROOT_RELATIVE_PATH = /^(?:[^\x2f\\\x00.][^\x2f\\\x00]*|\.[^\x2f\\\x00.][^\x2f\\\x00]*|\.\.[^\x2f\\\x00]+)(?:\x2f(?:[^\x2f\\\x00.][^\x2f\\\x00]*|\.[^\x2f\\\x00.][^\x2f\\\x00]*|\.\.[^\x2f\\\x00]+))*$/u;
|
|
12
12
|
const rootRelativePathSchema = z
|
|
13
13
|
.string()
|
|
14
14
|
.min(1)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import {} from "./artifactGraph.js";
|
|
4
4
|
import { evidenceSchema } from "./evidence.js";
|
|
@@ -112,7 +112,7 @@ export const compareArtifacts = (leftEvidence, rightEvidence) => {
|
|
|
112
112
|
right_manifest_id: right.inventory.manifest.manifest_id,
|
|
113
113
|
summary,
|
|
114
114
|
changes,
|
|
115
|
-
limitations: [...new Set(limitations)].sort(
|
|
115
|
+
limitations: [...new Set(limitations)].sort(compareUnicodeCodePoints),
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
118
|
const compareOccurrences = (left, right, evidenceLinks, complete) => {
|
|
@@ -124,7 +124,7 @@ const compareOccurrences = (left, right, evidenceLinks, complete) => {
|
|
|
124
124
|
const rightRelations = relationsByPath(right);
|
|
125
125
|
const paths = [
|
|
126
126
|
...new Set([...leftByPath.keys(), ...rightByPath.keys()]),
|
|
127
|
-
].sort(
|
|
127
|
+
].sort(compareUnicodeCodePoints);
|
|
128
128
|
const output = [];
|
|
129
129
|
for (const path of paths) {
|
|
130
130
|
const leftOccurrence = leftByPath.get(path);
|
|
@@ -271,7 +271,7 @@ const relationsByPath = (inventory) => {
|
|
|
271
271
|
values.push(projection);
|
|
272
272
|
}
|
|
273
273
|
for (const values of output.values())
|
|
274
|
-
values.sort((left, right) =>
|
|
274
|
+
values.sort((left, right) => compareUnicodeCodePoints(canonicalJson(left), canonicalJson(right)));
|
|
275
275
|
return output;
|
|
276
276
|
};
|
|
277
277
|
const summarize = (left, right, changes, covered) => {
|
|
@@ -121,7 +121,7 @@ const artifactOccurrenceSchema = z.object({
|
|
|
121
121
|
limitations: z.array(z.string()),
|
|
122
122
|
});
|
|
123
123
|
/** Observed bytes that contradict a container's declared integrity identity. */
|
|
124
|
-
const integrityContradictionSchema = z.object({
|
|
124
|
+
export const integrityContradictionSchema = z.object({
|
|
125
125
|
contradiction_id: contradictionIdSchema,
|
|
126
126
|
occurrence_id: occurrenceIdSchema,
|
|
127
127
|
parent_artifact_id: artifactIdSchema,
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { digestCanonicalValue } from "./canonicalDigest.js";
|
|
2
2
|
/** Content-address an artifact independently of where it was observed. */
|
|
3
|
-
export const artifactIdForContent = (sha256) => `art_${
|
|
3
|
+
export const artifactIdForContent = (sha256) => `art_${digestCanonicalValue({ sha256 }, "Artifact")}`;
|
|
4
4
|
/** Identify an occurrence by its root and exact logical location. */
|
|
5
5
|
export const occurrenceIdForLocation = (input) => input.logicalPath === "."
|
|
6
|
-
? `occ_${
|
|
7
|
-
: `occ_${
|
|
6
|
+
? `occ_${digestCanonicalValue({ root: input.rootArtifactId }, "Artifact")}`
|
|
7
|
+
: `occ_${digestCanonicalValue({
|
|
8
8
|
root_artifact_id: input.rootArtifactId,
|
|
9
9
|
logical_path: input.logicalPath,
|
|
10
10
|
entry_kind: input.entryKind,
|
|
11
11
|
}, "Artifact")}`;
|
|
12
12
|
/** Commit to graph members in the ordering established by the inventory owner. */
|
|
13
|
-
export const artifactGraphDigest = (input) =>
|
|
13
|
+
export const artifactGraphDigest = (input) => digestCanonicalValue({
|
|
14
14
|
nodes: input.nodes,
|
|
15
15
|
occurrences: input.occurrences,
|
|
16
16
|
edges: input.edges,
|
|
17
17
|
integrity_contradictions: input.contradictions,
|
|
18
18
|
}, "Artifact");
|
|
19
19
|
/** Bind a root artifact to its graph commitment. */
|
|
20
|
-
export const artifactManifestId = (rootArtifactId, graphSha256) => `agm_${
|
|
20
|
+
export const artifactManifestId = (rootArtifactId, graphSha256) => `agm_${digestCanonicalValue({ root_artifact_id: rootArtifactId, graph_sha256: graphSha256 }, "Artifact")}`;
|
|
21
21
|
/** Identify one integrity disagreement at its observed logical path. */
|
|
22
|
-
export const artifactContradictionId = (input) => `ic_${
|
|
22
|
+
export const artifactContradictionId = (input) => `ic_${digestCanonicalValue({
|
|
23
23
|
root_artifact_id: input.rootArtifactId,
|
|
24
24
|
logical_path: input.logicalPath,
|
|
25
25
|
declared_sha256: input.declaredSha256,
|
|
26
26
|
observed_sha256: input.observedSha256,
|
|
27
27
|
}, "Artifact")}`;
|
|
28
28
|
/** Identify an edge by its semantic relationship and exact occurrence. */
|
|
29
|
-
export const artifactEdgeId = (semantic) => `edge_${
|
|
29
|
+
export const artifactEdgeId = (semantic) => `edge_${digestCanonicalValue(semantic, "Artifact")}`;
|