shroud-privacy 2.3.0 → 2.3.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/config-manager.js
CHANGED
|
@@ -167,8 +167,10 @@ export class ConfigManager {
|
|
|
167
167
|
for (let i = 0; i < BUILTIN_PATTERNS.length; i++) {
|
|
168
168
|
const p = BUILTIN_PATTERNS[i];
|
|
169
169
|
const comma = i < BUILTIN_PATTERNS.length - 1 ? "," : "";
|
|
170
|
-
// Convert RegExp to source string
|
|
171
|
-
|
|
170
|
+
// Convert RegExp to source string + flags
|
|
171
|
+
const flags = p.pattern.flags.replace("g", "") || undefined; // "g" is always added; only store extra flags (i, m, etc.)
|
|
172
|
+
const flagsPart = flags ? `, "flags": "${flags}"` : "";
|
|
173
|
+
lines.push(` "${p.name}": { "pattern": ${JSON.stringify(p.pattern.source)}, "category": "${p.category}", "confidence": ${p.confidence}${flagsPart} }${comma}`);
|
|
172
174
|
}
|
|
173
175
|
lines.push(" }");
|
|
174
176
|
lines.push("}");
|
|
@@ -23,6 +23,8 @@ export type DetectorOverrides = Record<string, {
|
|
|
23
23
|
export type ConfigRule = {
|
|
24
24
|
enabled?: boolean;
|
|
25
25
|
pattern?: string;
|
|
26
|
+
/** Extra regex flags beyond "g" (e.g. "i", "m", "im"). Always gets "g" automatically. */
|
|
27
|
+
flags?: string;
|
|
26
28
|
category?: string;
|
|
27
29
|
confidence?: number;
|
|
28
30
|
};
|
package/dist/detectors/regex.js
CHANGED
|
@@ -1273,8 +1273,9 @@ export class RegexDetector {
|
|
|
1273
1273
|
return p;
|
|
1274
1274
|
const updated = { ...p };
|
|
1275
1275
|
if (rule.pattern) {
|
|
1276
|
+
const flags = "g" + (rule.flags || "").replace(/g/g, "");
|
|
1276
1277
|
try {
|
|
1277
|
-
updated.pattern = new RegExp(rule.pattern,
|
|
1278
|
+
updated.pattern = new RegExp(rule.pattern, flags);
|
|
1278
1279
|
}
|
|
1279
1280
|
catch { /* invalid regex — keep built-in */ }
|
|
1280
1281
|
}
|
|
@@ -1298,9 +1299,10 @@ export class RegexDetector {
|
|
|
1298
1299
|
if (!rule.pattern)
|
|
1299
1300
|
continue; // new rules must have a pattern
|
|
1300
1301
|
try {
|
|
1302
|
+
const flags = "g" + (rule.flags || "").replace(/g/g, "");
|
|
1301
1303
|
patterns.push({
|
|
1302
1304
|
name,
|
|
1303
|
-
pattern: new RegExp(rule.pattern,
|
|
1305
|
+
pattern: new RegExp(rule.pattern, flags),
|
|
1304
1306
|
category: rule.category ? resolveCategory(rule.category) : Category.CUSTOM,
|
|
1305
1307
|
confidence: rule.confidence ?? 0.9,
|
|
1306
1308
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shroud-privacy",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Privacy and infrastructure protection for AI agents — detects sensitive data (PII, network topology, credentials, OT/SCADA) and replaces with deterministic fakes before anything reaches the LLM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|