@conarium-ai/core 0.3.2 → 0.3.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/CHANGELOG.md +84 -0
- package/dist/mask/speech.d.ts +10 -0
- package/dist/mask/speech.d.ts.map +1 -0
- package/dist/mask/speech.js +468 -0
- package/dist/mask/speech.js.map +1 -0
- package/dist/mask-text.d.ts +5 -1
- package/dist/mask-text.d.ts.map +1 -1
- package/dist/mask-text.js +127 -7
- package/dist/mask-text.js.map +1 -1
- package/dist/mask.d.ts +18 -0
- package/dist/mask.d.ts.map +1 -0
- package/dist/mask.js +16 -0
- package/dist/mask.js.map +1 -0
- package/docs/API-STABILITY.md +11 -6
- package/docs/claims/reviews/0.3.3.md +65 -0
- package/docs/claims/reviews/0.3.4.md +137 -0
- package/package.json +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.4 - a speech pipeline for hyphenated digits and spoken addresses
|
|
4
|
+
|
|
5
|
+
`maskField` now accepts `pipeline: 'speech'` for text a local speech model
|
|
6
|
+
wrote from a recording. That pipeline masks digit runs of 7 or more digits
|
|
7
|
+
split by spaces or hyphens (a valid TCKN, a phone shape the text pipeline
|
|
8
|
+
already accepts, a Luhn-valid 13-to-19-digit card, or a run with no class,
|
|
9
|
+
which is always masked), `TR` plus digits split the same way when there are
|
|
10
|
+
at least four of them as an IBAN, and addresses said with `et` / `at` and
|
|
11
|
+
`nokta` or written as four or more dotted labels whose first two are
|
|
12
|
+
letters only, without `@`, when a word is in the fixed list
|
|
13
|
+
`DOMAIN_ENDINGS` in `src/mask/speech.ts`: the last label of a dotted run;
|
|
14
|
+
a spoken address is read up to its last listed word, so
|
|
15
|
+
`example nokta dev nokta jp` leaves `nokta jp`. An address may mix written
|
|
16
|
+
dots and spoken `nokta` on either side of `et` / `at`
|
|
17
|
+
(`ayse.yilmaz et example nokta com`, `ayse nokta yilmaz et example.com`,
|
|
18
|
+
`ayse.yilmaz et example.com`) and is one `email` span. An ending written
|
|
19
|
+
with a Turkish dotted capital I (U+0130) is read: for the ending lookup
|
|
20
|
+
only, the word is lowercased, U+0307 is dropped and U+0131 is read as `i`,
|
|
21
|
+
so `AI` with U+0130 matches `ai`.
|
|
22
|
+
`biz` is in the list and is also the Turkish word "we": a spoken address
|
|
23
|
+
is read up to `biz` only when no other listed word is on its chain, so
|
|
24
|
+
`example nokta com nokta Biz` is masked up to `com` and leaves `nokta Biz`,
|
|
25
|
+
while `firma nokta biz` and a dotted `ali.yilmaz.firma.biz` are masked.
|
|
26
|
+
An address with no listed word is not masked by these rules. Classes come
|
|
27
|
+
from the text pipeline's core detectors first, as in 0.3.3, so a
|
|
28
|
+
Luhn-valid card written in phone-shaped groups (`4111-11-111-111-1111`)
|
|
29
|
+
counts as `phone`, and an 11-digit run that fails the TCKN checksum counts
|
|
30
|
+
as `tckn`; when the core and the speech rules name different classes for
|
|
31
|
+
one number (`1-000-000-0146`: `phone` and `tckn`), both are counted and it
|
|
32
|
+
is masked if either class is asked for. It leaves an amount with thousands
|
|
33
|
+
separators (`1.250.000`, `1.250,00`) or under 7 digits before its decimal
|
|
34
|
+
comma, and a time with a colon, dates (`28-10-2026`, `28.10.2026`,
|
|
35
|
+
`28 10 2026`), two years joined by one space or one hyphen (`2025-2026`,
|
|
36
|
+
`2025 2026`), and a six-digit run: `8-4-23-26` is the broken-up tail of an
|
|
37
|
+
IBAN, and this pipeline does not close that leak. The same digits written
|
|
38
|
+
with spaces (`1 250 000`) are a run and are masked. `1234567,89` is a run
|
|
39
|
+
of 7 digits and is masked, and so is a decimal part of 7 or more digits
|
|
40
|
+
(`0,1234567`). The text pipeline is unchanged.
|
|
41
|
+
|
|
42
|
+
`re2js`, which runs operator patterns, is 2.8.7 in both packages: 2.8.6 has
|
|
43
|
+
quadratic-time lookbehind matching (GHSA-gg6h-894w-4m9c), and an operator
|
|
44
|
+
pattern may use lookbehind.
|
|
45
|
+
|
|
46
|
+
## 0.3.3 - the masking engine as a library: @conarium-ai/mask, and per-class masking
|
|
47
|
+
|
|
48
|
+
Importing `@conarium-ai/core` runs the stdio gateway: `dist/index.js` calls
|
|
49
|
+
`main()` on import, so a program that only wanted to mask a value had nothing
|
|
50
|
+
it could import. `@conarium-ai/core/mask` is that entry. It exports
|
|
51
|
+
`maskField`, `maskSensitiveText` and `compileCustomPatterns` with their types,
|
|
52
|
+
the same functions the gateway calls (`src/governance.ts`, `src/audit.ts`),
|
|
53
|
+
and importing it starts no server: `test/mask_entry.mjs` imports it by name
|
|
54
|
+
with stdin left open and requires the process to exit with no output.
|
|
55
|
+
|
|
56
|
+
`@conarium-ai/mask` is the same entry as a package of its own, built from the
|
|
57
|
+
same `src/mask.ts` into `packages/mask`. Its only dependencies are the two the
|
|
58
|
+
engine imports, `@eslint-community/regexpp` and `re2js`, at the root's pins, so
|
|
59
|
+
a program that masks does not install the gateway's server and database
|
|
60
|
+
dependencies. `test/mask_package.mjs` checks the version, the pins, that the
|
|
61
|
+
built tree imports nothing else, what npm ships, and that importing it starts
|
|
62
|
+
nothing.
|
|
63
|
+
|
|
64
|
+
`maskField` can now mask some classes and leave others. `only` lists the
|
|
65
|
+
classes to mask. The result gains `classes`, how many spans of each class the
|
|
66
|
+
core found, and `masked`, what was replaced: a count per class,
|
|
67
|
+
`unclassified` for regions the 0.2.54 belt masks without a class (those are
|
|
68
|
+
always masked), or `{ whole: 1 }` when the whole field was replaced. The
|
|
69
|
+
counts carry no values, and a zero-length match (a custom pattern that can
|
|
70
|
+
match the empty string, such as `^|SECRET`) is not counted: before this was
|
|
71
|
+
caught in review, `"SECRET"` came back as `[MASKED_PII]SECRET` with
|
|
72
|
+
`masked: { custom: 1 }`. Without `only` the masked text is what it was. Before
|
|
73
|
+
this, `byClass` was the only count and it covered custom patterns alone; it
|
|
74
|
+
keeps that meaning.
|
|
75
|
+
|
|
76
|
+
The package now has an `exports` map. `"."` is the gateway as before,
|
|
77
|
+
`"./mask"` is the new entry, and `"./*"` resolves a deep path to the same
|
|
78
|
+
file. One thing that resolved before no longer does: an extensionless
|
|
79
|
+
`require` path such as `@conarium-ai/core/dist/governance`. Name the file with
|
|
80
|
+
its extension. What deep paths reach stays internal.
|
|
81
|
+
|
|
82
|
+
`docs/API-STABILITY.md` said there was no `exports` map. It now lists the
|
|
83
|
+
three entries with their labels, and `test/api_stability_exports.mjs` fails
|
|
84
|
+
when a key of the map is missing from that table or when the document says
|
|
85
|
+
the map is absent.
|
|
86
|
+
|
|
3
87
|
## 0.3.2 - compressed JSON bodies are refused, and zod moves to 4.6.7
|
|
4
88
|
|
|
5
89
|
The anchor service and the console parsed JSON request bodies with
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Span } from './core.js';
|
|
2
|
+
export interface SpeechHit {
|
|
3
|
+
classified: Span[];
|
|
4
|
+
unclassified: {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
}[];
|
|
8
|
+
}
|
|
9
|
+
export declare function detectSpeechSpans(text: string): SpeechHit;
|
|
10
|
+
//# sourceMappingURL=speech.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../../src/mask/speech.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAa,MAAM,WAAW,CAAA;AA2DhD,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,IAAI,EAAE,CAAA;IAClB,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC/C;AAuZD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CASzD"}
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Speech-pipeline spans: digits a local model split with spaces or hyphens,
|
|
3
|
+
* TR plus such a run, and addresses said with et/at and nokta or written
|
|
4
|
+
* as four or more dotted labels. Called only when pipeline is `speech`.
|
|
5
|
+
* Every walk is linear; no open-ended backtracking.
|
|
6
|
+
*/
|
|
7
|
+
import { luhnOk } from '../digit_pii.js';
|
|
8
|
+
import { tcknChecksumOk } from '../tckn.js';
|
|
9
|
+
import { detectNumericSpans } from './detectors/numeric.js';
|
|
10
|
+
const PII = '[MASKED_PII]';
|
|
11
|
+
// Shared by the spoken `et`/`at`+`nokta` rule and the dotted-label rule.
|
|
12
|
+
// An address whose last label is not in this list is not masked by either.
|
|
13
|
+
// `at` is omitted: it is also the spoken `@`.
|
|
14
|
+
const DOMAIN_ENDINGS = new Set([
|
|
15
|
+
'com',
|
|
16
|
+
'net',
|
|
17
|
+
'org',
|
|
18
|
+
'edu',
|
|
19
|
+
'gov',
|
|
20
|
+
'mil',
|
|
21
|
+
'int',
|
|
22
|
+
'info',
|
|
23
|
+
'biz',
|
|
24
|
+
'io',
|
|
25
|
+
'ai',
|
|
26
|
+
'app',
|
|
27
|
+
'dev',
|
|
28
|
+
'co',
|
|
29
|
+
'me',
|
|
30
|
+
'tv',
|
|
31
|
+
'xyz',
|
|
32
|
+
'online',
|
|
33
|
+
'site',
|
|
34
|
+
'tech',
|
|
35
|
+
'cloud',
|
|
36
|
+
'email',
|
|
37
|
+
'tr',
|
|
38
|
+
'uk',
|
|
39
|
+
'de',
|
|
40
|
+
'fr',
|
|
41
|
+
'nl',
|
|
42
|
+
'it',
|
|
43
|
+
'es',
|
|
44
|
+
'eu',
|
|
45
|
+
'us',
|
|
46
|
+
'ca',
|
|
47
|
+
'au',
|
|
48
|
+
'ch',
|
|
49
|
+
'be',
|
|
50
|
+
'se',
|
|
51
|
+
'no',
|
|
52
|
+
'dk',
|
|
53
|
+
'fi',
|
|
54
|
+
'pl',
|
|
55
|
+
'ru',
|
|
56
|
+
'az',
|
|
57
|
+
'cy',
|
|
58
|
+
]);
|
|
59
|
+
// Endings that are also Turkish words (`biz` is "we"). A spoken nokta
|
|
60
|
+
// chain reads one only when no other listed ending is on that chain; a
|
|
61
|
+
// dotted run reads it as any other ending.
|
|
62
|
+
const WORD_ENDINGS = new Set(['biz']);
|
|
63
|
+
const SCHEMES = new Set(['http', 'https', 'ftp', 'mailto', 'file']);
|
|
64
|
+
const MAX_LABELS = 32;
|
|
65
|
+
function isDigit(c) {
|
|
66
|
+
return c !== undefined && c >= '0' && c <= '9';
|
|
67
|
+
}
|
|
68
|
+
function isLetter(c) {
|
|
69
|
+
return c !== undefined && /\p{L}/u.test(c);
|
|
70
|
+
}
|
|
71
|
+
function isLabelChar(c) {
|
|
72
|
+
if (c === undefined)
|
|
73
|
+
return false;
|
|
74
|
+
if (isLetter(c) || isDigit(c))
|
|
75
|
+
return true;
|
|
76
|
+
return c === '-';
|
|
77
|
+
}
|
|
78
|
+
function lettersOnly(s) {
|
|
79
|
+
if (s.length === 0)
|
|
80
|
+
return false;
|
|
81
|
+
for (let i = 0; i < s.length; i++) {
|
|
82
|
+
if (!isLetter(s[i]))
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
/** Ending lookup only: U+0130 lowercases to `i` + U+0307, which misses `ai`. */
|
|
88
|
+
function endingKey(s) {
|
|
89
|
+
const lower = s.toLowerCase();
|
|
90
|
+
let out = '';
|
|
91
|
+
for (let i = 0; i < lower.length; i++) {
|
|
92
|
+
const c = lower[i];
|
|
93
|
+
if (c === '\u0307')
|
|
94
|
+
continue;
|
|
95
|
+
out += c === '\u0131' ? 'i' : c;
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
function isDomainEnding(s) {
|
|
100
|
+
return DOMAIN_ENDINGS.has(endingKey(s));
|
|
101
|
+
}
|
|
102
|
+
function isolatedRun(text, start, end) {
|
|
103
|
+
const left = start === 0 ? '' : text[start - 1];
|
|
104
|
+
const right = end >= text.length ? '' : text[end];
|
|
105
|
+
if (isDigit(left) || isDigit(right))
|
|
106
|
+
return false;
|
|
107
|
+
if (isLetter(left) || isLetter(right))
|
|
108
|
+
return false;
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
function isDateRun(raw) {
|
|
112
|
+
if (raw.length < 8 || raw.length > 10)
|
|
113
|
+
return false;
|
|
114
|
+
let i = 0;
|
|
115
|
+
let day = 0;
|
|
116
|
+
let n = 0;
|
|
117
|
+
while (i < raw.length && isDigit(raw[i]) && n < 2) {
|
|
118
|
+
day = day * 10 + (raw.charCodeAt(i) - 48);
|
|
119
|
+
i++;
|
|
120
|
+
n++;
|
|
121
|
+
}
|
|
122
|
+
if (n === 0 || i >= raw.length)
|
|
123
|
+
return false;
|
|
124
|
+
const sep = raw[i];
|
|
125
|
+
if (sep !== '-' && sep !== '.' && sep !== ' ')
|
|
126
|
+
return false;
|
|
127
|
+
i++;
|
|
128
|
+
let month = 0;
|
|
129
|
+
n = 0;
|
|
130
|
+
while (i < raw.length && isDigit(raw[i]) && n < 2) {
|
|
131
|
+
month = month * 10 + (raw.charCodeAt(i) - 48);
|
|
132
|
+
i++;
|
|
133
|
+
n++;
|
|
134
|
+
}
|
|
135
|
+
if (n === 0 || raw[i] !== sep)
|
|
136
|
+
return false;
|
|
137
|
+
i++;
|
|
138
|
+
n = 0;
|
|
139
|
+
while (i < raw.length && isDigit(raw[i])) {
|
|
140
|
+
n++;
|
|
141
|
+
i++;
|
|
142
|
+
}
|
|
143
|
+
if (n !== 4 || i !== raw.length)
|
|
144
|
+
return false;
|
|
145
|
+
return day >= 1 && day <= 31 && month >= 1 && month <= 12;
|
|
146
|
+
}
|
|
147
|
+
function yearValue(raw, from) {
|
|
148
|
+
if (from + 4 > raw.length)
|
|
149
|
+
return null;
|
|
150
|
+
let y = 0;
|
|
151
|
+
for (let k = 0; k < 4; k++) {
|
|
152
|
+
const c = raw[from + k];
|
|
153
|
+
if (!isDigit(c))
|
|
154
|
+
return null;
|
|
155
|
+
y = y * 10 + (c.charCodeAt(0) - 48);
|
|
156
|
+
}
|
|
157
|
+
if (y < 1900 || y > 2099)
|
|
158
|
+
return null;
|
|
159
|
+
return y;
|
|
160
|
+
}
|
|
161
|
+
/** Exactly two 4-digit years 1900–2099 joined by one space or one hyphen. */
|
|
162
|
+
function isYearRange(raw) {
|
|
163
|
+
if (raw.length !== 9)
|
|
164
|
+
return false;
|
|
165
|
+
const sep = raw[4];
|
|
166
|
+
if (sep !== '-' && sep !== ' ')
|
|
167
|
+
return false;
|
|
168
|
+
return yearValue(raw, 0) !== null && yearValue(raw, 5) !== null;
|
|
169
|
+
}
|
|
170
|
+
function readDigitRun(text, start) {
|
|
171
|
+
if (!isDigit(text[start]))
|
|
172
|
+
return null;
|
|
173
|
+
let i = start;
|
|
174
|
+
let digits = '';
|
|
175
|
+
while (i < text.length) {
|
|
176
|
+
const c = text[i];
|
|
177
|
+
if (isDigit(c)) {
|
|
178
|
+
digits += c;
|
|
179
|
+
i++;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if ((c === ' ' || c === '-') && i + 1 < text.length && isDigit(text[i + 1])) {
|
|
183
|
+
i++;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
return { end: i, digits };
|
|
189
|
+
}
|
|
190
|
+
function classifyDigits(digits, runText) {
|
|
191
|
+
if (digits.length === 11 && tcknChecksumOk(digits))
|
|
192
|
+
return 'tckn';
|
|
193
|
+
if (detectNumericSpans(runText).some((sp) => sp.cls === 'phone'))
|
|
194
|
+
return 'phone';
|
|
195
|
+
if (digits.length === 10)
|
|
196
|
+
return 'phone';
|
|
197
|
+
if (digits.length === 11 && digits.charCodeAt(0) === 48)
|
|
198
|
+
return 'phone';
|
|
199
|
+
if (digits.length >= 13 && digits.length <= 19 && luhnOk(digits))
|
|
200
|
+
return 'card';
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
function pushClassified(out, start, end, cls) {
|
|
204
|
+
if (end <= start)
|
|
205
|
+
return;
|
|
206
|
+
out.push({ start, end, cls, token: PII, source: 'speech' });
|
|
207
|
+
}
|
|
208
|
+
function findDigitRuns(text, classified, unclassified) {
|
|
209
|
+
let i = 0;
|
|
210
|
+
while (i < text.length) {
|
|
211
|
+
if (!isDigit(text[i])) {
|
|
212
|
+
i++;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const run = readDigitRun(text, i);
|
|
216
|
+
if (!run) {
|
|
217
|
+
i++;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
const start = i;
|
|
221
|
+
const end = run.end;
|
|
222
|
+
i = end;
|
|
223
|
+
if (run.digits.length < 7)
|
|
224
|
+
continue;
|
|
225
|
+
if (!isolatedRun(text, start, end))
|
|
226
|
+
continue;
|
|
227
|
+
const raw = text.slice(start, end);
|
|
228
|
+
if (isDateRun(raw) || isYearRange(raw))
|
|
229
|
+
continue;
|
|
230
|
+
const cls = classifyDigits(run.digits, raw);
|
|
231
|
+
if (cls)
|
|
232
|
+
pushClassified(classified, start, end, cls);
|
|
233
|
+
else
|
|
234
|
+
unclassified.push({ start, end });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function findIbans(text, classified) {
|
|
238
|
+
let i = 0;
|
|
239
|
+
while (i < text.length) {
|
|
240
|
+
const a = text[i];
|
|
241
|
+
const b = text[i + 1];
|
|
242
|
+
if ((a !== 'T' && a !== 't') || (b !== 'R' && b !== 'r')) {
|
|
243
|
+
i++;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (i > 0 && isLetter(text[i - 1])) {
|
|
247
|
+
i++;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
let j = i + 2;
|
|
251
|
+
if (j < text.length && (text[j] === ' ' || text[j] === '-') && j + 1 < text.length && isDigit(text[j + 1])) {
|
|
252
|
+
j++;
|
|
253
|
+
}
|
|
254
|
+
const run = readDigitRun(text, j);
|
|
255
|
+
if (!run || run.digits.length < 4) {
|
|
256
|
+
i++;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
pushClassified(classified, i, run.end, 'iban');
|
|
260
|
+
i = run.end;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function collectWords(text) {
|
|
264
|
+
const out = [];
|
|
265
|
+
let i = 0;
|
|
266
|
+
while (i < text.length) {
|
|
267
|
+
if (!isLetter(text[i])) {
|
|
268
|
+
i++;
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const start = i;
|
|
272
|
+
while (i < text.length && isLetter(text[i]))
|
|
273
|
+
i++;
|
|
274
|
+
out.push({ start, end: i, lower: text.slice(start, i).toLowerCase() });
|
|
275
|
+
}
|
|
276
|
+
return out;
|
|
277
|
+
}
|
|
278
|
+
function singleSpace(text, from, to) {
|
|
279
|
+
return to === from + 1 && text.charCodeAt(from) === 32;
|
|
280
|
+
}
|
|
281
|
+
function noktaLink(words, text, left, right) {
|
|
282
|
+
if (right !== left + 2)
|
|
283
|
+
return false;
|
|
284
|
+
const mid = words[left + 1];
|
|
285
|
+
return (mid.lower === 'nokta'
|
|
286
|
+
&& singleSpace(text, words[left].end, mid.start)
|
|
287
|
+
&& singleSpace(text, mid.end, words[right].start));
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* For each word, how far a nokta chain extends left and right, plus the
|
|
291
|
+
* rightmost TLD that sits on that right-hand chain, and separately the
|
|
292
|
+
* rightmost one of `WORD_ENDINGS`. Built in two linear passes so each
|
|
293
|
+
* `et` / `at` is then a constant-time lookup.
|
|
294
|
+
*/
|
|
295
|
+
function noktaExtents(words, text) {
|
|
296
|
+
const n = words.length;
|
|
297
|
+
const leftExtent = new Array(n);
|
|
298
|
+
const rightExtent = new Array(n);
|
|
299
|
+
const rightmostTld = new Array(n);
|
|
300
|
+
const rightmostWordTld = new Array(n);
|
|
301
|
+
for (let i = 0; i < n; i++) {
|
|
302
|
+
leftExtent[i] = i >= 2 && noktaLink(words, text, i - 2, i) ? leftExtent[i - 2] : i;
|
|
303
|
+
}
|
|
304
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
305
|
+
const key = endingKey(words[i].lower);
|
|
306
|
+
const word = WORD_ENDINGS.has(key) ? i : -1;
|
|
307
|
+
const tld = word < 0 && DOMAIN_ENDINGS.has(key) ? i : -1;
|
|
308
|
+
if (i + 2 < n && noktaLink(words, text, i, i + 2)) {
|
|
309
|
+
rightExtent[i] = rightExtent[i + 2];
|
|
310
|
+
const further = rightmostTld[i + 2];
|
|
311
|
+
rightmostTld[i] = further >= 0 ? further : tld;
|
|
312
|
+
const furtherWord = rightmostWordTld[i + 2];
|
|
313
|
+
rightmostWordTld[i] = furtherWord >= 0 ? furtherWord : word;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
rightExtent[i] = i;
|
|
317
|
+
rightmostTld[i] = tld;
|
|
318
|
+
rightmostWordTld[i] = word;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return { leftExtent, rightExtent, rightmostTld, rightmostWordTld };
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* For each word, the start of the dotted run it sits in, and, when the
|
|
325
|
+
* word begins a dotted run of two or more labels whose last is a listed
|
|
326
|
+
* ending, that run's end. One left-to-right pass so each `et` / `at`
|
|
327
|
+
* then reads these in constant time.
|
|
328
|
+
*/
|
|
329
|
+
function dottedExtents(words, text) {
|
|
330
|
+
const n = words.length;
|
|
331
|
+
const runStart = new Array(n);
|
|
332
|
+
const endingEnd = new Array(n);
|
|
333
|
+
for (let w = 0; w < n; w++) {
|
|
334
|
+
runStart[w] = words[w].start;
|
|
335
|
+
endingEnd[w] = -1;
|
|
336
|
+
}
|
|
337
|
+
let i = 0;
|
|
338
|
+
let wi = 0;
|
|
339
|
+
while (i < text.length) {
|
|
340
|
+
if (!isLetter(text[i]) && !isDigit(text[i])) {
|
|
341
|
+
i++;
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
if (i > 0 && isLabelChar(text[i - 1])) {
|
|
345
|
+
i++;
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
const parsed = parseDotted(text, i);
|
|
349
|
+
if (!parsed) {
|
|
350
|
+
i++;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
const { labels, end } = parsed;
|
|
354
|
+
while (wi < n && words[wi].start < i)
|
|
355
|
+
wi++;
|
|
356
|
+
const first = wi;
|
|
357
|
+
while (wi < n && words[wi].start < end) {
|
|
358
|
+
runStart[wi] = i;
|
|
359
|
+
wi++;
|
|
360
|
+
}
|
|
361
|
+
if (first < n
|
|
362
|
+
&& words[first].start === i
|
|
363
|
+
&& labels.length >= 2
|
|
364
|
+
&& isDomainEnding(labels[labels.length - 1].lower)
|
|
365
|
+
&& (end === text.length || !isLabelChar(text[end]))) {
|
|
366
|
+
endingEnd[first] = end;
|
|
367
|
+
}
|
|
368
|
+
i = end;
|
|
369
|
+
}
|
|
370
|
+
return { runStart, endingEnd };
|
|
371
|
+
}
|
|
372
|
+
function findSpokenEmails(text, classified) {
|
|
373
|
+
const words = collectWords(text);
|
|
374
|
+
if (words.length === 0)
|
|
375
|
+
return;
|
|
376
|
+
const { leftExtent, rightExtent, rightmostTld, rightmostWordTld } = noktaExtents(words, text);
|
|
377
|
+
const { runStart, endingEnd } = dottedExtents(words, text);
|
|
378
|
+
for (let e = 0; e < words.length; e++) {
|
|
379
|
+
const mark = words[e].lower;
|
|
380
|
+
if (mark !== 'et' && mark !== 'at')
|
|
381
|
+
continue;
|
|
382
|
+
if (e === 0 || e + 1 >= words.length)
|
|
383
|
+
continue;
|
|
384
|
+
if (!singleSpace(text, words[e - 1].end, words[e].start))
|
|
385
|
+
continue;
|
|
386
|
+
if (!singleSpace(text, words[e].end, words[e + 1].start))
|
|
387
|
+
continue;
|
|
388
|
+
const left = leftExtent[e - 1];
|
|
389
|
+
const start = runStart[left];
|
|
390
|
+
const tld = rightmostTld[e + 1];
|
|
391
|
+
const spokenRight = tld >= e + 3 ? tld : rightmostWordTld[e + 1];
|
|
392
|
+
if (spokenRight >= e + 3 && spokenRight <= rightExtent[e + 1]) {
|
|
393
|
+
pushClassified(classified, start, words[spokenRight].end, 'email');
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
const dottedEnd = endingEnd[e + 1];
|
|
397
|
+
if (dottedEnd > words[e + 1].start) {
|
|
398
|
+
pushClassified(classified, start, dottedEnd, 'email');
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function parseDotted(text, start) {
|
|
403
|
+
const labels = [];
|
|
404
|
+
let i = start;
|
|
405
|
+
while (labels.length < MAX_LABELS && i < text.length) {
|
|
406
|
+
if (!isLetter(text[i]) && !isDigit(text[i]))
|
|
407
|
+
break;
|
|
408
|
+
const ls = i;
|
|
409
|
+
while (i < text.length && isLabelChar(text[i]))
|
|
410
|
+
i++;
|
|
411
|
+
if (i === ls)
|
|
412
|
+
break;
|
|
413
|
+
const raw = text.slice(ls, i);
|
|
414
|
+
labels.push({ start: ls, end: i, raw, lower: raw.toLowerCase() });
|
|
415
|
+
if (text[i] !== '.')
|
|
416
|
+
break;
|
|
417
|
+
i++;
|
|
418
|
+
}
|
|
419
|
+
if (labels.length === 0)
|
|
420
|
+
return null;
|
|
421
|
+
return { end: labels[labels.length - 1].end, labels };
|
|
422
|
+
}
|
|
423
|
+
function findDottedEmails(text, classified) {
|
|
424
|
+
let i = 0;
|
|
425
|
+
while (i < text.length) {
|
|
426
|
+
if (!isLetter(text[i]) && !isDigit(text[i])) {
|
|
427
|
+
i++;
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
if (i > 0 && isLabelChar(text[i - 1])) {
|
|
431
|
+
i++;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const parsed = parseDotted(text, i);
|
|
435
|
+
if (!parsed) {
|
|
436
|
+
i++;
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
const { labels, end } = parsed;
|
|
440
|
+
const first = labels[0];
|
|
441
|
+
if (first.lower === 'www' || SCHEMES.has(first.lower) || (i >= 3 && text.slice(i - 3, i) === '://')) {
|
|
442
|
+
i = end;
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
if (labels.length >= 4
|
|
446
|
+
&& lettersOnly(labels[0].raw)
|
|
447
|
+
&& lettersOnly(labels[1].raw)
|
|
448
|
+
&& isDomainEnding(labels[labels.length - 1].lower)
|
|
449
|
+
&& (end === text.length || !isLabelChar(text[end]))) {
|
|
450
|
+
pushClassified(classified, first.start, end, 'email');
|
|
451
|
+
i = end;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
i = end;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
export function detectSpeechSpans(text) {
|
|
458
|
+
const classified = [];
|
|
459
|
+
const unclassified = [];
|
|
460
|
+
if (text.length === 0)
|
|
461
|
+
return { classified, unclassified };
|
|
462
|
+
findDigitRuns(text, classified, unclassified);
|
|
463
|
+
findIbans(text, classified);
|
|
464
|
+
findSpokenEmails(text, classified);
|
|
465
|
+
findDottedEmails(text, classified);
|
|
466
|
+
return { classified, unclassified };
|
|
467
|
+
}
|
|
468
|
+
//# sourceMappingURL=speech.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speech.js","sourceRoot":"","sources":["../../src/mask/speech.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,MAAM,GAAG,GAAG,cAAc,CAAA;AAC1B,yEAAyE;AACzE,2EAA2E;AAC3E,8CAA8C;AAC9C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,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G,CAAC;eAC1B,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;eAC/C,CAAC,GAAG,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EACnD,CAAC;YACD,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;YACrD,CAAC,GAAG,GAAG,CAAA;YACP,SAAQ;QACV,CAAC;QACD,CAAC,GAAG,GAAG,CAAA;IACT,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,UAAU,GAAW,EAAE,CAAA;IAC7B,MAAM,YAAY,GAAqC,EAAE,CAAA;IACzD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1D,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAA;IAC7C,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAC3B,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAClC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAClC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAA;AACrC,CAAC"}
|
package/dist/mask-text.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CompiledCustomPattern } from './custom_patterns.js';
|
|
2
2
|
import type { DetectorToggles } from './types.js';
|
|
3
|
+
import { type SpanClass } from './mask/core.js';
|
|
3
4
|
export interface MaskTextOptions {
|
|
4
5
|
scanCharCap?: number;
|
|
5
6
|
detectors?: DetectorToggles;
|
|
@@ -8,14 +9,17 @@ export interface MaskTextOptions {
|
|
|
8
9
|
export declare const SECRET_VALUE_RE: RegExp;
|
|
9
10
|
export declare function maskSecretShapedValues(text: string, token?: string): string;
|
|
10
11
|
export interface MaskFieldOptions extends MaskTextOptions {
|
|
11
|
-
pipeline: 'text' | 'governance';
|
|
12
|
+
pipeline: 'text' | 'governance' | 'speech';
|
|
12
13
|
column?: string;
|
|
13
14
|
maskLabelledNames?: boolean;
|
|
15
|
+
only?: readonly SpanClass[];
|
|
14
16
|
}
|
|
15
17
|
export declare function maskField(text: string, opts: MaskFieldOptions): {
|
|
16
18
|
text: string;
|
|
17
19
|
count: number;
|
|
18
20
|
byClass: Record<string, number>;
|
|
21
|
+
classes: Record<string, number>;
|
|
22
|
+
masked: Record<string, number>;
|
|
19
23
|
};
|
|
20
24
|
export declare function maskSensitiveText(text: string, opts?: MaskTextOptions): string;
|
|
21
25
|
//# sourceMappingURL=mask-text.d.ts.map
|
package/dist/mask-text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-text.d.ts","sourceRoot":"","sources":["../src/mask-text.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"mask-text.d.ts","sourceRoot":"","sources":["../src/mask-text.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAIzE,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B,cAAc,CAAC,EAAE,qBAAqB,EAAE,CAAA;CACzC;AAED,eAAO,MAAM,eAAe,QAC0I,CAAA;AAEtK,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAoB,GAAG,MAAM,CAGtF;AAKD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAA;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;CAC5B;AAmPD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,CAqDA;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,eAAoB,GAAG,MAAM,CAOlF"}
|
package/dist/mask-text.js
CHANGED
|
@@ -6,6 +6,7 @@ import { normalizePiiText } from './pii_normalize.js';
|
|
|
6
6
|
import { resolveScanCharCap } from './digit_pii.js';
|
|
7
7
|
import { apply, detect } from './mask/core.js';
|
|
8
8
|
import { beltCover } from './mask/belt.js';
|
|
9
|
+
import { detectSpeechSpans } from './mask/speech.js';
|
|
9
10
|
export const SECRET_VALUE_RE = /\b(?:sk-[A-Za-z0-9]{12,}|sk_live_[A-Za-z0-9]{6,}|AKIA[0-9A-Z]{16}|ghp_[A-Za-z0-9]{20,}|gsk_[A-Za-z0-9]{20,}|xox[baprs]-[A-Za-z0-9-]{8,}|eyJ[A-Za-z0-9._-]{20,})\b/g;
|
|
10
11
|
export function maskSecretShapedValues(text, token = '[MASKED_SECRET]') {
|
|
11
12
|
SECRET_VALUE_RE.lastIndex = 0;
|
|
@@ -147,11 +148,112 @@ function ownByClass(src) {
|
|
|
147
148
|
}
|
|
148
149
|
return bag;
|
|
149
150
|
}
|
|
151
|
+
function emptyBag() {
|
|
152
|
+
return Object.create(null);
|
|
153
|
+
}
|
|
154
|
+
function addCount(bag, key, n = 1) {
|
|
155
|
+
if (!(n > 0))
|
|
156
|
+
return;
|
|
157
|
+
const prev = Object.prototype.hasOwnProperty.call(bag, key) ? bag[key] : 0;
|
|
158
|
+
Object.defineProperty(bag, key, {
|
|
159
|
+
value: prev + n,
|
|
160
|
+
writable: true,
|
|
161
|
+
enumerable: true,
|
|
162
|
+
configurable: true,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function countClasses(spans) {
|
|
166
|
+
const bag = emptyBag();
|
|
167
|
+
for (let i = 0; i < spans.length; i++) {
|
|
168
|
+
if (spans[i].end > spans[i].start)
|
|
169
|
+
addCount(bag, spans[i].cls);
|
|
170
|
+
}
|
|
171
|
+
return bag;
|
|
172
|
+
}
|
|
173
|
+
function countMasked(core, beltOnly) {
|
|
174
|
+
const bag = emptyBag();
|
|
175
|
+
for (let i = 0; i < core.length; i++) {
|
|
176
|
+
if (core[i].end > core[i].start)
|
|
177
|
+
addCount(bag, core[i].cls);
|
|
178
|
+
}
|
|
179
|
+
for (let i = 0; i < beltOnly.length; i++) {
|
|
180
|
+
if (beltOnly[i].end > beltOnly[i].start)
|
|
181
|
+
addCount(bag, 'unclassified');
|
|
182
|
+
}
|
|
183
|
+
return bag;
|
|
184
|
+
}
|
|
185
|
+
function wholeMasked() {
|
|
186
|
+
const bag = emptyBag();
|
|
187
|
+
addCount(bag, 'whole');
|
|
188
|
+
return bag;
|
|
189
|
+
}
|
|
190
|
+
// Fold each speech span into a core span of its class that it overlaps
|
|
191
|
+
// (widening that core span); otherwise add it. Core spans stay as the
|
|
192
|
+
// text pipeline produced them — two overlapping operator patterns stay
|
|
193
|
+
// two. Sort the speech spans and walk each class's cores once; do not
|
|
194
|
+
// walk every span for every speech span.
|
|
195
|
+
function absorbSpeech(spans, extra) {
|
|
196
|
+
if (extra.length === 0)
|
|
197
|
+
return;
|
|
198
|
+
const speech = extra.slice();
|
|
199
|
+
speech.sort((a, b) => (a.cls < b.cls ? -1 : a.cls > b.cls ? 1 : a.start - b.start || a.end - b.end));
|
|
200
|
+
const byClass = Object.create(null);
|
|
201
|
+
for (let i = 0; i < spans.length; i++) {
|
|
202
|
+
const sp = spans[i];
|
|
203
|
+
const list = Object.prototype.hasOwnProperty.call(byClass, sp.cls)
|
|
204
|
+
? byClass[sp.cls]
|
|
205
|
+
: (byClass[sp.cls] = []);
|
|
206
|
+
list.push(sp);
|
|
207
|
+
}
|
|
208
|
+
for (const key of Object.keys(byClass)) {
|
|
209
|
+
byClass[key].sort((a, b) => a.start - b.start || a.end - b.end);
|
|
210
|
+
}
|
|
211
|
+
let cls = '';
|
|
212
|
+
let cores = [];
|
|
213
|
+
let c = 0;
|
|
214
|
+
for (let i = 0; i < speech.length; i++) {
|
|
215
|
+
const sp = speech[i];
|
|
216
|
+
if (sp.cls !== cls) {
|
|
217
|
+
cls = sp.cls;
|
|
218
|
+
cores = Object.prototype.hasOwnProperty.call(byClass, cls) ? byClass[cls] : [];
|
|
219
|
+
c = 0;
|
|
220
|
+
}
|
|
221
|
+
while (c < cores.length && cores[c].end <= sp.start)
|
|
222
|
+
c++;
|
|
223
|
+
let folded = false;
|
|
224
|
+
for (let k = c; k < cores.length && cores[k].start < sp.end; k++) {
|
|
225
|
+
if (sp.start < cores[k].end) {
|
|
226
|
+
if (sp.start < cores[k].start)
|
|
227
|
+
cores[k].start = sp.start;
|
|
228
|
+
if (sp.end > cores[k].end)
|
|
229
|
+
cores[k].end = sp.end;
|
|
230
|
+
folded = true;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (!folded)
|
|
235
|
+
spans.push(sp);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function coreToApply(spans, only) {
|
|
239
|
+
if (!only)
|
|
240
|
+
return spans;
|
|
241
|
+
const allow = new Set(only);
|
|
242
|
+
const out = [];
|
|
243
|
+
for (let i = 0; i < spans.length; i++) {
|
|
244
|
+
if (allow.has(spans[i].cls))
|
|
245
|
+
out.push(spans[i]);
|
|
246
|
+
}
|
|
247
|
+
return out;
|
|
248
|
+
}
|
|
249
|
+
function wholeFieldResult(text, byClass, classes) {
|
|
250
|
+
return { text, count: 1, byClass, classes, masked: wholeMasked() };
|
|
251
|
+
}
|
|
150
252
|
// The core detects on its own. The belt keeps every span 0.2.54 masked.
|
|
151
253
|
// When the belt cannot decide, the whole field is masked.
|
|
152
254
|
export function maskField(text, opts) {
|
|
153
255
|
if (text.length > resolveScanCharCap(opts.scanCharCap)) {
|
|
154
|
-
return
|
|
256
|
+
return wholeFieldResult(PII, emptyBag(), emptyBag());
|
|
155
257
|
}
|
|
156
258
|
try {
|
|
157
259
|
const normalized = normalizePiiText(text);
|
|
@@ -162,10 +264,16 @@ export function maskField(text, opts) {
|
|
|
162
264
|
column: opts.column,
|
|
163
265
|
maskLabelledNames: opts.maskLabelledNames,
|
|
164
266
|
});
|
|
267
|
+
let speechUnclassified = [];
|
|
268
|
+
if (opts.pipeline === 'speech') {
|
|
269
|
+
const found = detectSpeechSpans(normalized);
|
|
270
|
+
absorbSpeech(detected.spans, found.classified);
|
|
271
|
+
speechUnclassified = found.unclassified;
|
|
272
|
+
}
|
|
165
273
|
const belt = beltCover({
|
|
166
274
|
raw: text,
|
|
167
275
|
normalized,
|
|
168
|
-
pipeline: opts.pipeline,
|
|
276
|
+
pipeline: opts.pipeline === 'governance' ? 'governance' : 'text',
|
|
169
277
|
policy: {
|
|
170
278
|
detectors: opts.detectors,
|
|
171
279
|
scanCharCap: opts.scanCharCap,
|
|
@@ -176,16 +284,28 @@ export function maskField(text, opts) {
|
|
|
176
284
|
scanCharCap: opts.scanCharCap,
|
|
177
285
|
});
|
|
178
286
|
const byClass = ownByClass(detected.byClass);
|
|
287
|
+
const classes = countClasses(detected.spans);
|
|
179
288
|
if (!belt.ok)
|
|
180
|
-
return
|
|
289
|
+
return wholeFieldResult(PII, byClass, classes);
|
|
181
290
|
const whole = preferToken(detected.wholeField?.token, belt.wholeField, rules);
|
|
182
291
|
if (whole)
|
|
183
|
-
return
|
|
184
|
-
const
|
|
185
|
-
|
|
292
|
+
return wholeFieldResult(whole, byClass, classes);
|
|
293
|
+
const coreApplied = coreToApply(detected.spans, opts.only);
|
|
294
|
+
const beltRanges = speechUnclassified.length === 0
|
|
295
|
+
? belt.spans
|
|
296
|
+
: belt.spans.concat(speechUnclassified);
|
|
297
|
+
const beltOnly = beltOnlySpans(detected.spans, beltRanges);
|
|
298
|
+
const applied = apply(normalized, coreApplied.concat(beltOnly));
|
|
299
|
+
return {
|
|
300
|
+
text: applied.text,
|
|
301
|
+
count: applied.regions,
|
|
302
|
+
byClass,
|
|
303
|
+
classes,
|
|
304
|
+
masked: countMasked(coreApplied, beltOnly),
|
|
305
|
+
};
|
|
186
306
|
}
|
|
187
307
|
catch {
|
|
188
|
-
return
|
|
308
|
+
return wholeFieldResult(PII, emptyBag(), emptyBag());
|
|
189
309
|
}
|
|
190
310
|
}
|
|
191
311
|
// The core detects on its own. The belt keeps every span 0.2.54 masked.
|
package/dist/mask-text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-text.js","sourceRoot":"","sources":["../src/mask-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAa,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAQ1C,MAAM,CAAC,MAAM,eAAe,GAC1B,oKAAoK,CAAA;AAEtK,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,KAAK,GAAG,iBAAiB;IAC5E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K,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1D,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,KAAK,CAAC;YAChD,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;QACzC,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;QAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;QAC/D,OAAO;YACL,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,OAAO;YACtB,OAAO;YACP,OAAO;YACP,MAAM,EAAE,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC;SAC3C,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IACtD,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,0DAA0D;AAC1D,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAI,GAAoB,EAAE;IACxE,OAAO,SAAS,CAAC,IAAI,EAAE;QACrB,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,cAAc,EAAE,IAAI,CAAC,cAAc;KACpC,CAAC,CAAC,IAAI,CAAA;AACT,CAAC"}
|
package/dist/mask.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library entry: `@conarium-ai/core/mask`.
|
|
3
|
+
*
|
|
4
|
+
* The package root is the stdio server and runs main() on import. This entry
|
|
5
|
+
* is the masking engine alone, for a program that wants to mask a value
|
|
6
|
+
* without starting anything: importing it starts no server and opens no
|
|
7
|
+
* stream (test/mask_entry.mjs). It is the same pipeline the server uses.
|
|
8
|
+
*
|
|
9
|
+
* maskField returns the masked text, how many regions were masked, `classes`
|
|
10
|
+
* (how many spans of each class it found) and `masked` (what it replaced, or
|
|
11
|
+
* `{ whole: 1 }` when the whole field went). `only` lists the classes to mask
|
|
12
|
+
* and leaves the rest; the counts never carry the values.
|
|
13
|
+
*/
|
|
14
|
+
export { maskField, maskSensitiveText, type MaskFieldOptions, type MaskTextOptions, } from './mask-text.js';
|
|
15
|
+
export { compileCustomPatterns, type CompiledCustomPattern, type CustomPatternReject, } from './custom_patterns.js';
|
|
16
|
+
export type { CustomPiiPattern, DetectorToggles } from './types.js';
|
|
17
|
+
export type { SpanClass } from './mask/core.js';
|
|
18
|
+
//# sourceMappingURL=mask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../src/mask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACnE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/mask.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library entry: `@conarium-ai/core/mask`.
|
|
3
|
+
*
|
|
4
|
+
* The package root is the stdio server and runs main() on import. This entry
|
|
5
|
+
* is the masking engine alone, for a program that wants to mask a value
|
|
6
|
+
* without starting anything: importing it starts no server and opens no
|
|
7
|
+
* stream (test/mask_entry.mjs). It is the same pipeline the server uses.
|
|
8
|
+
*
|
|
9
|
+
* maskField returns the masked text, how many regions were masked, `classes`
|
|
10
|
+
* (how many spans of each class it found) and `masked` (what it replaced, or
|
|
11
|
+
* `{ whole: 1 }` when the whole field went). `only` lists the classes to mask
|
|
12
|
+
* and leaves the rest; the counts never carry the values.
|
|
13
|
+
*/
|
|
14
|
+
export { maskField, maskSensitiveText, } from './mask-text.js';
|
|
15
|
+
export { compileCustomPatterns, } from './custom_patterns.js';
|
|
16
|
+
//# sourceMappingURL=mask.js.map
|
package/dist/mask.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../src/mask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,SAAS,EACT,iBAAiB,GAGlB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,qBAAqB,GAGtB,MAAM,sBAAsB,CAAA"}
|
package/docs/API-STABILITY.md
CHANGED
|
@@ -29,9 +29,10 @@ No dates. Shipping 1.0 is a decision, not a document.
|
|
|
29
29
|
|
|
30
30
|
## What 1.0 would not promise
|
|
31
31
|
|
|
32
|
-
- A JavaScript import surface.
|
|
33
|
-
stdio gateway
|
|
34
|
-
|
|
32
|
+
- A JavaScript import surface. The package root (`main`, and `"."` in the
|
|
33
|
+
`exports` map) is the stdio gateway and runs it on import. The one library
|
|
34
|
+
entry, `@conarium-ai/core/mask`, is experimental (see Package exports).
|
|
35
|
+
`import { Governance } from '@conarium-ai/core'` is not an API.
|
|
35
36
|
- MySQL. The SQL gate is Postgres, Microsoft SQL Server, and Oracle. Oracle synonyms and database links are not resolved.
|
|
36
37
|
- That an OpenTimestamps stamp is confirmed. `pending` is a valid
|
|
37
38
|
outcome.
|
|
@@ -162,10 +163,14 @@ Env: `CONARIUM_CONSOLE_HOST`, `CONARIUM_CONSOLE_PORT`,
|
|
|
162
163
|
| Entry | Label |
|
|
163
164
|
|---|---|
|
|
164
165
|
| `bin` map above | see CLI |
|
|
165
|
-
| `"main": "./dist/index.js"` | experimental — process entry, not a library |
|
|
166
|
-
| `exports`
|
|
166
|
+
| `"main": "./dist/index.js"`, `exports["."]` | experimental — process entry, not a library; importing it starts the stdio gateway |
|
|
167
|
+
| `exports["./mask"]` → `./dist/mask.js` | experimental — `maskField`, `maskSensitiveText`, `compileCustomPatterns` and their types; importing it starts no server (`test/mask_entry.mjs`) |
|
|
168
|
+
| `maskField` options `only`, results `classes` and `masked` | experimental — `only` lists the classes to mask; `classes` counts what the core found per class, `masked` what was replaced (`unclassified`, or `{ whole: 1 }`); counts, never values (`src/mask-classes.test.ts`) |
|
|
169
|
+
| `maskField` option `pipeline: 'speech'` | experimental — text a local speech model wrote from a recording; digit runs of 7 or more digits split by spaces or hyphens, spoken `et` / `at` and `nokta` addresses and four or more dotted labels whose first two are letters only, with a word in the fixed list `DOMAIN_ENDINGS` in `src/mask/speech.ts` (a dotted run's last label; a spoken address is read up to its last listed word, so `example nokta dev nokta jp` leaves `nokta jp`; an address that mixes written dots and spoken `nokta` on either side of `et` / `at` (`ayse.yilmaz et example nokta com`, `ayse nokta yilmaz et example.com`, `ayse.yilmaz et example.com`) is one `email` span; an ending written with a Turkish dotted capital I (U+0130) is read — for the ending lookup only, the word is lowercased, U+0307 is dropped and U+0131 is read as `i`; a spoken chain reads `biz` only when no other listed word is on it, so `example nokta com nokta Biz` leaves `nokta Biz`; an address with no listed word is not masked by these rules), and `TR` plus at least four such digits as an IBAN. Classes come from the text pipeline's core detectors first, as in 0.3.3, so a Luhn-valid card written in phone-shaped groups (`4111-11-111-111-1111`) counts as `phone`, and an 11-digit run that fails the TCKN checksum counts as `tckn`; when the core and the speech rules name different classes for one number (`1-000-000-0146`: `phone` and `tckn`), both are counted and it is masked if either class is asked for. An amount with thousands separators (`1.250.000`, `1.250,00`) or under 7 digits before its decimal comma stays; `1234567,89` is a run of 7 digits and is masked, and so is a decimal part of 7 or more digits (`0,1234567`). The same digits with spaces (`1 250 000`) are a run. The text pipeline is unchanged. |
|
|
170
|
+
| package `@conarium-ai/mask` (`packages/mask`) | experimental — the same `src/mask.ts`, built on its own with `@eslint-community/regexpp` and `re2js` as its only dependencies (`test/mask_package.mjs`) |
|
|
171
|
+
| `exports["./*"]` → `./*` | a deep path that names a file, extension included, resolves to that file; extensionless `require` paths, which resolved before the map existed, no longer do. What it reaches is **internal** |
|
|
167
172
|
| `dist/governance.js`, `dist/ots/*`, `dist/http.js`, … | **internal** |
|
|
168
|
-
| TypeScript types in `src/types.ts` | **internal
|
|
173
|
+
| TypeScript types in `src/types.ts` | **internal**, except the ones `./mask` re-exports |
|
|
169
174
|
|
|
170
175
|
---
|
|
171
176
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Claims review — 0.3.3
|
|
2
|
+
|
|
3
|
+
- base: v0.3.2
|
|
4
|
+
- head: 47e0832
|
|
5
|
+
- surface: sha256:78a212eb6c4e7ba407f228d033143da3c100b180d520fd82b7b9b548f51bffcf
|
|
6
|
+
- verdict: pass
|
|
7
|
+
- reviewer: Claude. One claim surface changed between v0.3.2 and HEAD:
|
|
8
|
+
`docs/API-STABILITY.md` (`node test/denetci.mjs input v0.3.2 HEAD`).
|
|
9
|
+
|
|
10
|
+
The release adds `src/mask.ts`, an `exports` map in `package.json`, two
|
|
11
|
+
checks (`test/mask_entry.mjs`, `test/api_stability_exports.mjs`) and their
|
|
12
|
+
lines in `test/run-checks.mjs`, the version fields (`package.json`,
|
|
13
|
+
`package-lock.json`, `server.json`), the version assertion in
|
|
14
|
+
`src/demo-mode.test.ts`, the changelog entry, and the edits to
|
|
15
|
+
`docs/API-STABILITY.md` below.
|
|
16
|
+
|
|
17
|
+
Each new sentence in `docs/API-STABILITY.md` was set against what
|
|
18
|
+
establishes it: the package root runs the gateway on import (`src/index.ts`
|
|
19
|
+
calls `main()`; pointing `./mask` at `dist/index.js` made
|
|
20
|
+
`test/mask_entry.mjs` fail with the gateway's boot error); `./mask` starts no
|
|
21
|
+
server (`test/mask_entry.mjs`); the list of exported names (`src/mask.ts`);
|
|
22
|
+
which deep paths resolve under `./*` (`createRequire` against the tree, see
|
|
23
|
+
finding 2).
|
|
24
|
+
|
|
25
|
+
The two rows added in `47e0832` were set against their tests: `only`,
|
|
26
|
+
`classes` and `masked`, and that the counts carry no values
|
|
27
|
+
(`src/mask-classes.test.ts`, which failed before `cdbd65e`); the
|
|
28
|
+
`@conarium-ai/mask` package, its two dependencies at the root's pins and that
|
|
29
|
+
its built tree imports nothing else (`test/mask_package.mjs`, which failed
|
|
30
|
+
before `cdbd65e`).
|
|
31
|
+
|
|
32
|
+
The changelog is not a claim surface, but its sentences were checked the same
|
|
33
|
+
way; "the same functions the gateway calls" was read from `src/governance.ts`
|
|
34
|
+
and `src/audit.ts`, which import `maskField` / `maskSensitiveText` from
|
|
35
|
+
`src/mask-text.ts`.
|
|
36
|
+
|
|
37
|
+
## Findings
|
|
38
|
+
|
|
39
|
+
### 1. docs/API-STABILITY.md:33 — "There is no `exports` map."
|
|
40
|
+
|
|
41
|
+
- Claim: "There is no `exports` map." and, in the Package exports table, "`exports` field | **absent**"
|
|
42
|
+
- Mechanism: `package.json` without an `exports` field
|
|
43
|
+
- Why it falls short: #147 added the map, so both statements were false on
|
|
44
|
+
`main` from 0513cfd. The claims gate did not notice: it reads a document
|
|
45
|
+
only when the document changes.
|
|
46
|
+
- Disposition: reworded in `0fefb60`, with `test/api_stability_exports.mjs`
|
|
47
|
+
comparing the table to `package.json` from now on
|
|
48
|
+
|
|
49
|
+
### 2. docs/API-STABILITY.md:168 — "passes every deep path through as before the map existed"
|
|
50
|
+
|
|
51
|
+
- Claim: "passes every deep path through as before the map existed"
|
|
52
|
+
- Mechanism: resolving deep paths by name under the new map
|
|
53
|
+
- Why it falls short: `@conarium-ai/core/dist/governance.js` resolves, but the
|
|
54
|
+
extensionless `@conarium-ai/core/dist/governance`, which `require` resolved
|
|
55
|
+
before the map existed, now fails with `MODULE_NOT_FOUND`
|
|
56
|
+
- Disposition: reworded in `3caffbe`; the changelog names the change
|
|
57
|
+
|
|
58
|
+
### 3. CHANGELOG.md (0.3.3, first draft) — "a count per class"
|
|
59
|
+
|
|
60
|
+
- Claim: "`maskField` returns the masked text, the number of masked regions and a count per class."
|
|
61
|
+
- Mechanism: `maskField`'s `byClass` for a text with an e-mail address and a TCKN
|
|
62
|
+
- Why it falls short: `byClass` came back `{}`; it counts custom patterns only, and the built-in
|
|
63
|
+
classes had no count at all. The changelog is not a claim surface, so the gate did not read it.
|
|
64
|
+
- Disposition: the sentence was replaced in `47e0832` after `cdbd65e` added `classes` and
|
|
65
|
+
`masked`, which `src/mask-classes.test.ts` checks
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Claims review — 0.3.4
|
|
2
|
+
|
|
3
|
+
- base: v0.3.3
|
|
4
|
+
- head: ff89678
|
|
5
|
+
- surface: sha256:529c447e52d294b7d38c67d281c12bd415d1cbeda1f1c85723ccc3f9beb3c783
|
|
6
|
+
- verdict: pass
|
|
7
|
+
- reviewer: Cursor; findings 3 and 4 from a read-only model review, reworded by Claude; finding 6 from an automated security review, fixed by Claude. One claim surface changed between v0.3.3 and HEAD:
|
|
8
|
+
`docs/API-STABILITY.md` (`node test/denetci.mjs input v0.3.3 HEAD`).
|
|
9
|
+
|
|
10
|
+
The release adds `src/mask/speech.ts`, `src/mask/speech.test.ts` and the
|
|
11
|
+
`pipeline: 'speech'` option on `maskField` (`src/mask-text.ts`), the version
|
|
12
|
+
fields (`package.json`, `package-lock.json`, `server.json`,
|
|
13
|
+
`packages/mask/package.json`), the version assertion in
|
|
14
|
+
`src/demo-mode.test.ts`, the changelog entry, and the one row in
|
|
15
|
+
`docs/API-STABILITY.md` below.
|
|
16
|
+
|
|
17
|
+
The new row was set against what establishes it: `MaskFieldOptions.pipeline`
|
|
18
|
+
accepts `'speech'` (`src/mask-text.ts`); `detectSpeechSpans` walks digit runs
|
|
19
|
+
of 7 or more digits split by a single space or hyphen, `TR` plus at least
|
|
20
|
+
four such digits as an IBAN, spoken `et` / `at` + `nokta` addresses and
|
|
21
|
+
four or more dotted labels whose first two are letters only and whose last
|
|
22
|
+
label is in the fixed list `DOMAIN_ENDINGS` (`src/mask/speech.ts`), a spoken
|
|
23
|
+
address being read up to its last word in that list; a spoken address that
|
|
24
|
+
mixes written dots and spoken `nokta` on either side of `et` / `at` is one
|
|
25
|
+
`email` span (`ayse.yilmaz et example nokta com` and the two forms with
|
|
26
|
+
`example.com` on the right — `src/mask/speech.test.ts`); an ending written
|
|
27
|
+
with a Turkish dotted capital I (U+0130) is read (`endingKey` lowercases,
|
|
28
|
+
drops U+0307 and reads U+0131 as `i`); a spoken chain reads `biz` only when
|
|
29
|
+
no other listed word is on it (`WORD_ENDINGS`: `example nokta com nokta Biz`
|
|
30
|
+
leaves `nokta Biz`, while `firma nokta biz` and `ali.yilmaz.firma.biz` are
|
|
31
|
+
masked — `src/mask/speech.test.ts`). The text
|
|
32
|
+
pipeline's output on
|
|
33
|
+
the spoken-numbers fixture is unchanged (`src/mask/speech.test.ts`). An
|
|
34
|
+
amount with thousands separators (`1.250.000`, `1.250,00`) or under 7
|
|
35
|
+
digits before its decimal comma stays; `1234567,89` is a run of 7 digits
|
|
36
|
+
and is masked, and so is a decimal part of 7 or more digits (`0,1234567`).
|
|
37
|
+
Dates include `dd mm yyyy` with one space between parts. Two years
|
|
38
|
+
1900–2099, a six-digit run, and `TR` plus fewer than four digits are also
|
|
39
|
+
left, which the row does not claim to mask.
|
|
40
|
+
|
|
41
|
+
Classes come from the text pipeline's core detectors first, as in 0.3.3
|
|
42
|
+
(`detect` then `absorbSpeech` in `src/mask-text.ts`; `findPhones` before
|
|
43
|
+
later digit runs in `src/mask/detectors/numeric.ts`):
|
|
44
|
+
`4111-11-111-111-1111` is a Luhn-valid 16-digit card and counts as
|
|
45
|
+
`phone`; `12345678901` fails the TCKN checksum and counts as `tckn`;
|
|
46
|
+
`1-000-000-0146` is `phone` from the core and `tckn` from the speech
|
|
47
|
+
rules, so both are counted and either class in `only` masks it.
|
|
48
|
+
|
|
49
|
+
The changelog is not a claim surface, but its sentences were checked the
|
|
50
|
+
same way: the 7-digit floor, the IBAN's four-digit floor, the dotted-label
|
|
51
|
+
rule, the fixed ending list, the three mixed forms, the U+0130 ending lookup,
|
|
52
|
+
when `biz` is read as an ending, the class limits above, what is left
|
|
53
|
+
(including that a six-digit broken-up IBAN tail can leak, that spaced
|
|
54
|
+
digits are a run, and that `1234567,89` is a run), and that the text
|
|
55
|
+
pipeline is unchanged are what `src/mask/speech.test.ts` and the core
|
|
56
|
+
detectors assert.
|
|
57
|
+
|
|
58
|
+
The previous wording of the row, the changelog, and this record said more
|
|
59
|
+
than that. Those two overclaims are the findings below; they were reworded
|
|
60
|
+
in `bf49021`. The earlier dotted-label and spaced-amount overclaims were
|
|
61
|
+
reworded in `1072dac`. This round's new sentences (mixed forms, U+0130,
|
|
62
|
+
`biz`, class limits) were set against the tests and the core detectors and
|
|
63
|
+
hold after finding 5 was reworded.
|
|
64
|
+
|
|
65
|
+
## Findings
|
|
66
|
+
|
|
67
|
+
### 1. docs/API-STABILITY.md:169 — spoken and dotted addresses without a named ending list
|
|
68
|
+
|
|
69
|
+
- Claim: "spoken `et` / `at` and `nokta` addresses and four or more dotted
|
|
70
|
+
labels whose first two are letters only"
|
|
71
|
+
- Mechanism: `findSpokenEmails` and `findDottedEmails` in `src/mask/speech.ts`
|
|
72
|
+
keep a run only when the last label is in `DOMAIN_ENDINGS`
|
|
73
|
+
- Why it falls short: `ayse.yilmaz.example.xyzzy` is four dotted labels
|
|
74
|
+
whose first two are letters only and is not masked — `xyzzy` is not in
|
|
75
|
+
the list
|
|
76
|
+
- Disposition: reworded in `bf49021` to name `DOMAIN_ENDINGS` in
|
|
77
|
+
`src/mask/speech.ts` and that an address ending in anything else is not
|
|
78
|
+
masked by these rules
|
|
79
|
+
|
|
80
|
+
### 2. CHANGELOG.md (0.3.4, previous wording) — "an amount written with dots or commas"
|
|
81
|
+
|
|
82
|
+
- Claim: "It leaves an amount written with dots or commas"
|
|
83
|
+
- Mechanism: `findDigitRuns` masks a run of 7 or more digits; thousands
|
|
84
|
+
separators (`1.250.000`, `1.250,00`) break the run, and fewer than 7
|
|
85
|
+
digits before a decimal comma stay
|
|
86
|
+
- Why it falls short: `1234567,89` is written with a comma and is a run
|
|
87
|
+
of 7 digits, so it is masked
|
|
88
|
+
- Disposition: reworded in `bf49021`
|
|
89
|
+
|
|
90
|
+
### 3. docs/API-STABILITY.md:169 — "an address ending in anything else is not masked"
|
|
91
|
+
|
|
92
|
+
- Claim: "ending in the fixed list `DOMAIN_ENDINGS` … (an address ending in
|
|
93
|
+
anything else is not masked by these rules)"
|
|
94
|
+
- Mechanism: `findSpokenEmails` in `src/mask/speech.ts` takes the rightmost
|
|
95
|
+
word in `DOMAIN_ENDINGS` on the nokta chain after `et` / `at`, not the
|
|
96
|
+
chain's last word
|
|
97
|
+
- Why it falls short: `ayse et example nokta dev nokta jp` ends in `jp`,
|
|
98
|
+
which is not in the list, and becomes `[MASKED_PII] nokta jp`
|
|
99
|
+
- Disposition: reworded in `026a6f4`: a dotted run's last label, and a spoken
|
|
100
|
+
address read up to its last listed word
|
|
101
|
+
|
|
102
|
+
### 4. docs/API-STABILITY.md:169 — "under 7 digits before its decimal comma stays"
|
|
103
|
+
|
|
104
|
+
- Claim: "An amount … under 7 digits before its decimal comma stays"
|
|
105
|
+
- Mechanism: `findDigitRuns` reads each side of the comma as its own run
|
|
106
|
+
- Why it falls short: `0,1234567 BTC` has one digit before the comma and
|
|
107
|
+
becomes `0,[MASKED_PII] BTC`
|
|
108
|
+
- Disposition: reworded in `026a6f4`: a decimal part of 7 or more digits is
|
|
109
|
+
masked too
|
|
110
|
+
|
|
111
|
+
### 5. docs/API-STABILITY.md:169 — Turkish-specific letters on an English surface
|
|
112
|
+
|
|
113
|
+
- Claim: the first wording of this round wrote the mixed-form examples and
|
|
114
|
+
the dotted capital I with Turkish-specific letters (U+015F, U+0130, U+0131)
|
|
115
|
+
- Mechanism: `test/locale_letters.mjs` and `test/claim_discipline.mjs` reject
|
|
116
|
+
those letters on English claim surfaces; `test/pack_locale.mjs` rejects
|
|
117
|
+
them in `dist/`
|
|
118
|
+
- Why it falls short: that wording failed `locale_letters` on this row, and
|
|
119
|
+
`endingKey` with a literal U+0131 failed `pack_locale` on
|
|
120
|
+
`dist/mask/speech.js`
|
|
121
|
+
- Disposition: reworded in `8336ca7` to ASCII local parts and to U+0130 /
|
|
122
|
+
U+0131 by code point
|
|
123
|
+
|
|
124
|
+
### 6. docs/API-STABILITY.md:169 — "`biz` is not in the list"
|
|
125
|
+
|
|
126
|
+
- Claim: "`biz` is not in the list", which `62e1aac` wrote after `d08d8fb`
|
|
127
|
+
removed `biz` from `DOMAIN_ENDINGS` so the Turkish word "we" was not
|
|
128
|
+
masked after a spoken address
|
|
129
|
+
- Mechanism: both the dotted rule and the spoken `nokta` rule keep a run only
|
|
130
|
+
when its ending is in `DOMAIN_ENDINGS`
|
|
131
|
+
- Why it falls short: the sentence was true, and the behaviour was a leak:
|
|
132
|
+
`ali.yilmaz.firma.biz`, `ali et firma nokta biz`, `ali et firma.biz` and
|
|
133
|
+
`ali nokta yilmaz et firma nokta biz` were left unmasked
|
|
134
|
+
- Disposition: fixed in `ff89678`: `biz` is back in the list, and a spoken
|
|
135
|
+
chain reads it only when no other listed word is on it (`WORD_ENDINGS`), so
|
|
136
|
+
`example nokta com nokta Biz` still leaves `nokta Biz`; the row, the
|
|
137
|
+
changelog and this record were reworded in the same commit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conarium-ai/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"mcpName": "io.github.dogrucanemek-alt/conarium",
|
|
5
5
|
"//files-artefakt": "Generated files under examples/ (private key, receipt/audit JSONL) are EXCLUDED. .gitignore does not bind npm: because the allow-list contained 'examples', `npm publish` on a machine that had run the demo was shipping _keys/audit-ed25519.pem (PRIVATE KEY) and the receipts. test/pack_artefakt.mjs locks this. The exclusions are LIMITED to examples/: receipts.jsonl and .pub.pem under test-vectors/ MUST ship, or a third party cannot run the conformance vectors.",
|
|
6
6
|
"//files": "Allow-list of what enters the package. Without it npm sent everything: 296 files / 1.5 MB — CI workflows, gitleaks config, a 137 KB marketing image, the site's api/chat.js. A bank security team opens the tarball and sees those. scripts/ is here ON PURPOSE: conarium-reconcile references scripts/pg-snapshot.sql at runtime; without it the user files a support mail.",
|
|
@@ -86,6 +86,14 @@
|
|
|
86
86
|
"license": "MIT",
|
|
87
87
|
"type": "module",
|
|
88
88
|
"main": "./dist/index.js",
|
|
89
|
+
"exports": {
|
|
90
|
+
".": "./dist/index.js",
|
|
91
|
+
"./mask": {
|
|
92
|
+
"types": "./dist/mask.d.ts",
|
|
93
|
+
"default": "./dist/mask.js"
|
|
94
|
+
},
|
|
95
|
+
"./*": "./*"
|
|
96
|
+
},
|
|
89
97
|
"bin": {
|
|
90
98
|
"conarium": "dist/index.js",
|
|
91
99
|
"conarium-doctor": "bin/conarium-doctor.mjs",
|
|
@@ -102,7 +110,7 @@
|
|
|
102
110
|
"conarium-suggest-policy": "bin/conarium-suggest-policy.mjs"
|
|
103
111
|
},
|
|
104
112
|
"scripts": {
|
|
105
|
-
"build": "tsc",
|
|
113
|
+
"build": "tsc && tsc -p tsconfig.mask.json",
|
|
106
114
|
"test": "vitest run",
|
|
107
115
|
"test:anchor-verify": "npm run build && node test/anchor_verify.mjs",
|
|
108
116
|
"test:checks": "npm run build && node test/run-checks.mjs",
|
|
@@ -124,7 +132,7 @@
|
|
|
124
132
|
"node-sql-parser": "^5.4.0",
|
|
125
133
|
"pgsql-ast-parser": "^12.0.2",
|
|
126
134
|
"postgres": "^3.4.4",
|
|
127
|
-
"re2js": "2.8.
|
|
135
|
+
"re2js": "2.8.7",
|
|
128
136
|
"zod": "4.6.7"
|
|
129
137
|
},
|
|
130
138
|
"devDependencies": {
|