Skip to content

Commit 788391b

Browse files
committed
chore: dotenv-diff ignore
1 parent d87a900 commit 788391b

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

packages/cli/test/unit/core/security/secretDetectors.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('secretDetectors', () => {
130130

131131
it('should detect high-entropy long strings', () => {
132132
const source =
133-
'const value = "Xy9Pq2Wz8Rt4Lm6Ks0Hv3Jn7Bp1Df5Cg9Ea2Ub6Tx4Sy8Rw3Qu7Pv0Nz5My1Lx9Kw2Jv6Iu4Ht0Gs8Fr3Eq7Dp1Co5Bn9Am";';
133+
'const value = "Xy9Pq2Wz8Rt4Lm6Ks0Hv3Jn7Bp1Df5Cg9Ea2Ub6Tx4Sy8Rw3Qu7Pv0Nz5My1Lx9Kw2Jv6Iu4Ht0Gs8Fr3Eq7Dp1Co5Bn9Am";'; // dotenv-diff-ignore
134134
const findings = detectSecretsInSource('test.ts', source);
135135

136136
expect(findings.length).toBeGreaterThan(0);
@@ -469,40 +469,43 @@ const email = "user@example.com";
469469
});
470470

471471
it('should ignore lowercase-only alphabet', () => {
472-
const source = 'const id = nanoid(\'abcdefghijklmnopqrstuvwxyz\', 10);';
472+
const source = "const id = nanoid('abcdefghijklmnopqrstuvwxyz', 10);";
473473
const findings = detectSecretsInSource('test.ts', source);
474474
expect(findings).toHaveLength(0);
475475
});
476476

477477
it('should ignore uppercase-only alphabet', () => {
478-
const source = 'const code = customAlphabet(\'ABCDEFGHIJKLMNOPQRSTUVWXYZ\', 6);';
478+
const source =
479+
"const code = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 6);";
479480
const findings = detectSecretsInSource('test.ts', source);
480481
expect(findings).toHaveLength(0);
481482
});
482483

483484
it('should ignore hex charset', () => {
484485
// 16 unique chars, has a sequential run of 10 digits + 6 letters
485-
const source = 'const hex = customAlphabet(\'0123456789abcdef\', 32);';
486+
const source = "const hex = customAlphabet('0123456789abcdef', 32);";
486487
const findings = detectSecretsInSource('test.ts', source);
487488
expect(findings).toHaveLength(0);
488489
});
489490

490491
it('should ignore base32 alphabet', () => {
491492
// RFC 4648 base32: A-Z + 2-7
492-
const source = 'const encoded = customAlphabet(\'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\', 16);';
493+
const source =
494+
"const encoded = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', 16);";
493495
const findings = detectSecretsInSource('test.ts', source);
494496
expect(findings).toHaveLength(0);
495497
});
496498

497499
it('should ignore digits-only charset', () => {
498-
const source = 'const pin = customAlphabet(\'0123456789\', 6);';
500+
const source = "const pin = customAlphabet('0123456789', 6);";
499501
const findings = detectSecretsInSource('test.ts', source);
500502
expect(findings).toHaveLength(0);
501503
});
502504

503505
it('should still detect a real high-entropy secret that is not a charset', () => {
504506
// Looks like a real token — no sequential runs, no large unique set structure
505-
const source = 'const token = "xK9mQwP2zLsR8tYu5nV7cJ4hFgD6eS1iO0pA3bC";';
507+
const source =
508+
'const token = "xK9mQwP2zLsR8tYu5nV7cJ4hFgD6eS1iO0pA3bC";';
506509
const findings = detectSecretsInSource('test.ts', source);
507510
// Should still be flagged as entropy finding
508511
expect(findings.length).toBeGreaterThan(0);
@@ -518,7 +521,8 @@ const email = "user@example.com";
518521

519522
it('should ignore alphabet assigned to a variable without a function call', () => {
520523
// Charset used as a plain constant, not inside a function
521-
const source = 'const ALPHABET = \'abcdefghijklmnopqrstuvwxyz0123456789\';';
524+
const source =
525+
"const ALPHABET = 'abcdefghijklmnopqrstuvwxyz0123456789';";
522526
const findings = detectSecretsInSource('test.ts', source);
523527
expect(findings).toHaveLength(0);
524528
});

0 commit comments

Comments
 (0)