@silmaril-security/firewall-plugin 1.2.10 → 1.2.11

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/CLAUDE.md CHANGED
@@ -44,9 +44,9 @@ Source file: `index.ts`
44
44
 
45
45
  OpenClaw runtime entrypoint: `dist/index.js`
46
46
 
47
- Package and runtime attribution are prepared as `1.2.10` with
48
- `@silmaril-security/sdk` `0.8.2`; the published install remains `1.2.9`.
49
- Local archive examples below use the source package version.
47
+ Prepared package and runtime attribution are `1.2.11` with
48
+ `@silmaril-security/sdk` `0.8.2`. The post-publication registry and local
49
+ archive examples below both use `1.2.11`.
50
50
 
51
51
  Runtime behavior:
52
52
 
@@ -90,6 +90,13 @@ Runtime behavior:
90
90
  demo URL without serving local UI or reading or printing classifier config
91
91
  - hook registration is unconditional; classifier config is resolved when each
92
92
  hook runs
93
+ - the configured classifier timeout is also a plugin-owned end-to-end deadline
94
+ over all SDK attempts, retry backoff, and response-body handling. The SDK
95
+ receives its caller abort signal and retains the same per-attempt timeout
96
+ - plugin-authored hook budgets add a bounded 1000 ms cleanup margin to the
97
+ classifier timeout, up to 11000 ms. OpenClaw hook-specific and plugin-wide
98
+ operator timeout overrides retain native precedence and may intentionally be
99
+ shorter
93
100
  - Shadow adds no agent-visible context. Warn can prepend the fixed
94
101
  `before_prompt_build` warning. The plugin adds no system or developer context
95
102
  - no wrapper tools, exporters, or queues are registered
@@ -110,7 +117,10 @@ Configuration fields:
110
117
  - `timeoutMs`: optional classifier timeout in milliseconds. OpenClaw plugin
111
118
  configuration accepts JSON integers from `250` through `10000`; omission uses
112
119
  `2500`. The host validates the manifest schema before runtime loading and
113
- rejects numeric strings, fractional numbers, and out-of-range values
120
+ rejects numeric strings, fractional numbers, and out-of-range values. This
121
+ value remains the SDK per-attempt timeout and is also the plugin's overall
122
+ classification deadline. The plugin-authored host hook budget is the deadline
123
+ plus a bounded 1000 ms cleanup margin
114
124
  - `mode`: optional `shadow`, `warn`, or `block` override. A set value wins over
115
125
  the legacy booleans below and over `mode` on the classifier response
116
126
  - `shadowMode`: legacy flag. `true` forces Shadow, including when
@@ -152,6 +162,10 @@ for direct source loading or the CLI install path is unavailable.
152
162
  openclaw --version
153
163
  ```
154
164
 
165
+ Existing OpenClaw installations older than `2026.8.2` must be upgraded
166
+ through their supported installation method before this plugin version is
167
+ enabled.
168
+
155
169
  3. Initialize OpenClaw local state:
156
170
 
157
171
  ```sh
@@ -231,6 +245,13 @@ for direct source loading or the CLI install path is unavailable.
231
245
  Use these only when the user explicitly asks for a different install style or
232
246
  when `openclaw plugins install -l .` is unavailable.
233
247
 
248
+ Exact npm registry flow after publication:
249
+
250
+ ```sh
251
+ openclaw plugins install npm:@silmaril-security/firewall-plugin@1.2.11
252
+ openclaw plugins enable firewall-plugin
253
+ ```
254
+
234
255
  Direct source checkout flow: register the checkout through
235
256
  `plugins.load.paths` instead of using the CLI install command.
236
257
 
@@ -250,7 +271,7 @@ for direct source loading or the CLI install path is unavailable.
250
271
 
251
272
  ```sh
252
273
  npm pack
253
- openclaw plugins install ./silmaril-security-firewall-plugin-1.2.10.tgz
274
+ openclaw plugins install ./silmaril-security-firewall-plugin-1.2.11.tgz
254
275
  openclaw plugins enable firewall-plugin
255
276
  ```
256
277
 
package/README.md CHANGED
@@ -12,11 +12,16 @@ the subagent lifecycle hooks stay unchanged and record `blockUnavailable: true`
12
12
  when Block would have applied. Classifier failures fail open without adding
13
13
  agent-visible context.
14
14
 
