acp-devtools 0.6.0 → 0.6.1

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
@@ -9179,6 +9179,9 @@ var init_export = __esm({
9179
9179
  });
9180
9180
 
9181
9181
  // ../core/dist/storage/redact.js
9182
+ function isNameValuePair(v) {
9183
+ return v !== null && typeof v === "object" && !Array.isArray(v) && typeof v["name"] === "string" && typeof v["value"] === "string";
9184
+ }
9182
9185
  function redactMessage(message) {
9183
9186
  if (message.payload == null) {
9184
9187
  return { redacted: message, count: 0 };
@@ -9209,6 +9212,9 @@ function redactValue(value, ctx) {
9209
9212
  return { value: out, count };
9210
9213
  }
9211
9214
  if (value !== null && typeof value === "object") {
9215
+ if (isNameValuePair(value) && SENSITIVE_HEADER_NAMES.has(value.name.toLowerCase())) {
9216
+ return redactPair(value, ctx);
9217
+ }
9212
9218
  let count = 0;
9213
9219
  const out = {};
9214
9220
  for (const [k, v] of Object.entries(value)) {
@@ -9217,6 +9223,20 @@ function redactValue(value, ctx) {
9217
9223
  count += 1;
9218
9224
  continue;
9219
9225
  }
9226
+ if (CREDENTIAL_LIST_KEYS.has(k.toLowerCase())) {
9227
+ if (Array.isArray(v) && v.some(isNameValuePair)) {
9228
+ const r2 = redactPairList(v, ctx);
9229
+ out[k] = r2.value;
9230
+ count += r2.count;
9231
+ continue;
9232
+ }
9233
+ if (k.toLowerCase() === "env" && v !== null && typeof v === "object" && !Array.isArray(v)) {
9234
+ const r2 = redactHeadersBlock(v);
9235
+ out[k] = r2.value;
9236
+ count += r2.count;
9237
+ continue;
9238
+ }
9239
+ }
9220
9240
  if (ctx.inProxyConfig && k === "headers" && v !== null && typeof v === "object" && !Array.isArray(v)) {
9221
9241
  const r2 = redactHeadersBlock(v);
9222
9242
  out[k] = r2.value;
@@ -9232,13 +9252,37 @@ function redactValue(value, ctx) {
9232
9252
  }
9233
9253
  return { value, count: 0 };
9234
9254
  }
9255
+ function redactPair(pair, ctx) {
9256
+ let count = pair.value === REDACTED_PLACEHOLDER ? 0 : 1;
9257
+ const out = {};
9258
+ for (const [k, v] of Object.entries(pair)) {
9259
+ if (k === "value" || k === "name") {
9260
+ out[k] = k === "value" ? REDACTED_PLACEHOLDER : v;
9261
+ continue;
9262
+ }
9263
+ const r = redactValue(v, ctx);
9264
+ out[k] = r.value;
9265
+ count += r.count;
9266
+ }
9267
+ return { value: out, count };
9268
+ }
9269
+ function redactPairList(list, ctx) {
9270
+ let count = 0;
9271
+ const out = list.map((item) => {
9272
+ const r = isNameValuePair(item) ? redactPair(item, ctx) : redactValue(item, ctx);
9273
+ count += r.count;
9274
+ return r.value;
9275
+ });
9276
+ return { value: out, count };
9277
+ }
9235
9278
  function redactHeadersBlock(obj) {
9236
9279
  let count = 0;
9237
9280
  const out = {};
9238
9281
  for (const [k, v] of Object.entries(obj)) {
9239
9282
  if (typeof v === "string") {
9240
9283
  out[k] = REDACTED_PLACEHOLDER;
9241
- count += 1;
9284
+ if (v !== REDACTED_PLACEHOLDER)
9285
+ count += 1;
9242
9286
  } else {
9243
9287
  out[k] = v;
9244
9288
  }
@@ -9265,7 +9309,7 @@ function redactSessionExport(exp) {
9265
9309
  fieldsRedacted
9266
9310
  };
9267
9311
  }
9268
- var REDACTED_PLACEHOLDER, SENSITIVE_HEADER_NAMES;
9312
+ var REDACTED_PLACEHOLDER, SENSITIVE_HEADER_NAMES, CREDENTIAL_LIST_KEYS;
9269
9313
  var init_redact = __esm({
9270
9314
  "../core/dist/storage/redact.js"() {
9271
9315
  "use strict";
@@ -9283,6 +9327,7 @@ var init_redact = __esm({
9283
9327
  "cookie",
9284
9328
  "set-cookie"
9285
9329
  ]);
9330
+ CREDENTIAL_LIST_KEYS = /* @__PURE__ */ new Set(["headers", "env"]);
9286
9331
  }
9287
9332
  });
9288
9333
 
@@ -11051,7 +11096,7 @@ var CLI_VERSION;
11051
11096
  var init_version = __esm({
11052
11097
  "src/version.ts"() {
11053
11098
  "use strict";
11054
- CLI_VERSION = "0.6.0";
11099
+ CLI_VERSION = "0.6.1";
11055
11100
  }
11056
11101
  });
11057
11102