@weave_protocol/mund 0.4.2 → 0.5.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/dist/index.d.ts CHANGED
@@ -5,4 +5,11 @@
5
5
  export { ThreatIntelManager, threatIntel } from './threat-intel-manager.js';
6
6
  export { threatIntelTools, createThreatIntelToolHandlers } from './threat-intel-tools.js';
7
7
  export * from './threat-intel-types.js';
8
+ export { scan, SCAN_TYPES } from './scan.js';
9
+ export type { ScanType, ScanOptions, ScanResult } from './scan.js';
10
+ export { AnalyzerEngine, getAnalyzers, SecretScanner, PIIDetector, CodeAnalyzer, InjectionDetector, ExfiltrationDetector, McpServerAnalyzer, } from './analyzers/index.js';
11
+ export { DEFAULT_RULES } from './constants.js';
12
+ export { computeRiskScore, labelForScore } from './scoring.js';
13
+ export type { RiskScore } from './scoring.js';
14
+ export type { Severity, SecurityIssue, DetectionRule, IAnalyzer } from './types.js';
8
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAC1F,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAC1F,cAAc,yBAAyB,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,cAAc,EAAE,YAAY,EAC5B,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,GACrG,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,11 @@
5
5
  export { ThreatIntelManager, threatIntel } from './threat-intel-manager.js';
6
6
  export { threatIntelTools, createThreatIntelToolHandlers } from './threat-intel-tools.js';
7
7
  export * from './threat-intel-types.js';
8
+ // Scanning
9
+ export { scan, SCAN_TYPES } from './scan.js';
10
+ export { AnalyzerEngine, getAnalyzers, SecretScanner, PIIDetector, CodeAnalyzer, InjectionDetector, ExfiltrationDetector, McpServerAnalyzer, } from './analyzers/index.js';
11
+ export { DEFAULT_RULES } from './constants.js';
12
+ export { computeRiskScore, labelForScore } from './scoring.js';
8
13
  // Importing this module has no side effects. Run directly (`node dist/index.js`,
9
14
  // as older MCP configs do), it still starts the server; the bin points at server.js.
10
15
  import { realpathSync } from 'node:fs';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAC1F,cAAc,yBAAyB,CAAC;AAExC,iFAAiF;AACjF,qFAAqF;AACrF,OAAO,EAAE,YAAY,EAAE,M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AC;QACH,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AACL,IAAI,eAAe;IAAE,KAAK,MAAM,CAAC,aAAa,CAAC,CAAC"}
package/dist/scan.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Library scan: the same analyzers and default rules as the mund_scan_content
3
+ * tool, returning issues plus a 0–100 risk score.
4
+ */
5
+ import { type RiskScore } from './scoring.js';
6
+ import type { DetectionRule, SecurityIssue } from './types.js';
7
+ /** Friendly scan types → analyzer types. */
8
+ export declare const SCAN_TYPES: {
9
+ readonly secrets: readonly ["secret"];
10
+ readonly pii: readonly ["pii"];
11
+ readonly injection: readonly ["injection"];
12
+ readonly exfiltration: readonly ["exfiltration"];
13
+ readonly code: readonly ["code_pattern"];
14
+ };
15
+ export type ScanType = keyof typeof SCAN_TYPES;
16
+ export interface ScanOptions {
17
+ /** Limit to these scan types; default: all analyzers. */
18
+ types?: ScanType[];
19
+ /** Rules to apply; default: Mund's built-in rules. */
20
+ rules?: DetectionRule[];
21
+ }
22
+ export interface ScanResult {
23
+ issues: SecurityIssue[];
24
+ risk: RiskScore;
25
+ }
26
+ export declare function scan(content: string, options?: ScanOptions): Promise<ScanResult>;
27
+ //# sourceMappingURL=scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/D,4CAA4C;AAC5C,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,sDAAsD;IACtD,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ1F"}
package/dist/scan.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Library scan: the same analyzers and default rules as the mund_scan_content
3
+ * tool, returning issues plus a 0–100 risk score.
4
+ */
5
+ import { AnalyzerEngine, getAnalyzers } from './analyzers/index.js';
6
+ import { DEFAULT_RULES } from './constants.js';
7
+ import { computeRiskScore } from './scoring.js';
8
+ /** Friendly scan types → analyzer types. */
9
+ export const SCAN_TYPES = {
10
+ secrets: ['secret'],
11
+ pii: ['pii'],
12
+ injection: ['injection'],
13
+ exfiltration: ['exfiltration'],
14
+ code: ['code_pattern'],
15
+ };
16
+ export async function scan(content, options = {}) {
17
+ let analyzers = getAnalyzers();
18
+ if (options.types?.length) {
19
+ const wanted = new Set(options.types.flatMap((t) => SCAN_TYPES[t] ?? []));
20
+ analyzers = analyzers.filter((a) => wanted.has(a.type));
21
+ }
22
+ const issues = await new AnalyzerEngine(analyzers).analyzeAll(content, options.rules ?? DEFAULT_RULES);
23
+ return { issues, risk: computeRiskScore(issues) };
24
+ }
25
+ //# sourceMappingURL=scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAE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ol - MCP-based security monitoring for agentic AI systems",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -7,6 +7,18 @@ export { ThreatIntelManager, threatIntel } from './threat-intel-manager.js';
7
7
  export { threatIntelTools, createThreatIntelToolHandlers } from './threat-intel-tools.js';