15
- The package declares OpenClaw plugin API `>=2026.5.28` and minimum gateway
16
- version `2026.5.28` (`package.json` `openclaw.compat`). The shipped classifier
17
- dependency pin in this source checkout is `@silmaril-security/sdk` `0.8.2`. The manifest declares startup
18
- activation for hook capability loading, and the runtime entry registers typed
19
- Gateway hooks with `api.on(...)`.
15
+ The package declares OpenClaw plugin API `>=2026.8.2` and minimum gateway
16
+ version `2026.8.2` (`package.json` `openclaw.compat`). This patched security
17
+ floor excludes affected core host lines identified by OpenClaw advisories. The
18
+ current registration and hook contract are qualified against OpenClaw
19
+ `2026.11.2`. The shipped classifier dependency pin in this source checkout is
20
+ `@silmaril-security/sdk` `0.8.2`. The manifest declares startup activation for
21
+ hook capability loading, and the runtime entry registers typed Gateway hooks
22
+ with `api.on(...)`. Upgrade an existing OpenClaw host older than `2026.8.2`
23
+ through its supported installation method before enabling this plugin version;
24
+ the host rejects it below that floor.
20
25
 
21
26
  ## Runtime Hooks
22
27
 
@@ -126,7 +131,18 @@ diagnostic.
126
131
  from `250` through `10000`; for example, `"timeoutMs": 2500`. Omit it to use
127
132
  `2500`. The host validates configuration against the plugin manifest before
128
133
  loading the runtime and rejects numeric strings, fractional numbers, and values
129
- outside that range. That value bounds each classifier request.
134
+ outside that range. That value remains the SDK's per-attempt timeout and is also
135
+ the plugin-owned end-to-end deadline over all SDK attempts, retry backoff, and
136
+ response-body handling. Deadline settlement aborts the SDK call and remains
137
+ bounded even if underlying cleanup ignores cancellation. The plugin authors each
138
+ OpenClaw hook budget as that classifier deadline plus a bounded `1000` ms
139
+ cleanup margin, up to `11000` ms. This lets a classifier timeout settle through
140
+ the plugin's fail-open catch before the host gate budget expires. OpenClaw
141
+ operator settings retain native precedence:
142
+ `hooks.timeouts.<hookName>` overrides `hooks.timeoutMs`, which overrides this
143
+ plugin-authored budget. An operator can intentionally configure a shorter
144
+ budget; OpenClaw's native timeout/error policy then applies, including
145
+ fail-closed behavior for `before_agent_run` and `before_tool_call`.
130
146
 
131
147
  The Silmaril endpoint app supplies `endpointId` as a canonical UUID v4. Every classifier request carries plugin-owned `metadata.silmaril.provenance` with `schema_version` `1` and harness `openclaw`. An omitted or invalid endpoint ID omits `endpoint_id`. On macOS, provenance can also include the local computer name. Classification does not wait for that lookup, and other platforms omit it.
132
148
 
@@ -191,14 +207,13 @@ not represented as independently verified prevention.
191
207
 
192
208
  ## Install
193
209
 
194
- The immutable published install remains `1.2.9`. This source checkout is
195
- prepared as `1.2.10` with SDK `0.8.2` and can be validated through the source
196
- or locally packed archive flows below.
210
+ Version `1.2.11` is the prepared package version for this release. It keeps
211
+ `@silmaril-security/sdk` at `0.8.2`.
197
212
 
198
- Install the published version:
213
+ After `1.2.11` is published, install that exact npm registry release:
199
214
 
200
215
  ```sh
201
- openclaw plugins install @silmaril-security/firewall-plugin@1.2.9
216
+ openclaw plugins install npm:@silmaril-security/firewall-plugin@1.2.11
202
217
  openclaw plugins enable firewall-plugin
203
218
  openclaw gateway restart
204
219
  ```
@@ -242,7 +257,7 @@ generated tarball:
242
257
  npm install
243
258
  npm run build
244
259
  npm pack
245
- openclaw plugins install ./silmaril-security-firewall-plugin-1.2.10.tgz
260
+ openclaw plugins install ./silmaril-security-firewall-plugin-1.2.11.tgz
246
261
  openclaw plugins enable firewall-plugin
247
262
  openclaw gateway restart
