@heroku/js-blanket 0.0.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.
@@ -0,0 +1,531 @@
1
+ /**
2
+ * Tests for Generic Logging Adapter
3
+ *
4
+ * The generic adapter is a thin wrapper around the core Scrubber,
5
+ * designed for use with any logging library (Winston, Pino, Bunyan, etc.)
6
+ */
7
+
8
+ import { expect } from 'chai';
9
+ import { createRedactor } from './generic.js';
10
+ import { Scrubber } from '../../core/scrubber.js';
11
+ import { HEROKU_FIELDS, GDPR_FIELDS, PCI_FIELDS } from '../../core/presets.js';
12
+
13
+ describe('Generic Logging Adapter', () => {
14
+ describe('createRedactor()', () => {
15
+ it('returns a Scrubber instance', () => {
16
+ const redactor = createRedactor({ fields: ['password'] });
17
+ expect(redactor).to.be.instanceOf(Scrubber);
18
+ });
19
+
20
+ it('creates a functional scrubber', () => {
21
+ const redactor = createRedactor({ fields: ['password'] });
22
+ const result = redactor.scrub({ user: 'john', password: 'secret' });
23
+
24
+ expect(result.data.password).to.equal('[SCRUBBED]');
25
+ expect(result.scrubbed).to.be.true;
26
+ });
27
+
28
+ it('accepts empty configuration', () => {
29
+ const redactor = createRedactor({});
30
+ const result = redactor.scrub({ data: 'test' });
31
+
32
+ expect(result.data).to.deep.equal({ data: 'test' });
33
+ expect(result.scrubbed).to.be.false;
34
+ });
35
+ });
36
+
37
+ describe('Configuration Options', () => {
38
+ it('supports field-based scrubbing', () => {
39
+ const redactor = createRedactor({
40
+ fields: ['password', 'apiToken', 'secret'],
41
+ });
42
+
43
+ const result = redactor.scrub({
44
+ user: 'john',
45
+ password: 'secret123',
46
+ apiToken: 'token123',
47
+ secret: 'hidden',
48
+ public: 'visible',
49
+ });
50
+
51
+ expect(result.data.password).to.equal('[SCRUBBED]');
52
+ expect(result.data.apiToken).to.equal('[SCRUBBED]');
53
+ expect(result.data.secret).to.equal('[SCRUBBED]');
54
+ expect(result.data.public).to.equal('visible');
55
+ });
56
+
57
+ it('supports regex field patterns', () => {
58
+ const redactor = createRedactor({
59
+ fields: [/api[-_]?key/i, /^secret/i],
60
+ });
61
+
62
+ const result = redactor.scrub({
63
+ api_key: 'key1',
64
+ 'api-key': 'key2',
65
+ apikey: 'key3',
66
+ secret_token: 'token',
67
+ SECRET: 'hidden',
68
+ });
69
+
70
+ expect(result.data.api_key).to.equal('[SCRUBBED]');
71
+ expect(result.data['api-key']).to.equal('[SCRUBBED]');
72
+ expect(result.data.apikey).to.equal('[SCRUBBED]');
73
+ expect(result.data.secret_token).to.equal('[SCRUBBED]');
74
+ expect(result.data.SECRET).to.equal('[SCRUBBED]');
75
+ });
76
+
77
+ it('supports path-based scrubbing', () => {
78
+ const redactor = createRedactor({
79
+ paths: ['user.email', 'request.headers.authorization'],
80
+ });
81
+
82
+ const result = redactor.scrub({
83
+ user: {
84
+ name: 'John',
85
+ email: 'john@example.com',
86
+ },
87
+ request: {
88
+ method: 'POST',
89
+ headers: {
90
+ authorization: 'Bearer token123',
91
+ 'content-type': 'application/json',
92
+ },
93
+ },
94
+ });
95
+
96
+ expect(result.data.user.email).to.equal('[SCRUBBED]');
97
+ expect(result.data.request.headers.authorization).to.equal('[SCRUBBED]');
98
+ expect(result.data.user.name).to.equal('John');
99
+ expect(result.data.request.headers['content-type']).to.equal(
100
+ 'application/json'
101
+ );
102
+ });
103
+
104
+ it('supports pattern-based scrubbing', () => {
105
+ const redactor = createRedactor({
106
+ patterns: [
107
+ /\b\d{3}-\d{2}-\d{4}\b/g, // SSN
108
+ /\d{4}-\d{4}-\d{4}-\d{4}/g, // Credit card
109
+ ],
110
+ });
111
+
112
+ const result = redactor.scrub({
113
+ message: 'User SSN is 123-45-6789 and card is 4532-1234-5678-9010',
114
+ });
115
+
116
+ expect(result.data.message).to.equal(
117
+ 'User SSN is [SCRUBBED] and card is [SCRUBBED]'
118
+ );
119
+ });
120
+
121
+ it('supports combined scrubbing modes', () => {
122
+ const redactor = createRedactor({
123
+ fields: ['password'],
124
+ paths: ['user.email'],
125
+ patterns: [/\b\d{3}-\d{2}-\d{4}\b/g],
126
+ });
127
+
128
+ const result = redactor.scrub({
129
+ user: {
130
+ name: 'John',
131
+ email: 'john@example.com',
132
+ password: 'secret',
133
+ },
134
+ message: 'SSN: 123-45-6789',
135
+ });
136
+
137
+ expect(result.data.user.password).to.equal('[SCRUBBED]');
138
+ expect(result.data.user.email).to.equal('[SCRUBBED]');
139
+ expect(result.data.message).to.equal('SSN: [SCRUBBED]');
140
+ expect(result.data.user.name).to.equal('John');
141
+ });
142
+
143
+ it('supports custom replacement text', () => {
144
+ const redactor = createRedactor({
145
+ fields: ['password'],
146
+ replacement: '[REDACTED]',
147
+ });
148
+
149
+ const result = redactor.scrub({ password: 'secret' });
150
+ expect(result.data.password).to.equal('[REDACTED]');
151
+ });
152
+
153
+ it('supports recursive scrubbing control', () => {
154
+ const redactorRecursive = createRedactor({
155
+ fields: ['password'],
156
+ recursive: true,
157
+ });
158
+
159
+ const redactorNonRecursive = createRedactor({
160
+ fields: ['password'],
161
+ recursive: false,
162
+ });
163
+
164
+ const data = {
165
+ password: 'level1',
166
+ nested: {
167
+ password: 'level2',
168
+ },
169
+ };
170
+
171
+ const recursiveResult = redactorRecursive.scrub(data);
172
+ expect(recursiveResult.data.password).to.equal('[SCRUBBED]');
173
+ expect(recursiveResult.data.nested.password).to.equal('[SCRUBBED]');
174
+
175
+ const nonRecursiveResult = redactorNonRecursive.scrub(data);
176
+ expect(nonRecursiveResult.data.password).to.equal('[SCRUBBED]');
177
+ // Non-recursive should still scrub nested fields
178
+ // (the recursive flag controls traversal depth, not field matching)
179
+ });
180
+ });
181
+
182
+ describe('Preset Integration', () => {
183
+ it('works with HEROKU_FIELDS preset', () => {
184
+ const redactor = createRedactor({ fields: HEROKU_FIELDS });
185
+
186
+ const result = redactor.scrub({
187
+ user: 'john',
188
+ password: 'secret',
189
+ access_token: 'token123',
190
+ api_key: 'key123',
191
+ email: 'john@example.com',
192
+ });
193
+
194
+ expect(result.data.password).to.equal('[SCRUBBED]');
195
+ expect(result.data.access_token).to.equal('[SCRUBBED]');
196
+ expect(result.data.api_key).to.equal('[SCRUBBED]');
197
+ expect(result.data.user).to.equal('john');
198
+ });
199
+
200
+ it('works with GDPR_FIELDS preset', () => {
201
+ const redactor = createRedactor({ fields: GDPR_FIELDS });
202
+
203
+ const result = redactor.scrub({
204
+ name: 'John Doe',
205
+ email: 'john@example.com',
206
+ phone: '+1-555-1234',
207
+ address: '123 Main St',
208
+ });
209
+
210
+ expect(result.data.email).to.equal('[SCRUBBED]');
211
+ expect(result.data.phone).to.equal('[SCRUBBED]');
212
+ expect(result.data.address).to.equal('[SCRUBBED]');
213
+ expect(result.data.name).to.equal('John Doe');
214
+ });
215
+
216
+ it('works with PCI_FIELDS preset', () => {
217
+ const redactor = createRedactor({ fields: PCI_FIELDS });
218
+
219
+ const result = redactor.scrub({
220
+ user: 'john',
221
+ card_number: '4532-1234-5678-9010',
222
+ cvv: '123',
223
+ credit_card: '4111111111111111',
224
+ });
225
+
226
+ expect(result.data.card_number).to.equal('[SCRUBBED]');
227
+ expect(result.data.cvv).to.equal('[SCRUBBED]');
228
+ expect(result.data.credit_card).to.equal('[SCRUBBED]');
229
+ expect(result.data.user).to.equal('john');
230
+ });
231
+
232
+ it('works with combined presets', () => {
233
+ const redactor = createRedactor({
234
+ fields: [...HEROKU_FIELDS, ...GDPR_FIELDS, ...PCI_FIELDS],
235
+ });
236
+
237
+ const result = redactor.scrub({
238
+ user: 'john',
239
+ password: 'secret', // HEROKU_FIELDS
240
+ email: 'john@example.com', // GDPR_FIELDS
241
+ cvv: '123', // PCI_FIELDS
242
+ public: 'data',
243
+ });
244
+
245
+ expect(result.data.password).to.equal('[SCRUBBED]');
246
+ expect(result.data.email).to.equal('[SCRUBBED]');
247
+ expect(result.data.cvv).to.equal('[SCRUBBED]');
248
+ expect(result.data.public).to.equal('data');
249
+ });
250
+ });
251
+
252
+ describe('Logging Library Integration Patterns', () => {
253
+ it('can be used with Winston-style loggers', () => {
254
+ // Simulate Winston logger integration
255
+ const redactor = createRedactor({ fields: ['password', 'apiToken'] });
256
+
257
+ // Simulate Winston's meta object
258
+ const logEntry = {
259
+ level: 'info',
260
+ message: 'User login',
261
+ metadata: {
262
+ user: 'john',
263
+ password: 'secret123',
264
+ apiToken: 'token123',
265
+ ip: '192.168.1.1',
266
+ },
267
+ timestamp: new Date().toISOString(),
268
+ };
269
+
270
+ const result = redactor.scrub(logEntry);
271
+
272
+ expect(result.data.metadata.password).to.equal('[SCRUBBED]');
273
+ expect(result.data.metadata.apiToken).to.equal('[SCRUBBED]');
274
+ expect(result.data.metadata.user).to.equal('john');
275
+ expect(result.data.level).to.equal('info');
276
+ });
277
+
278
+ it('can be used with Pino-style loggers', () => {
279
+ // Simulate Pino logger integration
280
+ const redactor = createRedactor({ fields: ['password'] });
281
+
282
+ // Simulate Pino's flat log object
283
+ const logEntry = {
284
+ level: 30, // info
285
+ time: Date.now(),
286
+ msg: 'User action',
287
+ user: 'john',
288
+ password: 'secret',
289
+ req: {
290
+ method: 'POST',
291
+ url: '/api/login',
292
+ },
293
+ };
294
+
295
+ const result = redactor.scrub(logEntry);
296
+
297
+ expect(result.data.password).to.equal('[SCRUBBED]');
298
+ expect(result.data.user).to.equal('john');
299
+ expect(result.data.req.method).to.equal('POST');
300
+ });
301
+
302
+ it('can be used with Bunyan-style loggers', () => {
303
+ // Simulate Bunyan logger integration
304
+ const redactor = createRedactor({ fields: ['password', 'token'] });
305
+
306
+ const logEntry = {
307
+ name: 'myapp',
308
+ hostname: 'server01',
309
+ pid: 12345,
310
+ level: 30,
311
+ msg: 'Authentication successful',
312
+ password: 'secret',
313
+ token: 'jwt123',
314
+ time: new Date(),
315
+ };
316
+
317
+ const result = redactor.scrub(logEntry);
318
+
319
+ expect(result.data.password).to.equal('[SCRUBBED]');
320
+ expect(result.data.token).to.equal('[SCRUBBED]');
321
+ expect(result.data.msg).to.equal('Authentication successful');
322
+ });
323
+
324
+ it('handles array of log entries', () => {
325
+ const redactor = createRedactor({ fields: ['password'] });
326
+
327
+ const logs = [
328
+ { msg: 'Login attempt', user: 'john', password: 'secret1' },
329
+ { msg: 'Login success', user: 'jane', password: 'secret2' },
330
+ { msg: 'Logout', user: 'john' },
331
+ ];
332
+
333
+ const result = redactor.scrub(logs);
334
+
335
+ expect(result.data[0]?.password).to.equal('[SCRUBBED]');
336
+ expect(result.data[1]?.password).to.equal('[SCRUBBED]');
337
+ expect(result.data[2]?.password).to.be.undefined;
338
+ expect(result.data[0]?.user).to.equal('john');
339
+ });
340
+ });
341
+
342
+ describe('oauth-provider-adapters-for-mcp Migration', () => {
343
+ it('provides drop-in replacement for redaction.ts', () => {
344
+ // This test validates the interface matches what oauth-provider-adapters expects
345
+ const redactor = createRedactor({
346
+ fields: ['client_secret', 'refresh_token', 'access_token'],
347
+ paths: ['oauth.credentials.secret'],
348
+ });
349
+
350
+ // Simulate OAuth data structure
351
+ const oauthData = {
352
+ client_id: 'my-client',
353
+ client_secret: 'secret123',
354
+ redirect_uri: 'http://localhost:3000/callback',
355
+ oauth: {
356
+ credentials: {
357
+ access_token: 'access123',
358
+ refresh_token: 'refresh123',
359
+ secret: 'hidden',
360
+ },
361
+ },
362
+ };
363
+
364
+ const result = redactor.scrub(oauthData);
365
+
366
+ // Verify the interface provides .data (scrubbed result)
367
+ expect(result).to.have.property('data');
368
+ expect(result).to.have.property('scrubbed');
369
+ expect(result).to.have.property('scrubbedPaths');
370
+
371
+ // Verify scrubbing worked
372
+ expect(result.data.client_secret).to.equal('[SCRUBBED]');
373
+ expect(result.data.oauth.credentials.access_token).to.equal('[SCRUBBED]');
374
+ expect(result.data.oauth.credentials.refresh_token).to.equal(
375
+ '[SCRUBBED]'
376
+ );
377
+ expect(result.data.oauth.credentials.secret).to.equal('[SCRUBBED]');
378
+ expect(result.data.client_id).to.equal('my-client');
379
+ });
380
+
381
+ it('supports the same API as oauth-provider redaction', () => {
382
+ const redactor = createRedactor({ fields: ['secret'] });
383
+
384
+ // The API should support:
385
+ // 1. scrub() method
386
+ expect(redactor).to.have.property('scrub');
387
+ expect(typeof redactor.scrub).to.equal('function');
388
+
389
+ // 2. Return value with .data property
390
+ const result = redactor.scrub({ secret: 'hidden' });
391
+ expect(result).to.have.property('data');
392
+
393
+ // 3. Immutability (original not modified)
394
+ const original = { secret: 'hidden', public: 'visible' };
395
+ const scrubbed = redactor.scrub(original);
396
+ expect(original.secret).to.equal('hidden'); // Original unchanged
397
+ expect(scrubbed.data.secret).to.equal('[SCRUBBED]');
398
+ });
399
+ });
400
+
401
+ describe('Performance', () => {
402
+ it('handles high-volume logging scenarios efficiently', () => {
403
+ const redactor = createRedactor({ fields: ['password'] });
404
+
405
+ const start = performance.now();
406
+ const iterations = 1000;
407
+
408
+ for (let i = 0; i < iterations; i++) {
409
+ redactor.scrub({
410
+ timestamp: new Date().toISOString(),
411
+ level: 'info',
412
+ message: 'User action',
413
+ user: `user${i}`,
414
+ password: `secret${i}`,
415
+ });
416
+ }
417
+
418
+ const end = performance.now();
419
+ const avgTime = (end - start) / iterations;
420
+
421
+ // Should average < 1ms per log entry (target from discovery doc)
422
+ expect(avgTime).to.be.lessThan(1);
423
+ });
424
+
425
+ it('handles large nested objects efficiently', () => {
426
+ const redactor = createRedactor({ fields: ['password'] });
427
+
428
+ // Create a large nested structure
429
+ const largeObject: Record<string, unknown> = {
430
+ level: 'info',
431
+ timestamp: Date.now(),
432
+ };
433
+
434
+ for (let i = 0; i < 100; i++) {
435
+ largeObject[`user${i}`] = {
436
+ id: i,
437
+ name: `User ${i}`,
438
+ password: `secret${i}`,
439
+ metadata: {
440
+ lastLogin: new Date().toISOString(),
441
+ loginCount: i * 10,
442
+ },
443
+ };
444
+ }
445
+
446
+ const start = performance.now();
447
+ const result = redactor.scrub(largeObject);
448
+ const end = performance.now();
449
+
450
+ expect(end - start).to.be.lessThan(10); // Should be < 10ms
451
+ expect(result.scrubbed).to.be.true;
452
+ });
453
+ });
454
+
455
+ describe('Edge Cases', () => {
456
+ it('handles null and undefined values', () => {
457
+ const redactor = createRedactor({ fields: ['password'] });
458
+
459
+ const result = redactor.scrub({
460
+ user: 'john',
461
+ password: null,
462
+ apiToken: undefined,
463
+ });
464
+
465
+ // Fields matching the scrubber config are scrubbed regardless of value
466
+ expect(result.data.password).to.equal('[SCRUBBED]');
467
+ // Fields not in the config are left as-is
468
+ expect(result.data.apiToken).to.be.undefined;
469
+ expect(result.data.user).to.equal('john');
470
+ });
471
+
472
+ it('handles circular references', () => {
473
+ const redactor = createRedactor({ fields: ['password'] });
474
+
475
+ const obj: Record<string, unknown> = {
476
+ user: 'john',
477
+ password: 'secret',
478
+ };
479
+ obj.self = obj; // Circular reference
480
+
481
+ const result = redactor.scrub(obj);
482
+
483
+ expect(result.data.password).to.equal('[SCRUBBED]');
484
+ expect(result.data.user).to.equal('john');
485
+ // Circular reference handled gracefully
486
+ });
487
+
488
+ it('handles empty objects and arrays', () => {
489
+ const redactor = createRedactor({ fields: ['password'] });
490
+
491
+ expect(redactor.scrub({}).data).to.deep.equal({});
492
+ expect(redactor.scrub([]).data).to.deep.equal([]);
493
+ });
494
+
495
+ it('handles primitive values', () => {
496
+ const redactor = createRedactor({ fields: ['password'] });
497
+
498
+ expect(redactor.scrub('string').data).to.equal('string');
499
+ expect(redactor.scrub(42).data).to.equal(42);
500
+ expect(redactor.scrub(true).data).to.equal(true);
501
+ expect(redactor.scrub(null).data).to.equal(null);
502
+ });
503
+ });
504
+
505
+ describe('Type Safety', () => {
506
+ it('preserves TypeScript types', () => {
507
+ interface LogEntry {
508
+ level: string;
509
+ message: string;
510
+ user: string;
511
+ password: string;
512
+ }
513
+
514
+ const redactor = createRedactor({ fields: ['password'] });
515
+ const entry: LogEntry = {
516
+ level: 'info',
517
+ message: 'User login',
518
+ user: 'john',
519
+ password: 'secret',
520
+ };
521
+
522
+ const result = redactor.scrub(entry);
523
+
524
+ // result.data should maintain LogEntry type
525
+ expect(result.data.level).to.be.a('string');
526
+ expect(result.data.message).to.be.a('string');
527
+ expect(result.data.user).to.be.a('string');
528
+ expect(result.data.password).to.equal('[SCRUBBED]');
529
+ });
530
+ });
531
+ });
@@ -0,0 +1,21 @@
1
+ import { Scrubber } from '../../core/scrubber.js';
2
+ import { ScrubConfig } from '../../core/types.js';
3
+
4
+ /**
5
+ * Create a generic redactor for use with any logging library
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const redactor = createRedactor({
10
+ * fields: HEROKU_FIELDS,
11
+ * paths: ['request.headers.Authorization'],
12
+ * patterns: PII_PATTERNS
13
+ * });
14
+ *
15
+ * const scrubbed = redactor.scrub({ user: { password: 'secret' } });
16
+ * console.log(scrubbed.data); // { user: { password: '[SCRUBBED]' } }
17
+ * ```
18
+ */
19
+ export function createRedactor(config: ScrubConfig) {
20
+ return new Scrubber(config);
21
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Regex patterns for detecting PII in string content
3
+ */
4
+ export const PII_PATTERNS = [
5
+ // Social Security Numbers (US)
6
+ /\b\d{3}-\d{2}-\d{4}\b/g,
7
+
8
+ // Credit Cards (basic - matches common formats)
9
+ /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,
10
+
11
+ // Email addresses
12
+ /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,
13
+
14
+ // Phone numbers (US format)
15
+ /\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g,
16
+
17
+ // JWT tokens
18
+ /\beyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,
19
+
20
+ // API keys (generic 32+ char alphanumeric strings)
21
+ /\b[A-Za-z0-9]{32,}\b/g,
22
+ ];
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Heroku-specific sensitive field patterns
3
+ *
4
+ * Consolidated list of field names and patterns that contain sensitive data in Heroku applications.
5
+ *
6
+ * Use this preset to ensure consistent PII handling across Heroku services.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { HEROKU_FIELDS } from '@heroku/js-blanket/core/presets';
11
+ * import { Scrubber } from '@heroku/js-blanket';
12
+ *
13
+ * const scrubber = new Scrubber({ fields: HEROKU_FIELDS });
14
+ * const result = scrubber.scrub(data);
15
+ * ```
16
+ */
17
+ export const HEROKU_FIELDS = [
18
+ // Authentication & Sessions
19
+ 'access_token',
20
+ /api[-_]?key/i, // Matches api_key, api-key, apikey (case insensitive)
21
+ 'authenticity_token',
22
+ 'heroku_oauth_token',
23
+ 'heroku_session_nonce',
24
+ 'heroku_user_session',
25
+ 'oauth_token',
26
+ 'sudo_oauth_token',
27
+ 'super_user_session_secret',
28
+ 'user_session_secret',
29
+ 'postgres_session_nonce',
30
+
31
+ // Passwords & Secrets
32
+ 'password',
33
+ 'passwd',
34
+ 'old_secret',
35
+ 'secret',
36
+ 'secret_token',
37
+ 'confirm_password',
38
+ 'password_confirmation',
39
+ /client[-_]?secret/i, // Matches client_secret, client-secret, clientsecret
40
+
41
+ // Tokens & Codes
42
+ 'token',
43
+ 'code',
44
+ 'state',
45
+ 'bouncer.token',
46
+ 'bouncer.refresh_token',
47
+
48
+ // Headers (case-insensitive)
49
+ /authorization/i,
50
+ /cookie/i,
51
+ /x-refresh-token/i,
52
+
53
+ // SSO & Sessions
54
+ 'www-sso-session',
55
+
56
+ // Payment
57
+ 'payment_method',
58
+
59
+ // Infrastructure
60
+ 'logplexUrl',
61
+ ];
62
+
63
+ /**
64
+ * GDPR-relevant PII field patterns
65
+ *
66
+ * Field names that typically contain personally identifiable information (PII)
67
+ * regulated by GDPR (General Data Protection Regulation).
68
+ *
69
+ * Use this preset when handling EU user data to ensure compliance with GDPR requirements.
70
+ *
71
+ * @see {@link https://gdpr.eu/what-is-gdpr/|GDPR Official Documentation}
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * import { GDPR_FIELDS, HEROKU_FIELDS } from '@heroku/js-blanket/core/presets';
76
+ * import { Scrubber } from '@heroku/js-blanket';
77
+ *
78
+ * // Combine multiple presets
79
+ * const scrubber = new Scrubber({
80
+ * fields: [...HEROKU_FIELDS, ...GDPR_FIELDS]
81
+ * });
82
+ * ```
83
+ */
84
+ export const GDPR_FIELDS = [
85
+ 'email',
86
+ 'phone',
87
+ 'address',
88
+ 'postal_code',
89
+ 'ssn',
90
+ 'tax_id',
91
+ ];
92
+
93
+ /**
94
+ * PCI-DSS relevant field patterns
95
+ *
96
+ * Field names that typically contain payment card information regulated by
97
+ * PCI-DSS (Payment Card Industry Data Security Standard).
98
+ *
99
+ * Use this preset when handling payment card data to help maintain PCI-DSS compliance.
100
+ *
101
+ * **Important**: This preset helps reduce exposure of sensitive payment data in logs and
102
+ * error reports, but is not a substitute for full PCI-DSS compliance measures.
103
+ *
104
+ * @see {@link https://www.pcisecuritystandards.org/|PCI Security Standards Council}
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * import { PCI_FIELDS } from '@heroku/js-blanket/core/presets';
109
+ * import { Scrubber } from '@heroku/js-blanket';
110
+ *
111
+ * const scrubber = new Scrubber({
112
+ * fields: PCI_FIELDS,
113
+ * patterns: [/\d{4}-\d{4}-\d{4}-\d{4}/g] // Also scrub card numbers in text
114
+ * });
115
+ * ```
116
+ */
117
+ export const PCI_FIELDS = [
118
+ 'card_number',
119
+ 'cvv',
120
+ 'credit_card',
121
+ 'payment_method',
122
+ ];