rea-agents 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -16
- package/dist/application/AnalysisContextQueries.js +21 -9
- package/dist/application/ApplicationWorkflowEvidenceResolver.js +19 -11
- package/dist/application/ArtifactInventory/policy.js +17 -0
- package/dist/application/ArtifactInventory/reader.js +1 -4
- package/dist/application/ArtifactInventory/scanCanonical.js +0 -3
- package/dist/application/ArtifactInventory/scanReader.js +7 -7
- package/dist/application/ArtifactInventory/types.js +1 -5
- package/dist/application/BinarySession.js +14 -16
- package/dist/application/BinarySessionRecords.js +31 -5
- package/dist/application/BinarySessionStatus.js +11 -5
- package/dist/application/BrowserEvidence.js +3 -5
- package/dist/application/CapabilityClientRequirements.js +26 -0
- package/dist/application/CapabilityInventory.js +134 -63
- package/dist/application/CrossVersionInventory.js +7 -6
- package/dist/application/ElectronActiveEvidence.js +55 -0
- package/dist/application/ElectronActiveObservationPort.js +1 -0
- package/dist/application/ElectronActiveObservationService.js +81 -0
- package/dist/application/EnhancedTools.js +22 -20
- package/dist/application/EvidenceBundleCommands.js +5 -1
- package/dist/application/EvidenceLedger.js +8 -1
- package/dist/application/JavaScriptReplayPermission.js +1 -1
- package/dist/application/JavaScriptReplayService.js +23 -15
- package/dist/application/ManagedRuntimeCorrelationService.js +9 -5
- package/dist/application/NodeRuntimeCharacterizationService.js +8 -9
- package/dist/application/ProcessCaptureLifecycle.js +5 -0
- package/dist/application/ProcessCli.js +2 -1
- package/dist/application/ProcessHarness.js +8 -3
- package/dist/application/ProcessNormalization.js +2 -1
- package/dist/application/ProjectPermissionStore.js +1 -0
- package/dist/application/ReferenceSourceImport.js +2 -2
- package/dist/application/SetupClientConfiguration.js +6 -1
- package/dist/application/WindowsCapabilities.js +5 -4
- package/dist/artifacts/ArtifactProvider.js +8 -10
- package/dist/artifacts/SafeOutputTree.js +7 -8
- package/dist/browser/CdpCaptureStorageFingerprints.js +10 -7
- package/dist/browser/CdpElectronInspection.js +3 -1
- package/dist/browser/JavaScriptRuntimeScope.js +5 -0
- package/dist/browser/PlaywrightElectronActiveActions.js +324 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +294 -0
- package/dist/browser/PlaywrightScenarioBrowser.js +4 -4
- package/dist/browser/PlaywrightScenarioSession.js +4 -4
- package/dist/browser/SensitiveTextCapture.js +1 -1
- package/dist/browser/V8InspectorCaptureProjection.js +1 -0
- package/dist/browser/V8InspectorProvider.js +3 -3
- package/dist/catalogIdentity.js +12 -6
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cliApplicationCommands.js +2 -2
- package/dist/cliBrowserAdvancedCommands.js +11 -5
- package/dist/cliBrowserCommands.js +14 -7
- package/dist/cliCommandNames.js +1 -0
- package/dist/cliElectronCommands.js +46 -4
- package/dist/cliJavaScriptRuntimeCommands.js +14 -6
- package/dist/cliObservationOptions.js +4 -0
- package/dist/cliPolicyCommands.js +1 -0
- package/dist/config/browserScenario.js +77 -0
- package/dist/config/electronAutomation.js +35 -0
- package/dist/config/environment.js +6 -0
- package/dist/config/javascriptReplay.js +41 -0
- package/dist/config/managedRuntime.js +25 -0
- package/dist/config/parseConfig.js +56 -200
- package/dist/config/parsers.js +10 -1
- package/dist/config/passiveObservation.js +157 -0
- package/dist/config/processCapture.js +47 -0
- package/dist/contracts/applicationToolContracts.js +2 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +86 -96
- package/dist/contracts/artifactToolContracts.js +27 -34
- package/dist/contracts/browserToolContracts.js +2 -2
- package/dist/contracts/electronToolContracts.js +30 -1
- package/dist/contracts/enhancedInputs.js +13 -29
- package/dist/contracts/functionWorkflowToolContracts.js +2 -3
- package/dist/contracts/managedToolContracts.js +4 -9
- package/dist/contracts/managedWorkflowExamples.js +12 -9
- package/dist/contracts/managedWorkflowToolContracts.js +30 -27
- package/dist/contracts/nativeToolContracts.js +2 -3
- package/dist/contracts/sessionToolSchemas.js +61 -0
- package/dist/contracts/toolContractExamples.js +1 -0
- package/dist/contracts/toolContractHelpers.js +23 -0
- package/dist/contracts/toolContracts.js +5 -77
- package/dist/contracts/toolEffects.js +15 -0
- package/dist/contracts/toolOutputSchemaGroups.js +17 -2
- package/dist/contracts/toolOutputSchemaPrimitives.js +76 -26
- package/dist/contracts/toolSchemaMetadata.js +128 -0
- package/dist/doctorRuntime.js +1 -1
- package/dist/domain/androidApplication.js +2 -0
- package/dist/domain/appleApplication.js +2 -0
- package/dist/domain/binaryTarget.js +7 -5
- package/dist/domain/binaryTargetTypes.js +1 -0
- package/dist/domain/browserCaptureComparison.js +21 -69
- package/dist/domain/browserObservation.js +22 -9
- package/dist/domain/bytecodeProvider.js +33 -35
- package/dist/domain/callPath.js +3 -2
- package/dist/domain/conformanceReplay.js +3 -3
- package/dist/domain/conformanceTrustGate.js +151 -16
- package/dist/domain/customProtocolCapture.js +3 -3
- package/dist/domain/electronActiveObservation.js +277 -0
- package/dist/domain/electronObservation.js +15 -11
- package/dist/domain/electronStaticAnalysisValues.js +4 -1
- package/dist/domain/eventProcessTree.js +82 -79
- package/dist/domain/functionComparisonNormalization.js +15 -8
- package/dist/domain/functionDossierEvidence.js +9 -4
- package/dist/domain/hopperValues.js +68 -71
- package/dist/domain/inputIssueProjection.js +4 -1
- package/dist/domain/investigationWorkspace.js +16 -15
- package/dist/domain/javascriptExportShapeComparisonSchemas.js +2 -2
- package/dist/domain/javascriptReplay.js +79 -63
- package/dist/domain/javascriptRuntimeObservation.js +1 -0
- package/dist/domain/javascriptRuntimeReconciliationActive.js +89 -0
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +11 -10
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +57 -49
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +5 -1
- package/dist/domain/javascriptRuntimeReconciliationResult.js +21 -14
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +1 -1
- package/dist/domain/knownPageCoverage.js +15 -7
- package/dist/domain/nativeApiBoundary.js +15 -7
- package/dist/domain/nodeRuntimeCharacterization.js +14 -13
- package/dist/domain/processCaptureReactiveValidation.js +8 -3
- package/dist/domain/processCaptureValidation.js +7 -3
- package/dist/domain/processComparison.js +12 -7
- package/dist/domain/processObservation.js +5 -6
- package/dist/domain/processReactiveMatching.js +14 -7
- package/dist/domain/processReactiveTransition.js +9 -3
- package/dist/domain/processScenario.js +6 -3
- package/dist/domain/processTraceComparison.js +3 -2
- package/dist/domain/protocolCapture.js +8 -6
- package/dist/domain/reconstructionReadinessSchemas.js +30 -2
- package/dist/domain/referenceSourceImportParsing.js +2 -2
- package/dist/domain/replayMachineRuntime.js +5 -3
- package/dist/domain/sourceToBundleComparison.js +2 -2
- package/dist/domain/sourceToBundleComparisonSchemas.js +8 -8
- package/dist/domain/sourceToBundleSignals.js +7 -1
- package/dist/domain/staticRuntimeCorrelation.js +7 -5
- package/dist/domain/webBundleAnalysis.js +14 -14
- package/dist/domain/webCaptureDiff.js +15 -12
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +2 -3
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraClient.js +1 -1
- package/dist/ghidra/GhidraClientStartup.js +1 -1
- package/dist/ghidra/GhidraFunctionValues.js +17 -15
- package/dist/ghidra/GhidraInventoryValues.js +57 -47
- package/dist/ghidra/GhidraProvider.js +18 -10
- package/dist/ghidra/GhidraProviderCapabilities.js +5 -1
- package/dist/ghidra/GhidraSocketConnection.js +1 -1
- package/dist/ghidra/protocol.js +19 -42
- package/dist/hopper/BridgeLauncher.js +3 -1
- package/dist/hopper/HopperAnalysisProfile.js +2 -4
- package/dist/hopper/HopperCleanup.js +5 -6
- package/dist/hopper/HopperClient.js +1 -1
- package/dist/hopper/HopperProvider.js +0 -14
- package/dist/hopper/LinuxPrivateDisplayProbe.js +16 -10
- package/dist/main/reload.js +1 -6
- package/dist/main/state.js +0 -14
- package/dist/main/transport.js +30 -37
- package/dist/main.js +17 -15
- package/dist/mcpDoctor.js +2 -24
- package/dist/process/PrivateRuntimeRoot.js +17 -0
- package/dist/process/ProcessOwnership.js +64 -128
- package/dist/process/ProcessOwnershipIdentity.js +13 -0
- package/dist/process/ProcessOwnershipObservation.js +88 -0
- package/dist/process/ProcessOwnershipProcessTree.js +22 -0
- package/dist/process/ProviderDeadline.js +8 -12
- package/dist/process/WindowsAuthority.js +32 -0
- package/dist/reference/ReferenceSourceReader.js +3 -3
- package/dist/reference/ReferenceSourceReaderEntries.js +2 -2
- package/dist/replay/JavaScriptReplayWorker.js +95 -11
- package/dist/replay/JavaScriptReplayWorkerTypes.js +1 -0
- package/dist/replay/LinuxJavaScriptReplayRunner.js +10 -15
- package/dist/replay/ReplayOutcome.js +26 -15
- package/dist/replay/ReplayWorkerProtocol.js +34 -29
- package/dist/server/createServer.js +158 -94
- package/dist/server/mcpClientMetadata.js +32 -0
- package/dist/server/registerApplicationTools/characterization.js +6 -13
- package/dist/server/registerApplicationTools/compareExportShapes.js +2 -7
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +2 -7
- package/dist/server/registerApplicationTools/compareVersions.js +3 -8
- package/dist/server/registerApplicationTools/controlledReplay.js +6 -11
- package/dist/server/registerApplicationTools/coverage.js +13 -19
- package/dist/server/registerApplicationTools/obligationLedger.js +1 -6
- package/dist/server/registerApplicationTools/readiness.js +1 -6
- package/dist/server/registerApplicationTools/traceFeature.js +3 -8
- package/dist/server/registerApplicationTools/traceSemantics.js +1 -6
- package/dist/server/registerArtifactComparisonTool.js +12 -16
- package/dist/server/registerBrowserScenarioTool.js +1 -6
- package/dist/server/registerBrowserTools.js +37 -79
- package/dist/server/registerBundleComparisonTool.js +10 -14
- package/dist/server/registerCloseLifecycleTool.js +6 -14
- package/dist/server/registerElectronTools.js +30 -47
- package/dist/server/registerEnhancedTools.js +114 -122
- package/dist/server/registerEvidenceTools.js +5 -9
- package/dist/server/registerFunctionComparisonTool.js +11 -15
- package/dist/server/registerInvestigationTools.js +41 -57
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +13 -27
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -9
- package/dist/server/registerManagedWorkflowTools/contract.js +2 -3
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -8
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +3 -8
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +8 -13
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +4 -9
- package/dist/server/registerOfficialTools.js +8 -9
- package/dist/server/registerProcessComparisonTool.js +19 -24
- package/dist/server/registerReplayMachineTool.js +4 -10
- package/dist/server/registerSessionRecordTools.js +69 -40
- package/dist/server/registerSessionStatusTool.js +13 -28
- package/dist/server/registerSessionTools.js +36 -52
- package/dist/server/sessionAvailabilityPolicy.js +2 -1
- package/dist/server/sessionToolPolicies.js +1 -5
- package/dist/server/toolRegistrationOptions.js +4 -192
- package/dist/server/toolResult.js +2 -18
- package/package.json +22 -14
- package/scripts/electron-active-hook-boundaries.cjs +394 -0
- package/scripts/electron-active-hook.cjs +501 -0
- package/scripts/rea.mjs +1 -11
- package/skills/reverse-engineer-anything/SKILL.md +2 -2
- package/dist/server/DynamicToolAvailability.js +0 -70
- package/dist/server/LazyToolCatalog.js +0 -134
- package/dist/server/hydrateServerTools.js +0 -191
- package/dist/server/toolInputValidation.js +0 -77
- package/scripts/package-runner-bootstrap.mjs +0 -72
|
@@ -197,7 +197,21 @@ export const reconstructionReadinessInputSchema = z.strictObject({
|
|
|
197
197
|
closure_history: z.array(closureObservationSchema).min(2).max(1_000),
|
|
198
198
|
delegation_checks: z.array(delegationCheckSchema).min(1).max(1_000),
|
|
199
199
|
replay: replaySchema,
|
|
200
|
-
stages: z
|
|
200
|
+
stages: z
|
|
201
|
+
.array(stageSchema)
|
|
202
|
+
.length(9)
|
|
203
|
+
.superRefine((stages, context) => {
|
|
204
|
+
const seen = new Set();
|
|
205
|
+
stages.forEach((stage, index) => {
|
|
206
|
+
if (seen.has(stage.stage_id))
|
|
207
|
+
context.addIssue({
|
|
208
|
+
code: "custom",
|
|
209
|
+
path: [index, "stage_id"],
|
|
210
|
+
message: "Readiness stage IDs must be unique",
|
|
211
|
+
});
|
|
212
|
+
seen.add(stage.stage_id);
|
|
213
|
+
});
|
|
214
|
+
}),
|
|
201
215
|
});
|
|
202
216
|
const findingSchema = z.strictObject({
|
|
203
217
|
code: stableIdSchema,
|
|
@@ -233,7 +247,21 @@ export const reconstructionReadinessReportSchema = z.strictObject({
|
|
|
233
247
|
cleanup_leak_count: z.number().int().min(0),
|
|
234
248
|
nondeterministic_replay_count: z.number().int().min(0),
|
|
235
249
|
}),
|
|
236
|
-
stages: z
|
|
250
|
+
stages: z
|
|
251
|
+
.array(stageSchema)
|
|
252
|
+
.length(9)
|
|
253
|
+
.superRefine((stages, context) => {
|
|
254
|
+
const seen = new Set();
|
|
255
|
+
stages.forEach((stage, index) => {
|
|
256
|
+
if (seen.has(stage.stage_id))
|
|
257
|
+
context.addIssue({
|
|
258
|
+
code: "custom",
|
|
259
|
+
path: [index, "stage_id"],
|
|
260
|
+
message: "Readiness stage IDs must be unique",
|
|
261
|
+
});
|
|
262
|
+
seen.add(stage.stage_id);
|
|
263
|
+
});
|
|
264
|
+
}),
|
|
237
265
|
findings: z.array(findingSchema).max(10_000),
|
|
238
266
|
evidence_links: z.array(evidenceIdSchema).max(100_000),
|
|
239
267
|
snapshot: reconstructionReadinessInputSchema,
|
|
@@ -199,11 +199,11 @@ const parseWithBabel = (path, source, language) => {
|
|
|
199
199
|
});
|
|
200
200
|
return { ast, parseState: "parsed" };
|
|
201
201
|
}
|
|
202
|
-
catch (
|
|
202
|
+
catch (cause) {
|
|
203
203
|
return {
|
|
204
204
|
ast: undefined,
|
|
205
205
|
parseState: "unknown",
|
|
206
|
-
reason:
|
|
206
|
+
reason: cause instanceof Error ? cause.message : "Parse failed",
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
};
|
|
@@ -20,7 +20,7 @@ const replayEventHeadersSchema = z
|
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
const replayEventFields = {
|
|
23
|
-
at_ms: z.number().int().
|
|
23
|
+
at_ms: z.number().int().safe().nonnegative(),
|
|
24
24
|
path: z.string().startsWith("/").max(8_192),
|
|
25
25
|
headers: replayEventHeadersSchema,
|
|
26
26
|
body: z.string().max(1_000_000),
|
|
@@ -51,7 +51,8 @@ export const replayMachineEventSchema = z.discriminatedUnion("protocol", [
|
|
|
51
51
|
]);
|
|
52
52
|
const parseJson = (value) => {
|
|
53
53
|
try {
|
|
54
|
-
|
|
54
|
+
const parsed = JSON.parse(value);
|
|
55
|
+
return parsed;
|
|
55
56
|
}
|
|
56
57
|
catch {
|
|
57
58
|
return undefined;
|
|
@@ -70,7 +71,8 @@ const atPath = (value, path) => {
|
|
|
70
71
|
current === null ||
|
|
71
72
|
!Object.hasOwn(current, segment))
|
|
72
73
|
return undefined;
|
|
73
|
-
|
|
74
|
+
const next = Reflect.get(current, segment);
|
|
75
|
+
current = next;
|
|
74
76
|
}
|
|
75
77
|
return current;
|
|
76
78
|
};
|
|
@@ -135,8 +135,8 @@ const comparisonCoverage = (projection, mappings, factors) => ({
|
|
|
135
135
|
const scoringModel = () => ({
|
|
136
136
|
algorithm: "rea-source-to-bundle-signals/v1",
|
|
137
137
|
minimum_candidate_score: 20,
|
|
138
|
-
weights:
|
|
139
|
-
signal
|
|
138
|
+
weights: SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS.map(([signal, weight]) => ({
|
|
139
|
+
signal,
|
|
140
140
|
weight,
|
|
141
141
|
})),
|
|
142
142
|
});
|
|
@@ -6,14 +6,14 @@ const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
|
6
6
|
const evidenceIdSchema = z.string().regex(/^ev_[a-f0-9]{64}$/u);
|
|
7
7
|
const nodeIdSchema = z.string().regex(/^jag_node_[a-f0-9]{64}$/u);
|
|
8
8
|
const boundedTextSchema = z.string().min(1).max(4_096);
|
|
9
|
-
export const SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS =
|
|
10
|
-
"exact-source-digest"
|
|
11
|
-
"source-map-original-path"
|
|
12
|
-
"current-path-exact"
|
|
13
|
-
"current-path-suffix"
|
|
14
|
-
"basename-match"
|
|
15
|
-
"language-extension"
|
|
16
|
-
|
|
9
|
+
export const SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS = [
|
|
10
|
+
["exact-source-digest", 100],
|
|
11
|
+
["source-map-original-path", 70],
|
|
12
|
+
["current-path-exact", 60],
|
|
13
|
+
["current-path-suffix", 40],
|
|
14
|
+
["basename-match", 20],
|
|
15
|
+
["language-extension", 5],
|
|
16
|
+
];
|
|
17
17
|
const sourceToBundleSignalKindSchema = z.enum([
|
|
18
18
|
"exact-source-digest",
|
|
19
19
|
"source-map-original-path",
|
|
@@ -14,6 +14,12 @@ const PATH_PROPERTIES = [
|
|
|
14
14
|
"declared_path",
|
|
15
15
|
];
|
|
16
16
|
const MAX_PATH_SUFFIXES = 128;
|
|
17
|
+
const signalWeight = (kind) => {
|
|
18
|
+
const entry = SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS.find(([signal]) => signal === kind);
|
|
19
|
+
if (entry === undefined)
|
|
20
|
+
throw new TypeError(`Missing source-to-bundle signal weight: ${kind}`);
|
|
21
|
+
return entry[1];
|
|
22
|
+
};
|
|
17
23
|
/** Keep source-bearing application nodes in stable identifier order. */
|
|
18
24
|
export const sourceBearingNodes = (nodes) => nodes
|
|
19
25
|
.filter(({ kind }) => RELEVANT_NODE_KINDS.has(kind))
|
|
@@ -145,7 +151,7 @@ const candidateSignals = (source, current) => {
|
|
|
145
151
|
};
|
|
146
152
|
const signal = (kind, sourceValue, currentValues) => ({
|
|
147
153
|
kind,
|
|
148
|
-
weight:
|
|
154
|
+
weight: signalWeight(kind),
|
|
149
155
|
source_value: sourceValue,
|
|
150
156
|
current_values: [...new Set(currentValues)].sort(compareText).slice(0, 64),
|
|
151
157
|
});
|
|
@@ -242,11 +242,12 @@ const selectStatic = (evidence, selector) => {
|
|
|
242
242
|
throw new TypeError("Function selector requires function comparison Evidence");
|
|
243
243
|
const result = functionComparisonResultSchema.parse(evidence.normalized_result);
|
|
244
244
|
const matches = result.dimensions.filter(({ dimension }) => dimension === selector.dimension);
|
|
245
|
-
|
|
245
|
+
const match = matches.at(0);
|
|
246
|
+
if (matches.length !== 1 || match === undefined)
|
|
246
247
|
throw new TypeError("Function selector must resolve exactly once");
|
|
247
248
|
return {
|
|
248
|
-
status:
|
|
249
|
-
conclusion_kind:
|
|
249
|
+
status: match.status,
|
|
250
|
+
conclusion_kind: match.conclusion_kind,
|
|
250
251
|
};
|
|
251
252
|
}
|
|
252
253
|
if (evidence.operation !== "compare_artifacts")
|
|
@@ -257,9 +258,10 @@ const selectStatic = (evidence, selector) => {
|
|
|
257
258
|
result.changes.items.length !== result.changes.total)
|
|
258
259
|
throw new TypeError("Static/runtime correlation requires complete artifact comparison pagination");
|
|
259
260
|
const matches = result.changes.items.filter(({ logical_path: path }) => path === selector.logical_path);
|
|
260
|
-
|
|
261
|
+
const match = matches.at(0);
|
|
262
|
+
if (matches.length !== 1 || match === undefined)
|
|
261
263
|
throw new TypeError("Artifact selector must resolve exactly one reported delta");
|
|
262
|
-
const status =
|
|
264
|
+
const status = match.classification;
|
|
263
265
|
return {
|
|
264
266
|
status,
|
|
265
267
|
conclusion_kind: status === "contradiction"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { inspectWebPageWithSourceInputSchema } from "./browserObservation.js";
|
|
3
3
|
import { webTextArtifactSchema } from "./webContentArtifact.js";
|
|
4
4
|
const webBundleLimitsSchema = z.object({
|
|
5
5
|
max_findings: z.number().int().min(1).max(10_000).default(1_000),
|
|
@@ -21,12 +21,7 @@ const webBundleLimitsSchema = z.object({
|
|
|
21
21
|
max_original_sources: z.number().int().min(1).max(20_000).default(2_000),
|
|
22
22
|
});
|
|
23
23
|
/** Capture-and-analyze input with separate source and source-map approvals. */
|
|
24
|
-
|
|
25
|
-
.safeExtend({
|
|
26
|
-
include_script_sources: z.literal(true).default(true),
|
|
27
|
-
source_capture_approved: z.literal(true),
|
|
28
|
-
fetch_source_maps: z.boolean().default(false),
|
|
29
|
-
source_map_fetch_approved: z.boolean().default(false),
|
|
24
|
+
const analyzeWebBundleFactsSchema = inspectWebPageWithSourceInputSchema.safeExtend({
|
|
30
25
|
analysis_limits: webBundleLimitsSchema.default({
|
|
31
26
|
max_findings: 1_000,
|
|
32
27
|
max_ast_nodes: 250_000,
|
|
@@ -36,14 +31,19 @@ export const analyzeWebBundleInputSchema = inspectWebPageInputSchema
|
|
|
36
31
|
max_source_map_mappings: 10_000,
|
|
37
32
|
max_original_sources: 2_000,
|
|
38
33
|
}),
|
|
39
|
-
})
|
|
34
|
+
});
|
|
35
|
+
export const analyzeWebBundleInputSchema = z
|
|
36
|
+
.union([
|
|
37
|
+
analyzeWebBundleFactsSchema.safeExtend({
|
|
38
|
+
fetch_source_maps: z.literal(false).default(false),
|
|
39
|
+
source_map_fetch_approved: z.literal(false).default(false),
|
|
40
|
+
}),
|
|
41
|
+
analyzeWebBundleFactsSchema.safeExtend({
|
|
42
|
+
fetch_source_maps: z.literal(true),
|
|
43
|
+
source_map_fetch_approved: z.literal(true),
|
|
44
|
+
}),
|
|
45
|
+
])
|
|
40
46
|
.superRefine((input, context) => {
|
|
41
|
-
if (input.fetch_source_maps && !input.source_map_fetch_approved)
|
|
42
|
-
context.addIssue({
|
|
43
|
-
code: "custom",
|
|
44
|
-
path: ["source_map_fetch_approved"],
|
|
45
|
-
message: "Source-map network fetch requires separate approval",
|
|
46
|
-
});
|
|
47
47
|
if (input.analysis_limits.max_source_map_bytes >
|
|
48
48
|
input.analysis_limits.max_total_source_map_bytes)
|
|
49
49
|
context.addIssue({
|
|
@@ -228,20 +228,23 @@ const accessibilityComparable = (inspection) => {
|
|
|
228
228
|
return { text, nodes, complete };
|
|
229
229
|
};
|
|
230
230
|
const accessibilityProjection = (accessibility, includeText, includeNodes) => {
|
|
231
|
-
const result = {
|
|
232
|
-
total_nodes: accessibility.total_nodes,
|
|
233
|
-
};
|
|
234
231
|
if (!includeNodes)
|
|
235
|
-
return
|
|
232
|
+
return { total_nodes: accessibility.total_nodes };
|
|
236
233
|
const nodeIndexes = new Map(accessibility.nodes.map((node, index) => [node.node_id, index]));
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
234
|
+
return {
|
|
235
|
+
total_nodes: accessibility.total_nodes,
|
|
236
|
+
nodes: accessibility.nodes.map((node) => ({
|
|
237
|
+
parent_index: node.parent_id === null
|
|
238
|
+
? null
|
|
239
|
+
: (nodeIndexes.get(node.parent_id) ?? -1),
|
|
240
|
+
role: node.role,
|
|
241
|
+
ignored: node.ignored,
|
|
242
|
+
states: node.states,
|
|
243
|
+
...(includeText
|
|
244
|
+
? { name: node.name, description: node.description }
|
|
245
|
+
: {}),
|
|
246
|
+
})),
|
|
247
|
+
};
|
|
245
248
|
};
|
|
246
249
|
const storageKeysComparable = (inspection) => sectionsComplete(inspection, ["storage_keys"]);
|
|
247
250
|
const storageComparable = (before, after, keysComplete, usageComplete) => keysComplete &&
|
|
@@ -59,8 +59,7 @@ const emptyInspection = (target, bytes, classification, issues = []) => managedN
|
|
|
59
59
|
"Static inspection does not load or execute target code, so native export resolution is not performed.",
|
|
60
60
|
],
|
|
61
61
|
});
|
|
62
|
-
const readBoundaryInventory = (bytes, pe, limits) => {
|
|
63
|
-
const cli = pe.cli;
|
|
62
|
+
const readBoundaryInventory = (bytes, pe, cli, limits) => {
|
|
64
63
|
const metadataOffset = pe.rvaToOffset(cli.metadata.rva, cli.metadata.size, "cli.metadata");
|
|
65
64
|
const layout = readManagedMetadataLayout(bytes, metadataOffset, cli.metadata.size, limits.maxTableRows);
|
|
66
65
|
const resourceDirectory = {
|
|
@@ -104,7 +103,7 @@ export const inspectManagedNativeBoundariesBytes = (bytes, target, limits) => {
|
|
|
104
103
|
let layout;
|
|
105
104
|
let inventory;
|
|
106
105
|
try {
|
|
107
|
-
({ layout, inventory } = readBoundaryInventory(bytes, pe, limits));
|
|
106
|
+
({ layout, inventory } = readBoundaryInventory(bytes, pe, pe.cli, limits));
|
|
108
107
|
}
|
|
109
108
|
catch (cause) {
|
|
110
109
|
if (!(cause instanceof ManagedReaderFailure))
|