@camstack/types 0.1.38 → 0.1.39

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-BblD92Si.js");
3
+ const index = require("./index-CMM1Y9W6.js");
4
4
  const zod = require("zod");
5
5
  class DisposerChain {
6
6
  disposers = [];
@@ -5689,13 +5689,42 @@ function getCapsByProviderKind(kind) {
5689
5689
  }
5690
5690
  return out;
5691
5691
  }
5692
+ const CREDENTIAL_PARAM_PATTERNS = [
5693
+ /^user$/i,
5694
+ /^usr$/i,
5695
+ /^username$/i,
5696
+ /^password$/i,
5697
+ /^pwd$/i,
5698
+ /^pass$/i,
5699
+ /^passwd$/i,
5700
+ /^secret$/i,
5701
+ /^token$/i,
5702
+ /^auth$/i,
5703
+ /^auth[_-]?token$/i,
5704
+ /^bearer$/i,
5705
+ /^api[_-]?key$/i,
5706
+ /^access[_-]?token$/i,
5707
+ /^refresh[_-]?token$/i
5708
+ ];
5709
+ function isCredentialParam(name) {
5710
+ return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
5711
+ }
5692
5712
  function maskUrlCredentials(rawUrl) {
5693
5713
  try {
5694
5714
  const u = new URL(rawUrl);
5695
- if (!u.username && !u.password) return rawUrl;
5696
- u.username = "";
5697
- u.password = "";
5698
- return u.toString();
5715
+ let touched = false;
5716
+ if (u.username || u.password) {
5717
+ u.username = "";
5718
+ u.password = "";
5719
+ touched = true;
5720
+ }
5721
+ for (const key of [...u.searchParams.keys()]) {
5722
+ if (isCredentialParam(key)) {
5723
+ u.searchParams.set(key, "***");
5724
+ touched = true;
5725
+ }
5726
+ }
5727
+ return touched ? u.toString() : rawUrl;
5699
5728
  } catch {
5700
5729
  return rawUrl;
5701
5730
  }