248
263
  ```
package/dist/index.js CHANGED
@@ -225,12 +225,14 @@ function omitUndefined(record) {
225
225
 
226
226
  // index.ts
227
227
  var PLUGIN_ID = "firewall-plugin";
228
- var PLUGIN_VERSION = "1.2.10";
228
+ var PLUGIN_VERSION = "1.2.11";
229
229
  var OPENCLAW_AGENT_ID = "openclaw";
230
230
  var LOCAL_EVIDENCE_POLICY_VERSION = "openclaw-plugin-policy-v1";
231
231
  var DEFAULT_CLASSIFY_TIMEOUT_MS = 2500;
232
232
  var MIN_CLASSIFY_TIMEOUT_MS = 250;
233
233
  var MAX_CLASSIFY_TIMEOUT_MS = 1e4;
234
+ var HOOK_CLEANUP_MARGIN_MS = 1e3;
235
+ var MAX_PLUGIN_HOOK_TIMEOUT_MS = MAX_CLASSIFY_TIMEOUT_MS + HOOK_CLEANUP_MARGIN_MS;
234
236
  var OUTBOUND_DEDUPE_TTL_MS = 5e3;
235
237
  var MAX_OUTBOUND_DEDUPE_ENTRIES = 256;
236
238
  var MAC_DEVICE_NAME_TIMEOUT_MS = 100;
@@ -250,12 +252,15 @@ var index_default = definePluginEntry({
250
252
  description: "Passes OpenClaw hook payloads to Silmaril and renders readable blocked-decision feedback",
251
253
  register(api) {
252
254
  startMacDeviceNameLookup();
253
- const registrationTimeoutMs = readIntegerInRange(
255
+ const classifierTimeoutMs = readIntegerInRange(
254
256
  readRecord(api.pluginConfig)?.timeoutMs,
255
257
  MIN_CLASSIFY_TIMEOUT_MS,
256
258
  MAX_CLASSIFY_TIMEOUT_MS
257
259
  ) ?? DEFAULT_CLASSIFY_TIMEOUT_MS;
258
- const hookOptions = { priority: 0, timeoutMs: registrationTimeoutMs };
260
+ const hookOptions = {
261
+ priority: 0,
262
+ timeoutMs: pluginHookBudgetMs(classifierTimeoutMs)
263
+ };
259
264
  let missingConfigWarned = false;
260
265
  let runtimeClient;
261
266
  const outboundClassificationCache = /* @__PURE__ */ new Map();
@@ -278,14 +283,7 @@ var index_default = definePluginEntry({
278
283
  agentInputClassificationCache.clear();
279
284
  runtimeClient = {
280
285
  config,
281
- state: {
282
- firewall: new Firewall({
283
- apiKey: config.apiKey,
284
- apiUrl: config.apiUrl,
285
- timeoutMs: config.timeoutMs,
286
- ...config.mode ? { mode: config.mode } : {}
287
- })
288
- }
286
+ state: createRuntimeState(config)
289
287
  };
290
288
  }
291
289
  return runtimeClient;
@@ -308,7 +306,7 @@ var index_default = definePluginEntry({
308
306
  return;
309
307
  }
310
308
  const result = await classifyOnce(
311
- runtime.state.firewall,
309
+ runtime.state.classifier,
312
310
  text,
313
311
  meta,
314
312
  agentInputClassificationCache,
@@ -350,7 +348,7 @@ var index_default = definePluginEntry({
350
348
  return;
351
349
  }
352
350
  const result = await classifyOnce(
353
- runtime.state.firewall,
351
+ runtime.state.classifier,
354
352
  text,
355
353
  meta,
356
354
  agentInputClassificationCache,
@@ -376,7 +374,7 @@ var index_default = definePluginEntry({
376
374
  try {
377
375
  const runtimeConfig = runtime.config;
378
376
  const text = safeStringify(event?.params ?? {});
379
- const result = await classifyHookPayload(runtime.state.firewall, text, meta, runtime.config.endpointId);
377
+ const result = await classifyHookPayload(runtime.state.classifier, text, meta, runtime.config.endpointId);
380
378
  if (shouldBlockClassification(runtimeConfig, result)) {
381
379
  emitOpenClawLocalEvidence(
382
380
  meta,
@@ -416,7 +414,7 @@ var index_default = definePluginEntry({
416
414
  logSkipped(meta, "empty_payload");
417
415
  return;
418
416
  }
419
- const result = await classifyHookPayload(runtime.state.firewall, text, meta, runtime.config.endpointId);
417
+ const result = await classifyHookPayload(runtime.state.classifier, text, meta, runtime.config.endpointId);
420
418
  emitOpenClawLocalEvidence(meta, text, result, runtime.config, "allowed", false);
421
419
  } catch (err) {
422
420
  logError(meta, err);
@@ -435,7 +433,7 @@ var index_default = definePluginEntry({
435
433
  logSkipped(meta, "empty_payload");
436
434
  return;
437
435
  }
438
- void classifyHookPayload(runtime.state.firewall, text, meta, runtime.config.endpointId).then((result) => {
436
+ void classifyHookPayload(runtime.state.classifier, text, meta, runtime.config.endpointId).then((result) => {
439
437
  emitOpenClawLocalEvidence(meta, text, result, runtime.config, "allowed", false);
440
438
  }).catch((err) => logError(meta, err));
441
439
  } catch (err) {
@@ -457,7 +455,7 @@ var index_default = definePluginEntry({
457
455
  }
458
456
  const runtimeConfig = runtime.config;
459
457
  const result = await classifyOnce(
460
- runtime.state.firewall,
458
+ runtime.state.classifier,
461
459
  text,
462
460
  meta,
463
461
  outboundClassificationCache,
@@ -489,7 +487,7 @@ var index_default = definePluginEntry({
489
487
  return;
490
488
  }
491
489
  const result = await classifyOnce(
492
- runtime.state.firewall,
490
+ runtime.state.classifier,
493
491
  text,
494
492
  meta,
495
493
  outboundClassificationCache,
@@ -531,7 +529,7 @@ var index_default = definePluginEntry({
531
529
  logSkipped(meta, "empty_payload");
532
530
  return;
533
531
  }
534
- const result = await classifyHookPayload(runtime.state.firewall, text, meta, runtime.config.endpointId);
532
+ const result = await classifyHookPayload(runtime.state.classifier, text, meta, runtime.config.endpointId);
535
533
  emitOpenClawLocalEvidence(meta, text, result, runtime.config, "allowed", false);
536
534
  } catch (err) {
537
535
  logError(meta, err);
@@ -550,7 +548,7 @@ var index_default = definePluginEntry({
550
548
  logSkipped(meta, "empty_payload");
551
549
  return;
552
550
  }
553
- const result = await classifyHookPayload(runtime.state.firewall, text, meta, runtime.config.endpointId);
551
+ const result = await classifyHookPayload(runtime.state.classifier, text, meta, runtime.config.endpointId);
554
552
  emitOpenClawLocalEvidence(meta, text, result, runtime.config, "allowed", false);
555
553
  } catch (err) {
556
554
  logError(meta, err);
@@ -569,7 +567,7 @@ var index_default = definePluginEntry({
569
567
  logSkipped(meta, "empty_payload");
570
568
  return;
571
569
  }
572
- const result = await classifyHookPayload(runtime.state.firewall, text, meta, runtime.config.endpointId);
570
+ const result = await classifyHookPayload(runtime.state.classifier, text, meta, runtime.config.endpointId);
573
571
  emitOpenClawLocalEvidence(meta, text, result, runtime.config, "allowed", false);
574
572
  } catch (err) {
575
573
  logError(meta, err);
@@ -580,6 +578,65 @@ var index_default = definePluginEntry({
580
578
  function sameRuntimeConfig(left, right) {
581
579
  return left.apiKey === right.apiKey && left.apiUrl === right.apiUrl && left.timeoutMs === right.timeoutMs && left.mode === right.mode && left.endpointId === right.endpointId;
582
580
  }
581
+ function createRuntimeState(config) {
582
+ const firewall = new Firewall({
583
+ apiKey: config.apiKey,
584
+ apiUrl: config.apiUrl,
585
+ timeoutMs: config.timeoutMs,
586
+ ...config.mode ? { mode: config.mode } : {}
587
+ });
588
+ return {
589
+ classifier: createBoundedClassificationClient(firewall, config.timeoutMs)
590
+ };
591
+ }
592
+ function createBoundedClassificationClient(firewall, timeoutMs) {
593
+ return {
594
+ classify(text, options) {
595
+ return withClassificationDeadline(
596
+ timeoutMs,
597
+ (signal) => firewall.classify(text, { ...options, signal })
598
+ );
599
+ }
600
+ };
601
+ }
602
+ function withClassificationDeadline(timeoutMs, classify) {
603
+ const controller = new AbortController();
604
+ let settled = false;
605
+ let timer;
606
+ return new Promise((resolve, reject) => {
607
+ const settle = (finish, value) => {
608
+ if (settled) return;
609
+ settled = true;
610
+ clearTimeout(timer);
611
+ finish(value);
612
+ };
613
+ const fail = (error) => {
614
+ if (settled) return;
615
+ settled = true;
616
+ clearTimeout(timer);
617
+ reject(error);
618
+ };
619
+ timer = setTimeout(() => {
620
+ const error = new DOMException(
621
+ "Silmaril classification deadline exceeded",
622
+ "TimeoutError"
623
+ );
624
+ controller.abort(error);
625
+ fail(error);
626
+ }, timeoutMs);
627
+ let classification;
628
+ try {
629
+ classification = classify(controller.signal);
630
+ } catch (error) {
631
+ fail(error);
632
+ return;
633
+ }
634
+ Promise.resolve(classification).then(
635
+ (result) => settle(resolve, result),
636
+ (error) => fail(error)
637
+ );
638
+ });
639
+ }
583
640
  function resolveRuntimeConfig(rawConfig) {
584
641
  const config = readRecord(rawConfig);
585
642
  const apiKey = readString(config?.silmarilApiKey) ?? readString(config?.apiKey);
@@ -620,6 +677,12 @@ function readIntegerInRange(value, min, max) {
620
677
  }
621
678
  return integerValue;
622
679
  }
680
+ function pluginHookBudgetMs(classifierTimeoutMs) {
681
+ return Math.min(
682
+ classifierTimeoutMs + HOOK_CLEANUP_MARGIN_MS,
683
+ MAX_PLUGIN_HOOK_TIMEOUT_MS
684
+ );
685
+ }
623
686
  function readBoolean(value) {
624
687
  if (typeof value === "boolean") {
625
688
  return value;
@@ -653,13 +716,13 @@ function omitUndefined2(record) {
653
716
  Object.entries(record).filter((entry) => entry[1] !== void 0)
654
717
  );
655
718
  }
656
- async function classifyHookPayload(firewall, text, meta, endpointId) {
719
+ async function classifyHookPayload(classifier, text, meta, endpointId) {
657
720
  const trimmed = text.trim();
658
721
  if (!trimmed) {
659
722
  logSkipped(meta, "empty_payload");
660
723
  return void 0;
661
724
  }
662
- const result = await firewall.classify(text, {
725
+ const result = await classifier.classify(text, {
663
726
  hook: meta.hook,
664
727
  toolName: meta.toolName,
665
728
  requestId: buildStableRequestId(meta, text),
@@ -685,17 +748,17 @@ function buildGovernanceContext(meta) {
685
748
  resource
686
749
  };
687
750
  }
688
- async function classifyOnce(firewall, text, meta, cache, endpointId, now = Date.now()) {
751
+ async function classifyOnce(classifier, text, meta, cache, endpointId, now = Date.now()) {
689
752
  const key = outboundDedupeKey(meta, text);
690
753
  pruneOutboundCache(cache, now);
691
754
  if (!key) {
692
- return classifyHookPayload(firewall, text, meta, endpointId);
755
+ return classifyHookPayload(classifier, text, meta, endpointId);
693
756
  }
694
757
  const existing = cache.get(key);
695
758
  if (existing && now - existing.createdAt <= OUTBOUND_DEDUPE_TTL_MS) {
696
759
  return existing.result;
697
760
  }
698
- const result = classifyHookPayload(firewall, text, meta, endpointId);
761
+ const result = classifyHookPayload(classifier, text, meta, endpointId);
699
762
  cache.set(key, { createdAt: now, result });
700
763
  if (cache.size > MAX_OUTBOUND_DEDUPE_ENTRIES) {
701
764
  const oldest = cache.keys().next().value;
@@ -1314,6 +1377,11 @@ var __testInternals = {
1314
1377
  readRecord,
1315
1378
  readString,
1316
1379
  readIntegerInRange,
1380
+ pluginHookBudgetMs,
1381
+ HOOK_CLEANUP_MARGIN_MS,
1382
+ MAX_PLUGIN_HOOK_TIMEOUT_MS,
1383
+ createBoundedClassificationClient,
1384
+ withClassificationDeadline,
1317
1385
  readBoolean,
1318
1386
  readMode,
1319
1387
  classifyHookPayload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silmaril-security/firewall-plugin",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "repository": {
@@ -35,12 +35,12 @@
35
35
  "./dist/index.js"
36
36
  ],
37
37
  "compat": {
38
- "pluginApi": ">=2026.5.28",
39
- "minGatewayVersion": "2026.5.28"
38
+ "pluginApi": ">=2026.8.2",
39
+ "minGatewayVersion": "2026.8.2"
40
40
  },
41
41
  "build": {
42
- "openclawVersion": "2026.5.28",
43
- "pluginSdkVersion": "2026.5.28"
42
+ "openclawVersion": "2026.11.2",
43
+ "pluginSdkVersion": "2026.11.2"
44
44
  }
45
45
  },
46
46
  "publishConfig": {