shroud-privacy 2.2.11 → 2.2.13

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.
Files changed (40) hide show
  1. package/README.md +19 -10
  2. package/dist/hooks.js +246 -14
  3. package/openclaw.plugin.json +1 -1
  4. package/package.json +3 -2
  5. package/dist/agent-session.d.ts +0 -259
  6. package/dist/agent-session.js +0 -693
  7. package/dist/compliance.d.ts +0 -44
  8. package/dist/compliance.js +0 -76
  9. package/dist/dashboard.d.ts +0 -42
  10. package/dist/dashboard.js +0 -1558
  11. package/dist/detectors/injection-multilingual.d.ts +0 -27
  12. package/dist/detectors/injection-multilingual.js +0 -399
  13. package/dist/detectors/injection-signatures.d.ts +0 -26
  14. package/dist/detectors/injection-signatures.js +0 -508
  15. package/dist/detectors/injection.d.ts +0 -56
  16. package/dist/detectors/injection.js +0 -269
  17. package/dist/detectors/tool-guard.d.ts +0 -27
  18. package/dist/detectors/tool-guard.js +0 -418
  19. package/dist/event-grader.d.ts +0 -97
  20. package/dist/event-grader.js +0 -214
  21. package/dist/exposure.d.ts +0 -29
  22. package/dist/exposure.js +0 -72
  23. package/dist/policy.d.ts +0 -99
  24. package/dist/policy.js +0 -212
  25. package/dist/profiler-analysis.d.ts +0 -35
  26. package/dist/profiler-analysis.js +0 -230
  27. package/dist/profiler-store.d.ts +0 -33
  28. package/dist/profiler-store.js +0 -118
  29. package/dist/profiler-types.d.ts +0 -128
  30. package/dist/profiler-types.js +0 -16
  31. package/dist/profiler.d.ts +0 -81
  32. package/dist/profiler.js +0 -392
  33. package/dist/security-event.d.ts +0 -70
  34. package/dist/security-event.js +0 -80
  35. package/dist/siem.d.ts +0 -49
  36. package/dist/siem.js +0 -113
  37. package/dist/signature-loader.d.ts +0 -113
  38. package/dist/signature-loader.js +0 -255
  39. package/dist/store-file.d.ts +0 -26
  40. package/dist/store-file.js +0 -79
