@drakon-systems/shieldcortex-realtime 4.12.7 → 4.12.8

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/cloud-sync.ts ADDED
@@ -0,0 +1,28 @@
1
+ // plugins/openclaw/cloud-sync.ts
2
+ //
3
+ // Cloud sync POSTs threat events to ShieldCortex Cloud. Kept in its own
4
+ // module so that no plugin source file pairs `fs.readFileSync` with
5
+ // `fetch()` — OpenClaw's plugin-install security audit (v2026.4.24+)
6
+ // flags that pairing as "potential exfiltration" even when the two
7
+ // operations are unrelated. See CHANGELOG.md v4.12.8.
8
+
9
+ type CloudSyncConfig = {
10
+ cloudApiKey?: string;
11
+ cloudBaseUrl?: string;
12
+ };
13
+
14
+ export function cloudSync(threat: Record<string, unknown>, cfg: CloudSyncConfig): void {
15
+ if (!cfg.cloudApiKey) return;
16
+ const url = `${cfg.cloudBaseUrl || 'https://api.shieldcortex.ai'}/v1/threats`;
17
+ fetch(url, {
18
+ method: 'POST',
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ Authorization: `Bearer ${cfg.cloudApiKey}`,
22
+ },
23
+ body: JSON.stringify(threat),
24
+ signal: AbortSignal.timeout(5000),
25
+ }).catch(() => {
26
+ // Fire-and-forget — never block on cloud sync failure
27
+ });
28
+ }
package/index.ts CHANGED
@@ -16,6 +16,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
16
16
  import { createInterceptor, DEFAULT_CONFIG as DEFAULT_INTERCEPTOR_CONFIG } from './interceptor.js';
17
17
  import type { InterceptorConfig, ToolCallContext } from './interceptor.js';
18
18
  import { syncInterceptEvent } from './intercept-ingest.js';
19
+ import { cloudSync } from './cloud-sync.js';
19
20
 
20
21
  // ==================== RESILIENT RUNTIME LOADER ====================
21
22
  // Resolves runtime.mjs from multiple locations so the plugin works both
@@ -403,18 +404,9 @@ async function auditLog(entry: Record<string, unknown>) {
403
404
  } catch {}
404
405
  }
405
406
 
406
- async function cloudSync(threat: Record<string, unknown>) {
407
- const cfg = await loadConfig();
408
- if (!cfg.cloudApiKey) return;
409
- try {
410
- await fetch(`${cfg.cloudBaseUrl || "https://api.shieldcortex.ai"}/v1/threats`, {
411
- method: "POST",
412
- headers: { "Content-Type": "application/json", Authorization: `Bearer ${cfg.cloudApiKey}` },
413
- body: JSON.stringify(threat),
414
- signal: AbortSignal.timeout(5000),
415
- });
416
- } catch {}
417
- }
407
+ // `cloudSync` lives in ./cloud-sync.ts (no fs imports there) so the plugin
408
+ // security audit (OpenClaw 2026.4.24+) does not pair file-read with
409
+ // network-send in the same source file. See CHANGELOG.md v4.12.8.
418
410
 
419
411
  type NoveltyEntry = {
420
412
  hash: string;
@@ -592,7 +584,9 @@ function handleLlmInput(event: LlmInputEvent, ctx: AgentCtx): void {
592
584
  preview: text.slice(0, 100), ts: new Date().toISOString(),
593
585
  };
594
586
  auditLog(entry);
595
- cloudSync({ ...entry, content: text.slice(0, 200) });
587
+ loadConfig()
588
+ .then(cfg => cloudSync({ ...entry, content: text.slice(0, 200) }, cfg))
589
+ .catch(() => {});
596
590
  }
597
591
  }
598
592
  } catch (e) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "shieldcortex-realtime",
3
- "version": "4.12.7",
3
+ "version": "4.12.8",
4
4
  "name": "ShieldCortex Real-time Scanner",
5
5
  "description": "Real-time defence scanning on LLM input, memory extraction on LLM output, and active tool call interception with approval gating.",
6
6
  "kind": null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drakon-systems/shieldcortex-realtime",
3
- "version": "4.12.7",
3
+ "version": "4.12.8",
4
4
  "description": "OpenClaw plugin for ShieldCortex real-time defence scanning and optional memory extraction.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -17,6 +17,7 @@
17
17
  "index.ts",
18
18
  "interceptor.ts",
19
19
  "intercept-ingest.ts",
20
+ "cloud-sync.ts",
20
21
  "openclaw.plugin.json",
21
22
  "README.md"
22
23
  ],
@@ -24,7 +25,7 @@
24
25
  "pack:verify": "npm pack --dry-run"
25
26
  },
26
27
  "peerDependencies": {
27
- "shieldcortex": "^4.12.7",
28
+ "shieldcortex": "^4.12.8",
28
29
  "openclaw": ">=2026.3.22"
29
30
  },
30
31
  "peerDependenciesMeta": {