@rosthq/cli 0.7.151 → 0.7.152

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
@@ -30133,6 +30133,8 @@ function hasSecretShapedString(value) {
30133
30133
  }
30134
30134
  var SECRET_KEY = /(api[_-]?key|secret|password|token|authorization|credential|private[_-]?key)/i;
30135
30135
  var MAX_ARRAY_ENTRIES = 50;
30136
+ var MAX_SECRET_SHAPED_VALUE_DEPTH = 8;
30137
+ var MAX_SECRET_SHAPED_VALUE_NODES = 1e6;
30136
30138
  function hasSecretShapedContent(value) {
30137
30139
  if (typeof value === "string") {
30138
30140
  return hasSecretShapedString(value);
@@ -30145,18 +30147,65 @@ function hasSecretShapedContent(value) {
30145
30147
  }
30146
30148
  return false;
30147
30149
  }
30148
- function hasSecretShapedValue(value) {
30149
- if (typeof value === "string") {
30150
- return hasSecretShapedString(value);
30151
- }
30152
- if (Array.isArray(value)) {
30153
- return value.some(hasSecretShapedValue);
30154
- }
30155
- if (value && typeof value === "object") {
30156
- return Object.values(value).some(hasSecretShapedValue);
30150
+ function scanSecretShapedValue(value, budget) {
30151
+ const stack = [{ value, depth: 0 }];
30152
+ const seen = /* @__PURE__ */ new WeakSet();
30153
+ while (stack.length > 0) {
30154
+ const entry = stack.pop();
30155
+ if (!entry) {
30156
+ continue;
30157
+ }
30158
+ const { value: current, depth } = entry;
30159
+ budget.visitedNodes += 1;
30160
+ if (budget.visitedNodes > MAX_SECRET_SHAPED_VALUE_NODES) {
30161
+ return true;
30162
+ }
30163
+ if (depth > MAX_SECRET_SHAPED_VALUE_DEPTH && current !== "[REDACTED]" && current !== "[MAX_DEPTH]") {
30164
+ return true;
30165
+ }
30166
+ if (typeof current === "string") {
30167
+ if (hasSecretShapedString(current)) {
30168
+ return true;
30169
+ }
30170
+ continue;
30171
+ }
30172
+ if (!current || typeof current !== "object") {
30173
+ continue;
30174
+ }
30175
+ if (seen.has(current)) {
30176
+ continue;
30177
+ }
30178
+ seen.add(current);
30179
+ try {
30180
+ if (Array.isArray(current)) {
30181
+ if (current.length > MAX_SECRET_SHAPED_VALUE_NODES) {
30182
+ return true;
30183
+ }
30184
+ for (let index = current.length - 1; index >= 0; index -= 1) {
30185
+ stack.push({ value: current[index], depth: depth + 1 });
30186
+ }
30187
+ } else {
30188
+ const keys = Object.keys(current);
30189
+ if (keys.length > MAX_SECRET_SHAPED_VALUE_NODES) {
30190
+ return true;
30191
+ }
30192
+ for (let index = keys.length - 1; index >= 0; index -= 1) {
30193
+ const key = keys[index];
30194
+ if (key === void 0) {
30195
+ return true;
30196
+ }
30197
+ stack.push({ value: current[key], depth: depth + 1 });
30198
+ }
30199
+ }
30200
+ } catch {
30201
+ return true;
30202
+ }
30157
30203
  }
30158
30204
  return false;
30159
30205
  }
30206
+ function hasSecretShapedValue(value) {
30207
+ return scanSecretShapedValue(value, { visitedNodes: 0 });
30208
+ }
30160
30209
 
30161
30210
  // ../../packages/protocol/src/agent-setup.ts
30162
30211
  var uuidSchema3 = external_exports.string().uuid();