@agent-inspect/eval 6.17.2 → 6.17.4
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/README.md +1 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -217,8 +217,11 @@ function runCircuits(events, options = {}) {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// packages/redact/src/sensitive-key.ts
|
|
220
|
+
function keyHasExplicitSeparator(value) {
|
|
221
|
+
return /[_\-.]/.test(value);
|
|
222
|
+
}
|
|
220
223
|
function normalizeSensitiveKey(value) {
|
|
221
|
-
return value.toLowerCase().replace(/[^a-z0-
|
|
224
|
+
return value.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
222
225
|
}
|
|
223
226
|
var NON_CREDENTIAL_TOKEN_CONFIG_KEYS = new Set(
|
|
224
227
|
[
|
|
@@ -248,6 +251,7 @@ function isCredentialSensitiveKey(key, sensitiveKeys) {
|
|
|
248
251
|
const normalized = normalizeSensitiveKey(key);
|
|
249
252
|
if (!normalized) return false;
|
|
250
253
|
if (NON_CREDENTIAL_TOKEN_CONFIG_KEYS.has(normalized)) return false;
|
|
254
|
+
const allowPrefixCompound = keyHasExplicitSeparator(key);
|
|
251
255
|
for (const sensitive of sensitiveKeys) {
|
|
252
256
|
const s = normalizeSensitiveKey(sensitive);
|
|
253
257
|
if (!s) continue;
|
|
@@ -256,7 +260,8 @@ function isCredentialSensitiveKey(key, sensitiveKeys) {
|
|
|
256
260
|
continue;
|
|
257
261
|
}
|
|
258
262
|
if (normalized === s) return true;
|
|
259
|
-
if (normalized.endsWith(`_${s}`)
|
|
263
|
+
if (normalized.endsWith(`_${s}`)) return true;
|
|
264
|
+
if (allowPrefixCompound && normalized.startsWith(`${s}_`)) return true;
|
|
260
265
|
}
|
|
261
266
|
return false;
|
|
262
267
|
}
|