rea-agents 2.0.0 → 2.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 +78 -32
- package/bridge/ghidra/ReaGhidraBridge.java +96 -11
- package/dist/application/ArtifactExtraction.js +1 -1
- package/dist/application/ArtifactInventory/classify.js +42 -0
- package/dist/application/ArtifactInventory/hash.js +43 -0
- package/dist/application/ArtifactInventory/reader.js +41 -0
- package/dist/application/ArtifactInventory/scanCanonical.js +155 -0
- package/dist/application/ArtifactInventory/scanReader.js +124 -0
- package/dist/application/ArtifactInventory/types.js +10 -0
- package/dist/application/ArtifactInventory.js +9 -351
- package/dist/application/AuthorizedArtifactInventory.js +2 -2
- package/dist/application/BinarySession.js +47 -270
- package/dist/application/BinarySessionExecution.js +28 -0
- package/dist/application/BinarySessionOpen.js +39 -0
- package/dist/application/BinarySessionRecords.js +149 -0
- package/dist/application/BinarySessionStatus.js +75 -0
- package/dist/application/CapabilityInventory.js +24 -2
- package/dist/application/ClientRegistrationStatus.js +1 -1
- package/dist/application/CrossVersionInventory.js +8 -2
- package/dist/application/CrossVersionInvestigation.js +1 -23
- package/dist/application/CrossVersionInvestigationCollections.js +23 -0
- package/dist/application/DirectAnalysis.js +47 -44
- package/dist/application/Doctor.js +156 -238
- package/dist/application/DoctorDiagnostics.js +180 -0
- package/dist/application/ElectronBoundaryAnalysis.js +23 -7
- package/dist/application/ElectronBoundaryGraphWindows.js +32 -8
- package/dist/application/EnhancedToolPagination.js +22 -0
- package/dist/application/EnhancedToolTypes.js +4 -0
- package/dist/application/EnhancedTools.js +20 -37
- package/dist/application/InstrumentedJavaScriptReplayHost.js +36 -0
- package/dist/application/InvestigationWorkspaceStore.js +24 -10
- package/dist/application/JavaScriptArtifactAnalysis.js +45 -6
- package/dist/application/JavaScriptArtifactFiles.js +6 -2
- package/dist/application/JavaScriptArtifactGraphBuilder.js +23 -1
- package/dist/application/JavaScriptArtifactGraphBundlers.js +225 -0
- package/dist/application/JavaScriptArtifactGraphContext.js +37 -36
- package/dist/application/JavaScriptArtifactGraphDocuments.js +27 -4
- package/dist/application/JavaScriptArtifactGraphFindings.js +54 -8
- package/dist/application/JavaScriptArtifactGraphStructure.js +29 -101
- package/dist/application/JavaScriptArtifactPathResolution.js +269 -0
- package/dist/application/JavaScriptArtifactReconstruction.js +1 -1
- package/dist/application/JavaScriptJsonModules.js +39 -0
- package/dist/application/JavaScriptModuleRelationships.js +262 -0
- package/dist/application/JavaScriptReplayPermission.js +16 -0
- package/dist/application/JavaScriptReplayService.js +182 -156
- package/dist/application/LinuxHopper.js +10 -0
- package/dist/application/MacHopper.js +22 -11
- package/dist/application/NodeRuntimeCharacterizationService.js +196 -0
- package/dist/application/PermissionAuthority.js +106 -63
- package/dist/application/ProcessCaptureCapability.js +1 -1
- package/dist/application/ProcessCapturePermission.js +13 -0
- package/dist/application/ProcessCli.js +2 -12
- package/dist/application/ProcessHarness.js +1 -1
- package/dist/application/ProjectPermissionStore.js +48 -9
- package/dist/application/RealHopperAssertions.js +76 -0
- package/dist/application/ReconstructionCoverageService.js +69 -0
- package/dist/application/ReconstructionCoverageWorkspaceStore.js +31 -0
- package/dist/application/RuntimeExecutableDiagnostics.js +172 -0
- package/dist/application/Setup.js +147 -259
- package/dist/application/SetupClientConfiguration.js +220 -0
- package/dist/application/SetupClients.js +24 -2
- package/dist/application/SetupPlan.js +123 -12
- package/dist/application/SetupSkill.js +26 -12
- package/dist/application/SupportedClients.js +1 -0
- package/dist/application/Uninstall.js +6 -3
- package/dist/application/WindowsCapabilities.js +86 -0
- package/dist/artifacts/AsarArtifactReader.js +11 -0
- package/dist/browser/BrowserProcessStartup.js +88 -0
- package/dist/browser/CdpCaptureDocuments.js +12 -8
- package/dist/browser/CdpCaptureEventBodyShapes.js +75 -0
- package/dist/browser/CdpCaptureEventHandlers.js +336 -0
- package/dist/browser/CdpCaptureEventHelpers.js +71 -0
- package/dist/browser/CdpCaptureEventState.js +1 -0
- package/dist/browser/CdpCaptureEventTypes.js +1 -0
- package/dist/browser/CdpCaptureEvents.js +29 -496
- package/dist/browser/CdpObservationSession.js +51 -8
- package/dist/browser/CdpPageCapture.js +12 -133
- package/dist/browser/CdpPageCaptureScripts.js +97 -0
- package/dist/browser/CdpPageCaptureWorkers.js +46 -0
- package/dist/browser/CdpWebMcpDiscovery.js +38 -14
- package/dist/browser/PngVisualDiff.js +9 -2
- package/dist/catalogIdentity.js +4 -0
- package/dist/cli/artifactCommands.js +82 -0
- package/dist/cli/coreAnalysisCommands.js +232 -0
- package/dist/cli/managedCommands.js +397 -0
- package/dist/cli/managedProjectGraphCommand.js +24 -0
- package/dist/cli/options.js +9 -0
- package/dist/cli/setupCommands.js +108 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/utilityCommands.js +122 -0
- package/dist/cli.js +10 -768
- package/dist/cliApplicationCommands.js +118 -4
- package/dist/cliBrowserAdvancedCommands.js +73 -16
- package/dist/cliBrowserCommands.js +39 -115
- package/dist/cliCommandNames.js +4 -0
- package/dist/cliElectronCommands.js +33 -62
- package/dist/cliEvidenceCommands.js +13 -2
- package/dist/cliInvestigationCommands.js +53 -10
- package/dist/cliObservationOptions.js +137 -0
- package/dist/cliPolicyCommands.js +80 -46
- package/dist/cliSetup.js +289 -0
- package/dist/config/environment.js +107 -0
- package/dist/config/parseConfig.js +228 -0
- package/dist/config/parsers.js +68 -0
- package/dist/config/permissions.js +30 -0
- package/dist/config/types.js +1 -0
- package/dist/config.js +1 -375
- package/dist/contracts/applicationToolContracts.js +134 -0
- package/dist/contracts/managedToolContracts.js +1 -1
- package/dist/contracts/managedWorkflowToolContracts.js +3 -3
- package/dist/contracts/providerSelection.js +2 -0
- package/dist/contracts/toolContracts.js +2 -2
- package/dist/contracts/toolEffects.js +14 -0
- package/dist/contracts/toolOutputSchemaGroups.js +232 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +327 -0
- package/dist/contracts/toolOutputSchemas.js +2 -550
- package/dist/domain/analysisErrorPresentation.js +234 -0
- package/dist/domain/analysisErrorProjection.js +284 -0
- package/dist/domain/artifactComparison.js +34 -15
- package/dist/domain/binaryTarget.js +87 -37
- package/dist/domain/browserObservation.js +1 -285
- package/dist/domain/browserObservationSchemas.js +286 -0
- package/dist/domain/electronStaticAnalysisBrowser.js +14 -2
- package/dist/domain/errors.js +4 -486
- package/dist/domain/functionComparison.js +4 -165
- package/dist/domain/functionComparisonDimensions.js +164 -0
- package/dist/domain/javascriptApplicationVersionItems.js +18 -6
- package/dist/domain/javascriptApplicationVersionKeys.js +8 -8
- package/dist/domain/javascriptExportInstrumentation.js +97 -0
- package/dist/domain/javascriptFeatureTraversal.js +19 -7
- package/dist/domain/javascriptRuntimeStaticCandidates.js +3 -1
- package/dist/domain/javascriptSemanticAnalysis.js +386 -0
- package/dist/domain/javascriptSemanticIr.js +30 -0
- package/dist/domain/javascriptSemanticProjection.js +366 -0
- package/dist/domain/javascriptSemanticState.js +40 -0
- package/dist/domain/javascriptSemanticTraversal.js +22 -0
- package/dist/domain/javascriptSemanticValues.js +352 -0
- package/dist/domain/javascriptStaticAnalysis.js +5 -221
- package/dist/domain/javascriptStaticAnalysisBundler.js +209 -0
- package/dist/domain/javascriptStaticAnalysisCalls.js +180 -0
- package/dist/domain/javascriptStaticAnalysisHelpers.js +71 -2
- package/dist/domain/knownPageCoverage.js +21 -0
- package/dist/domain/managedApplicationGraph.js +14 -364
- package/dist/domain/managedApplicationGraphCoverage.js +170 -0
- package/dist/domain/managedApplicationGraphNodeCoverage.js +6 -0
- package/dist/domain/managedApplicationGraphNodes.js +336 -0
- package/dist/domain/managedArtifact.js +16 -8
- package/dist/domain/managedMemberComparison.js +37 -391
- package/dist/domain/managedMemberComparisonCoverage.js +72 -0
- package/dist/domain/managedMemberComparisonMatch.js +356 -0
- package/dist/domain/managedNativeVerification.js +27 -389
- package/dist/domain/managedNativeVerificationMatch.js +272 -0
- package/dist/domain/managedNativeVerificationSchemas.js +141 -0
- package/dist/domain/managedReconstruction.js +82 -69
- package/dist/domain/managedRuntimeCorrelation.js +12 -3
- package/dist/domain/nodeRuntimeCharacterization.js +66 -0
- package/dist/domain/permissionPolicy.js +2 -0
- package/dist/domain/reconstructionCoverage.js +387 -0
- package/dist/domain/reconstructionCoverageEvaluation.js +212 -0
- package/dist/domain/reconstructionVerificationSchemas.js +8 -0
- package/dist/domain/runtimeCharacterization.js +85 -0
- package/dist/domain/webBundleAnalyzer.js +3 -409
- package/dist/domain/webBundleAnalyzerAst.js +77 -0
- package/dist/domain/webBundleAnalyzerInspection.js +307 -0
- package/dist/domain/webBundleAnalyzerResult.js +120 -0
- package/dist/dotnet/ManagedArtifactInspector.js +50 -29
- package/dist/dotnet/ManagedMemberInspector.js +51 -785
- package/dist/dotnet/ManagedMemberInspectorCore.js +297 -0
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +427 -0
- package/dist/dotnet/ManagedMemberRows.js +120 -0
- package/dist/dotnet/ManagedMetadataInventory.js +42 -306
- package/dist/dotnet/ManagedMetadataInventoryRows.js +292 -0
- package/dist/dotnet/ManagedMetadataLayout.js +48 -111
- package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
- package/dist/dotnet/ManagedMethodBodyReader.js +143 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +311 -0
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +102 -350
- package/dist/dotnet/ManagedPeReader.js +59 -28
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraClient.js +76 -91
- package/dist/ghidra/GhidraClientStartup.js +29 -0
- package/dist/ghidra/GhidraClientWire.js +34 -0
- package/dist/ghidra/GhidraDefaults.js +1 -1
- package/dist/ghidra/GhidraDiagnostics.js +6 -1
- package/dist/ghidra/GhidraInstallation.js +20 -15
- package/dist/ghidra/GhidraLauncher.js +93 -29
- package/dist/ghidra/GhidraProvider.js +61 -161
- package/dist/ghidra/GhidraProviderCapabilities.js +173 -0
- package/dist/ghidra/GhidraSessionValues.js +2 -0
- package/dist/ghidra/GhidraSocketConnection.js +44 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +30 -0
- package/dist/ghidra/GhidraTransport.js +71 -0
- package/dist/identity.js +3 -2
- package/dist/main/messages.js +5 -0
- package/dist/main/reload.js +49 -0
- package/dist/main/shutdown.js +25 -0
- package/dist/main/startup.js +14 -0
- package/dist/main/state.js +26 -0
- package/dist/main/transport.js +61 -0
- package/dist/main/types.js +1 -0
- package/dist/main.js +35 -146
- package/dist/process/PrivateRuntimeRoot.js +3 -2
- package/dist/process/ProcessOwnership.js +35 -0
- package/dist/process/ProviderProcess.js +2 -0
- package/dist/replay/JavaScriptReplayWorker.js +64 -50
- package/dist/replay/LinuxJavaScriptReplayRunner.js +173 -390
- package/dist/replay/LinuxJavaScriptReplaySandbox.js +140 -0
- package/dist/replay/ReplayOutcome.js +95 -0
- package/dist/replay/ReplayProcessLifecycle.js +71 -0
- package/dist/server/ProcessCaptureElicitation.js +157 -0
- package/dist/server/createServer.js +119 -54
- package/dist/server/registerApplicationTools/characterization.js +57 -0
- package/dist/server/registerApplicationTools/compareVersions.js +34 -0
- package/dist/server/registerApplicationTools/controlledReplay.js +38 -0
- package/dist/server/registerApplicationTools/coverage.js +84 -0
- package/dist/server/registerApplicationTools/helpers.js +42 -0
- package/dist/server/registerApplicationTools/traceFeature.js +26 -0
- package/dist/server/registerApplicationTools/types.js +1 -0
- package/dist/server/registerApplicationTools.js +10 -112
- package/dist/server/registerBrowserTools.js +59 -83
- package/dist/server/registerElectronTools.js +31 -46
- package/dist/server/registerEnhancedTools.js +34 -42
- package/dist/server/registerEvidenceResources.js +54 -0
- package/dist/server/registerInvestigationTools/helpers.js +74 -0
- package/dist/server/registerInvestigationTools/types.js +1 -0
- package/dist/server/registerInvestigationTools.js +83 -116
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +65 -0
- package/dist/server/registerManagedWorkflowTools/contract.js +8 -0
- package/dist/server/registerManagedWorkflowTools/evidence.js +43 -0
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +39 -0
- package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +39 -0
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +52 -0
- package/dist/server/registerManagedWorkflowTools/types.js +1 -0
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +75 -0
- package/dist/server/registerManagedWorkflowTools.js +10 -274
- package/dist/server/registerOfficialTools.js +73 -59
- package/dist/server/registerSessionRecordTools.js +137 -0
- package/dist/server/registerSessionStatusTool.js +2 -1
- package/dist/server/registerSessionTools.js +60 -164
- package/dist/server/sessionAvailabilityPolicy.js +10 -0
- package/dist/server/toolRegistrationOptions.js +101 -3
- package/dist/server/toolResult.js +5 -0
- package/package.json +10 -11
- package/skills/{rea-analysis → reverse-engineer-anything}/SKILL.md +20 -7
- package/scripts/prepare-node-pty.mjs +0 -35
- package/scripts/rebuild-native.mjs +0 -22
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { browserCompletenessSchema } from "./browserCompleteness.js";
|
|
3
|
+
import { webTextArtifactSchema } from "./webContentArtifact.js";
|
|
4
|
+
import { jsonShapeSchema } from "./jsonShape.js";
|
|
5
|
+
const browserVersionSchema = z.object({
|
|
6
|
+
product: z.string(),
|
|
7
|
+
protocol_version: z.string(),
|
|
8
|
+
revision: z.string(),
|
|
9
|
+
user_agent: z.string(),
|
|
10
|
+
js_version: z.string(),
|
|
11
|
+
});
|
|
12
|
+
const browserTargetSchema = z.object({
|
|
13
|
+
target_id: z.string(),
|
|
14
|
+
type: z.string(),
|
|
15
|
+
title: z.string(),
|
|
16
|
+
url: z.string(),
|
|
17
|
+
origin: z.string(),
|
|
18
|
+
attached: z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
/** Bounded and policy-filtered browser target discovery result. */
|
|
21
|
+
export const browserTargetListSchema = z.object({
|
|
22
|
+
schema_version: z.literal(1),
|
|
23
|
+
browser: browserVersionSchema,
|
|
24
|
+
targets: z.object({
|
|
25
|
+
items: z.array(browserTargetSchema),
|
|
26
|
+
offset: z.number().int().min(0),
|
|
27
|
+
limit: z.number().int().min(1),
|
|
28
|
+
total: z.number().int().min(0),
|
|
29
|
+
next_offset: z.number().int().min(0).nullable(),
|
|
30
|
+
has_more: z.boolean(),
|
|
31
|
+
}),
|
|
32
|
+
excluded: z.object({
|
|
33
|
+
disallowed_origin: z.number().int().min(0),
|
|
34
|
+
unsupported_url: z.number().int().min(0),
|
|
35
|
+
non_page: z.number().int().min(0),
|
|
36
|
+
}),
|
|
37
|
+
limitations: z.array(z.string()),
|
|
38
|
+
});
|
|
39
|
+
const browserFrameSchema = z.object({
|
|
40
|
+
frame_id: z.string(),
|
|
41
|
+
parent_frame_id: z.string().nullable(),
|
|
42
|
+
url: z.string(),
|
|
43
|
+
origin: z.string().nullable(),
|
|
44
|
+
});
|
|
45
|
+
const browserDomNodeSchema = z.object({
|
|
46
|
+
index: z.number().int().min(0),
|
|
47
|
+
parent_index: z.number().int().min(-1),
|
|
48
|
+
node_type: z.number().int().min(0),
|
|
49
|
+
node_name: z.string(),
|
|
50
|
+
node_value_length: z.number().int().min(0),
|
|
51
|
+
attribute_names: z.array(z.string()),
|
|
52
|
+
});
|
|
53
|
+
const browserAxNodeSchema = z.object({
|
|
54
|
+
node_id: z.string(),
|
|
55
|
+
parent_id: z.string().nullable(),
|
|
56
|
+
role: z.string().nullable(),
|
|
57
|
+
name: z.string().nullable(),
|
|
58
|
+
description: z.string().nullable(),
|
|
59
|
+
ignored: z.boolean(),
|
|
60
|
+
});
|
|
61
|
+
const browserScriptSourceSchema = z.discriminatedUnion("included", [
|
|
62
|
+
z.object({ included: z.literal(false), reason: z.string() }),
|
|
63
|
+
z.object({
|
|
64
|
+
included: z.literal(true),
|
|
65
|
+
artifact: webTextArtifactSchema,
|
|
66
|
+
}),
|
|
67
|
+
]);
|
|
68
|
+
const browserResourceReconciliationSchema = z.discriminatedUnion("status", [
|
|
69
|
+
z.object({ status: z.literal("exact"), resource_key: z.string() }),
|
|
70
|
+
z.object({
|
|
71
|
+
status: z.literal("ambiguous"),
|
|
72
|
+
candidate_resource_keys: z.array(z.string()),
|
|
73
|
+
}),
|
|
74
|
+
z.object({
|
|
75
|
+
status: z.literal("unmatched"),
|
|
76
|
+
reason: z.literal("no_exact_sanitized_url"),
|
|
77
|
+
}),
|
|
78
|
+
]);
|
|
79
|
+
const browserScriptSchema = z.object({
|
|
80
|
+
script_key: z.string().regex(/^scr_[a-f0-9]{64}(?:_[0-9]+)?$/u),
|
|
81
|
+
frame_id: z.string().nullable().default(null),
|
|
82
|
+
url: z.string(),
|
|
83
|
+
origin: z.string().nullable(),
|
|
84
|
+
cdp_hash: z.string(),
|
|
85
|
+
length: z.number().int().min(0),
|
|
86
|
+
is_module: z.boolean(),
|
|
87
|
+
language: z.string().nullable(),
|
|
88
|
+
source_map_url: z.string().nullable(),
|
|
89
|
+
resource_reconciliation: browserResourceReconciliationSchema,
|
|
90
|
+
source: browserScriptSourceSchema,
|
|
91
|
+
});
|
|
92
|
+
const browserResourceSchema = z.object({
|
|
93
|
+
resource_key: z.string().regex(/^res_[a-f0-9]{64}$/u),
|
|
94
|
+
url: z.string(),
|
|
95
|
+
origin: z.string().nullable(),
|
|
96
|
+
type: z.string(),
|
|
97
|
+
mime_type: z.string(),
|
|
98
|
+
content_size: z.number().min(0).nullable(),
|
|
99
|
+
});
|
|
100
|
+
const browserNetworkRequestSchema = z.object({
|
|
101
|
+
request_id: z.string(),
|
|
102
|
+
url: z.string(),
|
|
103
|
+
origin: z.string().nullable(),
|
|
104
|
+
method: z.string(),
|
|
105
|
+
resource_type: z.string().nullable(),
|
|
106
|
+
status: z.number().nullable(),
|
|
107
|
+
mime_type: z.string().nullable(),
|
|
108
|
+
encoded_data_length: z.number().min(0).nullable(),
|
|
109
|
+
initiator: z.object({
|
|
110
|
+
type: z.string(),
|
|
111
|
+
url: z.string().nullable(),
|
|
112
|
+
line: z.number().int().min(0).nullable(),
|
|
113
|
+
column: z.number().int().min(0).nullable(),
|
|
114
|
+
}),
|
|
115
|
+
body_shapes: z.object({
|
|
116
|
+
status: z.enum([
|
|
117
|
+
"not_approved",
|
|
118
|
+
"included",
|
|
119
|
+
"partial",
|
|
120
|
+
"unavailable",
|
|
121
|
+
"truncated",
|
|
122
|
+
]),
|
|
123
|
+
request: jsonShapeSchema.nullable(),
|
|
124
|
+
response: jsonShapeSchema.nullable(),
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
127
|
+
const browserConsoleEventSchema = z.object({
|
|
128
|
+
type: z.string(),
|
|
129
|
+
timestamp: z.number(),
|
|
130
|
+
argument_types: z.array(z.string()),
|
|
131
|
+
url: z.string().nullable(),
|
|
132
|
+
line: z.number().int().min(0).nullable(),
|
|
133
|
+
column: z.number().int().min(0).nullable(),
|
|
134
|
+
text_capture: z.object({
|
|
135
|
+
status: z.enum(["not_approved", "included", "truncated"]),
|
|
136
|
+
values: z.array(z.object({
|
|
137
|
+
argument_index: z.number().int().min(0),
|
|
138
|
+
type: z.string(),
|
|
139
|
+
text: z.string(),
|
|
140
|
+
})),
|
|
141
|
+
retained_bytes: z.number().int().min(0),
|
|
142
|
+
truncated_values: z.number().int().min(0),
|
|
143
|
+
}),
|
|
144
|
+
});
|
|
145
|
+
const browserWebSocketEventSchema = z.object({
|
|
146
|
+
request_id: z.string(),
|
|
147
|
+
direction: z.enum(["sent", "received"]),
|
|
148
|
+
opcode: z.number().int().min(0),
|
|
149
|
+
payload_bytes: z.number().int().min(0),
|
|
150
|
+
payload_shape: z
|
|
151
|
+
.object({
|
|
152
|
+
format: z.enum(["json", "text", "binary"]),
|
|
153
|
+
json_shape: jsonShapeSchema.nullable(),
|
|
154
|
+
truncated: z.boolean(),
|
|
155
|
+
})
|
|
156
|
+
.nullable(),
|
|
157
|
+
});
|
|
158
|
+
const browserWorkerSchema = z.object({
|
|
159
|
+
target_id: z.string(),
|
|
160
|
+
type: z.string(),
|
|
161
|
+
url: z.string(),
|
|
162
|
+
origin: z.string().nullable(),
|
|
163
|
+
attached: z.boolean(),
|
|
164
|
+
opener_target_id: z.string().nullable().default(null),
|
|
165
|
+
parent_frame_id: z.string().nullable().default(null),
|
|
166
|
+
});
|
|
167
|
+
const browserCspSourceSchema = z.object({
|
|
168
|
+
kind: z.enum([
|
|
169
|
+
"keyword",
|
|
170
|
+
"scheme",
|
|
171
|
+
"approved_origin",
|
|
172
|
+
"external_origin",
|
|
173
|
+
"other",
|
|
174
|
+
]),
|
|
175
|
+
value: z.string().nullable(),
|
|
176
|
+
});
|
|
177
|
+
const browserLinkMetadataSchema = z.object({
|
|
178
|
+
href: z.string().nullable(),
|
|
179
|
+
destination_scope: z.enum(["approved", "outside_policy", "unsupported"]),
|
|
180
|
+
rel: z.array(z.string()),
|
|
181
|
+
as: z.string().nullable(),
|
|
182
|
+
type: z.string().nullable(),
|
|
183
|
+
crossorigin: z.string().nullable(),
|
|
184
|
+
});
|
|
185
|
+
const browserAgentHintSchema = z.object({
|
|
186
|
+
mechanism: z.enum([
|
|
187
|
+
"link_rel",
|
|
188
|
+
"dom_link_rel",
|
|
189
|
+
"well_known_resource",
|
|
190
|
+
"response_header",
|
|
191
|
+
]),
|
|
192
|
+
declaration: z.string(),
|
|
193
|
+
url: z.string().nullable(),
|
|
194
|
+
trust: z.literal("page-declared-untrusted"),
|
|
195
|
+
});
|
|
196
|
+
const browserSafeMetadataSchema = z.object({
|
|
197
|
+
responses: z.array(z.object({
|
|
198
|
+
request_id: z.string(),
|
|
199
|
+
url: z.string(),
|
|
200
|
+
mime_type: z.string().nullable(),
|
|
201
|
+
content_length: z.number().int().min(0).nullable(),
|
|
202
|
+
content_encoding: z.string().nullable(),
|
|
203
|
+
csp: z.object({
|
|
204
|
+
directives: z.array(z.object({
|
|
205
|
+
name: z.string(),
|
|
206
|
+
sources: z.array(browserCspSourceSchema),
|
|
207
|
+
})),
|
|
208
|
+
nonce_count: z.number().int().min(0),
|
|
209
|
+
hash_count: z.number().int().min(0),
|
|
210
|
+
}),
|
|
211
|
+
links: z.array(browserLinkMetadataSchema),
|
|
212
|
+
policies: z.object({
|
|
213
|
+
coop: z.string().nullable(),
|
|
214
|
+
coep: z.string().nullable(),
|
|
215
|
+
corp: z.string().nullable(),
|
|
216
|
+
referrer_policy: z.string().nullable(),
|
|
217
|
+
x_content_type_options: z.string().nullable(),
|
|
218
|
+
permissions_policy_features: z.array(z.string()),
|
|
219
|
+
}),
|
|
220
|
+
})),
|
|
221
|
+
dom_urls: z.array(z.object({
|
|
222
|
+
node_index: z.number().int().min(0),
|
|
223
|
+
attribute: z.enum(["href", "src", "action", "formaction", "poster"]),
|
|
224
|
+
url: z.string().nullable(),
|
|
225
|
+
destination_scope: z.enum(["approved", "outside_policy", "unsupported"]),
|
|
226
|
+
})),
|
|
227
|
+
agent_hints: z.array(browserAgentHintSchema),
|
|
228
|
+
excluded_dom_urls: z.number().int().min(0),
|
|
229
|
+
headers_allowlisted: z.literal(true),
|
|
230
|
+
});
|
|
231
|
+
/** Provider-neutral normalized result for one passive web-page observation. */
|
|
232
|
+
export const webPageInspectionSchema = z.object({
|
|
233
|
+
schema_version: z.literal(2),
|
|
234
|
+
browser: browserVersionSchema,
|
|
235
|
+
target: browserTargetSchema,
|
|
236
|
+
capture_window: z.object({
|
|
237
|
+
started_at: z.iso.datetime(),
|
|
238
|
+
ended_at: z.iso.datetime(),
|
|
239
|
+
observation_ms: z.number().int().min(0),
|
|
240
|
+
}),
|
|
241
|
+
completeness: browserCompletenessSchema,
|
|
242
|
+
frames: z.array(browserFrameSchema),
|
|
243
|
+
dom: z.object({
|
|
244
|
+
total_nodes: z.number().int().min(0),
|
|
245
|
+
nodes: z.array(browserDomNodeSchema),
|
|
246
|
+
}),
|
|
247
|
+
accessibility: z.object({
|
|
248
|
+
total_nodes: z.number().int().min(0),
|
|
249
|
+
text_capture: z.object({
|
|
250
|
+
status: z.enum(["not_approved", "included", "truncated", "unavailable"]),
|
|
251
|
+
retained_bytes: z.number().int().min(0),
|
|
252
|
+
excluded_fields: z.number().int().min(0),
|
|
253
|
+
truncated_fields: z.number().int().min(0),
|
|
254
|
+
}),
|
|
255
|
+
nodes: z.array(browserAxNodeSchema),
|
|
256
|
+
}),
|
|
257
|
+
scripts: z.object({
|
|
258
|
+
total: z.number().int().min(0),
|
|
259
|
+
items: z.array(browserScriptSchema),
|
|
260
|
+
}),
|
|
261
|
+
resources: z.array(browserResourceSchema),
|
|
262
|
+
network: z.object({
|
|
263
|
+
requests: z.array(browserNetworkRequestSchema),
|
|
264
|
+
websocket_events: z.array(browserWebSocketEventSchema),
|
|
265
|
+
coverage_started_at: z.iso.datetime(),
|
|
266
|
+
prior_activity_available: z.literal(false),
|
|
267
|
+
}),
|
|
268
|
+
console: z.object({
|
|
269
|
+
events: z.array(browserConsoleEventSchema),
|
|
270
|
+
coverage_started_at: z.iso.datetime(),
|
|
271
|
+
prior_activity_available: z.literal(false),
|
|
272
|
+
}),
|
|
273
|
+
workers: z.array(browserWorkerSchema),
|
|
274
|
+
metadata: browserSafeMetadataSchema,
|
|
275
|
+
storage: z.object({
|
|
276
|
+
origin: z.string(),
|
|
277
|
+
usage_bytes: z.number().min(0).nullable(),
|
|
278
|
+
quota_bytes: z.number().min(0).nullable(),
|
|
279
|
+
local_storage_keys: z.array(z.string()),
|
|
280
|
+
session_storage_keys: z.array(z.string()),
|
|
281
|
+
indexed_db_names: z.array(z.string()),
|
|
282
|
+
cache_names: z.array(z.string()),
|
|
283
|
+
values_redacted: z.literal(true),
|
|
284
|
+
}),
|
|
285
|
+
limitations: z.array(z.string()),
|
|
286
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { boundedExpression, collectContextBridgeMembers, electronStaticValue, objectProperty, } from "./electronStaticAnalysisValues.js";
|
|
3
3
|
import { addLocatedFinding } from "./javascriptStaticAnalysisFindings.js";
|
|
4
|
-
import { argumentNode, calleeName, compareCodePoints, propertyName, range, staticPath, } from "./javascriptStaticAnalysisHelpers.js";
|
|
4
|
+
import { argumentNode, calleeName, compareCodePoints, propertyName, range, staticPath, staticPathResolutionContext, } from "./javascriptStaticAnalysisHelpers.js";
|
|
5
5
|
const MAX_WEB_PREFERENCES = 64;
|
|
6
6
|
/** Inspect BrowserWindow, contextBridge, and utility-process syntax. */
|
|
7
7
|
export const inspectElectronBrowserNode = (node, context) => {
|
|
@@ -29,6 +29,7 @@ const inspectBrowserWindow = (node, context) => {
|
|
|
29
29
|
web_preferences: collected.preferences,
|
|
30
30
|
omitted_web_preferences: collected.omitted,
|
|
31
31
|
preload_path: collected.preloadPath,
|
|
32
|
+
preload_resolution_context: collected.preloadResolutionContext,
|
|
32
33
|
module_key: null,
|
|
33
34
|
location: range(node),
|
|
34
35
|
};
|
|
@@ -45,6 +46,7 @@ const collectWindowOptions = (source, options) => {
|
|
|
45
46
|
status: options === undefined ? "missing" : "dynamic",
|
|
46
47
|
preferences: [],
|
|
47
48
|
preloadPath: null,
|
|
49
|
+
preloadResolutionContext: null,
|
|
48
50
|
unknown: options === undefined ? 0 : 1,
|
|
49
51
|
omitted: 0,
|
|
50
52
|
};
|
|
@@ -54,6 +56,7 @@ const collectWindowOptions = (source, options) => {
|
|
|
54
56
|
status: "missing",
|
|
55
57
|
preferences: [],
|
|
56
58
|
preloadPath: null,
|
|
59
|
+
preloadResolutionContext: null,
|
|
57
60
|
unknown: 0,
|
|
58
61
|
omitted: 0,
|
|
59
62
|
};
|
|
@@ -62,6 +65,7 @@ const collectWindowOptions = (source, options) => {
|
|
|
62
65
|
status: "dynamic",
|
|
63
66
|
preferences: [],
|
|
64
67
|
preloadPath: null,
|
|
68
|
+
preloadResolutionContext: null,
|
|
65
69
|
unknown: 1,
|
|
66
70
|
omitted: 0,
|
|
67
71
|
};
|
|
@@ -71,6 +75,7 @@ const collectWebPreferences = (source, object) => {
|
|
|
71
75
|
const preferences = [];
|
|
72
76
|
let unknown = 0;
|
|
73
77
|
let preloadPath = null;
|
|
78
|
+
let preloadResolutionContext = null;
|
|
74
79
|
for (const property of object.properties) {
|
|
75
80
|
if (t.isSpreadElement(property)) {
|
|
76
81
|
unknown += 1;
|
|
@@ -98,8 +103,10 @@ const collectWebPreferences = (source, object) => {
|
|
|
98
103
|
continue;
|
|
99
104
|
}
|
|
100
105
|
const path = name === "preload" ? staticPath(property.value) : undefined;
|
|
101
|
-
if (path !== undefined)
|
|
106
|
+
if (path !== undefined) {
|
|
102
107
|
preloadPath = path;
|
|
108
|
+
preloadResolutionContext = staticPathResolutionContext(property.value);
|
|
109
|
+
}
|
|
103
110
|
const value = path === undefined
|
|
104
111
|
? electronStaticValue(source, property.value)
|
|
105
112
|
: { status: "literal", value: path, expression: null };
|
|
@@ -112,6 +119,7 @@ const collectWebPreferences = (source, object) => {
|
|
|
112
119
|
status: "object-literal",
|
|
113
120
|
preferences: preferences.slice(0, MAX_WEB_PREFERENCES),
|
|
114
121
|
preloadPath,
|
|
122
|
+
preloadResolutionContext,
|
|
115
123
|
unknown,
|
|
116
124
|
omitted: Math.max(0, preferences.length - MAX_WEB_PREFERENCES),
|
|
117
125
|
};
|
|
@@ -162,6 +170,9 @@ const inspectUtilityProcess = (node, context) => {
|
|
|
162
170
|
return;
|
|
163
171
|
const moduleNode = argumentNode(node.arguments[0]);
|
|
164
172
|
const modulePath = moduleNode === undefined ? undefined : staticPath(moduleNode);
|
|
173
|
+
const moduleResolutionContext = modulePath === undefined || moduleNode === undefined
|
|
174
|
+
? null
|
|
175
|
+
: staticPathResolutionContext(moduleNode);
|
|
165
176
|
const options = argumentNode(node.arguments[2]);
|
|
166
177
|
const serviceName = t.isObjectExpression(options) &&
|
|
167
178
|
objectProperty(options, "serviceName") !== undefined
|
|
@@ -171,6 +182,7 @@ const inspectUtilityProcess = (node, context) => {
|
|
|
171
182
|
context.accumulator.unknownFindings += 1;
|
|
172
183
|
const finding = {
|
|
173
184
|
module_path: modulePath ?? null,
|
|
185
|
+
module_resolution_context: moduleResolutionContext,
|
|
174
186
|
module_expression: modulePath === undefined
|
|
175
187
|
? boundedExpression(context.source, moduleNode)
|
|
176
188
|
: null,
|