@agent-inspect/mcp-server 6.31.4 → 6.31.5

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/cli.cjs CHANGED
@@ -6704,6 +6704,19 @@ var EXPORT_PAYLOAD_VERSION = "0.1.2";
6704
6704
 
6705
6705
  // packages/core/src/safety/url-redaction.ts
6706
6706
  var HTTP_URL = /^https?:\/\/[^\s]+$/i;
6707
+ var CONNECTION_PROTOCOLS = /* @__PURE__ */ new Set([
6708
+ "postgres:",
6709
+ "postgresql:",
6710
+ "mysql:",
6711
+ "mariadb:",
6712
+ "mongodb:",
6713
+ "mongodb+srv:",
6714
+ "redis:",
6715
+ "rediss:",
6716
+ "amqp:",
6717
+ "amqps:"
6718
+ ]);
6719
+ var CONNECTION_URI = /^(?:postgres|postgresql|mysql|mariadb|mongodb(?:\+srv)?|rediss?|amqps?):\/\/[^\s]+$/i;
6707
6720
  var UUID_SEGMENT = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6708
6721
  var HEX_SEGMENT = /^[0-9a-f]{12,}$/i;
6709
6722
  var NUMERIC_SEGMENT = /^\d{5,}$/;
@@ -6711,14 +6724,25 @@ var OPAQUE_SEGMENT = /^[A-Za-z0-9_-]{20,}$/;
6711
6724
  function looksLikeHttpUrl(value) {
6712
6725
  return HTTP_URL.test(value.trim());
6713
6726
  }
