@intutic/shared-types 2.1.0 → 2.3.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.
- package/dist/anomaly.d.ts +6 -10
- package/dist/anomaly.d.ts.map +1 -1
- package/dist/anomaly.js +0 -2
- package/dist/anomaly.js.map +1 -1
- package/dist/api-contracts.d.ts +1 -1
- package/dist/api-contracts.js +1 -1
- package/dist/attenuation.d.ts +1 -1
- package/dist/attenuation.js +1 -1
- package/dist/auth.d.ts +10 -9
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +3 -4
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/billing.js +1 -1
- package/dist/destructiveSql.d.ts +48 -0
- package/dist/destructiveSql.d.ts.map +1 -0
- package/dist/destructiveSql.js +43 -0
- package/dist/destructiveSql.js.map +1 -0
- package/dist/devInventory.d.ts +120 -0
- package/dist/devInventory.d.ts.map +1 -0
- package/dist/devInventory.js +80 -0
- package/dist/devInventory.js.map +1 -0
- package/dist/enums.d.ts +18 -21
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +24 -28
- package/dist/enums.js.map +1 -1
- package/dist/errors.js +3 -3
- package/dist/errors.js.map +1 -1
- package/dist/finops.d.ts +14 -2
- package/dist/finops.d.ts.map +1 -1
- package/dist/finops.js +15 -1
- package/dist/finops.js.map +1 -1
- package/dist/gateDecisions.d.ts +18 -0
- package/dist/gateDecisions.d.ts.map +1 -0
- package/dist/gateDecisions.js +20 -0
- package/dist/gateDecisions.js.map +1 -0
- package/dist/gateIdentity.d.ts +23 -0
- package/dist/gateIdentity.d.ts.map +1 -0
- package/dist/gateIdentity.js +32 -0
- package/dist/gateIdentity.js.map +1 -0
- package/dist/gateKind.d.ts +172 -0
- package/dist/gateKind.d.ts.map +1 -0
- package/dist/gateKind.js +160 -0
- package/dist/gateKind.js.map +1 -0
- package/dist/gateLimits.d.ts +170 -0
- package/dist/gateLimits.d.ts.map +1 -0
- package/dist/gateLimits.js +96 -0
- package/dist/gateLimits.js.map +1 -0
- package/dist/gitRemote.d.ts +17 -0
- package/dist/gitRemote.d.ts.map +1 -0
- package/dist/gitRemote.js +71 -0
- package/dist/gitRemote.js.map +1 -0
- package/dist/governanceCoverage.d.ts +3 -3
- package/dist/governanceCoverage.js +3 -3
- package/dist/guardrailIr.d.ts +3 -3
- package/dist/guardrailIr.d.ts.map +1 -1
- package/dist/guardrailIr.js +3 -3
- package/dist/guardrailIr.js.map +1 -1
- package/dist/guardrailRender.d.ts +1 -1
- package/dist/guardrailRender.js +1 -1
- package/dist/harnessRules.d.ts +74 -0
- package/dist/harnessRules.d.ts.map +1 -0
- package/dist/harnessRules.js +142 -0
- package/dist/harnessRules.js.map +1 -0
- package/dist/holdMessages.d.ts +25 -0
- package/dist/holdMessages.d.ts.map +1 -0
- package/dist/holdMessages.js +34 -0
- package/dist/holdMessages.js.map +1 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +2 -2
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +36 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -10
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +1 -2
- package/dist/intelligence.d.ts.map +1 -1
- package/dist/intelligence.js.map +1 -1
- package/dist/mcpBudgets.d.ts +191 -0
- package/dist/mcpBudgets.d.ts.map +1 -0
- package/dist/mcpBudgets.js +144 -0
- package/dist/mcpBudgets.js.map +1 -0
- package/dist/mcpRegistryRecord.d.ts +143 -0
- package/dist/mcpRegistryRecord.d.ts.map +1 -0
- package/dist/mcpRegistryRecord.js +229 -0
- package/dist/mcpRegistryRecord.js.map +1 -0
- package/dist/mcpToolRisk.d.ts +82 -0
- package/dist/mcpToolRisk.d.ts.map +1 -0
- package/dist/mcpToolRisk.js +334 -0
- package/dist/mcpToolRisk.js.map +1 -0
- package/dist/modelCatalog.d.ts +2 -2
- package/dist/modelCatalog.generated.js +1 -1
- package/dist/modelCatalog.generated.js.map +1 -1
- package/dist/modelCatalog.js +2 -2
- package/dist/notifications.d.ts +20 -130
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +241 -1
- package/dist/notifications.js.map +1 -1
- package/dist/phrases.d.ts +87 -0
- package/dist/phrases.d.ts.map +1 -0
- package/dist/phrases.js +241 -0
- package/dist/phrases.js.map +1 -0
- package/dist/piiDetectors.d.ts +97 -0
- package/dist/piiDetectors.d.ts.map +1 -0
- package/dist/piiDetectors.js +96 -0
- package/dist/piiDetectors.js.map +1 -0
- package/dist/piiDetectors.json +71 -0
- package/dist/policy.d.ts +1 -1
- package/dist/policy.js +1 -1
- package/dist/policyGuardrails.d.ts +127 -10
- package/dist/policyGuardrails.d.ts.map +1 -1
- package/dist/policyGuardrails.js +59 -6
- package/dist/policyGuardrails.js.map +1 -1
- package/dist/posturePresets.js +1 -1
- package/dist/posturePresets.js.map +1 -1
- package/dist/providerVerification.d.ts +2 -2
- package/dist/providerVerification.js +2 -2
- package/dist/providers.d.ts +4 -4
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +11 -6
- package/dist/providers.js.map +1 -1
- package/dist/regoBuiltins.d.ts +42 -0
- package/dist/regoBuiltins.d.ts.map +1 -0
- package/dist/regoBuiltins.js +732 -0
- package/dist/regoBuiltins.js.map +1 -0
- package/dist/regoRules.d.ts +105 -0
- package/dist/regoRules.d.ts.map +1 -0
- package/dist/regoRules.js +407 -0
- package/dist/regoRules.js.map +1 -0
- package/dist/ruleLoadFailures.d.ts +15 -0
- package/dist/ruleLoadFailures.d.ts.map +1 -0
- package/dist/ruleLoadFailures.js +26 -0
- package/dist/ruleLoadFailures.js.map +1 -0
- package/dist/scriptScan.d.ts +5 -5
- package/dist/scriptScan.js +3 -3
- package/dist/sequence.d.ts +52 -0
- package/dist/sequence.d.ts.map +1 -0
- package/dist/sequence.js +127 -0
- package/dist/sequence.js.map +1 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/skillScan.d.ts +3 -3
- package/dist/skillScan.d.ts.map +1 -1
- package/dist/skillScan.js +26 -4
- package/dist/skillScan.js.map +1 -1
- package/dist/sop.d.ts +24 -11
- package/dist/sop.d.ts.map +1 -1
- package/dist/sop.js +10 -9
- package/dist/sop.js.map +1 -1
- package/dist/sourceProviders.d.ts +1 -8
- package/dist/sourceProviders.d.ts.map +1 -1
- package/dist/sourceProviders.js +2 -9
- package/dist/sourceProviders.js.map +1 -1
- package/dist/ssoGroupClearance.d.ts +119 -0
- package/dist/ssoGroupClearance.d.ts.map +1 -0
- package/dist/ssoGroupClearance.js +196 -0
- package/dist/ssoGroupClearance.js.map +1 -0
- package/dist/sync.d.ts +42 -14
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +3 -3
- package/dist/sync.js.map +1 -1
- package/dist/taskManagement.d.ts +0 -2
- package/dist/taskManagement.d.ts.map +1 -1
- package/dist/taskManagement.js +0 -2
- package/dist/taskManagement.js.map +1 -1
- package/dist/toolPoison.d.ts +33 -0
- package/dist/toolPoison.d.ts.map +1 -0
- package/dist/toolPoison.js +85 -0
- package/dist/toolPoison.js.map +1 -0
- package/dist/usage.d.ts +186 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/wasmBinary.d.ts +25 -0
- package/dist/wasmBinary.d.ts.map +1 -0
- package/dist/wasmBinary.js +111 -0
- package/dist/wasmBinary.js.map +1 -0
- package/dist/wasmFuel.d.ts +52 -0
- package/dist/wasmFuel.d.ts.map +1 -0
- package/dist/wasmFuel.js +320 -0
- package/dist/wasmFuel.js.map +1 -0
- package/dist/wasmMemoryCap.d.ts +21 -0
- package/dist/wasmMemoryCap.d.ts.map +1 -0
- package/dist/wasmMemoryCap.js +58 -0
- package/dist/wasmMemoryCap.js.map +1 -0
- package/dist/workspaceSettings.d.ts +126 -17
- package/dist/workspaceSettings.d.ts.map +1 -1
- package/dist/workspaceSettings.js +21 -2
- package/dist/workspaceSettings.js.map +1 -1
- package/package.json +2 -2
package/dist/phrases.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Phrase matching for shell commands and SQL in linear time.
|
|
4
|
+
*
|
|
5
|
+
* Every command classifier asks the same question: does this text contain
|
|
6
|
+
* `git push`, `drop table`, `curl --data`, whatever separates the words? The
|
|
7
|
+
* separators that count are the ones the shell or the database reads as a
|
|
8
|
+
* word break:
|
|
9
|
+
*
|
|
10
|
+
* - whitespace, a two-character escaped `\n`, `\t` or `\r`, and a backslash
|
|
11
|
+
* before whitespace (a line continuation, or an escaped space);
|
|
12
|
+
* - a `/* … *\/` comment;
|
|
13
|
+
* - a `-- …` comment that runs to a newline (real or escaped);
|
|
14
|
+
* - a run of options starting with `--` (`git --no-pager push`,
|
|
15
|
+
* `kubectl --context prod apply`), which stops at `;`, `&`, `|` or a real
|
|
16
|
+
* newline — the end of the shell command it is in.
|
|
17
|
+
*
|
|
18
|
+
* The proxy's Rust classifier expresses this as a regex (`SQL_GAP` in
|
|
19
|
+
* `actions.rs`), which is safe there: Rust's engine is linear. JavaScript's
|
|
20
|
+
* and Python's backtrack, and that regex took seconds on a few hundred
|
|
21
|
+
* kilobytes of `git -- git -- …` — text an agent can be talked into producing.
|
|
22
|
+
* So here the text is cut into words in one pass, and a phrase is matched over
|
|
23
|
+
* the words right to left with one array per phrase word: O(length × words).
|
|
24
|
+
* No regex runs on the input.
|
|
25
|
+
*
|
|
26
|
+
* The two functions are self-contained on purpose — no imports, no module
|
|
27
|
+
* state — because the hook gates emit them as source (`phraseText.toString()`)
|
|
28
|
+
* and run them outside this package. `packages/gate-js/src/phrases.ts` is a
|
|
29
|
+
* byte-identical copy and `intutic_clawde/gate/phrases.py` a transliteration;
|
|
30
|
+
* all of them run `action_vectors.json` beside the proxy's `actions.rs`.
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
33
|
+
*/
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.PHRASES_JS_SOURCE = void 0;
|
|
36
|
+
exports.phraseText = phraseText;
|
|
37
|
+
exports.hasPhrase = hasPhrase;
|
|
38
|
+
/**
|
|
39
|
+
* Cuts `input` into words in one pass. A `--` inside a word starts a new one
|
|
40
|
+
* (`drop--why` is `drop` and `--why`), glued rather than separated, so it can
|
|
41
|
+
* open a comment or an option run but cannot stand for a plain gap.
|
|
42
|
+
*/
|
|
43
|
+
function phraseText(input) {
|
|
44
|
+
const s = String(input == null ? '' : input).toLowerCase();
|
|
45
|
+
const n = s.length;
|
|
46
|
+
const isSpace = (c) => c === ' ' || c === '\t' || c === '\n' || c === '\r' || c === '\v' || c === '\f' ||
|
|
47
|
+
c === '\u00a0' || c === '\u1680' || (c >= '\u2000' && c <= '\u200a') ||
|
|
48
|
+
c === '\u2028' || c === '\u2029' || c === '\u202f' || c === '\u205f' || c === '\u3000' || c === '\ufeff';
|
|
49
|
+
const t = { raw: s, joined: '', toks: [], sep: [], nl: [], eol: [], dash: [], bar: [], tail: false, memo: {}, next: null };
|
|
50
|
+
let start = -1;
|
|
51
|
+
let tokBar = false;
|
|
52
|
+
let pendSep = false;
|
|
53
|
+
let pendNl = false;
|
|
54
|
+
let pendEol = false;
|
|
55
|
+
// The next `*/` at or after the last search; -1 once there is none left.
|
|
56
|
+
let close = -2;
|
|
57
|
+
const end = (at) => {
|
|
58
|
+
if (start < 0)
|
|
59
|
+
return;
|
|
60
|
+
t.toks.push(s.slice(start, at));
|
|
61
|
+
t.sep.push(pendSep);
|
|
62
|
+
t.nl.push(pendNl);
|
|
63
|
+
t.eol.push(pendEol);
|
|
64
|
+
t.dash.push(s.charAt(start) === '-' && s.charAt(start + 1) === '-');
|
|
65
|
+
t.bar.push(tokBar);
|
|
66
|
+
start = -1;
|
|
67
|
+
tokBar = false;
|
|
68
|
+
pendSep = false;
|
|
69
|
+
pendNl = false;
|
|
70
|
+
pendEol = false;
|
|
71
|
+
};
|
|
72
|
+
const gap = (newline, eol) => {
|
|
73
|
+
end(i);
|
|
74
|
+
pendSep = true;
|
|
75
|
+
if (newline)
|
|
76
|
+
pendNl = true;
|
|
77
|
+
if (eol)
|
|
78
|
+
pendEol = true;
|
|
79
|
+
};
|
|
80
|
+
let i = 0;
|
|
81
|
+
while (i < n) {
|
|
82
|
+
const c = s.charAt(i);
|
|
83
|
+
const d = i + 1 < n ? s.charAt(i + 1) : '';
|
|
84
|
+
if (isSpace(c)) {
|
|
85
|
+
gap(c === '\n', c === '\n');
|
|
86
|
+
i += 1;
|
|
87
|
+
}
|
|
88
|
+
else if (c === '\\' && (d === 'n' || d === 't' || d === 'r')) {
|
|
89
|
+
gap(false, d === 'n');
|
|
90
|
+
i += 2;
|
|
91
|
+
}
|
|
92
|
+
else if (c === '\\' && d !== '' && isSpace(d)) {
|
|
93
|
+
gap(false, false);
|
|
94
|
+
i += 2;
|
|
95
|
+
}
|
|
96
|
+
else if (c === '/' && d === '*' && close !== -1 && (close >= i + 2 || (close = s.indexOf('*/', i + 2)) !== -1)) {
|
|
97
|
+
gap(false, false);
|
|
98
|
+
i = close + 2;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (c === '-' && d === '-' && start >= 0 && s.charAt(i - 1) !== '-')
|
|
102
|
+
end(i);
|
|
103
|
+
if (start < 0)
|
|
104
|
+
start = i;
|
|
105
|
+
if (c === ';' || c === '&' || c === '|')
|
|
106
|
+
tokBar = true;
|
|
107
|
+
i += 1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
end(n);
|
|
111
|
+
t.tail = pendSep;
|
|
112
|
+
t.joined = t.toks.join(' ');
|
|
113
|
+
return t;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Whether `t` contains `needle`, a phrase whose words are separated by single
|
|
117
|
+
* spaces. A one-word needle is a plain substring. In a longer one the first
|
|
118
|
+
* word may end a word of the text (`digit push` contains `git push`, as a
|
|
119
|
+
* substring would), the last may begin one, and the words between must be
|
|
120
|
+
* whole; a trailing space (`'update '`) asks for a separator after the last
|
|
121
|
+
* word. `bounded` additionally requires a non-word character (or the edge of
|
|
122
|
+
* the word) before the first word and after the last, where `.` also counts
|
|
123
|
+
* as part of a word (`table.log` is not `table`).
|
|
124
|
+
*/
|
|
125
|
+
function hasPhrase(t, needle, bounded) {
|
|
126
|
+
const words = needle.toLowerCase().split(' ');
|
|
127
|
+
if (words.length === 1)
|
|
128
|
+
return t.raw.indexOf(words[0]) !== -1;
|
|
129
|
+
const trailingGap = words[words.length - 1] === '';
|
|
130
|
+
if (trailingGap)
|
|
131
|
+
words.pop();
|
|
132
|
+
for (const w of words)
|
|
133
|
+
if (w === '' || t.joined.indexOf(w) === -1)
|
|
134
|
+
return false;
|
|
135
|
+
const T = t.toks.length;
|
|
136
|
+
const k = words.length;
|
|
137
|
+
const isWord = (c) => (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c === '_';
|
|
138
|
+
// Whether word `i` of the phrase can be the word at `q`, by its position.
|
|
139
|
+
// Typed arrays throughout: every array here has one entry per word of the
|
|
140
|
+
// text, and a classifier asks dozens of phrases of the same text.
|
|
141
|
+
const matches = (i) => {
|
|
142
|
+
const w = words[i];
|
|
143
|
+
const first = i === 0;
|
|
144
|
+
const last = i === k - 1 && !trailingGap;
|
|
145
|
+
const key = (first ? 'f' : '') + (last ? 'l' : '') + (bounded ? 'b' : '') + ':' + w;
|
|
146
|
+
const hit = t.memo[key];
|
|
147
|
+
if (hit)
|
|
148
|
+
return hit;
|
|
149
|
+
const out = new Uint8Array(T);
|
|
150
|
+
for (let q = 0; q < T; q++) {
|
|
151
|
+
const tok = t.toks[q];
|
|
152
|
+
let ok;
|
|
153
|
+
if (first && last)
|
|
154
|
+
ok = tok.indexOf(w) !== -1;
|
|
155
|
+
else if (first)
|
|
156
|
+
ok = tok.length >= w.length && tok.lastIndexOf(w) === tok.length - w.length;
|
|
157
|
+
else if (last)
|
|
158
|
+
ok = tok.lastIndexOf(w, 0) === 0;
|
|
159
|
+
else
|
|
160
|
+
ok = tok === w;
|
|
161
|
+
if (ok && bounded && first)
|
|
162
|
+
ok = tok.length === w.length || !isWord(tok.charAt(tok.length - w.length - 1));
|
|
163
|
+
if (ok && bounded && last)
|
|
164
|
+
ok = tok.length === w.length || !(isWord(tok.charAt(w.length)) || tok.charAt(w.length) === '.');
|
|
165
|
+
out[q] = ok ? 1 : 0;
|
|
166
|
+
}
|
|
167
|
+
t.memo[key] = out;
|
|
168
|
+
return out;
|
|
169
|
+
};
|
|
170
|
+
// nextBar[x]: first word at or after x containing `;&|`; nextNl[x]: first
|
|
171
|
+
// word at or after x with a real newline before it; nextEol likewise for any
|
|
172
|
+
// newline. T when there is none. Once per text, not once per phrase.
|
|
173
|
+
if (t.next === null) {
|
|
174
|
+
const bar = new Int32Array(T + 1);
|
|
175
|
+
const nl = new Int32Array(T + 1);
|
|
176
|
+
const eol = new Int32Array(T + 1);
|
|
177
|
+
bar[T] = T;
|
|
178
|
+
nl[T] = T;
|
|
179
|
+
eol[T] = T;
|
|
180
|
+
for (let x = T - 1; x >= 0; x--) {
|
|
181
|
+
bar[x] = t.bar[x] ? x : bar[x + 1];
|
|
182
|
+
nl[x] = t.nl[x] ? x : nl[x + 1];
|
|
183
|
+
eol[x] = t.eol[x] ? x : eol[x + 1];
|
|
184
|
+
}
|
|
185
|
+
t.next = { bar, nl, eol };
|
|
186
|
+
}
|
|
187
|
+
const nextBar = t.next.bar;
|
|
188
|
+
const nextNl = t.next.nl;
|
|
189
|
+
const nextEol = t.next.eol;
|
|
190
|
+
// ok[q]: the rest of the phrase, from the current word on, matches with
|
|
191
|
+
// that word at q. Start with the last word and walk back.
|
|
192
|
+
let ok = new Uint8Array(T + 1);
|
|
193
|
+
const lastHits = matches(k - 1);
|
|
194
|
+
for (let q = 0; q < T; q++) {
|
|
195
|
+
let v = lastHits[q] === 1;
|
|
196
|
+
if (v && trailingGap) {
|
|
197
|
+
const r = q + 1;
|
|
198
|
+
v = r < T ? t.sep[r] || (t.dash[r] && !t.bar[r] && (r + 1 < T || t.tail)) : t.tail;
|
|
199
|
+
}
|
|
200
|
+
ok[q] = v ? 1 : 0;
|
|
201
|
+
}
|
|
202
|
+
for (let i = k - 2; i >= 0; i--) {
|
|
203
|
+
// nextOk[x]: first word at or after x where the rest matches after a separator.
|
|
204
|
+
const nextOk = new Int32Array(T + 2);
|
|
205
|
+
nextOk[T] = T;
|
|
206
|
+
nextOk[T + 1] = T;
|
|
207
|
+
for (let x = T - 1; x >= 0; x--)
|
|
208
|
+
nextOk[x] = ok[x] === 1 && t.sep[x] ? x : nextOk[x + 1];
|
|
209
|
+
// reach[r]: the gap that starts at word r leads into the rest of the phrase.
|
|
210
|
+
const reach = new Uint8Array(T + 1);
|
|
211
|
+
for (let r = T - 1; r >= 0; r--) {
|
|
212
|
+
let v = t.sep[r] && ok[r] === 1;
|
|
213
|
+
if (!v && t.dash[r]) {
|
|
214
|
+
// A `--` comment runs to the next newline; more gap may follow it.
|
|
215
|
+
const after = nextEol[r + 1];
|
|
216
|
+
if (after < T && reach[after] === 1)
|
|
217
|
+
v = true;
|
|
218
|
+
// An option run reaches any word before a `;&|` word or a real newline.
|
|
219
|
+
const limit = Math.min(nextBar[r], nextNl[r + 1], T - 1);
|
|
220
|
+
if (!v && nextOk[r + 1] <= limit)
|
|
221
|
+
v = true;
|
|
222
|
+
}
|
|
223
|
+
reach[r] = v ? 1 : 0;
|
|
224
|
+
}
|
|
225
|
+
const hits = matches(i);
|
|
226
|
+
const prev = new Uint8Array(T + 1);
|
|
227
|
+
for (let p = 0; p < T; p++)
|
|
228
|
+
prev[p] = hits[p] & reach[p + 1];
|
|
229
|
+
ok = prev;
|
|
230
|
+
}
|
|
231
|
+
for (let p = 0; p < T; p++)
|
|
232
|
+
if (ok[p] === 1)
|
|
233
|
+
return true;
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Both functions as JavaScript source, for a hook gate to emit: the gates run
|
|
238
|
+
* this exact code, not a retyped copy.
|
|
239
|
+
*/
|
|
240
|
+
exports.PHRASES_JS_SOURCE = `${phraseText.toString()}\n${hasPhrase.toString()}`;
|
|
241
|
+
//# sourceMappingURL=phrases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phrases.js","sourceRoot":"","sources":["../src/phrases.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;;AAoCH,gCA8DC;AAYD,8BA6FC;AA5KD;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAc;IACvC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;IAC1D,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,MAAM,OAAO,GAAG,CAAC,CAAS,EAAW,EAAE,CACrC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI;QAC/E,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,QAAQ,IAAI,CAAC,IAAI,QAAQ,CAAC;QACpE,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,CAAA;IAC1G,MAAM,CAAC,GAAe,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAA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AAG,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAE,CAAA;QAC9D,EAAE,GAAG,IAAI,CAAA;IACX,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;IACxD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;GAGG;AACU,QAAA,iBAAiB,GAAG,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PII detector definitions, shared with the Rust proxy.
|
|
3
|
+
*
|
|
4
|
+
* `piiDetectors.json` is a byte-identical copy of
|
|
5
|
+
* `packages/proxy/src/dlp/pii_detectors.json`, which the Rust proxy embeds at
|
|
6
|
+
* compile time. The proxy's image is built from `packages/proxy` alone, so it
|
|
7
|
+
* cannot read this package, and this package ships to npm without the Rust
|
|
8
|
+
* tree — hence two copies, each tested against the other (`dlp/pii.rs` and
|
|
9
|
+
* the MCP proxy's `dlpPii.test.ts`). The validators the definition names are
|
|
10
|
+
* implemented in `packages/proxy/src/dlp/pii.rs` and
|
|
11
|
+
* `packages/mcp-proxy/src/dlpPii.ts`.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
/** What a detector does with a match, least to most strict. `off` detectors are not run. */
|
|
15
|
+
export declare const PII_ACTIONS: readonly ["off", "redact", "block"];
|
|
16
|
+
export type PiiAction = (typeof PII_ACTIONS)[number];
|
|
17
|
+
/** Every detector's id, in `piiDetectors.json`'s order (a test holds the two equal). */
|
|
18
|
+
export declare const PII_DETECTOR_IDS: readonly ["pii.card", "pii.iban", "pii.ssn", "pii.email", "pii.phone"];
|
|
19
|
+
export type PiiDetectorId = (typeof PII_DETECTOR_IDS)[number];
|
|
20
|
+
/**
|
|
21
|
+
* The workspace setting `piiDetectors`: an action for each detector the
|
|
22
|
+
* workspace governs centrally. Both proxies use it as the baseline for the
|
|
23
|
+
* workspace's traffic, and a machine's own config may only tighten it
|
|
24
|
+
* ({@link effectivePiiActions}). A detector left out keeps each machine's
|
|
25
|
+
* action. Unknown ids and actions are refused.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PiiDetectorSettingsSchema: z.ZodRecord<z.ZodEnum<["pii.card", "pii.iban", "pii.ssn", "pii.email", "pii.phone"]>, z.ZodEnum<["off", "redact", "block"]>>;
|
|
28
|
+
export type PiiDetectorSettings = Partial<Record<PiiDetectorId, PiiAction>>;
|
|
29
|
+
/**
|
|
30
|
+
* The `piiDetectors` field of a control-plane answer, as a proxy reads it.
|
|
31
|
+
* The LLM proxy gets it from `/api/v1/auth/key-context`, the MCP proxy from
|
|
32
|
+
* `/api/v1/sop/rules` or `/api/v1/policy/resolve`; all three send the same
|
|
33
|
+
* value. `unreadable` goes to the proxy's fail mode.
|
|
34
|
+
*/
|
|
35
|
+
export type WorkspacePiiDetectors = {
|
|
36
|
+
kind: 'none';
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'set';
|
|
39
|
+
actions: PiiDetectorSettings;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'unreadable';
|
|
42
|
+
reason: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Reads the field. Absent is a control plane older than the setting, and
|
|
46
|
+
* `{}` a workspace that sets none: both `none`. `null` is the control plane
|
|
47
|
+
* saying it could not read the stored setting. An id this build does not
|
|
48
|
+
* know is left out, since a newer control plane can name a detector an older
|
|
49
|
+
* proxy cannot run; an action that does not exist makes the whole field
|
|
50
|
+
* unreadable. The Rust proxy reads it the same way (`dlp/workspace.rs`), and
|
|
51
|
+
* `fixtures/pii-precedence-vectors.json` holds the two together.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseWorkspacePiiDetectors(field: unknown): WorkspacePiiDetectors;
|
|
54
|
+
/**
|
|
55
|
+
* Every detector's action for a workspace's traffic on one machine.
|
|
56
|
+
*
|
|
57
|
+
* The workspace setting is the baseline for each detector it names, and the
|
|
58
|
+
* machine's own config (`local`, only the detectors it names) may tighten it
|
|
59
|
+
* (`off` → `redact` → `block`) but never loosen it, so a developer cannot
|
|
60
|
+
* switch off on their machine what the workspace turned on. A detector the
|
|
61
|
+
* workspace leaves out keeps the machine's action, else its default; with no
|
|
62
|
+
* workspace setting the machine's config applies alone. The Rust proxy's
|
|
63
|
+
* `effective_pii_actions` (`dlp.rs`) is the same rule, and both run
|
|
64
|
+
* `fixtures/pii-precedence-vectors.json`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function effectivePiiActions(local: PiiDetectorSettings, workspace: PiiDetectorSettings | null): Record<PiiDetectorId, PiiAction>;
|
|
67
|
+
export interface PiiDetectorDefinition {
|
|
68
|
+
/** Stable finding id, `pii.*`. */
|
|
69
|
+
id: string;
|
|
70
|
+
category: string;
|
|
71
|
+
description: string;
|
|
72
|
+
/** Rust regex ∩ JavaScript RegExp: ASCII classes, no `\b`, no lookaround. */
|
|
73
|
+
regex: string;
|
|
74
|
+
/** `numeric` adds the decimal/serial rule on top of the word boundary. */
|
|
75
|
+
boundary: 'word' | 'numeric';
|
|
76
|
+
validator: 'card_luhn' | 'iban_mod97' | 'ssn_ranges' | 'email_shape' | 'phone_digits';
|
|
77
|
+
default_action: PiiAction;
|
|
78
|
+
}
|
|
79
|
+
export interface PiiDefinition {
|
|
80
|
+
version: number;
|
|
81
|
+
detectors: PiiDetectorDefinition[];
|
|
82
|
+
/** Inclusive `[low, high]` IIN ranges, both bounds the same number of digits. */
|
|
83
|
+
card_brands: Array<{
|
|
84
|
+
brand: string;
|
|
85
|
+
prefixes: Array<[string, string]>;
|
|
86
|
+
lengths: number[];
|
|
87
|
+
}>;
|
|
88
|
+
/** IBAN length by ISO 3166 country code, from the SWIFT IBAN registry. */
|
|
89
|
+
iban_lengths: Record<string, number>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* JSON imports type their strings as `string`, not the unions above, hence
|
|
93
|
+
* the cast through `unknown`. The MCP proxy refuses to load an unknown
|
|
94
|
+
* validator name, and the conformance vectors pin the rest.
|
|
95
|
+
*/
|
|
96
|
+
export declare const PII_DEFINITION: PiiDefinition;
|
|
97
|
+
//# sourceMappingURL=piiDetectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piiDetectors.d.ts","sourceRoot":"","sources":["../src/piiDetectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,4FAA4F;AAC5F,eAAO,MAAM,WAAW,qCAAsC,CAAA;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,wEAAyE,CAAA;AACtG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,8HAA0D,CAAA;AAChG,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAA;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAK1C;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAkBhF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,mBAAmB,GAAG,IAAI,GACpC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,CAYlC;AAED,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,SAAS,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,CAAA;IACrF,cAAc,EAAE,SAAS,CAAA;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,qBAAqB,EAAE,CAAA;IAClC,iFAAiF;IACjF,WAAW,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;IAC3F,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAA4B,aAAa,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PII_DEFINITION = exports.PiiDetectorSettingsSchema = exports.PII_DETECTOR_IDS = exports.PII_ACTIONS = void 0;
|
|
7
|
+
exports.parseWorkspacePiiDetectors = parseWorkspacePiiDetectors;
|
|
8
|
+
exports.effectivePiiActions = effectivePiiActions;
|
|
9
|
+
/**
|
|
10
|
+
* PII detector definitions, shared with the Rust proxy.
|
|
11
|
+
*
|
|
12
|
+
* `piiDetectors.json` is a byte-identical copy of
|
|
13
|
+
* `packages/proxy/src/dlp/pii_detectors.json`, which the Rust proxy embeds at
|
|
14
|
+
* compile time. The proxy's image is built from `packages/proxy` alone, so it
|
|
15
|
+
* cannot read this package, and this package ships to npm without the Rust
|
|
16
|
+
* tree — hence two copies, each tested against the other (`dlp/pii.rs` and
|
|
17
|
+
* the MCP proxy's `dlpPii.test.ts`). The validators the definition names are
|
|
18
|
+
* implemented in `packages/proxy/src/dlp/pii.rs` and
|
|
19
|
+
* `packages/mcp-proxy/src/dlpPii.ts`.
|
|
20
|
+
*/
|
|
21
|
+
const zod_1 = require("zod");
|
|
22
|
+
const piiDetectors_json_1 = __importDefault(require("./piiDetectors.json"));
|
|
23
|
+
/** What a detector does with a match, least to most strict. `off` detectors are not run. */
|
|
24
|
+
exports.PII_ACTIONS = ['off', 'redact', 'block'];
|
|
25
|
+
/** Every detector's id, in `piiDetectors.json`'s order (a test holds the two equal). */
|
|
26
|
+
exports.PII_DETECTOR_IDS = ['pii.card', 'pii.iban', 'pii.ssn', 'pii.email', 'pii.phone'];
|
|
27
|
+
/**
|
|
28
|
+
* The workspace setting `piiDetectors`: an action for each detector the
|
|
29
|
+
* workspace governs centrally. Both proxies use it as the baseline for the
|
|
30
|
+
* workspace's traffic, and a machine's own config may only tighten it
|
|
31
|
+
* ({@link effectivePiiActions}). A detector left out keeps each machine's
|
|
32
|
+
* action. Unknown ids and actions are refused.
|
|
33
|
+
*/
|
|
34
|
+
exports.PiiDetectorSettingsSchema = zod_1.z.record(zod_1.z.enum(exports.PII_DETECTOR_IDS), zod_1.z.enum(exports.PII_ACTIONS));
|
|
35
|
+
const isPiiAction = (v) => exports.PII_ACTIONS.includes(v);
|
|
36
|
+
const isPiiDetectorId = (v) => exports.PII_DETECTOR_IDS.includes(v);
|
|
37
|
+
/**
|
|
38
|
+
* Reads the field. Absent is a control plane older than the setting, and
|
|
39
|
+
* `{}` a workspace that sets none: both `none`. `null` is the control plane
|
|
40
|
+
* saying it could not read the stored setting. An id this build does not
|
|
41
|
+
* know is left out, since a newer control plane can name a detector an older
|
|
42
|
+
* proxy cannot run; an action that does not exist makes the whole field
|
|
43
|
+
* unreadable. The Rust proxy reads it the same way (`dlp/workspace.rs`), and
|
|
44
|
+
* `fixtures/pii-precedence-vectors.json` holds the two together.
|
|
45
|
+
*/
|
|
46
|
+
function parseWorkspacePiiDetectors(field) {
|
|
47
|
+
if (field === undefined)
|
|
48
|
+
return { kind: 'none' };
|
|
49
|
+
if (field === null)
|
|
50
|
+
return { kind: 'unreadable', reason: "the control plane could not read the workspace's PII detector actions" };
|
|
51
|
+
if (typeof field !== 'object' || Array.isArray(field)) {
|
|
52
|
+
return { kind: 'unreadable', reason: `the workspace's PII detector actions are not an object: ${JSON.stringify(field)}` };
|
|
53
|
+
}
|
|
54
|
+
const actions = {};
|
|
55
|
+
for (const [id, action] of Object.entries(field)) {
|
|
56
|
+
if (!isPiiDetectorId(id))
|
|
57
|
+
continue;
|
|
58
|
+
if (!isPiiAction(action)) {
|
|
59
|
+
return {
|
|
60
|
+
kind: 'unreadable',
|
|
61
|
+
reason: `the workspace's piiDetectors setting sets '${id}' to ${JSON.stringify(action)}; only 'off', 'redact' and 'block' exist`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
actions[id] = action;
|
|
65
|
+
}
|
|
66
|
+
return Object.keys(actions).length > 0 ? { kind: 'set', actions } : { kind: 'none' };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Every detector's action for a workspace's traffic on one machine.
|
|
70
|
+
*
|
|
71
|
+
* The workspace setting is the baseline for each detector it names, and the
|
|
72
|
+
* machine's own config (`local`, only the detectors it names) may tighten it
|
|
73
|
+
* (`off` → `redact` → `block`) but never loosen it, so a developer cannot
|
|
74
|
+
* switch off on their machine what the workspace turned on. A detector the
|
|
75
|
+
* workspace leaves out keeps the machine's action, else its default; with no
|
|
76
|
+
* workspace setting the machine's config applies alone. The Rust proxy's
|
|
77
|
+
* `effective_pii_actions` (`dlp.rs`) is the same rule, and both run
|
|
78
|
+
* `fixtures/pii-precedence-vectors.json`.
|
|
79
|
+
*/
|
|
80
|
+
function effectivePiiActions(local, workspace) {
|
|
81
|
+
const rank = (a) => exports.PII_ACTIONS.indexOf(a);
|
|
82
|
+
const table = Object.fromEntries(exports.PII_DEFINITION.detectors.map((d) => [d.id, d.default_action]));
|
|
83
|
+
Object.assign(table, local);
|
|
84
|
+
for (const [id, baseline] of Object.entries(workspace ?? {})) {
|
|
85
|
+
const mine = local[id];
|
|
86
|
+
table[id] = mine !== undefined && rank(mine) > rank(baseline) ? mine : baseline;
|
|
87
|
+
}
|
|
88
|
+
return table;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* JSON imports type their strings as `string`, not the unions above, hence
|
|
92
|
+
* the cast through `unknown`. The MCP proxy refuses to load an unknown
|
|
93
|
+
* validator name, and the conformance vectors pin the rest.
|
|
94
|
+
*/
|
|
95
|
+
exports.PII_DEFINITION = piiDetectors_json_1.default;
|
|
96
|
+
//# sourceMappingURL=piiDetectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piiDetectors.js","sourceRoot":"","sources":["../src/piiDetectors.ts"],"names":[],"mappings":";;;;;;AAwDA,gEAkBC;AAcD,kDAeC;AAvGD;;;;;;;;;;;GAWG;AACH,6BAAuB;AACvB,4EAA4C;AAE5C,4FAA4F;AAC/E,QAAA,WAAW,GAAG,CAAC,KAAK,EAAE,QAAQ,EAA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AA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "PII detectors for both DLP scanners. The Rust proxy embeds this file (packages/proxy/src/dlp/pii_detectors.json); the MCP proxy reads a byte-identical copy (packages/shared-types/src/piiDetectors.json). Edit one, copy it over the other: a test on each side fails while they differ. Regexes are the subset Rust regex and JavaScript RegExp agree on — ASCII classes, no \\b, no \\d, no lookaround — and each match is then checked by the named validator and boundary rule, implemented identically in packages/proxy/src/dlp/pii.rs and packages/mcp-proxy/src/dlpPii.ts. Conformance vectors: packages/shared-types/fixtures/pii-detector-vectors.json.",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"detectors": [
|
|
5
|
+
{
|
|
6
|
+
"id": "pii.card",
|
|
7
|
+
"category": "pii",
|
|
8
|
+
"description": "Payment card number",
|
|
9
|
+
"regex": "[0-9]{4}[ -][0-9]{4}[ -][0-9]{4}[ -][0-9]{4}|[0-9]{4}[ -][0-9]{6}[ -][0-9]{4,5}|[0-9]{13,19}",
|
|
10
|
+
"boundary": "numeric",
|
|
11
|
+
"validator": "card_luhn",
|
|
12
|
+
"default_action": "redact"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "pii.iban",
|
|
16
|
+
"category": "pii",
|
|
17
|
+
"description": "IBAN",
|
|
18
|
+
"regex": "[A-Z]{2}[0-9]{2}(?: ?[A-Z0-9]){11,30}",
|
|
19
|
+
"boundary": "word",
|
|
20
|
+
"validator": "iban_mod97",
|
|
21
|
+
"default_action": "redact"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "pii.ssn",
|
|
25
|
+
"category": "pii",
|
|
26
|
+
"description": "US Social Security Number",
|
|
27
|
+
"regex": "[0-9]{3}-[0-9]{2}-[0-9]{4}",
|
|
28
|
+
"boundary": "numeric",
|
|
29
|
+
"validator": "ssn_ranges",
|
|
30
|
+
"default_action": "redact"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "pii.email",
|
|
34
|
+
"category": "pii",
|
|
35
|
+
"description": "Email address",
|
|
36
|
+
"regex": "[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9-]{1,63}(?:\\.[A-Za-z0-9-]{1,63}){1,8}",
|
|
37
|
+
"boundary": "word",
|
|
38
|
+
"validator": "email_shape",
|
|
39
|
+
"default_action": "off"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "pii.phone",
|
|
43
|
+
"category": "pii",
|
|
44
|
+
"description": "Phone number",
|
|
45
|
+
"regex": "\\+[1-9][0-9]{0,2}(?:[ .-]?\\([0-9]{1,4}\\)|[ .-]?[0-9]{1,4}){2,7}|(?:1[ .-])?(?:\\([2-9][0-9]{2}\\) ?|[2-9][0-9]{2}[ .-])[2-9][0-9]{2}[ .-][0-9]{4}",
|
|
46
|
+
"boundary": "numeric",
|
|
47
|
+
"validator": "phone_digits",
|
|
48
|
+
"default_action": "off"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"card_brands": [
|
|
52
|
+
{ "brand": "visa", "prefixes": [["4", "4"]], "lengths": [13, 16, 19] },
|
|
53
|
+
{ "brand": "mastercard", "prefixes": [["51", "55"], ["2221", "2720"]], "lengths": [16] },
|
|
54
|
+
{ "brand": "amex", "prefixes": [["34", "34"], ["37", "37"]], "lengths": [15] },
|
|
55
|
+
{ "brand": "discover", "prefixes": [["6011", "6011"], ["644", "649"], ["65", "65"], ["622126", "622925"]], "lengths": [16, 17, 18, 19] },
|
|
56
|
+
{ "brand": "jcb", "prefixes": [["3528", "3589"]], "lengths": [16, 17, 18, 19] },
|
|
57
|
+
{ "brand": "diners", "prefixes": [["300", "305"], ["3095", "3095"], ["36", "36"], ["38", "39"]], "lengths": [14, 15, 16, 17, 18, 19] },
|
|
58
|
+
{ "brand": "unionpay", "prefixes": [["62", "62"], ["81", "81"]], "lengths": [16, 17, 18, 19] }
|
|
59
|
+
],
|
|
60
|
+
"iban_lengths": {
|
|
61
|
+
"AD": 24, "AE": 23, "AL": 28, "AT": 20, "AZ": 28, "BA": 20, "BE": 16, "BG": 22, "BH": 22, "BI": 27,
|
|
62
|
+
"BR": 29, "BY": 28, "CH": 21, "CR": 22, "CY": 28, "CZ": 24, "DE": 22, "DJ": 27, "DK": 18, "DO": 28,
|
|
63
|
+
"EE": 20, "EG": 29, "ES": 24, "FI": 18, "FK": 18, "FO": 18, "FR": 27, "GB": 22, "GE": 22, "GI": 23,
|
|
64
|
+
"GL": 18, "GR": 27, "GT": 28, "HN": 28, "HR": 21, "HU": 28, "IE": 22, "IL": 23, "IQ": 23, "IS": 26,
|
|
65
|
+
"IT": 27, "JO": 30, "KW": 30, "KZ": 20, "LB": 28, "LC": 32, "LI": 21, "LT": 20, "LU": 20, "LV": 21,
|
|
66
|
+
"LY": 25, "MC": 27, "MD": 24, "ME": 22, "MK": 19, "MN": 20, "MR": 27, "MT": 31, "MU": 30, "NI": 28,
|
|
67
|
+
"NL": 18, "NO": 15, "OM": 23, "PK": 24, "PL": 28, "PS": 29, "PT": 25, "QA": 29, "RO": 24, "RS": 22,
|
|
68
|
+
"RU": 33, "SA": 24, "SC": 31, "SD": 18, "SE": 24, "SI": 19, "SK": 24, "SM": 27, "SO": 23, "ST": 25,
|
|
69
|
+
"SV": 28, "TL": 23, "TN": 24, "TR": 26, "UA": 29, "VA": 22, "VG": 24, "XK": 20, "YE": 30
|
|
70
|
+
}
|
|
71
|
+
}
|
package/dist/policy.d.ts
CHANGED