8
8
  export * from './threat-intel-types.js';
9
9
 
10
+ // Scanning
11
+ export { scan, SCAN_TYPES } from './scan.js';
12
+ export type { ScanType, ScanOptions, ScanResult } from './scan.js';
13
+ export {
14
+ AnalyzerEngine, getAnalyzers,
15
+ SecretScanner, PIIDetector, CodeAnalyzer, InjectionDetector, ExfiltrationDetector, McpServerAnalyzer,
16
+ } from './analyzers/index.js';
17
+ export { DEFAULT_RULES } from './constants.js';
18
+ export { computeRiskScore, labelForScore } from './scoring.js';
19
+ export type { RiskScore } from './scoring.js';
20
+ export type { Severity, SecurityIssue, DetectionRule, IAnalyzer } from './types.js';
21
+
10
22
  // Importing this module has no side effects. Run directly (`node dist/index.js`,
11
23
  // as older MCP configs do), it still starts the server; the bin points at server.js.
12
24
  import { realpathSync } from 'node:fs';
package/src/scan.ts ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Library scan: the same analyzers and default rules as the mund_scan_content
3
+ * tool, returning issues plus a 0–100 risk score.
4
+ */
5
+
6
+ import { AnalyzerEngine, getAnalyzers } from './analyzers/index.js';
7
+ import { DEFAULT_RULES } from './constants.js';
8
+ import { computeRiskScore, type RiskScore } from './scoring.js';
9
+ import type { DetectionRule, SecurityIssue } from './types.js';
10
+
11
+ /** Friendly scan types → analyzer types. */
12
+ export const SCAN_TYPES = {
13
+ secrets: ['secret'],
14
+ pii: ['pii'],
15
+ injection: ['injection'],
16
+ exfiltration: ['exfiltration'],
17
+ code: ['code_pattern'],
18
+ } as const;
19
+
20
+ export type ScanType = keyof typeof SCAN_TYPES;
21
+
22
+ export interface ScanOptions {
23
+ /** Limit to these scan types; default: all analyzers. */
24
+ types?: ScanType[];
25
+ /** Rules to apply; default: Mund's built-in rules. */
26
+ rules?: DetectionRule[];
27
+ }
28
+
29
+ export interface ScanResult {
30
+ issues: SecurityIssue[];
31
+ risk: RiskScore;
32
+ }
33
+
34
+ export async function scan(content: string, options: ScanOptions = {}): Promise<ScanResult> {
35
+ let analyzers = getAnalyzers();
36
+ if (options.types?.length) {
37
+ const wanted = new Set<string>(options.types.flatMap((t) => SCAN_TYPES[t] ?? []));
38
+ analyzers = analyzers.filter((a) => wanted.has(a.type));
39
+ }
40
+ const issues = await new AnalyzerEngine(analyzers).analyzeAll(content, options.rules ?? DEFAULT_RULES);
41
+ return { issues, risk: computeRiskScore(issues) };
42
+ }