agent-sanitizer 2.11.0 → 2.12.0

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.
@@ -185,10 +185,13 @@ export function deriveCredentialVocabulary(spec) {
185
185
  for (const noun of nouns)
186
186
  if (Array.isArray(noun?.uses) && noun.uses.includes(ENV_NAME_USE))
187
187
  segments.push(...segmentForms(parts(noun.parts, "nouns[].parts")));
188
+ // Rendered WITHOUT a leading underscore; the boundary is applied in the regex
189
+ // below, symmetrically with the match pattern. Baking `_` into the token makes
190
+ // the exclusion reachable only when something precedes the run, so a variable
191
+ // named exactly `PUBLIC_KEY` matched on its trailing `KEY` and never reached
192
+ // its exclusion — its value was then cut out of every tool output carrying it.
188
193
  const excludeSuffixes = nonSecret.flatMap((suffix) =>
189
- segmentForms(parts(suffix, "nonSecretSuffixes[]")).map(
190
- (form) => `_${form}`,
191
- ),
194
+ segmentForms(parts(suffix, "nonSecretSuffixes[]")),
192
195
  );
193
196
  return {
194
197
  segments: [...new Set(segments)],
@@ -244,7 +247,7 @@ export function buildCredentialNameRes(spec) {
244
247
  return {
245
248
  match: new RegExp(`(?:^|_)(?:${segments.join("|")})$`, "i"),
246
249
  exclude: new RegExp(
247
- `(?:${excludeSuffixes.join("|")})$|^(?:${excludeNames.join("|")})$`,
250
+ `(?:^|_)(?:${excludeSuffixes.join("|")})$|^(?:${excludeNames.join("|")})$`,
248
251
  "i",
249
252
  ),
250
253
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-sanitizer",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Defend an agent against hidden-content injection: strip payload-capable invisible Unicode and ANSI, splice out human-invisible HTML, and flag data-exfil URLs in untrusted text before any model sees it.",
5
5
  "type": "module",
6
6
  "repository": {