circle-ir 3.84.0 → 3.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/passes/scan-secrets-pass.d.ts +12 -4
- package/dist/analysis/passes/scan-secrets-pass.d.ts.map +1 -1
- package/dist/analysis/passes/scan-secrets-pass.js +282 -46
- package/dist/analysis/passes/scan-secrets-pass.js.map +1 -1
- package/dist/browser/circle-ir.js +141 -10
- package/package.json +1 -1
|
@@ -50,10 +50,18 @@ export declare class ScanSecretsPass implements AnalysisPass<ScanSecretsPassResu
|
|
|
50
50
|
/** Length + shape + denylist filter before entropy is computed. */
|
|
51
51
|
private isCandidate;
|
|
52
52
|
/**
|
|
53
|
-
* Shannon-entropy gate
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* Shannon-entropy gate (#125 Gate 4 — REQUIRED field-name match).
|
|
54
|
+
*
|
|
55
|
+
* The entropy layer emits ONLY when the enclosing assignment LHS
|
|
56
|
+
* identifier matches a credential keyword (password / secret / token /
|
|
57
|
+
* api_key / etc.). Without this requirement, the layer flagged every
|
|
58
|
+
* high-entropy string — attribution keys, base64 resource blobs, public
|
|
59
|
+
* encoding alphabets — as credentials. Provider patterns (Layer 1) and
|
|
60
|
+
* named-credential matcher (Layer 1b) remain the recall safety net for
|
|
61
|
+
* credentials that don't fit the `FIELD = "..."` shape.
|
|
62
|
+
*
|
|
63
|
+
* Base64-shaped strings need higher entropy than hex-shaped (hex alphabet
|
|
64
|
+
* is 4 bits/char by construction).
|
|
57
65
|
*/
|
|
58
66
|
private passesEntropyGate;
|
|
59
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-secrets-pass.d.ts","sourceRoot":"","sources":["../../../src/analysis/passes/scan-secrets-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"scan-secrets-pass.d.ts","sourceRoot":"","sources":["../../../src/analysis/passes/scan-secrets-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAoc9E,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,eAAgB,YAAW,YAAY,CAAC,qBAAqB,CAAC;IACzE,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,QAAQ,EAAG,UAAU,CAAU;IAExC,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,qBAAqB;IAiK5C,mEAAmE;IACnE,OAAO,CAAC,WAAW;IAanB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,iBAAiB;CAO1B"}
|
|
@@ -46,6 +46,18 @@ const TEST_FILENAME_RE = /(?:\.(?:test|spec)\.[cm]?[jt]sx?|_test\.go|_test\.py|T
|
|
|
46
46
|
function isTestFile(file) {
|
|
47
47
|
return TEST_PATH_RE.test(file) || TEST_FILENAME_RE.test(file);
|
|
48
48
|
}
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
// Generated-code skip heuristic (#125)
|
|
51
|
+
//
|
|
52
|
+
// Generated files routinely embed high-entropy attribution keys, provenance
|
|
53
|
+
// hashes, and embedded resource blobs that trip the entropy layer. Wholesale
|
|
54
|
+
// skip them, same as test files. Cognium-dev #125.
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
const GENERATED_PATH_RE = /(?:^|[\\/])(?:gen|generated|build[\\/]generated|src[\\/](?:main|test)[\\/]generated|target[\\/]generated-sources|target[\\/]generated-test-sources|node_modules[\\/]\.cache)(?:[\\/]|$)/i;
|
|
57
|
+
const GENERATED_FILENAME_RE = /__[ch]\.java$|\.pb\.go$|_pb2\.py$|\.generated\.[cm]?[jt]sx?$/i;
|
|
58
|
+
function isGeneratedFile(file) {
|
|
59
|
+
return GENERATED_PATH_RE.test(file) || GENERATED_FILENAME_RE.test(file);
|
|
60
|
+
}
|
|
49
61
|
const PROVIDER_PATTERNS = [
|
|
50
62
|
{
|
|
51
63
|
name: 'AWS access key',
|
|
@@ -262,16 +274,201 @@ function shannonEntropy(s) {
|
|
|
262
274
|
/** Words near the literal that imply credential context — used to lower the entropy threshold. */
|
|
263
275
|
const CREDENTIAL_NAME_RE = /(?:key|secret|token|password|passwd|credential|api[_-]?key)/i;
|
|
264
276
|
// ---------------------------------------------------------------------------
|
|
277
|
+
// Context-gate pre-scans (#125)
|
|
278
|
+
//
|
|
279
|
+
// The entropy layer alone fires on any high-entropy string. To kill the
|
|
280
|
+
// noise from generated attribution keys, embedded resource blobs, and
|
|
281
|
+
// public-spec constant tables, we layer three context-aware suppressions on
|
|
282
|
+
// top of the entropy gate: annotation-arg span, array-literal span, and
|
|
283
|
+
// enclosing field-name credential match.
|
|
284
|
+
//
|
|
285
|
+
// All three are regex-based (no AST), matching the existing pass design.
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
/**
|
|
288
|
+
* Pre-scan: return the set of 1-indexed line numbers that fall inside any
|
|
289
|
+
* `@Annotation( ... )` argument span (Java annotations, JS/TS decorators,
|
|
290
|
+
* Python decorators) or `#[...]` attribute span (Rust). String literals on
|
|
291
|
+
* suppressed lines are treated as annotation metadata, not credentials.
|
|
292
|
+
*
|
|
293
|
+
* Cognium-dev #125 Gate 1.
|
|
294
|
+
*/
|
|
295
|
+
function findAnnotationLineRanges(code) {
|
|
296
|
+
const lines = code.split('\n');
|
|
297
|
+
const inAnnotation = new Set();
|
|
298
|
+
// Match `@SomeAnnotation(` (Java/TS/Python with optional `.qualifier`) OR `#[`.
|
|
299
|
+
const OPEN_RE = /(?:@[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*\s*\(|#\[)/g;
|
|
300
|
+
for (let i = 0; i < lines.length; i++) {
|
|
301
|
+
OPEN_RE.lastIndex = 0;
|
|
302
|
+
let m;
|
|
303
|
+
while ((m = OPEN_RE.exec(lines[i])) !== null) {
|
|
304
|
+
const isRustAttr = m[0].startsWith('#[');
|
|
305
|
+
const openCh = isRustAttr ? '[' : '(';
|
|
306
|
+
const closeCh = isRustAttr ? ']' : ')';
|
|
307
|
+
// Walk forward tracking paren/bracket depth, skipping inside string literals.
|
|
308
|
+
let depth = 1;
|
|
309
|
+
let li = i;
|
|
310
|
+
let col = m.index + m[0].length;
|
|
311
|
+
// Soft cap to avoid runaway on unmatched parens.
|
|
312
|
+
let lineBudget = 200;
|
|
313
|
+
inAnnotation.add(li + 1);
|
|
314
|
+
while (depth > 0 && li < lines.length && lineBudget > 0) {
|
|
315
|
+
const ln = lines[li];
|
|
316
|
+
let inStr = null;
|
|
317
|
+
while (col < ln.length && depth > 0) {
|
|
318
|
+
const ch = ln[col];
|
|
319
|
+
if (inStr !== null) {
|
|
320
|
+
if (ch === '\\') {
|
|
321
|
+
col += 2;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (ch === inStr)
|
|
325
|
+
inStr = null;
|
|
326
|
+
}
|
|
327
|
+
else if (ch === '"' || ch === "'" || ch === '`') {
|
|
328
|
+
inStr = ch;
|
|
329
|
+
}
|
|
330
|
+
else if (ch === openCh) {
|
|
331
|
+
depth++;
|
|
332
|
+
}
|
|
333
|
+
else if (ch === closeCh) {
|
|
334
|
+
depth--;
|
|
335
|
+
}
|
|
336
|
+
col++;
|
|
337
|
+
}
|
|
338
|
+
if (depth > 0) {
|
|
339
|
+
li++;
|
|
340
|
+
col = 0;
|
|
341
|
+
lineBudget--;
|
|
342
|
+
if (li < lines.length)
|
|
343
|
+
inAnnotation.add(li + 1);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return inAnnotation;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Pre-scan: return the set of 1-indexed line numbers that fall inside any
|
|
352
|
+
* array/object literal containing ≥3 string-literal elements (constant
|
|
353
|
+
* data table). Catches the `String[] X = { "...", "...", "...", ... }`
|
|
354
|
+
* shape (Java) and `const X = ["...", "...", "..."]` shape (JS/TS/Python).
|
|
355
|
+
*
|
|
356
|
+
* Cognium-dev #125 Gate 3.
|
|
357
|
+
*/
|
|
358
|
+
function findStringArrayLineRanges(code) {
|
|
359
|
+
const lines = code.split('\n');
|
|
360
|
+
const inArray = new Set();
|
|
361
|
+
// Match assignment opener to array/object literal: `= {`, `= [`.
|
|
362
|
+
const OPEN_RE = /=\s*([{\[])/g;
|
|
363
|
+
const STR_LITERAL_COUNT_RE = /(["'`])(?:\\.|(?!\1).)*\1/g;
|
|
364
|
+
for (let i = 0; i < lines.length; i++) {
|
|
365
|
+
OPEN_RE.lastIndex = 0;
|
|
366
|
+
let m;
|
|
367
|
+
while ((m = OPEN_RE.exec(lines[i])) !== null) {
|
|
368
|
+
const openCh = m[1];
|
|
369
|
+
const closeCh = openCh === '{' ? '}' : ']';
|
|
370
|
+
let depth = 1;
|
|
371
|
+
let li = i;
|
|
372
|
+
let col = m.index + m[0].length;
|
|
373
|
+
// #126 perf: tightened 500 → 100 as defense-in-depth. Any legitimate
|
|
374
|
+
// constant-table array fits well under 100 lines; pathological openers
|
|
375
|
+
// (unbalanced braces in generated/minified code) now bail faster.
|
|
376
|
+
let lineBudget = 100;
|
|
377
|
+
const spanLines = [li + 1];
|
|
378
|
+
let spanText = '';
|
|
379
|
+
while (depth > 0 && li < lines.length && lineBudget > 0) {
|
|
380
|
+
const ln = lines[li];
|
|
381
|
+
let inStr = null;
|
|
382
|
+
const start = col;
|
|
383
|
+
while (col < ln.length && depth > 0) {
|
|
384
|
+
const ch = ln[col];
|
|
385
|
+
if (inStr !== null) {
|
|
386
|
+
if (ch === '\\') {
|
|
387
|
+
col += 2;
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
if (ch === inStr)
|
|
391
|
+
inStr = null;
|
|
392
|
+
}
|
|
393
|
+
else if (ch === '"' || ch === "'" || ch === '`') {
|
|
394
|
+
inStr = ch;
|
|
395
|
+
}
|
|
396
|
+
else if (ch === openCh) {
|
|
397
|
+
depth++;
|
|
398
|
+
}
|
|
399
|
+
else if (ch === closeCh) {
|
|
400
|
+
depth--;
|
|
401
|
+
}
|
|
402
|
+
col++;
|
|
403
|
+
}
|
|
404
|
+
spanText += ln.substring(start, col) + '\n';
|
|
405
|
+
if (depth > 0) {
|
|
406
|
+
li++;
|
|
407
|
+
col = 0;
|
|
408
|
+
lineBudget--;
|
|
409
|
+
if (li < lines.length)
|
|
410
|
+
spanLines.push(li + 1);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Count string literals inside the span; if ≥3, mark all span lines.
|
|
414
|
+
STR_LITERAL_COUNT_RE.lastIndex = 0;
|
|
415
|
+
let strCount = 0;
|
|
416
|
+
while (STR_LITERAL_COUNT_RE.exec(spanText) !== null) {
|
|
417
|
+
strCount++;
|
|
418
|
+
if (strCount >= 3)
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
if (strCount >= 3) {
|
|
422
|
+
for (const ln of spanLines)
|
|
423
|
+
inArray.add(ln);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return inArray;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Per-literal field-name extractor (#125 Gate 4).
|
|
431
|
+
*
|
|
432
|
+
* Extracts the assignment LHS identifier preceding the quoted string on the
|
|
433
|
+
* given line. Returns null if the literal is not an assignment value
|
|
434
|
+
* (e.g. annotation arg, function call arg, return expression).
|
|
435
|
+
*/
|
|
436
|
+
const FIELD_ASSIGN_RE = /(?:^|[\s,(])([A-Za-z_$][\w$]*)\s*[:=]\s*["'`]/;
|
|
437
|
+
function extractEnclosingFieldName(lineText) {
|
|
438
|
+
const m = FIELD_ASSIGN_RE.exec(lineText);
|
|
439
|
+
return m ? m[1] : null;
|
|
440
|
+
}
|
|
441
|
+
// ---------------------------------------------------------------------------
|
|
265
442
|
// Per-line FP-guard substrings (entropy layer only)
|
|
266
443
|
// ---------------------------------------------------------------------------
|
|
267
444
|
const TEST_CALL_RE = /\b(?:expect|assert|describe|it|test)\s*\(/;
|
|
268
445
|
const COMMENT_EXAMPLE_RE = /(?:\/\/|#)\s*(?:example|sample|test|fixture)/i;
|
|
446
|
+
// ---------------------------------------------------------------------------
|
|
447
|
+
// Cheap file-level entropy-candidate probe (#126 perf hotfix)
|
|
448
|
+
//
|
|
449
|
+
// 3.85.0 unconditionally ran the Gate 1 / Gate 3 span pre-scans on every
|
|
450
|
+
// file (after the test/generated-path skip). On string-constant-heavy Java
|
|
451
|
+
// repos (gson, Hystrix, openapi-generator) this caused 2.7×–17× slowdowns
|
|
452
|
+
// and 30-min timeouts because annotation walking compounded with the
|
|
453
|
+
// per-file cost while the entropy layer would never have fired anyway.
|
|
454
|
+
//
|
|
455
|
+
// FAST_CANDIDATE_PROBE_RE is a conservative pre-filter — it matches any
|
|
456
|
+
// quoted run of ≥32 base64-shape chars (a strict superset of every shape
|
|
457
|
+
// the entropy layer's `isCandidate()` accepts after the Gate 4 length
|
|
458
|
+
// floor). If the probe fails, the file cannot contain a single entropy
|
|
459
|
+
// candidate, so we skip the pre-scans AND the Layer 2 loop entirely.
|
|
460
|
+
//
|
|
461
|
+
// No recall loss: any literal that would have triggered the entropy layer
|
|
462
|
+
// is guaranteed to also match this probe. Verified by the gate-set tests
|
|
463
|
+
// in scan-secrets.test.ts.
|
|
464
|
+
// ---------------------------------------------------------------------------
|
|
465
|
+
const FAST_CANDIDATE_PROBE_RE = /["'`][A-Za-z0-9+/=_-]{32,}["'`]/;
|
|
269
466
|
export class ScanSecretsPass {
|
|
270
467
|
name = 'scan-secrets';
|
|
271
468
|
category = 'security';
|
|
272
469
|
run(ctx) {
|
|
273
470
|
const file = ctx.graph.ir.meta.file;
|
|
274
|
-
if (isTestFile(file)) {
|
|
471
|
+
if (isTestFile(file) || isGeneratedFile(file)) {
|
|
275
472
|
return { providerFindings: 0, entropyFindings: 0 };
|
|
276
473
|
}
|
|
277
474
|
const lines = ctx.code.split('\n');
|
|
@@ -285,6 +482,24 @@ export class ScanSecretsPass {
|
|
|
285
482
|
seen.add(`${f.line}:${f.rule_id}`);
|
|
286
483
|
}
|
|
287
484
|
}
|
|
485
|
+
// #126 perf hotfix: cheap probe to decide whether the entropy layer can
|
|
486
|
+
// fire at all. If the file has zero ≥32-char base64-shape literals, the
|
|
487
|
+
// entropy layer cannot produce any finding, so we skip the expensive
|
|
488
|
+
// Gate 1 / Gate 3 span pre-scans AND the Layer 2 loop entirely.
|
|
489
|
+
//
|
|
490
|
+
// Provider patterns (Layer 1) and named-credential matcher (Layer 1b)
|
|
491
|
+
// are unaffected — they run unconditionally below.
|
|
492
|
+
const hasEntropyCandidate = FAST_CANDIDATE_PROBE_RE.test(ctx.code);
|
|
493
|
+
// Pre-scan: line ranges to suppress in the entropy layer (#125 Gates 1 & 3).
|
|
494
|
+
// Provider patterns and named-credential layers are intentionally NOT gated
|
|
495
|
+
// by these — they retain full recall on real credential shapes.
|
|
496
|
+
// Only computed when the entropy layer has work to do.
|
|
497
|
+
const annotationLines = hasEntropyCandidate
|
|
498
|
+
? findAnnotationLineRanges(ctx.code)
|
|
499
|
+
: new Set();
|
|
500
|
+
const arrayLines = hasEntropyCandidate
|
|
501
|
+
? findStringArrayLineRanges(ctx.code)
|
|
502
|
+
: new Set();
|
|
288
503
|
let providerFindings = 0;
|
|
289
504
|
let entropyFindings = 0;
|
|
290
505
|
// Layer 1: provider patterns (line-by-line).
|
|
@@ -352,48 +567,60 @@ export class ScanSecretsPass {
|
|
|
352
567
|
providerFindings += 1;
|
|
353
568
|
}
|
|
354
569
|
// Layer 2: Shannon-entropy scan on string literals.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
continue;
|
|
362
|
-
// Reset regex state per line; STRING_LITERAL_RE is global.
|
|
363
|
-
STRING_LITERAL_RE.lastIndex = 0;
|
|
364
|
-
let match;
|
|
365
|
-
while ((match = STRING_LITERAL_RE.exec(lineText)) !== null) {
|
|
366
|
-
const value = match[2];
|
|
367
|
-
if (!this.isCandidate(value))
|
|
570
|
+
// #126 perf hotfix: short-circuit if the cheap probe found no candidate.
|
|
571
|
+
if (hasEntropyCandidate)
|
|
572
|
+
for (let i = 0; i < lines.length; i++) {
|
|
573
|
+
const lineText = lines[i];
|
|
574
|
+
const lineNum = i + 1;
|
|
575
|
+
if (TEST_CALL_RE.test(lineText))
|
|
368
576
|
continue;
|
|
369
|
-
if (
|
|
577
|
+
if (COMMENT_EXAMPLE_RE.test(lineText))
|
|
370
578
|
continue;
|
|
371
|
-
|
|
372
|
-
if (
|
|
579
|
+
// #125 Gate 1: skip annotation-arg spans (e.g. `@Original(key="...")`).
|
|
580
|
+
if (annotationLines.has(lineNum))
|
|
373
581
|
continue;
|
|
374
|
-
//
|
|
375
|
-
//
|
|
376
|
-
if (
|
|
582
|
+
// #125 Gate 3: skip array/object literal spans with ≥3 string elements
|
|
583
|
+
// (constant data tables — solar terms, encoding alphabets, etc.).
|
|
584
|
+
if (arrayLines.has(lineNum))
|
|
377
585
|
continue;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
586
|
+
// Reset regex state per line; STRING_LITERAL_RE is global.
|
|
587
|
+
STRING_LITERAL_RE.lastIndex = 0;
|
|
588
|
+
let match;
|
|
589
|
+
while ((match = STRING_LITERAL_RE.exec(lineText)) !== null) {
|
|
590
|
+
const value = match[2];
|
|
591
|
+
if (!this.isCandidate(value))
|
|
592
|
+
continue;
|
|
593
|
+
// #125 Gate 4 length floor: short high-entropy literals are too noisy.
|
|
594
|
+
if (value.length < 32)
|
|
595
|
+
continue;
|
|
596
|
+
if (!this.passesEntropyGate(value, lineText))
|
|
597
|
+
continue;
|
|
598
|
+
const key = `${lineNum}:hardcoded-credential-entropy`;
|
|
599
|
+
if (seen.has(key))
|
|
600
|
+
continue;
|
|
601
|
+
// Also dedup against provider-pattern hits on the same line — the
|
|
602
|
+
// entropy branch is purely additive coverage.
|
|
603
|
+
if (seen.has(`${lineNum}:hardcoded-credential`))
|
|
604
|
+
continue;
|
|
605
|
+
seen.add(key);
|
|
606
|
+
ctx.addFinding({
|
|
607
|
+
id: `hardcoded-credential-entropy-${file}-${lineNum}`,
|
|
608
|
+
pass: this.name,
|
|
609
|
+
category: this.category,
|
|
610
|
+
rule_id: 'hardcoded-credential-entropy',
|
|
611
|
+
cwe: 'CWE-798',
|
|
612
|
+
severity: 'high',
|
|
613
|
+
level: 'warning',
|
|
614
|
+
message: `Possible hardcoded secret: high-entropy string literal (${value.length} chars)`,
|
|
615
|
+
file,
|
|
616
|
+
line: lineNum,
|
|
617
|
+
snippet: lineText.trim().substring(0, 120),
|
|
618
|
+
fix: 'If this is a credential, move it to environment / secrets manager. If it is sample data, add an `example` / `test` marker or disable this pass via `disabledPasses: [\'scan-secrets\']`.',
|
|
619
|
+
evidence: { kind: 'entropy', length: value.length },
|
|
620
|
+
});
|
|
621
|
+
entropyFindings += 1;
|
|
622
|
+
}
|
|
395
623
|
}
|
|
396
|
-
}
|
|
397
624
|
return { providerFindings, entropyFindings };
|
|
398
625
|
}
|
|
399
626
|
/** Length + shape + denylist filter before entropy is computed. */
|
|
@@ -417,17 +644,26 @@ export class ScanSecretsPass {
|
|
|
417
644
|
return true;
|
|
418
645
|
}
|
|
419
646
|
/**
|
|
420
|
-
* Shannon-entropy gate
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
647
|
+
* Shannon-entropy gate (#125 Gate 4 — REQUIRED field-name match).
|
|
648
|
+
*
|
|
649
|
+
* The entropy layer emits ONLY when the enclosing assignment LHS
|
|
650
|
+
* identifier matches a credential keyword (password / secret / token /
|
|
651
|
+
* api_key / etc.). Without this requirement, the layer flagged every
|
|
652
|
+
* high-entropy string — attribution keys, base64 resource blobs, public
|
|
653
|
+
* encoding alphabets — as credentials. Provider patterns (Layer 1) and
|
|
654
|
+
* named-credential matcher (Layer 1b) remain the recall safety net for
|
|
655
|
+
* credentials that don't fit the `FIELD = "..."` shape.
|
|
656
|
+
*
|
|
657
|
+
* Base64-shaped strings need higher entropy than hex-shaped (hex alphabet
|
|
658
|
+
* is 4 bits/char by construction).
|
|
424
659
|
*/
|
|
425
660
|
passesEntropyGate(value, lineText) {
|
|
661
|
+
const fieldName = extractEnclosingFieldName(lineText);
|
|
662
|
+
if (fieldName === null || !CREDENTIAL_NAME_RE.test(fieldName))
|
|
663
|
+
return false;
|
|
426
664
|
const isHex = HEXISH_RE.test(value);
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
const h = shannonEntropy(value);
|
|
430
|
-
return h >= threshold;
|
|
665
|
+
const threshold = isHex ? 3.3 : 4.1;
|
|
666
|
+
return shannonEntropy(value) >= threshold;
|
|
431
667
|
}
|
|
432
668
|
}
|
|
433
669
|
//# sourceMappingURL=scan-secrets-pass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-secrets-pass.js","sourceRoot":"","sources":["../../../src/analysis/passes/scan-secrets-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAKH,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,0EAA0E;AAC1E,MAAM,YAAY,GAAG,2FAA2F,CAAC;AACjH,MAAM,gBAAgB,GAAG,gFAAgF,CAAC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AAC,CAAC;YAAE,OAAO,KAAK,CAAC;QACrC,IAAI,aAAa,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QACnC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QACzC,sEAAsE;QACtE,wCAAwC;QACxC,IAAI,mBAAmB,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACK,iBAAiB,CAAC,KAAa,EAAE,QAAgB;QACvD,MAAM,SAAS,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,SAAS,KAAK,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QAC5E,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACpC,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -28845,6 +28845,11 @@ var TEST_FILENAME_RE = /(?:\.(?:test|spec)\.[cm]?[jt]sx?|_test\.go|_test\.py|Tes
|
|
|
28845
28845
|
function isTestFile(file) {
|
|
28846
28846
|
return TEST_PATH_RE3.test(file) || TEST_FILENAME_RE.test(file);
|
|
28847
28847
|
}
|
|
28848
|
+
var GENERATED_PATH_RE = /(?:^|[\\/])(?:gen|generated|build[\\/]generated|src[\\/](?:main|test)[\\/]generated|target[\\/]generated-sources|target[\\/]generated-test-sources|node_modules[\\/]\.cache)(?:[\\/]|$)/i;
|
|
28849
|
+
var GENERATED_FILENAME_RE = /__[ch]\.java$|\.pb\.go$|_pb2\.py$|\.generated\.[cm]?[jt]sx?$/i;
|
|
28850
|
+
function isGeneratedFile(file) {
|
|
28851
|
+
return GENERATED_PATH_RE.test(file) || GENERATED_FILENAME_RE.test(file);
|
|
28852
|
+
}
|
|
28848
28853
|
var PROVIDER_PATTERNS = [
|
|
28849
28854
|
{
|
|
28850
28855
|
name: "AWS access key",
|
|
@@ -29011,14 +29016,126 @@ function shannonEntropy(s) {
|
|
|
29011
29016
|
return h;
|
|
29012
29017
|
}
|
|
29013
29018
|
var CREDENTIAL_NAME_RE = /(?:key|secret|token|password|passwd|credential|api[_-]?key)/i;
|
|
29019
|
+
function findAnnotationLineRanges(code) {
|
|
29020
|
+
const lines = code.split("\n");
|
|
29021
|
+
const inAnnotation = /* @__PURE__ */ new Set();
|
|
29022
|
+
const OPEN_RE = /(?:@[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*\s*\(|#\[)/g;
|
|
29023
|
+
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
29024
|
+
OPEN_RE.lastIndex = 0;
|
|
29025
|
+
let m;
|
|
29026
|
+
while ((m = OPEN_RE.exec(lines[i2])) !== null) {
|
|
29027
|
+
const isRustAttr = m[0].startsWith("#[");
|
|
29028
|
+
const openCh = isRustAttr ? "[" : "(";
|
|
29029
|
+
const closeCh = isRustAttr ? "]" : ")";
|
|
29030
|
+
let depth = 1;
|
|
29031
|
+
let li = i2;
|
|
29032
|
+
let col = m.index + m[0].length;
|
|
29033
|
+
let lineBudget = 200;
|
|
29034
|
+
inAnnotation.add(li + 1);
|
|
29035
|
+
while (depth > 0 && li < lines.length && lineBudget > 0) {
|
|
29036
|
+
const ln = lines[li];
|
|
29037
|
+
let inStr = null;
|
|
29038
|
+
while (col < ln.length && depth > 0) {
|
|
29039
|
+
const ch = ln[col];
|
|
29040
|
+
if (inStr !== null) {
|
|
29041
|
+
if (ch === "\\") {
|
|
29042
|
+
col += 2;
|
|
29043
|
+
continue;
|
|
29044
|
+
}
|
|
29045
|
+
if (ch === inStr) inStr = null;
|
|
29046
|
+
} else if (ch === '"' || ch === "'" || ch === "`") {
|
|
29047
|
+
inStr = ch;
|
|
29048
|
+
} else if (ch === openCh) {
|
|
29049
|
+
depth++;
|
|
29050
|
+
} else if (ch === closeCh) {
|
|
29051
|
+
depth--;
|
|
29052
|
+
}
|
|
29053
|
+
col++;
|
|
29054
|
+
}
|
|
29055
|
+
if (depth > 0) {
|
|
29056
|
+
li++;
|
|
29057
|
+
col = 0;
|
|
29058
|
+
lineBudget--;
|
|
29059
|
+
if (li < lines.length) inAnnotation.add(li + 1);
|
|
29060
|
+
}
|
|
29061
|
+
}
|
|
29062
|
+
}
|
|
29063
|
+
}
|
|
29064
|
+
return inAnnotation;
|
|
29065
|
+
}
|
|
29066
|
+
function findStringArrayLineRanges(code) {
|
|
29067
|
+
const lines = code.split("\n");
|
|
29068
|
+
const inArray = /* @__PURE__ */ new Set();
|
|
29069
|
+
const OPEN_RE = /=\s*([{\[])/g;
|
|
29070
|
+
const STR_LITERAL_COUNT_RE = /(["'`])(?:\\.|(?!\1).)*\1/g;
|
|
29071
|
+
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
29072
|
+
OPEN_RE.lastIndex = 0;
|
|
29073
|
+
let m;
|
|
29074
|
+
while ((m = OPEN_RE.exec(lines[i2])) !== null) {
|
|
29075
|
+
const openCh = m[1];
|
|
29076
|
+
const closeCh = openCh === "{" ? "}" : "]";
|
|
29077
|
+
let depth = 1;
|
|
29078
|
+
let li = i2;
|
|
29079
|
+
let col = m.index + m[0].length;
|
|
29080
|
+
let lineBudget = 100;
|
|
29081
|
+
const spanLines = [li + 1];
|
|
29082
|
+
let spanText = "";
|
|
29083
|
+
while (depth > 0 && li < lines.length && lineBudget > 0) {
|
|
29084
|
+
const ln = lines[li];
|
|
29085
|
+
let inStr = null;
|
|
29086
|
+
const start2 = col;
|
|
29087
|
+
while (col < ln.length && depth > 0) {
|
|
29088
|
+
const ch = ln[col];
|
|
29089
|
+
if (inStr !== null) {
|
|
29090
|
+
if (ch === "\\") {
|
|
29091
|
+
col += 2;
|
|
29092
|
+
continue;
|
|
29093
|
+
}
|
|
29094
|
+
if (ch === inStr) inStr = null;
|
|
29095
|
+
} else if (ch === '"' || ch === "'" || ch === "`") {
|
|
29096
|
+
inStr = ch;
|
|
29097
|
+
} else if (ch === openCh) {
|
|
29098
|
+
depth++;
|
|
29099
|
+
} else if (ch === closeCh) {
|
|
29100
|
+
depth--;
|
|
29101
|
+
}
|
|
29102
|
+
col++;
|
|
29103
|
+
}
|
|
29104
|
+
spanText += ln.substring(start2, col) + "\n";
|
|
29105
|
+
if (depth > 0) {
|
|
29106
|
+
li++;
|
|
29107
|
+
col = 0;
|
|
29108
|
+
lineBudget--;
|
|
29109
|
+
if (li < lines.length) spanLines.push(li + 1);
|
|
29110
|
+
}
|
|
29111
|
+
}
|
|
29112
|
+
STR_LITERAL_COUNT_RE.lastIndex = 0;
|
|
29113
|
+
let strCount = 0;
|
|
29114
|
+
while (STR_LITERAL_COUNT_RE.exec(spanText) !== null) {
|
|
29115
|
+
strCount++;
|
|
29116
|
+
if (strCount >= 3) break;
|
|
29117
|
+
}
|
|
29118
|
+
if (strCount >= 3) {
|
|
29119
|
+
for (const ln of spanLines) inArray.add(ln);
|
|
29120
|
+
}
|
|
29121
|
+
}
|
|
29122
|
+
}
|
|
29123
|
+
return inArray;
|
|
29124
|
+
}
|
|
29125
|
+
var FIELD_ASSIGN_RE = /(?:^|[\s,(])([A-Za-z_$][\w$]*)\s*[:=]\s*["'`]/;
|
|
29126
|
+
function extractEnclosingFieldName(lineText) {
|
|
29127
|
+
const m = FIELD_ASSIGN_RE.exec(lineText);
|
|
29128
|
+
return m ? m[1] : null;
|
|
29129
|
+
}
|
|
29014
29130
|
var TEST_CALL_RE = /\b(?:expect|assert|describe|it|test)\s*\(/;
|
|
29015
29131
|
var COMMENT_EXAMPLE_RE = /(?:\/\/|#)\s*(?:example|sample|test|fixture)/i;
|
|
29132
|
+
var FAST_CANDIDATE_PROBE_RE = /["'`][A-Za-z0-9+/=_-]{32,}["'`]/;
|
|
29016
29133
|
var ScanSecretsPass = class {
|
|
29017
29134
|
name = "scan-secrets";
|
|
29018
29135
|
category = "security";
|
|
29019
29136
|
run(ctx) {
|
|
29020
29137
|
const file = ctx.graph.ir.meta.file;
|
|
29021
|
-
if (isTestFile(file)) {
|
|
29138
|
+
if (isTestFile(file) || isGeneratedFile(file)) {
|
|
29022
29139
|
return { providerFindings: 0, entropyFindings: 0 };
|
|
29023
29140
|
}
|
|
29024
29141
|
const lines = ctx.code.split("\n");
|
|
@@ -29030,6 +29147,9 @@ var ScanSecretsPass = class {
|
|
|
29030
29147
|
seen.add(`${f.line}:${f.rule_id}`);
|
|
29031
29148
|
}
|
|
29032
29149
|
}
|
|
29150
|
+
const hasEntropyCandidate = FAST_CANDIDATE_PROBE_RE.test(ctx.code);
|
|
29151
|
+
const annotationLines = hasEntropyCandidate ? findAnnotationLineRanges(ctx.code) : /* @__PURE__ */ new Set();
|
|
29152
|
+
const arrayLines = hasEntropyCandidate ? findStringArrayLineRanges(ctx.code) : /* @__PURE__ */ new Set();
|
|
29033
29153
|
let providerFindings = 0;
|
|
29034
29154
|
let entropyFindings = 0;
|
|
29035
29155
|
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
@@ -29085,16 +29205,19 @@ var ScanSecretsPass = class {
|
|
|
29085
29205
|
});
|
|
29086
29206
|
providerFindings += 1;
|
|
29087
29207
|
}
|
|
29088
|
-
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
29208
|
+
if (hasEntropyCandidate) for (let i2 = 0; i2 < lines.length; i2++) {
|
|
29089
29209
|
const lineText = lines[i2];
|
|
29090
29210
|
const lineNum = i2 + 1;
|
|
29091
29211
|
if (TEST_CALL_RE.test(lineText)) continue;
|
|
29092
29212
|
if (COMMENT_EXAMPLE_RE.test(lineText)) continue;
|
|
29213
|
+
if (annotationLines.has(lineNum)) continue;
|
|
29214
|
+
if (arrayLines.has(lineNum)) continue;
|
|
29093
29215
|
STRING_LITERAL_RE.lastIndex = 0;
|
|
29094
29216
|
let match;
|
|
29095
29217
|
while ((match = STRING_LITERAL_RE.exec(lineText)) !== null) {
|
|
29096
29218
|
const value = match[2];
|
|
29097
29219
|
if (!this.isCandidate(value)) continue;
|
|
29220
|
+
if (value.length < 32) continue;
|
|
29098
29221
|
if (!this.passesEntropyGate(value, lineText)) continue;
|
|
29099
29222
|
const key = `${lineNum}:hardcoded-credential-entropy`;
|
|
29100
29223
|
if (seen.has(key)) continue;
|
|
@@ -29132,17 +29255,25 @@ var ScanSecretsPass = class {
|
|
|
29132
29255
|
return true;
|
|
29133
29256
|
}
|
|
29134
29257
|
/**
|
|
29135
|
-
* Shannon-entropy gate
|
|
29136
|
-
*
|
|
29137
|
-
*
|
|
29138
|
-
*
|
|
29258
|
+
* Shannon-entropy gate (#125 Gate 4 — REQUIRED field-name match).
|
|
29259
|
+
*
|
|
29260
|
+
* The entropy layer emits ONLY when the enclosing assignment LHS
|
|
29261
|
+
* identifier matches a credential keyword (password / secret / token /
|
|
29262
|
+
* api_key / etc.). Without this requirement, the layer flagged every
|
|
29263
|
+
* high-entropy string — attribution keys, base64 resource blobs, public
|
|
29264
|
+
* encoding alphabets — as credentials. Provider patterns (Layer 1) and
|
|
29265
|
+
* named-credential matcher (Layer 1b) remain the recall safety net for
|
|
29266
|
+
* credentials that don't fit the `FIELD = "..."` shape.
|
|
29267
|
+
*
|
|
29268
|
+
* Base64-shaped strings need higher entropy than hex-shaped (hex alphabet
|
|
29269
|
+
* is 4 bits/char by construction).
|
|
29139
29270
|
*/
|
|
29140
29271
|
passesEntropyGate(value, lineText) {
|
|
29272
|
+
const fieldName = extractEnclosingFieldName(lineText);
|
|
29273
|
+
if (fieldName === null || !CREDENTIAL_NAME_RE.test(fieldName)) return false;
|
|
29141
29274
|
const isHex = HEXISH_RE.test(value);
|
|
29142
|
-
const
|
|
29143
|
-
|
|
29144
|
-
const h = shannonEntropy(value);
|
|
29145
|
-
return h >= threshold;
|
|
29275
|
+
const threshold = isHex ? 3.3 : 4.1;
|
|
29276
|
+
return shannonEntropy(value) >= threshold;
|
|
29146
29277
|
}
|
|
29147
29278
|
};
|
|
29148
29279
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "circle-ir",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.85.1",
|
|
4
4
|
"description": "High-performance Static Application Security Testing (SAST) library for detecting security vulnerabilities through taint analysis",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|