@mlvscan/wasm-core 1.3.0 → 1.3.2

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 CHANGED
@@ -104,7 +104,7 @@ const result = await scanAssemblyWithConfig(bytes, 'MyMod.dll', {
104
104
  | `isMockScanner()` | `boolean` | True when running in mock mode. |
105
105
  | `getScannerStatus()` | `ScannerStatus` | Full status snapshot — ready, mock, explicit mock, and init error. |
106
106
  | `getScannerVersion()` | `Promise<string>` | Scanner engine version (e.g. `"1.1.7"`). Returns `"1.0.0-mock"` in mock mode. |
107
- | `getSchemaVersion()` | `Promise<string>` | Result schema version (e.g. `"1.0.0"`). |
107
+ | `getSchemaVersion()` | `Promise<string>` | Result schema version (e.g. `"1.1.0"`). |
108
108
  | `getInitError()` | `Error \| null` | The error that caused WASM fallback, or null if healthy. |
109
109
 
110
110
  ## Scan Modes
@@ -145,13 +145,14 @@ The root object returned by all scan functions.
145
145
  ```ts
146
146
  interface ScanResult {
147
147
  schemaVersion: string
148
- metadata: ScanMetadata // Scanner version, timestamp, scan mode, platform
148
+ metadata: ScanMetadata // Core/platform/scanner versions, timestamp, scan mode, platform
149
149
  input: ScanInput // File name, size, optional SHA-256
150
150
  summary: ScanSummary // Total findings and counts by severity
151
151
  findings: Finding[] // Individual security findings
152
152
  callChains?: CallChain[] // Detailed mode: execution paths
153
153
  dataFlows?: DataFlowChain[] // Developer mode: source-to-sink data flows
154
154
  developerGuidance?: DeveloperGuidance[] // Developer mode: remediation suggestions
155
+ threatFamilies?: ThreatFamily[] // Optional malware family classification matches
155
156
  }
156
157
  ```
157
158
 
@@ -159,11 +160,18 @@ interface ScanResult {
159
160
 
160
161
  ```ts
161
162
  interface Finding {
163
+ id?: string
162
164
  ruleId?: string
163
165
  description: string
164
166
  severity: 'Low' | 'Medium' | 'High' | 'Critical'
165
167
  location: string // Type/method name or file:line
166
168
  codeSnippet?: string
169
+ riskScore?: number
170
+ callChainId?: string
171
+ dataFlowChainId?: string
172
+ developerGuidance?: DeveloperGuidance
173
+ callChain?: CallChain
174
+ dataFlowChain?: DataFlowChain
167
175
  }
168
176
  ```
169
177
 
Binary file
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "mainAssemblyName": "MLVScan.WASM.dll",
3
3
  "resources": {
4
- "hash": "sha256-S9I9g3OEWVVXD+q9ftG1DyITG+uRCXv7z2NLRQP/A/Q=",
4
+ "hash": "sha256-WzaSqsHY/ngA9UnAUjRQExmlVfKt/FZKcrg6r191+KE=",
5
5
  "jsModuleNative": {
6
6
  "dotnet.native.js": "sha256-clxzGaAFwcQ6QWhwQ7dzpD9ktR/87yTache3B45gqoQ="
7
7
  },
@@ -9,7 +9,7 @@
9
9
  "dotnet.runtime.js": "sha256-TGUqQm2/C+r+yZ5BCjd72qyLw9wv0KPFKzKXk/giiyY="
10
10
  },
11
11
  "wasmNative": {
12
- "dotnet.native.wasm": "sha256-1r/HLMZN8wCaUAeJ64VS4EurUw6l/LOurifpBTQJwTs="
12
+ "dotnet.native.wasm": "sha256-PfaTGtSMdfmgXwONKJpmizaQAAEZ8/FrXU/wN3V8u54="
13
13
  },
14
14
  "wasmSymbols": {
15
15
  "dotnet.native.js.symbols": "sha256-/ELUOKLImoJAjzIqE+KihhRrJ03tbCU4XEx8ed80i28="
@@ -20,21 +20,21 @@
20
20
  "icudt_no_CJK.dat": "sha256-L7sV7NEYP37/Qr2FPCePo5cJqRgTXRwGHuwF5Q+0Nfs="
21
21
  },
22
22
  "assembly": {
23
- "MLVScan.Core.wasm": "sha256-bcRSGCccOVhJ7/OnmL+dYpnqZeSb4qWCgAkKy3yoU1w=",
24
- "MLVScan.WASM.wasm": "sha256-2FCjgRO/c5Oqzj9TKqLclanWvfToeL+yx/Gs4YYJNEg=",
23
+ "MLVScan.Core.wasm": "sha256-UOVEukjFMh9C0o56flSpP0COom+zTANQ5aWX7eYJRws=",
24
+ "MLVScan.WASM.wasm": "sha256-zHbvE/pqdDhZDh0Rcb4g6bwI33DzaktmppYrugorFrY=",
25
25
  "Mono.Cecil.wasm": "sha256-Wb+vzfNGLnGGDRhJupS658/i47mVwABGEw9O0N97dlY=",
26
- "System.Collections.Concurrent.wasm": "sha256-eN14sCdgiwv1l3/db6DYyAZeqPeCzrvBhgjUTJ9Tt50=",
26
+ "System.Collections.Concurrent.wasm": "sha256-wPVt+aIQOacLbnApfKS4CEzdPtO2romuWNhPI/BrfHw=",
27
27
  "System.Collections.wasm": "sha256-TRwwb/PWxTAKfplBNqMkn14z5rNLvuy459MunrnseDo=",
28
28
  "System.IO.Compression.wasm": "sha256-zPnVmOjOHN/V1tNLjZurM9T/xj1LXcVlKv+emtlb3gA=",
29
- "System.Linq.wasm": "sha256-EaoN/Pq8kexTC9+lrF3dsOItUMaSTH/m800NJbFN1gU=",
29
+ "System.Linq.wasm": "sha256-6ZZSoscz648hxEttQf2qnpT8NL3KWI5iQpw8xgFCzoM=",
30
30
  "System.Memory.wasm": "sha256-csnkwt/JrsppyyW/C58TooGjK2jHvla7al1hV1pbTm4=",
31
- "System.Private.CoreLib.wasm": "sha256-A5Lw0hoErVlyCqJTENA4AxGHGQ6th5IDN2bUCSVvHL8=",
31
+ "System.Private.CoreLib.wasm": "sha256-4YKIybhVOZXF2BNG+gFHVQNY43dFF3PFAcxMadtkDRA=",
32
32
  "System.Private.Uri.wasm": "sha256-Bp03tn762qScySUTOuLj6kB8+wrYiW5mmtkkUunGdoE=",
33
33
  "System.Runtime.InteropServices.JavaScript.wasm": "sha256-knh9wD83/GTpX28IRzoUJy42zEAtXZdBUcckFTm6bzw=",
34
34
  "System.Security.Cryptography.wasm": "sha256-1yetTxYoa9Mv2JdPd07A9bKVQKSs1o/cCS66raJYlMQ=",
35
35
  "System.Text.Encodings.Web.wasm": "sha256-nPDcUnKJT3K4bYAjeaZI+9dn3OmAWOVz87kkXfy7znA=",
36
36
  "System.Text.Json.wasm": "sha256-YqFU/f7TzL6PVK+O6A8w9jacqj/wZV9AhaJVvQuWNYI=",
37
- "System.Text.RegularExpressions.wasm": "sha256-DTmagJTxx7Gf9S3zUZ0drS+twu2qoMpVIHtoWPT85oA="
37
+ "System.Text.RegularExpressions.wasm": "sha256-siRj+T2Ah8aAKSudsqa7A0+kHH9PjRmdcxD8cWlZtVo="
38
38
  },
39
39
  "vfs": {
40
40
  "runtimeconfig.bin": {
Binary file
@@ -0,0 +1,132 @@
1
+ export type CallChainNodeType = 'EntryPoint' | 'IntermediateCall' | 'SuspiciousDeclaration';
2
+ export type DataFlowNodeType = 'Source' | 'Transform' | 'Sink' | 'Intermediate';
3
+ export type DataFlowPattern = 'Legitimate' | 'DownloadAndExecute' | 'DataExfiltration' | 'DynamicCodeLoading' | 'CredentialTheft' | 'RemoteConfigLoad' | 'ObfuscatedPersistence' | 'EmbeddedResourceDropAndExecute' | 'Unknown';
4
+ export type FindingVisibility = 'Default' | 'Advanced';
5
+ export type ScanMode = 'summary' | 'detailed' | 'developer';
6
+ export type ScanPlatform = 'core' | 'wasm' | 'cli' | 'server' | 'desktop' | 'mcp';
7
+ export declare const MLVSCAN_SCHEMA_VERSION: "1.2.0";
8
+ export type SchemaVersion = typeof MLVSCAN_SCHEMA_VERSION;
9
+ export type Severity = 'Low' | 'Medium' | 'High' | 'Critical';
10
+ export type ThreatDispositionClassification = 'Clean' | 'Suspicious' | 'KnownThreat';
11
+ export type ThreatMatchKind = 'ExactSampleHash' | 'BehaviorVariant';
12
+ export interface ScanResult {
13
+ schemaVersion: SchemaVersion;
14
+ metadata: ScanMetadata;
15
+ input: ScanInput;
16
+ summary: ScanSummary;
17
+ findings: Finding[];
18
+ callChains?: CallChain[] | null;
19
+ dataFlows?: DataFlowChain[] | null;
20
+ developerGuidance?: DeveloperGuidance[] | null;
21
+ threatFamilies?: ThreatFamily[] | null;
22
+ disposition?: ThreatDisposition | null;
23
+ }
24
+ export interface CallChain {
25
+ id?: string | null;
26
+ ruleId?: string | null;
27
+ description: string;
28
+ severity: Severity;
29
+ nodes: CallChainNode[];
30
+ }
31
+ export interface CallChainNode {
32
+ nodeType: CallChainNodeType;
33
+ location: string;
34
+ description: string;
35
+ codeSnippet?: string | null;
36
+ }
37
+ export interface DataFlowChain {
38
+ id?: string | null;
39
+ description: string;
40
+ severity: Severity;
41
+ pattern: DataFlowPattern;
42
+ sourceVariable?: string | null;
43
+ methodLocation?: string | null;
44
+ isCrossMethod: boolean;
45
+ isSuspicious: boolean;
46
+ callDepth: number;
47
+ involvedMethods?: string[] | null;
48
+ nodes: DataFlowNode[];
49
+ }
50
+ export interface DataFlowNode {
51
+ nodeType: DataFlowNodeType;
52
+ location: string;
53
+ operation: string;
54
+ dataDescription: string;
55
+ instructionOffset: number;
56
+ methodKey?: string | null;
57
+ isMethodBoundary: boolean;
58
+ targetMethodKey?: string | null;
59
+ codeSnippet?: string | null;
60
+ }
61
+ export interface DeveloperGuidance {
62
+ ruleId?: string | null;
63
+ ruleIds?: string[] | null;
64
+ remediation: string;
65
+ documentationUrl?: string | null;
66
+ alternativeApis?: string[] | null;
67
+ isRemediable: boolean;
68
+ }
69
+ export interface Finding {
70
+ id?: string | null;
71
+ ruleId?: string | null;
72
+ description: string;
73
+ severity: Severity;
74
+ location: string;
75
+ codeSnippet?: string | null;
76
+ riskScore?: number | null;
77
+ callChainId?: string | null;
78
+ dataFlowChainId?: string | null;
79
+ developerGuidance?: DeveloperGuidance | null;
80
+ callChain?: CallChain | null;
81
+ dataFlowChain?: DataFlowChain | null;
82
+ visibility?: FindingVisibility | null;
83
+ }
84
+ export interface ScanInput {
85
+ fileName: string;
86
+ sizeBytes: number;
87
+ sha256Hash?: string | null;
88
+ }
89
+ export interface ScanMetadata {
90
+ coreVersion: string;
91
+ platformVersion: string;
92
+ timestamp: string;
93
+ scanMode: ScanMode;
94
+ platform: ScanPlatform;
95
+ scannerVersion: string;
96
+ }
97
+ export interface ScanSummary {
98
+ totalFindings: number;
99
+ countBySeverity: Record<string, number>;
100
+ triggeredRules: string[];
101
+ }
102
+ export interface ThreatDisposition {
103
+ classification: ThreatDispositionClassification;
104
+ headline: string;
105
+ summary: string;
106
+ blockingRecommended: boolean;
107
+ primaryThreatFamilyId?: string | null;
108
+ relatedFindingIds: string[];
109
+ }
110
+ export interface ThreatFamily {
111
+ familyId: string;
112
+ variantId: string;
113
+ displayName: string;
114
+ summary: string;
115
+ matchKind: ThreatMatchKind;
116
+ confidence: number;
117
+ exactHashMatch: boolean;
118
+ matchedRules: string[];
119
+ advisorySlugs: string[];
120
+ evidence: ThreatFamilyEvidence[];
121
+ }
122
+ export interface ThreatFamilyEvidence {
123
+ kind: string;
124
+ value: string;
125
+ ruleId?: string | null;
126
+ location?: string | null;
127
+ callChainId?: string | null;
128
+ dataFlowChainId?: string | null;
129
+ pattern?: string | null;
130
+ methodLocation?: string | null;
131
+ confidence?: number | null;
132
+ }
@@ -0,0 +1,3 @@
1
+ // <auto-generated />
2
+ // Generated by MLVScan.SchemaGen. Do not edit manually.
3
+ export const MLVSCAN_SCHEMA_VERSION = '1.2.0';
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  * const result = await scanAssembly(dllBytes, 'MyMod.dll')
19
19
  * ```
20
20
  */
21
- import type { ScanConfigInput, ScanResult } from './types';
21
+ import { type ScanConfigInput, type ScanResult } from './types.js';
22
22
  /**
23
23
  * Options for initializing the WASM scanner.
24
24
  *
@@ -118,8 +118,8 @@ export declare function getScannerStatus(): ScannerStatus;
118
118
  */
119
119
  export declare function getScannerVersion(): Promise<string>;
120
120
  /**
121
- * Returns the scan result schema version (e.g. `"1.0.0"`). In mock mode returns
122
- * `"1.0.0"`. Initializes the scanner if not yet initialized.
121
+ * Returns the scan result schema version (e.g. `"1.2.0"`). In mock mode returns
122
+ * the generated schema version constant. Initializes the scanner if not yet initialized.
123
123
  *
124
124
  * @throws When the real WASM is loaded but the schema version call fails.
125
125
  */
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@
18
18
  * const result = await scanAssembly(dllBytes, 'MyMod.dll')
19
19
  * ```
20
20
  */
21
+ import { MLVSCAN_SCHEMA_VERSION, } from './types.js';
21
22
  let scannerExports = null;
22
23
  let scannerLoaded = false;
23
24
  let dotnetModule = null;
@@ -27,8 +28,10 @@ let initError = null;
27
28
  /** True when mock was explicitly requested via options; false when fallback due to error. */
28
29
  let mockRequestedExplicitly = false;
29
30
  const mockScanResult = {
30
- schemaVersion: '1.0.0',
31
+ schemaVersion: MLVSCAN_SCHEMA_VERSION,
31
32
  metadata: {
33
+ coreVersion: '1.0.0-mock',
34
+ platformVersion: '1.0.0-mock',
32
35
  scannerVersion: '1.0.0-mock',
33
36
  timestamp: new Date().toISOString(),
34
37
  scanMode: 'summary',
@@ -248,8 +251,8 @@ export async function getScannerVersion() {
248
251
  }
249
252
  }
250
253
  /**
251
- * Returns the scan result schema version (e.g. `"1.0.0"`). In mock mode returns
252
- * `"1.0.0"`. Initializes the scanner if not yet initialized.
254
+ * Returns the scan result schema version (e.g. `"1.2.0"`). In mock mode returns
255
+ * the generated schema version constant. Initializes the scanner if not yet initialized.
253
256
  *
254
257
  * @throws When the real WASM is loaded but the schema version call fails.
255
258
  */
@@ -258,7 +261,7 @@ export async function getSchemaVersion() {
258
261
  await initScanner();
259
262
  }
260
263
  if (useMockScanner || !scannerExports?.MLVScan?.WASM?.ScannerExports) {
261
- return '1.0.0';
264
+ return MLVSCAN_SCHEMA_VERSION;
262
265
  }
263
266
  try {
264
267
  return scannerExports.MLVScan.WASM.ScannerExports.GetSchemaVersion();
package/dist/types.d.ts CHANGED
@@ -1,143 +1,5 @@
1
- /**
2
- * MLVScan scan result and finding types.
3
- *
4
- * These match the JSON schema produced by MLVScan.WASM. Use with {@link scanAssembly}
5
- * from the main package.
6
- */
7
- /** Root object returned by a scan. Contains metadata, input info, summary, and findings. */
8
- export interface ScanResult {
9
- /** Schema version of this result (e.g. "1.0.0"). */
10
- schemaVersion: string;
11
- /** Scanner and scan run metadata. */
12
- metadata: ScanMetadata;
13
- /** The assembly that was scanned. */
14
- input: ScanInput;
15
- /** Aggregated counts and triggered rules. */
16
- summary: ScanSummary;
17
- /** Individual security/relevance findings. */
18
- findings: Finding[];
19
- /** Optional call chains for detailed mode. */
20
- callChains?: CallChain[];
21
- /** Optional data flow chains for developer mode. */
22
- dataFlows?: DataFlowChain[];
23
- /** Optional remediation guidance for developer mode. */
24
- developerGuidance?: DeveloperGuidance[];
25
- /** Optional known malware family matches derived from threat-intel classification. */
26
- threatFamilies?: ThreatFamily[];
27
- }
28
- /** Metadata about the scanner and this scan run. */
29
- export interface ScanMetadata {
30
- scannerVersion: string;
31
- /** ISO 8601 timestamp of the scan. */
32
- timestamp: string;
33
- /** Level of detail: summary, detailed (with call chains), or developer (with data flows and guidance). */
34
- scanMode: 'summary' | 'detailed' | 'developer';
35
- /** Where the scan ran: wasm, cli, server, or desktop. */
36
- platform: 'wasm' | 'cli' | 'server' | 'desktop';
37
- }
38
- /** Describes the assembly that was scanned. */
39
- export interface ScanInput {
40
- fileName: string;
41
- sizeBytes: number;
42
- /** SHA-256 hash of the file when available. */
43
- sha256Hash?: string;
44
- }
45
- /** Aggregated scan summary: total findings and counts by severity. */
46
- export interface ScanSummary {
47
- totalFindings: number;
48
- /** Map of severity (e.g. "Low", "Critical") to count. */
49
- countBySeverity: Record<string, number>;
50
- /** Rule IDs that produced at least one finding. */
51
- triggeredRules: string[];
52
- }
53
- /** Finding severity level. */
54
- export type Severity = 'Low' | 'Medium' | 'High' | 'Critical';
55
- /** A single finding: one triggered rule or suspicious pattern in the assembly. */
56
- export interface Finding {
57
- id?: string;
58
- ruleId?: string;
59
- description: string;
60
- severity: Severity;
61
- /** Human-readable location (e.g. type/method name or file:line). */
62
- location: string;
63
- codeSnippet?: string;
64
- /** Present in detailed/developer mode when a call chain was analyzed. */
65
- callChain?: CallChain;
66
- /** Present in developer mode when a data flow was analyzed. */
67
- dataFlowChain?: DataFlowChain;
68
- }
69
- /** A call chain from entry point to a suspicious declaration. */
70
- export interface CallChain {
71
- id?: string;
72
- ruleId?: string;
73
- description: string;
74
- severity: Severity;
75
- nodes: CallChainNode[];
76
- }
77
- /** Role of a node in a call chain. */
78
- export type CallChainNodeType = 'EntryPoint' | 'IntermediateCall' | 'SuspiciousDeclaration';
79
- /** One node in a call chain (method or declaration). */
80
- export interface CallChainNode {
81
- nodeType: CallChainNodeType;
82
- location: string;
83
- description: string;
84
- codeSnippet?: string;
85
- }
86
- /** A data flow from source to sink (e.g. download and execute). */
87
- export interface DataFlowChain {
88
- id?: string;
89
- description: string;
90
- severity: Severity;
91
- pattern: DataFlowPattern;
92
- /** Confidence score (e.g. 0–1). */
93
- confidence: number;
94
- sourceVariable?: string;
95
- methodLocation?: string;
96
- isCrossMethod: boolean;
97
- involvedMethods?: string[];
98
- nodes: DataFlowNode[];
99
- }
100
- /** Class of data flow pattern the chain represents. */
101
- export type DataFlowPattern = 'Legitimate' | 'DownloadAndExecute' | 'DataExfiltration' | 'DynamicCodeLoading' | 'CredentialTheft' | 'RemoteConfigLoad' | 'ObfuscatedPersistence' | 'Unknown';
102
- /** Role of a node in a data flow (source, transform, sink, or intermediate). */
103
- export type DataFlowNodeType = 'Source' | 'Transform' | 'Sink' | 'Intermediate';
104
- /** One node in a data flow chain. */
105
- export interface DataFlowNode {
106
- nodeType: DataFlowNodeType;
107
- location: string;
108
- operation: string;
109
- dataDescription: string;
110
- instructionOffset: number;
111
- methodKey?: string;
112
- isMethodBoundary: boolean;
113
- targetMethodKey?: string;
114
- codeSnippet?: string;
115
- }
116
- /** Remediation suggestion for a rule or finding (developer mode). */
117
- export interface DeveloperGuidance {
118
- ruleId?: string;
119
- remediation: string;
120
- documentationUrl?: string;
121
- alternativeApis?: string[];
122
- isRemediable: boolean;
123
- }
124
- export type ThreatMatchKind = 'ExactSampleHash' | 'BehaviorVariant';
125
- export interface ThreatFamilyEvidence {
126
- kind: string;
127
- value: string;
128
- }
129
- export interface ThreatFamily {
130
- familyId: string;
131
- variantId: string;
132
- displayName: string;
133
- summary: string;
134
- matchKind: ThreatMatchKind;
135
- confidence: number;
136
- exactHashMatch: boolean;
137
- matchedRules: string[];
138
- advisorySlugs: string[];
139
- evidence: ThreatFamilyEvidence[];
140
- }
1
+ export { MLVSCAN_SCHEMA_VERSION, } from './generated/mlvscan-schema.js';
2
+ export type { CallChain, CallChainNode, CallChainNodeType, DataFlowChain, DataFlowNode, DataFlowNodeType, DataFlowPattern, DeveloperGuidance, Finding, FindingVisibility, ScanInput, ScanMetadata, ScanMode, ScanPlatform, ScanResult, ScanSummary, SchemaVersion, Severity, ThreatDisposition, ThreatDispositionClassification, ThreatFamily, ThreatFamilyEvidence, ThreatMatchKind, } from './generated/mlvscan-schema.js';
141
3
  export interface DeepBehaviorAnalysisConfig {
142
4
  enableDeepAnalysis?: boolean;
143
5
  emitDiagnosticFindings?: boolean;
package/dist/types.js CHANGED
@@ -1,7 +1 @@
1
- /**
2
- * MLVScan scan result and finding types.
3
- *
4
- * These match the JSON schema produced by MLVScan.WASM. Use with {@link scanAssembly}
5
- * from the main package.
6
- */
7
- export {};
1
+ export { MLVSCAN_SCHEMA_VERSION, } from './generated/mlvscan-schema.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlvscan/wasm-core",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "WebAssembly core for MLVScan - scanning Unity mods in the browser",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",