nexus-agents 5.0.0 → 5.0.3

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.
@@ -7,7 +7,7 @@ import {
7
7
  toolStructuredError,
8
8
  toolSuccessStructured,
9
9
  wrapToolWithTimeout
10
- } from "./chunk-KRIAQJ7L.js";
10
+ } from "./chunk-O6TCROTE.js";
11
11
  import {
12
12
  JsonlStore,
13
13
  SECURITY_KEYWORDS,
@@ -2159,4 +2159,4 @@ export {
2159
2159
  runImprovementReview,
2160
2160
  registerImprovementReviewTool
2161
2161
  };
2162
- //# sourceMappingURL=chunk-CAQ5KUPL.js.map
2162
+ //# sourceMappingURL=chunk-AU6N4HZR.js.map
@@ -23,7 +23,7 @@ import {
23
23
  toolSuccessStructured,
24
24
  withProgressHeartbeat,
25
25
  wrapToolWithTimeout
26
- } from "./chunk-KRIAQJ7L.js";
26
+ } from "./chunk-O6TCROTE.js";
27
27
  import {
28
28
  assessPanelIndependence,
29
29
  countDistinctModels,
@@ -6848,4 +6848,4 @@ export {
6848
6848
  CONSENSUS_VOTE_TOOL_SCHEMA,
6849
6849
  registerConsensusVoteTool
6850
6850
  };
6851
- //# sourceMappingURL=chunk-5ZMA2TIE.js.map
6851
+ //# sourceMappingURL=chunk-FTIJ4V4A.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-EYOJLWOA.js";
3
+ } from "./chunk-RXJHAUJY.js";
4
4
  import {
5
5
  emitClawGuardViolation
6
6
  } from "./chunk-ZSNWRX2B.js";
@@ -649,24 +649,27 @@ function measuredTrustTier(context) {
649
649
 
650
650
  // src/mcp/middleware/tool-input-sanitizer.ts
651
651
  var XML_INJECTION_PATTERN = /<\/?(system|human|assistant|instructions|user|prompt|context|tool_use|tool_result)\b[^>]*>/gi;
652
+ var HIDDEN_INSTRUCTION_TRIGGER = /execute|delete|merge|apply/i;
653
+ function hasHiddenInstruction(value) {
654
+ const OPEN = "<!--";
655
+ const CLOSE = "-->";
656
+ let from = 0;
657
+ for (; ; ) {
658
+ const open = value.indexOf(OPEN, from);
659
+ if (open === -1) return false;
660
+ const close = value.indexOf(CLOSE, open + OPEN.length);
661
+ if (close === -1) return false;
662
+ if (HIDDEN_INSTRUCTION_TRIGGER.test(value.slice(open + OPEN.length, close))) {
663
+ return true;
664
+ }
665
+ from = close + CLOSE.length;
666
+ }
667
+ }
652
668
  var INJECTION_DETECTORS = [
653
669
  { name: "system_prompt_override", pattern: /ignore (?:all )?previous (?:instructions|rules)/i },
654
670
  { name: "role_impersonation", pattern: /i(?:'m| am) the (?:repo |project )?(?:owner|admin)/i },
655
- // The trigger must sit INSIDE one comment. `[\s\S]*?` used to cross an
656
- // intervening `-->`, so any body with an opening comment, a trigger word
657
- // anywhere in ordinary prose, and a later closing comment matched — a real
658
- // PR body like "<!-- header -->\nsafe to merge after CI\n<!-- footer -->"
659
- // was flagged (#5258). `(?:(?!-->)[\s\S])*?` is the standard tempered-dot
660
- // form: consume any character that does not begin the terminator.
661
- //
662
- // KNOWN RESIDUAL: GitHub's default PR template contains
663
- // "<!-- Please delete options that are not relevant -->", where the trigger
664
- // genuinely is inside a single comment. Containment cannot help there; the
665
- // trigger vocabulary overlaps ordinary English. Tracked in #5258.
666
- {
667
- name: "hidden_instruction",
668
- pattern: /<!--(?:(?!-->)[\s\S])*?(?:execute|delete|merge|apply)(?:(?!-->)[\s\S])*?-->/i
669
- }
671
+ // `hidden_instruction` is a scan, not a pattern — see hasHiddenInstruction.
672
+ { name: "hidden_instruction", match: hasHiddenInstruction }
670
673
  ];
671
674
  function sanitizeString(value) {
672
675
  const MAX_PASSES = 5;
@@ -681,9 +684,11 @@ function sanitizeString(value) {
681
684
  }
682
685
  function detectPatterns(value) {
683
686
  const detected = [];
684
- for (const { name, pattern } of INJECTION_DETECTORS) {
685
- pattern.lastIndex = 0;
686
- if (pattern.test(value)) {
687
+ for (const { name, pattern, match } of INJECTION_DETECTORS) {
688
+ if (pattern !== void 0) {
689
+ pattern.lastIndex = 0;
690
+ if (pattern.test(value)) detected.push(name);
691
+ } else if (match?.(value) === true) {
687
692
  detected.push(name);
688
693
  }
689
694
  }
@@ -2130,4 +2135,4 @@ export {
2130
2135
  VOTING_THRESHOLDS,
2131
2136
  ConsensusMetricsSchema
2132
2137
  };
2133
- //# sourceMappingURL=chunk-KRIAQJ7L.js.map
2138
+ //# sourceMappingURL=chunk-O6TCROTE.js.map