@@ -1,44 +0,0 @@
1
- /**
2
- * Compliance reporter — generates category coverage and detection gap reports.
3
- */
4
- export interface ComplianceConfig {
5
- /** Path to write report. Empty = disabled. */
6
- reportPath: string;
7
- /** Report interval: "hourly" | "daily". */
8
- reportInterval: "hourly" | "daily";
9
- /** Required categories that MUST have detections. */
10
- requiredCategories: string[];
11
- }
12
- export interface ComplianceReport {
13
- generatedAt: string;
14
- periodStart: string;
15
- periodEnd: string;
16
- /** Categories that had detections. */
17
- activeCategoryCoverage: Record<string, number>;
18
- /** Required categories with zero detections (gaps). */
19
- detectionGaps: string[];
20
- /** Total entities detected in period. */
21
- totalEntities: number;
22
- /** Store utilization. */
23
- storeMappings: number;
24
- /** Allowlist usage (how many entities were skipped). */
25
- allowlistSkips: number;
26
- /** Compliance score: % of required categories with detections. */
27
- complianceScore: number;
28
- }
29
- export declare class ComplianceReporter {
30
- private _config;
31
- private _periodStart;
32
- private _categoryCounts;
33
- private _totalEntities;
34
- private _allowlistSkips;
35
- constructor(config?: Partial<ComplianceConfig>);
36
- get enabled(): boolean;
37
- /** Record detection event. */
38
- recordDetections(categoryCounts: Record<string, number>, allowlistSkips?: number): void;
39
- /** Generate and optionally write a compliance report. */
40
- generateReport(storeMappings?: number): ComplianceReport;
41
- /** Reset for new period. */
42
- resetPeriod(): void;
43
- getStats(): object;
44
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * Compliance reporter — generates category coverage and detection gap reports.
3
- */
4
- import { writeFileSync } from "node:fs";
5
- export class ComplianceReporter {
6
- _config;
7
- _periodStart;
8
- _categoryCounts = {};
9
- _totalEntities = 0;
10
- _allowlistSkips = 0;
11
- constructor(config = {}) {
12
- this._config = {
13
- reportPath: config.reportPath ?? "",
14
- reportInterval: config.reportInterval ?? "daily",
15
- requiredCategories: config.requiredCategories ?? [],
16
- };
17
- this._periodStart = new Date().toISOString();
18
- }
19
- get enabled() {
20
- return !!this._config.reportPath;
21
- }
22
- /** Record detection event. */
23
- recordDetections(categoryCounts, allowlistSkips = 0) {
24
- for (const [cat, count] of Object.entries(categoryCounts)) {
25
- this._categoryCounts[cat] = (this._categoryCounts[cat] ?? 0) + count;
26
- }
27
- this._totalEntities += Object.values(categoryCounts).reduce((a, b) => a + b, 0);
28
- this._allowlistSkips += allowlistSkips;
29
- }
30
- /** Generate and optionally write a compliance report. */
31
- generateReport(storeMappings = 0) {
32
- const now = new Date().toISOString();
33
- const gaps = this._config.requiredCategories.filter((cat) => (this._categoryCounts[cat] ?? 0) === 0);
34
- const coveredRequired = this._config.requiredCategories.filter((cat) => (this._categoryCounts[cat] ?? 0) > 0);
35
- const score = this._config.requiredCategories.length > 0
36
- ? Math.round((coveredRequired.length / this._config.requiredCategories.length) *
37
- 100)
38
- : 100;
39
- const report = {
40
- generatedAt: now,
41
- periodStart: this._periodStart,
42
- periodEnd: now,
43
- activeCategoryCoverage: { ...this._categoryCounts },
44
- detectionGaps: gaps,
45
- totalEntities: this._totalEntities,
46
- storeMappings,
47
- allowlistSkips: this._allowlistSkips,
48
- complianceScore: score,
49
- };
50
- if (this._config.reportPath) {
51
- try {
52
- writeFileSync(this._config.reportPath, JSON.stringify(report, null, 2) + "\n");
53
- }
54
- catch {
55
- // best-effort
56
- }
57
- }
58
- return report;
59
- }
60
- /** Reset for new period. */
61
- resetPeriod() {
62
- this._categoryCounts = {};
63
- this._totalEntities = 0;
64
- this._allowlistSkips = 0;
65
- this._periodStart = new Date().toISOString();
66
- }
67
- getStats() {
68
- return {
69
- enabled: this.enabled,
70
- periodStart: this._periodStart,
71
- totalEntities: this._totalEntities,
72
- categoryCoverage: Object.keys(this._categoryCounts).length,
73
- requiredCategories: this._config.requiredCategories.length,
74
- };
75
- }
76
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * Real-time security dashboard — lightweight HTTP endpoint.
3
- *
4
- * Serves JSON snapshots of all agent sessions, security events,
5
- * profiling baselines, and injection detection stats. Designed
6
- * for Grafana, custom UIs, or direct curl consumption.
7
- *
8
- * Zero external dependencies — uses Node's built-in http module.
9
- *
10
- * Endpoints:
11
- * GET /health — liveness check
12
- * GET /api/overview — high-level security summary
13
- * GET /api/agents — all agent sessions with profiling status
14
- * GET /api/agents/:buildId — single agent detail
15
- * GET /api/events — recent security events (last 100)
16
- * GET /api/events/stream — SSE stream of security events (real-time)
17
- * GET /api/profiling — profiling baselines for all agents
18
- * GET /api/profiling/:buildId — single agent baseline detail
19
- * GET /api/stats — obfuscation + security stats combined
20
- */
21
- import { createServer } from "node:http";
22
- import type { SecurityEventBus } from "./security-event.js";
23
- import type { AgentSessionTracker } from "./agent-session.js";
24
- import type { BaselineStore } from "./profiler-store.js";
25
- import type { Obfuscator } from "./obfuscator.js";
26
- import type { BehaviouralProfiler } from "./profiler.js";
27
- import type { ShroudConfig } from "./types.js";
28
- import type { PolicyEngine } from "./policy.js";
29
- export interface DashboardDeps {
30
- securityBus: SecurityEventBus | null;
31
- agentTracker: AgentSessionTracker;
32
- baselineStore: BaselineStore | null;
33
- obfuscator: Obfuscator;
34
- profiler: BehaviouralProfiler | null;
35
- config: ShroudConfig;
36
- policyEngine: PolicyEngine | null;
37
- }
38
- /**
39
- * Start the dashboard HTTP server.
40
- * Returns the server instance for cleanup.
41
- */
42
- export declare function startDashboard(port: number, deps: DashboardDeps): ReturnType<typeof createServer>;