@conarium-ai/core 0.2.53 → 0.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/CHANGELOG.md +78 -0
- package/LIMITATIONS.md +94 -1
- package/LIMITATIONS.tr.md +96 -1
- package/README.md +1 -1
- package/dist/custom_patterns.d.ts +13 -12
- package/dist/custom_patterns.d.ts.map +1 -1
- package/dist/custom_patterns.js +576 -14
- package/dist/custom_patterns.js.map +1 -1
- package/dist/governance.d.ts.map +1 -1
- package/dist/governance.js +37 -139
- package/dist/governance.js.map +1 -1
- package/dist/mask/belt.d.ts +36 -0
- package/dist/mask/belt.d.ts.map +1 -0
- package/dist/mask/belt.js +771 -0
- package/dist/mask/belt.js.map +1 -0
- package/dist/mask/core.d.ts +36 -0
- package/dist/mask/core.d.ts.map +1 -0
- package/dist/mask/core.js +119 -0
- package/dist/mask/core.js.map +1 -0
- package/dist/mask/detectors/bearer.d.ts +6 -0
- package/dist/mask/detectors/bearer.d.ts.map +1 -0
- package/dist/mask/detectors/bearer.js +30 -0
- package/dist/mask/detectors/bearer.js.map +1 -0
- package/dist/mask/detectors/connection.d.ts +7 -0
- package/dist/mask/detectors/connection.d.ts.map +1 -0
- package/dist/mask/detectors/connection.js +20 -0
- package/dist/mask/detectors/connection.js.map +1 -0
- package/dist/mask/detectors/custom.d.ts +12 -0
- package/dist/mask/detectors/custom.d.ts.map +1 -0
- package/dist/mask/detectors/custom.js +44 -0
- package/dist/mask/detectors/custom.js.map +1 -0
- package/dist/mask/detectors/email.d.ts +3 -0
- package/dist/mask/detectors/email.d.ts.map +1 -0
- package/dist/mask/detectors/email.js +41 -0
- package/dist/mask/detectors/email.js.map +1 -0
- package/dist/mask/detectors/embedded.d.ts +3 -0
- package/dist/mask/detectors/embedded.d.ts.map +1 -0
- package/dist/mask/detectors/embedded.js +73 -0
- package/dist/mask/detectors/embedded.js.map +1 -0
- package/dist/mask/detectors/iban.d.ts +3 -0
- package/dist/mask/detectors/iban.d.ts.map +1 -0
- package/dist/mask/detectors/iban.js +92 -0
- package/dist/mask/detectors/iban.js.map +1 -0
- package/dist/mask/detectors/ip.d.ts +3 -0
- package/dist/mask/detectors/ip.d.ts.map +1 -0
- package/dist/mask/detectors/ip.js +42 -0
- package/dist/mask/detectors/ip.js.map +1 -0
- package/dist/mask/detectors/labelled_secret.d.ts +6 -0
- package/dist/mask/detectors/labelled_secret.d.ts.map +1 -0
- package/dist/mask/detectors/labelled_secret.js +31 -0
- package/dist/mask/detectors/labelled_secret.js.map +1 -0
- package/dist/mask/detectors/mrz.d.ts +3 -0
- package/dist/mask/detectors/mrz.d.ts.map +1 -0
- package/dist/mask/detectors/mrz.js +42 -0
- package/dist/mask/detectors/mrz.js.map +1 -0
- package/dist/mask/detectors/name.d.ts +6 -0
- package/dist/mask/detectors/name.d.ts.map +1 -0
- package/dist/mask/detectors/name.js +41 -0
- package/dist/mask/detectors/name.js.map +1 -0
- package/dist/mask/detectors/numeric.d.ts +3 -0
- package/dist/mask/detectors/numeric.d.ts.map +1 -0
- package/dist/mask/detectors/numeric.js +240 -0
- package/dist/mask/detectors/numeric.js.map +1 -0
- package/dist/mask/detectors/secret.d.ts +6 -0
- package/dist/mask/detectors/secret.d.ts.map +1 -0
- package/dist/mask/detectors/secret.js +31 -0
- package/dist/mask/detectors/secret.js.map +1 -0
- package/dist/mask/detectors/whole_base64.d.ts +3 -0
- package/dist/mask/detectors/whole_base64.d.ts.map +1 -0
- package/dist/mask/detectors/whole_base64.js +28 -0
- package/dist/mask/detectors/whole_base64.js.map +1 -0
- package/dist/mask/legacy_0254/conn_linear.d.ts +26 -0
- package/dist/mask/legacy_0254/conn_linear.d.ts.map +1 -0
- package/dist/mask/legacy_0254/conn_linear.js +97 -0
- package/dist/mask/legacy_0254/conn_linear.js.map +1 -0
- package/dist/mask/legacy_0254/custom_patterns.d.ts +42 -0
- package/dist/mask/legacy_0254/custom_patterns.d.ts.map +1 -0
- package/dist/mask/legacy_0254/custom_patterns.js +164 -0
- package/dist/mask/legacy_0254/custom_patterns.js.map +1 -0
- package/dist/mask/legacy_0254/digit_pii.d.ts +46 -0
- package/dist/mask/legacy_0254/digit_pii.d.ts.map +1 -0
- package/dist/mask/legacy_0254/digit_pii.js +230 -0
- package/dist/mask/legacy_0254/digit_pii.js.map +1 -0
- package/dist/mask/legacy_0254/iban.d.ts +56 -0
- package/dist/mask/legacy_0254/iban.d.ts.map +1 -0
- package/dist/mask/legacy_0254/iban.js +171 -0
- package/dist/mask/legacy_0254/iban.js.map +1 -0
- package/dist/mask/legacy_0254/ip_detect.d.ts +28 -0
- package/dist/mask/legacy_0254/ip_detect.d.ts.map +1 -0
- package/dist/mask/legacy_0254/ip_detect.js +92 -0
- package/dist/mask/legacy_0254/ip_detect.js.map +1 -0
- package/dist/mask/legacy_0254/legacy_governance_mask.d.ts +20 -0
- package/dist/mask/legacy_0254/legacy_governance_mask.d.ts.map +1 -0
- package/dist/mask/legacy_0254/legacy_governance_mask.js +171 -0
- package/dist/mask/legacy_0254/legacy_governance_mask.js.map +1 -0
- package/dist/mask/legacy_0254/legacy_mask_text.d.ts +11 -0
- package/dist/mask/legacy_0254/legacy_mask_text.d.ts.map +1 -0
- package/dist/mask/legacy_0254/legacy_mask_text.js +46 -0
- package/dist/mask/legacy_0254/legacy_mask_text.js.map +1 -0
- package/dist/mask/legacy_0254/mrz.d.ts +7 -0
- package/dist/mask/legacy_0254/mrz.d.ts.map +1 -0
- package/dist/mask/legacy_0254/mrz.js +74 -0
- package/dist/mask/legacy_0254/mrz.js.map +1 -0
- package/dist/mask/legacy_0254/pii_normalize.d.ts +38 -0
- package/dist/mask/legacy_0254/pii_normalize.d.ts.map +1 -0
- package/dist/mask/legacy_0254/pii_normalize.js +96 -0
- package/dist/mask/legacy_0254/pii_normalize.js.map +1 -0
- package/dist/mask/legacy_0254/safe-object.d.ts +14 -0
- package/dist/mask/legacy_0254/safe-object.d.ts.map +1 -0
- package/dist/mask/legacy_0254/safe-object.js +27 -0
- package/dist/mask/legacy_0254/safe-object.js.map +1 -0
- package/dist/mask/legacy_0254/tckn.d.ts +10 -0
- package/dist/mask/legacy_0254/tckn.d.ts.map +1 -0
- package/dist/mask/legacy_0254/tckn.js +70 -0
- package/dist/mask/legacy_0254/tckn.js.map +1 -0
- package/dist/mask/legacy_0254/types.d.ts +207 -0
- package/dist/mask/legacy_0254/types.d.ts.map +1 -0
- package/dist/mask/legacy_0254/types.js +2 -0
- package/dist/mask/legacy_0254/types.js.map +1 -0
- package/dist/mask-text.d.ts +11 -1
- package/dist/mask-text.d.ts.map +1 -1
- package/dist/mask-text.js +189 -30
- package/dist/mask-text.js.map +1 -1
- package/docs/claims/reviews/0.2.54.md +20 -0
- package/docs/claims/reviews/0.3.0.md +72 -0
- package/examples/per-user-identity/README.md +6 -6
- package/examples/per-user-identity/mint-token.mjs +1 -1
- package/examples/per-user-identity/policy.overlay.json +3 -3
- package/examples/per-user-identity/prove-identity.mjs +21 -21
- package/package.json +5 -1
- package/scripts/conarium_sabah_brief.mjs +0 -107
- package/scripts/start-mcp-c1.mjs +0 -93
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tckn.js","sourceRoot":"","sources":["../../../src/mask/legacy_0254/tckn.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAC/C,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAA;IACzD,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAA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G,EAAE,CAAC,EAAE,cAAc,CAAC,CAAA;YAC9B,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,cAAc,CAAC,CAAA;YAC9B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACX,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACX,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACvB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,CAAA;AACjD,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export interface ConariumConfig {
|
|
2
|
+
connectors: ConnectorConfig[];
|
|
3
|
+
serverName?: string;
|
|
4
|
+
serverVersion?: string;
|
|
5
|
+
/** Identity of the consumer (team / editor / user) for audit attribution. */
|
|
6
|
+
consumer?: string;
|
|
7
|
+
/** Access policy enforced on every connector call. */
|
|
8
|
+
policy?: GovernancePolicy;
|
|
9
|
+
/** Audit configuration. */
|
|
10
|
+
audit?: AuditConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Proof profile. `production` requires Ed25519 AND HMAC, turns G3 strict
|
|
13
|
+
* signatures and anchoring on, and defaults HTTP rate-limit to 60/min
|
|
14
|
+
* unless CONARIUM_MCP_RATE_PER_MIN is explicitly 0.
|
|
15
|
+
*/
|
|
16
|
+
profile?: 'production';
|
|
17
|
+
}
|
|
18
|
+
export interface GovernancePolicy {
|
|
19
|
+
/** Allow-list of schema-qualified tables (glob: "billing.*", "*"). Missing or empty = deny all (default-deny). */
|
|
20
|
+
allowTables?: string[];
|
|
21
|
+
/** Deny-list of schema-qualified tables; takes precedence over allow. */
|
|
22
|
+
denyTables?: string[];
|
|
23
|
+
/** Columns to mask before data leaves the boundary ("customers.email", "*.tckn"). */
|
|
24
|
+
maskColumns?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Columns whose values must not be learnable through predicates.
|
|
27
|
+
* Same glob syntax as `maskColumns` (`"customers.email"`, `"*.tckn"`).
|
|
28
|
+
*
|
|
29
|
+
* Every pattern here is also treated as a `maskColumns` pattern: the value
|
|
30
|
+
* is redacted in the result set. A column that cannot be queried but is
|
|
31
|
+
* returned in the clear would be meaningless. You do not need to repeat
|
|
32
|
+
* the pattern in `maskColumns`.
|
|
33
|
+
*
|
|
34
|
+
* A profile cannot set, clear, or replace this field. Protection is global.
|
|
35
|
+
*/
|
|
36
|
+
protectedColumns?: string[];
|
|
37
|
+
/** Hard cap on rows returned to the AI assistant (default 100). */
|
|
38
|
+
maxRows?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Which SQL gate the shipped `query` tool uses. Operator declaration —
|
|
41
|
+
* never inferred from the statement. Omitted = `postgres` (today's path)
|
|
42
|
+
* except when a `custom-sql` connector is present: that path requires an
|
|
43
|
+
* explicit dialect. Unknown values reject the config; they do not fall back.
|
|
44
|
+
*/
|
|
45
|
+
dialect?: 'postgres' | 'mssql' | 'oracle';
|
|
46
|
+
/**
|
|
47
|
+
* Mask names that the text itself marks as names — a title ("Sn. Ahmet
|
|
48
|
+
* Yılmaz") or a field label ("Yetkili: Ayşe Demir"). Default true.
|
|
49
|
+
*
|
|
50
|
+
* Names are the one identifier with no shape of their own, so column policy
|
|
51
|
+
* was the only thing catching them and free text went through untouched.
|
|
52
|
+
* This is NOT name recognition: a bare name in running prose is not detected,
|
|
53
|
+
* because guessing would trade this gateway's deterministic decisions for a
|
|
54
|
+
* confidence score. Set false where the labelled form is legitimate output —
|
|
55
|
+
* typically via a profile, so it stays off for one identified person rather
|
|
56
|
+
* than for everyone.
|
|
57
|
+
*/
|
|
58
|
+
maskLabelledNames?: boolean;
|
|
59
|
+
/** Allowed API tools (e.g. "addPet", "getUser*"). */
|
|
60
|
+
allowTools?: string[];
|
|
61
|
+
/** Denied API tools. */
|
|
62
|
+
denyTools?: string[];
|
|
63
|
+
/** Allowed connector names (glob). Missing or empty = deny all (fail-closed). */
|
|
64
|
+
allowConnectors?: string[];
|
|
65
|
+
/** Denied connector names (glob); takes precedence over allow. */
|
|
66
|
+
denyConnectors?: string[];
|
|
67
|
+
/**
|
|
68
|
+
* Named masking overlays, applied per person.
|
|
69
|
+
*
|
|
70
|
+
* The problem this solves: masking that is right for an AI agent is wrong for
|
|
71
|
+
* the data controller. A shop owner asking "which customer owes the most" needs
|
|
72
|
+
* the name; the assistant summarising revenue does not. A global on/off switch
|
|
73
|
+
* would answer that by disabling the product's only real guarantee.
|
|
74
|
+
*
|
|
75
|
+
* Deliberately narrow: a profile may override `maskColumns`, `maxRows` and
|
|
76
|
+
* `maskLabelledNames` — and NOTHING else. Table, tool and connector permissions
|
|
77
|
+
* stay global, so a profile can never widen what is reachable — only what is
|
|
78
|
+
* legible within it. `protectedColumns` is not overlayable: a per-person
|
|
79
|
+
* profile that could drop a protection rule would be a back door.
|
|
80
|
+
*/
|
|
81
|
+
profiles?: Record<string, MaskingProfile>;
|
|
82
|
+
/**
|
|
83
|
+
* Actor id → profile name. Honoured ONLY for actors authenticated with a
|
|
84
|
+
* per-user token (`assurance: 'per-user-token'`). A shared token never receives
|
|
85
|
+
* a profile: "whoever holds this token sees unmasked PII" is exactly the
|
|
86
|
+
* property this product exists to prevent.
|
|
87
|
+
*/
|
|
88
|
+
actorProfiles?: Record<string, string>;
|
|
89
|
+
/**
|
|
90
|
+
* Fail-closed scan length. A field longer than this is replaced whole with
|
|
91
|
+
* `[MASKED_PII]` — it is never skipped. Default 16 384. Env
|
|
92
|
+
* `CONARIUM_SCAN_CHAR_CAP` overrides. This is a usability knob: raising it
|
|
93
|
+
* grows scan cost quadratically on the remaining detectors.
|
|
94
|
+
*/
|
|
95
|
+
scanCharCap?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Optional content detectors. Identity detectors (TCKN, card, IBAN, email)
|
|
98
|
+
* are not keys here and cannot be turned off — a config that tries is
|
|
99
|
+
* rejected at load. `ip` defaults off (server IPs are not always personal
|
|
100
|
+
* data). `mrz` defaults on (a passport MRZ is identity and checksummed).
|
|
101
|
+
*/
|
|
102
|
+
detectors?: DetectorToggles;
|
|
103
|
+
/**
|
|
104
|
+
* Extra content detectors the operator writes. Same scanner as the built-in
|
|
105
|
+
* ones — not a second masking path. Each rule has a name (what the receipt
|
|
106
|
+
* records), a pattern, optional column globs, and a mask label.
|
|
107
|
+
*
|
|
108
|
+
* A broken or ReDoS-shaped pattern rejects the config. The pattern text is
|
|
109
|
+
* never written to logs or receipts.
|
|
110
|
+
*/
|
|
111
|
+
customPatterns?: CustomPiiPattern[];
|
|
112
|
+
}
|
|
113
|
+
/** Operator-defined content detector. See `GovernancePolicy.customPatterns`. */
|
|
114
|
+
export interface CustomPiiPattern {
|
|
115
|
+
/** Receipt `masking.byClass` key. Not the pattern. */
|
|
116
|
+
name: string;
|
|
117
|
+
/** JS regex source. Compiled at load; never logged. */
|
|
118
|
+
pattern: string;
|
|
119
|
+
/** Optional column globs (`*.hesap_no`). Empty / omitted = every scanned field. */
|
|
120
|
+
columns?: string[];
|
|
121
|
+
/** Replacement. Default `[MASKED_PII]`. Must be `[MASKED_…]`. */
|
|
122
|
+
label?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Optional example the doctor tries against the compiled pattern.
|
|
125
|
+
* Same sensitivity as `pattern` — never logged or printed.
|
|
126
|
+
*/
|
|
127
|
+
sample?: string;
|
|
128
|
+
}
|
|
129
|
+
/** See `GovernancePolicy.detectors`. */
|
|
130
|
+
export interface DetectorToggles {
|
|
131
|
+
/** Opt-in. Default false. */
|
|
132
|
+
ip?: boolean;
|
|
133
|
+
/** Passport TD3 MRZ. Default true. */
|
|
134
|
+
mrz?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/** Per-person overlay. See `GovernancePolicy.profiles`. */
|
|
137
|
+
export interface MaskingProfile {
|
|
138
|
+
maskColumns?: string[];
|
|
139
|
+
maxRows?: number;
|
|
140
|
+
maskLabelledNames?: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface AuditConfig {
|
|
143
|
+
/** Append-only JSONL file path. If unset, audit goes to stderr only. */
|
|
144
|
+
sink?: string;
|
|
145
|
+
failClosed?: boolean;
|
|
146
|
+
/** Optional: append-only JSONL file for verifiable access receipts. If unset, no receipts are produced. */
|
|
147
|
+
receiptSink?: string;
|
|
148
|
+
/** Model identification for receipts (provider/name/version). */
|
|
149
|
+
receiptModel?: {
|
|
150
|
+
provider: string;
|
|
151
|
+
name: string;
|
|
152
|
+
version: string;
|
|
153
|
+
};
|
|
154
|
+
/** Client identification for receipts (name/version). */
|
|
155
|
+
receiptClient?: {
|
|
156
|
+
name: string;
|
|
157
|
+
version: string;
|
|
158
|
+
};
|
|
159
|
+
/** Operator-declared destination. Not verified. Not a policy input. */
|
|
160
|
+
receiptDestination?: string;
|
|
161
|
+
}
|
|
162
|
+
export interface ConnectorConfig {
|
|
163
|
+
type: 'postgres' | 'supabase' | 'supabase-rest' | 'openapi' | 'files' | 'docs' | 'slack' | 'jira' | 'custom-sql' | 'demo';
|
|
164
|
+
name: string;
|
|
165
|
+
description: string;
|
|
166
|
+
config: Record<string, string>;
|
|
167
|
+
}
|
|
168
|
+
export interface SchemaTable {
|
|
169
|
+
name: string;
|
|
170
|
+
schema: string;
|
|
171
|
+
columns: SchemaColumn[];
|
|
172
|
+
rowCount?: number;
|
|
173
|
+
description?: string;
|
|
174
|
+
}
|
|
175
|
+
export interface SchemaColumn {
|
|
176
|
+
name: string;
|
|
177
|
+
type: string;
|
|
178
|
+
nullable: boolean;
|
|
179
|
+
isPrimary: boolean;
|
|
180
|
+
isForeign: boolean;
|
|
181
|
+
references?: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface QueryResult {
|
|
185
|
+
rows: Record<string, unknown>[];
|
|
186
|
+
rowCount: number;
|
|
187
|
+
fields: string[];
|
|
188
|
+
sql?: string;
|
|
189
|
+
}
|
|
190
|
+
export interface ConnectorCapabilities {
|
|
191
|
+
canQuery: boolean;
|
|
192
|
+
canListSchema: boolean;
|
|
193
|
+
canDescribeTable: boolean;
|
|
194
|
+
canSearch: boolean;
|
|
195
|
+
}
|
|
196
|
+
export interface Connector {
|
|
197
|
+
name: string;
|
|
198
|
+
description: string;
|
|
199
|
+
capabilities: ConnectorCapabilities;
|
|
200
|
+
connect(): Promise<void>;
|
|
201
|
+
disconnect(): Promise<void>;
|
|
202
|
+
listTables(): Promise<SchemaTable[]>;
|
|
203
|
+
describeTable(table: string): Promise<SchemaTable>;
|
|
204
|
+
query(sql: string, params?: unknown[]): Promise<QueryResult>;
|
|
205
|
+
search(query: string, tables?: string[]): Promise<QueryResult>;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mask/legacy_0254/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sDAAsD;IACtD,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,kHAAkH;IAClH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,OAAO,CAAC,EAAE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AC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,OAAO,CAAA;IACzB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,qBAAqB,CAAA;IACnC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IACpC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAClD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/mask/legacy_0254/types.ts"],"names":[],"mappings":""}
|
package/dist/mask-text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CompiledCustomPattern } from './custom_patterns.js';
|
|
2
2
|
import type { DetectorToggles } from './types.js';
|
|
3
3
|
export interface MaskTextOptions {
|
|
4
4
|
scanCharCap?: number;
|
|
@@ -7,5 +7,15 @@ export interface MaskTextOptions {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const SECRET_VALUE_RE: RegExp;
|
|
9
9
|
export declare function maskSecretShapedValues(text: string, token?: string): string;
|
|
10
|
+
export interface MaskFieldOptions extends MaskTextOptions {
|
|
11
|
+
pipeline: 'text' | 'governance';
|
|
12
|
+
column?: string;
|
|
13
|
+
maskLabelledNames?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function maskField(text: string, opts: MaskFieldOptions): {
|
|
16
|
+
text: string;
|
|
17
|
+
count: number;
|
|
18
|
+
byClass: Record<string, number>;
|
|
19
|
+
};
|
|
10
20
|
export declare function maskSensitiveText(text: string, opts?: MaskTextOptions): string;
|
|
11
21
|
//# 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":"
|
|
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;AAIjD,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,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAqID,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;CAChC,CAmCA;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,eAAoB,GAAG,MAAM,CAOlF"}
|
package/dist/mask-text.js
CHANGED
|
@@ -2,41 +2,200 @@
|
|
|
2
2
|
* Shared PII/secret masking pipeline. Audit args, error text, and (later)
|
|
3
3
|
* reason/target/governance all go through this — one copy, not three.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { maskMrz } from './mrz.js';
|
|
10
|
-
import { applyCustomPatterns, } from './custom_patterns.js';
|
|
5
|
+
import { normalizePiiText } from './pii_normalize.js';
|
|
6
|
+
import { resolveScanCharCap } from './digit_pii.js';
|
|
7
|
+
import { apply, detect } from './mask/core.js';
|
|
8
|
+
import { beltCover } from './mask/belt.js';
|
|
11
9
|
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;
|
|
12
10
|
export function maskSecretShapedValues(text, token = '[MASKED_SECRET]') {
|
|
13
11
|
SECRET_VALUE_RE.lastIndex = 0;
|
|
14
12
|
return text.replace(SECRET_VALUE_RE, token);
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
const SECRET = '[MASKED_SECRET]';
|
|
15
|
+
const PII = '[MASKED_PII]';
|
|
16
|
+
function tokenTier(token) {
|
|
17
|
+
if (token === SECRET)
|
|
18
|
+
return 0;
|
|
19
|
+
if (token === PII)
|
|
20
|
+
return 1;
|
|
21
|
+
return 2;
|
|
22
|
+
}
|
|
23
|
+
function preferToken(left, right, rules) {
|
|
24
|
+
if (!left)
|
|
25
|
+
return right;
|
|
26
|
+
if (!right)
|
|
27
|
+
return left;
|
|
28
|
+
const a = tokenTier(left);
|
|
29
|
+
const b = tokenTier(right);
|
|
30
|
+
if (a !== b)
|
|
31
|
+
return a < b ? left : right;
|
|
32
|
+
if (a < 2)
|
|
33
|
+
return left;
|
|
34
|
+
const ia = rules.findIndex((rule) => rule.label === left);
|
|
35
|
+
const ib = rules.findIndex((rule) => rule.label === right);
|
|
36
|
+
if (ia < 0)
|
|
37
|
+
return ib < 0 ? left : right;
|
|
38
|
+
if (ib < 0)
|
|
39
|
+
return left;
|
|
40
|
+
return ia <= ib ? left : right;
|
|
41
|
+
}
|
|
42
|
+
function legacySpan(start, end) {
|
|
43
|
+
return {
|
|
44
|
+
start,
|
|
45
|
+
end,
|
|
46
|
+
cls: 'legacy',
|
|
47
|
+
token: PII,
|
|
48
|
+
source: 'belt',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Belt ranges carry no token. Only the part a core span does not already cover enters as PII. */
|
|
52
|
+
function beltOnlySpans(core, belt) {
|
|
53
|
+
const raw = [];
|
|
54
|
+
for (let i = 0; i < core.length; i++) {
|
|
55
|
+
const sp = core[i];
|
|
56
|
+
if (sp.end > sp.start)
|
|
57
|
+
raw.push({ start: sp.start, end: sp.end });
|
|
58
|
+
}
|
|
59
|
+
raw.sort((a, b) => a.start - b.start || a.end - b.end);
|
|
60
|
+
const merged = [];
|
|
61
|
+
for (let i = 0; i < raw.length; i++) {
|
|
62
|
+
const iv = raw[i];
|
|
63
|
+
const cur = merged[merged.length - 1];
|
|
64
|
+
if (!cur || iv.start > cur.end)
|
|
65
|
+
merged.push({ start: iv.start, end: iv.end });
|
|
66
|
+
else if (iv.end > cur.end)
|
|
67
|
+
cur.end = iv.end;
|
|
68
|
+
}
|
|
69
|
+
const ordered = unionBelt(beltByStart(belt));
|
|
70
|
+
const out = [];
|
|
71
|
+
// `head` only moves forward. Belt ranges are in start order, so an interval
|
|
72
|
+
// that ended before this range cannot meet a later one.
|
|
73
|
+
let head = 0;
|
|
74
|
+
for (let b = 0; b < ordered.length; b++) {
|
|
75
|
+
const sp = ordered[b];
|
|
76
|
+
if (sp.end <= sp.start)
|
|
77
|
+
continue;
|
|
78
|
+
while (head < merged.length && merged[head].end <= sp.start)
|
|
79
|
+
head++;
|
|
80
|
+
let cursor = sp.start;
|
|
81
|
+
for (let k = head; k < merged.length; k++) {
|
|
82
|
+
const iv = merged[k];
|
|
83
|
+
if (iv.start >= sp.end)
|
|
84
|
+
break;
|
|
85
|
+
if (iv.start > cursor)
|
|
86
|
+
out.push(legacySpan(cursor, Math.min(iv.start, sp.end)));
|
|
87
|
+
if (iv.end > cursor)
|
|
88
|
+
cursor = iv.end;
|
|
89
|
+
if (cursor >= sp.end)
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (cursor < sp.end)
|
|
93
|
+
out.push(legacySpan(cursor, sp.end));
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
// Widest ranges of an ambiguous mask overlap. Cut the gaps once, on the
|
|
98
|
+
// union, or each range rebuilds the same gaps and the piece count squares.
|
|
99
|
+
function unionBelt(ordered) {
|
|
100
|
+
for (let i = 1; i < ordered.length; i++) {
|
|
101
|
+
if (ordered[i].start < ordered[i - 1].end)
|
|
102
|
+
return mergeBelt(ordered);
|
|
103
|
+
}
|
|
104
|
+
return ordered;
|
|
105
|
+
}
|
|
106
|
+
function mergeBelt(ordered) {
|
|
107
|
+
const merged = [];
|
|
108
|
+
for (let i = 0; i < ordered.length; i++) {
|
|
109
|
+
const sp = ordered[i];
|
|
110
|
+
if (sp.end <= sp.start)
|
|
111
|
+
continue;
|
|
112
|
+
const cur = merged[merged.length - 1];
|
|
113
|
+
if (cur && sp.start < cur.end) {
|
|
114
|
+
if (sp.end > cur.end)
|
|
115
|
+
cur.end = sp.end;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
merged.push({ start: sp.start, end: sp.end });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return merged;
|
|
122
|
+
}
|
|
123
|
+
function beltByStart(belt) {
|
|
124
|
+
for (let i = 1; i < belt.length; i++) {
|
|
125
|
+
if (belt[i].start < belt[i - 1].start) {
|
|
126
|
+
const copy = belt.slice();
|
|
127
|
+
copy.sort((a, b) => a.start - b.start);
|
|
128
|
+
return copy;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return belt;
|
|
132
|
+
}
|
|
133
|
+
function ownByClass(src) {
|
|
134
|
+
const bag = Object.create(null);
|
|
135
|
+
if (!src)
|
|
136
|
+
return bag;
|
|
137
|
+
for (const key of Object.keys(src)) {
|
|
138
|
+
const n = src[key];
|
|
139
|
+
if (typeof n !== 'number' || !(n > 0))
|
|
140
|
+
continue;
|
|
141
|
+
Object.defineProperty(bag, key, {
|
|
142
|
+
value: n,
|
|
143
|
+
writable: true,
|
|
144
|
+
enumerable: true,
|
|
145
|
+
configurable: true,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return bag;
|
|
149
|
+
}
|
|
150
|
+
// The core detects on its own. The belt keeps every span 0.2.54 masked.
|
|
151
|
+
// When the belt cannot decide, the whole field is masked.
|
|
152
|
+
export function maskField(text, opts) {
|
|
17
153
|
if (text.length > resolveScanCharCap(opts.scanCharCap)) {
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
154
|
+
return { text: PII, count: 1, byClass: Object.create(null) };
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
const normalized = normalizePiiText(text);
|
|
158
|
+
const rules = opts.customPatterns ?? [];
|
|
159
|
+
const detected = detect(normalized, {
|
|
160
|
+
detectors: opts.detectors,
|
|
161
|
+
customPatterns: rules,
|
|
162
|
+
column: opts.column,
|
|
163
|
+
maskLabelledNames: opts.maskLabelledNames,
|
|
164
|
+
});
|
|
165
|
+
const belt = beltCover({
|
|
166
|
+
raw: text,
|
|
167
|
+
normalized,
|
|
168
|
+
pipeline: opts.pipeline,
|
|
169
|
+
policy: {
|
|
170
|
+
detectors: opts.detectors,
|
|
171
|
+
scanCharCap: opts.scanCharCap,
|
|
172
|
+
maskLabelledNames: opts.maskLabelledNames,
|
|
173
|
+
},
|
|
174
|
+
customPatterns: rules,
|
|
175
|
+
column: opts.column,
|
|
176
|
+
scanCharCap: opts.scanCharCap,
|
|
177
|
+
});
|
|
178
|
+
const byClass = ownByClass(detected.byClass);
|
|
179
|
+
if (!belt.ok)
|
|
180
|
+
return { text: PII, count: 1, byClass };
|
|
181
|
+
const whole = preferToken(detected.wholeField?.token, belt.wholeField, rules);
|
|
182
|
+
if (whole)
|
|
183
|
+
return { text: whole, count: 1, byClass };
|
|
184
|
+
const applied = apply(normalized, detected.spans.concat(beltOnlySpans(detected.spans, belt.spans)));
|
|
185
|
+
return { text: applied.text, count: applied.regions, byClass };
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return { text: PII, count: 1, byClass: Object.create(null) };
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// The core detects on its own. The belt keeps every span 0.2.54 masked.
|
|
192
|
+
// When the belt cannot decide, the whole field is masked.
|
|
193
|
+
export function maskSensitiveText(text, opts = {}) {
|
|
194
|
+
return maskField(text, {
|
|
195
|
+
pipeline: 'text',
|
|
196
|
+
scanCharCap: opts.scanCharCap,
|
|
197
|
+
detectors: opts.detectors,
|
|
198
|
+
customPatterns: opts.customPatterns,
|
|
199
|
+
}).text;
|
|
41
200
|
}
|
|
42
201
|
//# sourceMappingURL=mask-text.js.map
|
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,
|
|
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,eAAe,CAAC,SAAS,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,MAAM,GAAG,iBAAiB,CAAA;AAChC,MAAM,GAAG,GAAG,cAAc,CAAA;AAQ1B,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,CAAC,CAAA;IAC9B,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,CAAC,CAAA;IAC3B,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,WAAW,CAClB,IAAwB,EACxB,KAAyB,EACzB,KAAmC;IAEnC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACvB,IAAI,CAAC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EAAE,CAAA;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;IAC9D,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Claims review — 0.2.54
|
|
2
|
+
|
|
3
|
+
- base: v0.2.53
|
|
4
|
+
- head: 4be9ceb
|
|
5
|
+
- surface: sha256:7c1f0d634937feae884815169827cb91a24aa73596fc98c8e045ca887d49ddf6
|
|
6
|
+
- verdict: pass
|
|
7
|
+
- reviewer: Claude. Across the claim surfaces the diff from v0.2.53 is one
|
|
8
|
+
changed line in `README.md`: the example `actorProfiles` key changes from a
|
|
9
|
+
personal id to `alice`. It is a placeholder name inside a configuration
|
|
10
|
+
example and asserts nothing about what the tool does.
|
|
11
|
+
|
|
12
|
+
The rest of the release is the `files` list in `package.json` (two operator
|
|
13
|
+
scripts excluded), the per-user identity example's names, the pack check, the
|
|
14
|
+
version fields (`package.json`, `server.json`, `package-lock.json`), the
|
|
15
|
+
version assertion in `src/demo-mode.test.ts`, and the changelog entry. None of
|
|
16
|
+
those files is a claim surface.
|
|
17
|
+
|
|
18
|
+
## Findings
|
|
19
|
+
|
|
20
|
+
none
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Claims review — 0.3.0
|
|
2
|
+
|
|
3
|
+
- base: v0.2.54
|
|
4
|
+
- head: baf3a9f
|
|
5
|
+
- surface: sha256:df5f83b4950b1c586d3a1a718fcfdb1cf6ae5ece4672cb07cb524901d44b241c
|
|
6
|
+
- verdict: pass
|
|
7
|
+
- reviewer: Claude. Across the claim surfaces the diff from v0.2.54 is
|
|
8
|
+
`LIMITATIONS.md` and `LIMITATIONS.tr.md`: the version line moves to 0.3.x and
|
|
9
|
+
four sections are added (a labelled secret is masked to its first delimiter;
|
|
10
|
+
a joined number is found only when it proves itself; each field also runs the
|
|
11
|
+
0.2.54 steps; custom patterns, what is refused and the engine they run on).
|
|
12
|
+
Each example in them was run against the head: the first-delimiter case, the
|
|
13
|
+
joined landline, the number with no separator, the dotless title and the
|
|
14
|
+
literal custom label behave as written. The custom-pattern section's four
|
|
15
|
+
added refusals were each run at the head (`(?m:^.$)`, `(?i:a)\w`, `(?:|a)?`,
|
|
16
|
+
`\u{D83D}`: refused with a reason naming the form) and against Node 24's
|
|
17
|
+
RegExp, which matches each differently from the engine; the Node 24 claim
|
|
18
|
+
about `\w` outside a case-insensitive group was run (`(?i:a)\w` matches `a`
|
|
19
|
+
and the Kelvin sign). Acceptance was compared with 0.2.54 over every Unicode
|
|
20
|
+
property name JavaScript accepts on Node 24 and the syntax forms of
|
|
21
|
+
`compile_parity`; no other pattern 0.2.54 accepted is refused there. A
|
|
22
|
+
pre-merge read found one more: repeats nested so that their counts multiply
|
|
23
|
+
past 1000. The section now names it, and it was run at the head
|
|
24
|
+
(`(?:(?:a{32})){32}` and `(?:x(?:a{32})|b){32}` refused as nested
|
|
25
|
+
quantifiers, `(?:(?:a{25})){40}` accepted and matching JavaScript on 1000
|
|
26
|
+
letters) and at v0.2.54 (accepted). The
|
|
27
|
+
equivalence the section states is the scope of
|
|
28
|
+
`src/custom_patterns.engine.test.ts`, `src/custom_patterns.unicode.test.ts`,
|
|
29
|
+
`src/custom_patterns.unicode_all.test.ts` and
|
|
30
|
+
`src/custom_patterns.edges.test.ts`; the two remaining differences it names
|
|
31
|
+
were run: an empty match between the halves of a surrogate pair (`\B` on `a`
|
|
32
|
+
and an emoji), and the seven letters beyond Latin-1 inside `(?i:…)`, each
|
|
33
|
+
typed and escaped, against each Latin-1 case partner: the engine matched on
|
|
34
|
+
a Latin-1-only text, Node 24.16's RegExp did not, both matched once the text
|
|
35
|
+
held a wider character, and both matched with the letter inside a class. The
|
|
36
|
+
sentence that the empty-choice rule is structural was run with `(?:$|a)?`
|
|
37
|
+
(refused at the head; re2js and Node 24 give the same positions on `a`, the
|
|
38
|
+
empty text, `ba` and `aa`). A raw lone surrogate was run (refused). The braced escapes
|
|
39
|
+
the 0.2.54 cap reads as quantifiers (`\u{100}`, `\u{65}`, `\u{2028}`) were
|
|
40
|
+
run at the head and at v0.2.54 (refused as unbounded or nested in both), and
|
|
41
|
+
their four-digit forms were accepted in both. The timings are measurements
|
|
42
|
+
from comparison scripts outside the repository and are written as "about"
|
|
43
|
+
and "up to".
|
|
44
|
+
|
|
45
|
+
The rest of the release is the masking engine (`src/mask/`, `src/mask-text.ts`,
|
|
46
|
+
`src/governance.ts`, `src/custom_patterns.ts`), its tests, the new runtime
|
|
47
|
+
dependencies `re2js` and `@eslint-community/regexpp`, the version fields (`package.json`, `server.json`,
|
|
48
|
+
`package-lock.json`), the version assertion in `src/demo-mode.test.ts`, and the
|
|
49
|
+
changelog entry. None of those files is a claim surface.
|
|
50
|
+
|
|
51
|
+
## Findings
|
|
52
|
+
|
|
53
|
+
### 1. LIMITATIONS.md:63 — an eleven-digit number stays readable
|
|
54
|
+
|
|
55
|
+
- Claim: "A joined landline (`siparis 2024 02321234567`), an eleven-digit number that fails the ID checksum, and a number with no separator before it (`siparis 202410000000146`) stay readable."
|
|
56
|
+
- Mechanism: the joined-number windows accept only parts that pass a checksum or are a Turkish mobile number.
|
|
57
|
+
- Why it falls short: run at the head, `siparis 2024 12345678901` comes back as `siparis [MASKED_PII]` in both paths: the frozen 0.2.54 steps mask it, so the sentence said less was masked than is.
|
|
58
|
+
- Disposition: reworded in `c529a1d` (the eleven-digit clause removed, in both languages).
|
|
59
|
+
|
|
60
|
+
### 2. LIMITATIONS.md:89 — custom patterns that can backtrack are refused
|
|
61
|
+
|
|
62
|
+
- Claim: "A custom pattern is refused when the policy loads if it can backtrack without bound: a quantified group that holds a quantifier or an alternation …, or two adjacent variable-width quantifiers over overlapping characters …"
|
|
63
|
+
- Mechanism: shape rules in `looksUnsafe`.
|
|
64
|
+
- Why it falls short: a third reading built `[0-9]{0,64}a?[0-9]{0,64}a?[0-9]{0,64}X`, which passed the rules and took 27 s on 16 000 digits; the same rules refused `(?:https?)?`, which 0.2.54 accepted. No list of shapes established "can backtrack without bound".
|
|
65
|
+
- Disposition: the mechanism changed (custom patterns run on a linear-time engine; the shape rules added in this release are gone, the 0.2.54 rules stay) and the section was rewritten in `b13a3e2`, in both languages.
|
|
66
|
+
|
|
67
|
+
### 3. LIMITATIONS.md:85 — what the 0.2.54 copy can hide that is not personal
|
|
68
|
+
|
|
69
|
+
- Claim: "Some text next to a masked value can then be hidden although it is not personal: a title without a dot (`Bay`, `Bayan`) next to a masked number, or a custom rule's label written literally in the source text."
|
|
70
|
+
- Mechanism: the belt masks every span the frozen 0.2.54 output implies; where that output fits the text in more than one way, the implied spans are the widest ones.
|
|
71
|
+
- Why it falls short: a pre-merge read found that the same title without a dot starting line after line makes the widest spans overlap across the whole run. Run at the head on the model path, `Sayin Ahmet`, `Sayin Mehmet`, `Sayin Ali` on three lines comes back as one mask (`Sayin [MASKED_PII]` and a line break); v0.2.54 gives two. The list named only the adjacent title and the literal label.
|
|
72
|
+
- Disposition: a sentence added in `ed149ef` (the English title spelled `Sayin` in `d2c7bf3`), in both languages, and narrowed in `fd560e2` and `baf3a9f`: the copy's output can fit those lines in more than one way, and the masks over them can then merge into one. The first wording said the region runs from the first name to the last; a second read showed that does not hold for every name shape, so the sentence no longer says where the region ends. Run at the head: `Bay Ab` on 2 340 lines gives one mask in 16 ms on the model path; the audit path keeps one mask for every one or two of those lines; a title followed by other lines (`Sayin Ahmet Bey,` then a sentence) gives the same output as v0.2.54 on the model path. The quadratic time and memory the read also found were fixed in `45caed5` (overlapping spans merge); the "up to about four times" sentence still holds on the inputs of that read (one megabyte of `Bay Ab` lines: 337 ms against 78 ms; 40 custom rules over dense matches: about three times).
|