6714
- function parseHttpUrl(value) {
6727
+ function looksLikeConnectionUri(value) {
6728
+ return CONNECTION_URI.test(value.trim());
6729
+ }
6730
+ function looksLikeUrlForRedaction(value) {
6731
+ return looksLikeHttpUrl(value) || looksLikeConnectionUri(value);
6732
+ }
6733
+ function parseRedactableUrl(value) {
6715
6734
  try {
6716
6735
  const url = new URL(value.trim());
6717
- return url.protocol === "http:" || url.protocol === "https:" ? url : void 0;
6736
+ if (url.protocol === "http:" || url.protocol === "https:") return url;
6737
+ if (CONNECTION_PROTOCOLS.has(url.protocol)) return url;
6738
+ return void 0;
6718
6739
  } catch {
6719
6740
  return void 0;
6720
6741
  }
6721
6742
  }
6743
+ function isHttpProtocol(protocol) {
6744
+ return protocol === "http:" || protocol === "https:";
6745
+ }
6722
6746
  function isIdentifierSegment(segment) {
6723
6747
  if (UUID_SEGMENT.test(segment)) return true;
6724
6748
  if (HEX_SEGMENT.test(segment)) return true;
@@ -6756,15 +6780,16 @@ function redactUrlString(value, options) {
6756
6780
  credentialRedacted: false,
6757
6781
  identifiersMasked: false
6758
6782
  };
6759
- if (!looksLikeHttpUrl(value)) return unchanged;
6760
- const url = parseHttpUrl(value);
6783
+ if (!looksLikeUrlForRedaction(value)) return unchanged;
6784
+ const url = parseRedactableUrl(value);
6761
6785
  if (!url) return unchanged;
6762
6786
  const replacement = options.replacement ?? "[REDACTED]";
6763
6787
  const idPlaceholder = options.idPlaceholder ?? "[id]";
6788
+ const http = isHttpProtocol(url.protocol);
6764
6789
  let credentialRedacted = url.username.length > 0 || url.password.length > 0;
6765
6790
  let identifiersMasked = false;
6766
6791
  let pathname = url.pathname;
6767
- if (options.maskPathIds === true) {
6792
+ if (http && options.maskPathIds === true) {
6768
6793
  pathname = url.pathname.split("/").map((segment) => {
6769
6794
  if (segment.length === 0 || !isIdentifierSegment(decodeParam(segment))) {
6770
6795
  return segment;
@@ -7562,6 +7587,19 @@ function valueContainsKeyValueSecret(value) {
7562
7587
 
7563
7588
  // packages/redact/src/url-redaction.ts
7564
7589
  var HTTP_URL2 = /^https?:\/\/[^\s]+$/i;
7590
+ var CONNECTION_PROTOCOLS2 = /* @__PURE__ */ new Set([
7591
+ "postgres:",
7592
+ "postgresql:",
7593
+ "mysql:",
7594
+ "mariadb:",
7595
+ "mongodb:",
7596
+ "mongodb+srv:",
7597
+ "redis:",
7598
+ "rediss:",
7599
+ "amqp:",
7600
+ "amqps:"
7601
+ ]);
7602
+ var CONNECTION_URI2 = /^(?:postgres|postgresql|mysql|mariadb|mongodb(?:\+srv)?|rediss?|amqps?):\/\/[^\s]+$/i;
7565
7603
  var UUID_SEGMENT2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7566
7604
  var HEX_SEGMENT2 = /^[0-9a-f]{12,}$/i;
7567
7605
  var NUMERIC_SEGMENT2 = /^\d{5,}$/;
@@ -7569,14 +7607,25 @@ var OPAQUE_SEGMENT2 = /^[A-Za-z0-9_-]{20,}$/;
7569
7607
  function looksLikeHttpUrl2(value) {
7570
7608
  return HTTP_URL2.test(value.trim());
7571
7609
  }
7572
- function parseHttpUrl2(value) {
7610
+ function looksLikeConnectionUri2(value) {
7611
+ return CONNECTION_URI2.test(value.trim());
7612
+ }
7613
+ function looksLikeUrlForRedaction2(value) {
7614
+ return looksLikeHttpUrl2(value) || looksLikeConnectionUri2(value);
7615
+ }
7616
+ function parseRedactableUrl2(value) {
7573
7617
  try {
7574
7618
  const url = new URL(value.trim());
7575
- return url.protocol === "http:" || url.protocol === "https:" ? url : void 0;
7619
+ if (url.protocol === "http:" || url.protocol === "https:") return url;
7620
+ if (CONNECTION_PROTOCOLS2.has(url.protocol)) return url;
7621
+ return void 0;
7576
7622
  } catch {
7577
7623
  return void 0;
7578
7624
  }
7579
7625
  }
7626
+ function isHttpProtocol2(protocol) {
7627
+ return protocol === "http:" || protocol === "https:";
7628
+ }
7580
7629
  function isIdentifierSegment2(segment) {
7581
7630
  if (UUID_SEGMENT2.test(segment)) return true;
7582
7631
  if (HEX_SEGMENT2.test(segment)) return true;
@@ -7614,15 +7663,16 @@ function redactUrlString2(value, options) {
7614
7663
  credentialRedacted: false,
7615
7664
  identifiersMasked: false
7616
7665
  };
7617
- if (!looksLikeHttpUrl2(value)) return unchanged;
7618
- const url = parseHttpUrl2(value);
7666
+ if (!looksLikeUrlForRedaction2(value)) return unchanged;
7667
+ const url = parseRedactableUrl2(value);
7619
7668
  if (!url) return unchanged;
7620
7669
  const replacement = options.replacement ?? "[REDACTED]";
7621
7670
  const idPlaceholder = options.idPlaceholder ?? "[id]";
7671
+ const http = isHttpProtocol2(url.protocol);
7622
7672
  let credentialRedacted = url.username.length > 0 || url.password.length > 0;
7623
7673
  let identifiersMasked = false;
7624
7674
  let pathname = url.pathname;
7625
- if (options.maskPathIds === true) {
7675
+ if (http && options.maskPathIds === true) {
7626
7676
  pathname = url.pathname.split("/").map((segment) => {
7627
7677
  if (segment.length === 0 || !isIdentifierSegment2(decodeParam2(segment))) {
7628
7678
  return segment;
@@ -8072,7 +8122,7 @@ var Redactor2 = class {
8072
8122
  return applyRule(rule, value, this.#replacement);
8073
8123
  }
8074
8124
  }
8075
- if (typeof value === "string" && looksLikeHttpUrl2(value)) {
8125
+ if (typeof value === "string" && looksLikeUrlForRedaction2(value)) {
8076
8126
  const url = redactUrlString2(value, {
8077
8127
  sensitiveKeys: this.#sensitiveKeys,
8078
8128
  isSensitiveValue: (candidate) => this.#detect(candidate, key, path17) !== void 0,