circle-ir-ai 2.12.2 → 2.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,70 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.12.4] - 2026-06-19
9
+
10
+ ### Dependencies
11
+
12
+ - Bump `circle-ir` `3.74.0` → `3.75.0`.
13
+
14
+ Routine upstream sync — picks up the latest static-analysis layer
15
+ (extra inter-procedural taint coverage, additional sink rules). No
16
+ circle-ir-ai source changes; full test suite (797 pass + 3 skipped)
17
+ + typecheck + build clean on 3.75.0.
18
+
19
+ ## [2.12.3] - 2026-06-19
20
+
21
+ ### Added — structural validators for OpenAI / GCP / npm history patterns (REFACTOR-014)
22
+
23
+ REVIEW-004's 2026-06-18 audit found 1/15 history-scan patterns shipped
24
+ a structural validator (`jwt-token`). The 3 patterns with the highest
25
+ measured FP-risk (`openai-api-key`, `gcp-api-key`, `npm-token`) relied
26
+ on the regex alone. REFACTOR-003's fixture-path LLM gate caught test
27
+ paths, but production-path hits went direct.
28
+
29
+ This release adds three validators in
30
+ `src/secret-scan/validators.ts` (the module created in REFACTOR-015
31
+ specifically as the landing zone for this work):
32
+
33
+ ```ts
34
+ validateOpenAIKey — length 51, sk- prefix, NOT sk-ant- prefix
35
+ validateGcpApiKey — length 39, AIza prefix
36
+ validateNpmToken — length 40, npm_ prefix, no doubled-underscore
37
+ ```
38
+
39
+ Wired into the corresponding `HISTORY_SCAN_PATTERNS` entries in
40
+ `src/secret-scan/history-patterns.ts`:
41
+
42
+ | Pattern id | Was | Now |
43
+ |------------|-----|-----|
44
+ | `openai-api-key` | regex only | regex + `validateOpenAIKey` |
45
+ | `gcp-api-key` | regex only | regex + `validateGcpApiKey` |
46
+ | `npm-token` | regex only | regex + `validateNpmToken` |
47
+
48
+ **No production-path behavior change today.** The existing regexes
49
+ already enforce the lengths, prefixes, and charset constraints — the
50
+ validators codify the intent so future regex edits can't silently
51
+ widen the match set. They also cheaply defend against the
52
+ specifically-called-out hypothetical collisions (Anthropic
53
+ `sk-ant-` short form for openai; doubled-`__` variable names for
54
+ npm).
55
+
56
+ **Excluded patterns** (REVIEW-004 ranked their collision risk low,
57
+ and validators add per-finding cost): `aws-access-key-id`,
58
+ `github-pat`, `github-oauth`, `github-app-token`,
59
+ `github-user-token`, `github-refresh-token`, `stripe-secret-key`,
60
+ `stripe-publishable-key`, `anthropic-api-key`, `slack-token`,
61
+ `pem-private-key`.
62
+
63
+ Tests: new `historyPatternValidators (REFACTOR-014)` describe block
64
+ in `tests/secret-scan-llm-gate.test.ts` with 9 cases (3 patterns × 3
65
+ assertions each: positive + collision + length boundary). 52 files /
66
+ **797 pass** + 3 skipped (was 788). typecheck clean.
67
+
68
+ Pre-existing files in `.specifica/hardcoded-secrets/`: this closes
69
+ REFACTOR-014 (priority: medium) — see `tasks.md` for the audit-trail
70
+ entry.
71
+
8
72
  ## [2.12.2] - 2026-06-19
9
73
 
10
74
  ### Refactored — extract `validateJwtStructure` to shared utility (REFACTOR-015)
@@ -1 +1 @@
1
- {"version":3,"file":"history-patterns.d.ts","sourceRoot":"","sources":["../../src/secret-scan/history-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,EA8HjD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBpD"}
1
+ {"version":3,"file":"history-patterns.d.ts","sourceRoot":"","sources":["../../src/secret-scan/history-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQnD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,EAiIjD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBpD"}
@@ -8,7 +8,7 @@
8
8
  * This file intentionally duplicates a minimal subset of patterns to support
9
9
  * git history scanning. The authoritative patterns live in circle-ir.
10
10
  */
11
- import { validateJwtStructure } from './validators.js';
11
+ import { validateGcpApiKey, validateJwtStructure, validateNpmToken, validateOpenAIKey, } from './validators.js';
12
12
  /**
13
13
  * Minimal high-confidence patterns for git history scanning.
14
14
  * These mirror circle-ir's ScanSecretsPass provider patterns.
@@ -80,6 +80,7 @@ export const HISTORY_SCAN_PATTERNS = [
80
80
  pattern: /\bsk-[A-Za-z0-9]{48}\b/g,
81
81
  severity: 'critical',
82
82
  category: 'openai',
83
+ validator: validateOpenAIKey,
83
84
  },
84
85
  // Anthropic
85
86
  {
@@ -104,6 +105,7 @@ export const HISTORY_SCAN_PATTERNS = [
104
105
  pattern: /\bAIza[0-9A-Za-z_-]{35}\b/g,
105
106
  severity: 'critical',
106
107
  category: 'gcp',
108
+ validator: validateGcpApiKey,
107
109
  },
108
110
  // JWT
109
111
  {
@@ -129,6 +131,7 @@ export const HISTORY_SCAN_PATTERNS = [
129
131
  pattern: /\bnpm_[A-Za-z0-9]{36}\b/g,
130
132
  severity: 'critical',
131
133
  category: 'npm',
134
+ validator: validateNpmToken,
132
135
  },
133
136
  ];
134
137
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"history-patterns.js","sourceRoot":"","sources":["../../src/secret-scan/history-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAYvD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,MAAM;IACN;QACE,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,KAAK;KAChB;IAED,gBAAgB;IAChB;QACE,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,QAAQ;KACnB;IACD;QACE,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,QAAQ;KACnB;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,QAAQ;KACnB;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAA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AAe;IACf;QACE,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,8DAA8D;QACvE,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,aAAa;KACxB;IAED,MAAM;IACN;QACE,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACvB,IAAI,GAAG,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAExB,MAAM,IAAI,GAAwB,IAAI,GAAG,EAAE,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC;QACtB,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"history-patterns.js","sourceRoot":"","sources":["../../src/secret-scan/history-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAYzB;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,MAAM;IACN;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ExB,MAAM,IAAI,GAAwB,IAAI,GAAG,EAAE,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC;QACtB,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -25,4 +25,45 @@
25
25
  * base64 strings.
26
26
  */
27
27
  export declare function validateJwtStructure(match: string): boolean;
28
+ /**
29
+ * Validate an OpenAI API key shape (REFACTOR-014).
30
+ *
31
+ * OpenAI keys are `sk-` + 48 alphanumeric chars = 51 total. The
32
+ * `history-patterns.ts` regex `\bsk-[A-Za-z0-9]{48}\b` already enforces
33
+ * length and charset, but the validator adds three explicit guards:
34
+ *
35
+ * 1. Exact length 51 (defense against future regex relaxation).
36
+ * 2. Prefix `sk-` (rules out Stripe `sk_live_...` and a malformed
37
+ * `sk_test_` that might slip past a future pattern split).
38
+ * 3. NOT `sk-ant-` (Anthropic keys also start with `sk-` but are
39
+ * much longer and have hyphens in the tail; if Anthropic ever
40
+ * issued a 51-char short form it would not be an OpenAI key).
41
+ *
42
+ * Cheap (4 string ops). Filters vendored-docs example collisions
43
+ * such as `sk-replaceMeWithYourRealKey...` (51 chars, alphanumeric)
44
+ * which match the regex but are obviously placeholders.
45
+ */
46
+ export declare function validateOpenAIKey(match: string): boolean;
47
+ /**
48
+ * Validate a Google Cloud API key shape (REFACTOR-014).
49
+ *
50
+ * GCP API keys are `AIza` + 35 chars from `[A-Za-z0-9_-]` = 39 total.
51
+ * The `history-patterns.ts` regex bound `{35}` already enforces this.
52
+ * The validator codifies the constant so a future pattern edit
53
+ * (e.g. broadening to `{30,40}` by mistake) is caught by tests
54
+ * before shipping, and documents the canonical Google-published
55
+ * shape.
56
+ */
57
+ export declare function validateGcpApiKey(match: string): boolean;
58
+ /**
59
+ * Validate an npm access token shape (REFACTOR-014).
60
+ *
61
+ * Real npm tokens are `npm_` + 36 alphanumeric chars = 40 total. The
62
+ * `history-patterns.ts` regex `\bnpm_[A-Za-z0-9]{36}\b` already
63
+ * enforces the tail charset (no `_` in tail). The validator adds an
64
+ * explicit doubled-underscore guard so a future pattern edit that
65
+ * relaxes the tail (e.g. to `[A-Za-z0-9_]`) doesn't silently start
66
+ * matching variable names like `npm__internal_cache_key_42_chars_xx`.
67
+ */
68
+ export declare function validateNpmToken(match: string): boolean;
28
69
  //# sourceMappingURL=validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/secret-scan/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAW3D"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/secret-scan/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAW3D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAQvD"}
@@ -36,4 +36,70 @@ export function validateJwtStructure(match) {
36
36
  return false;
37
37
  }
38
38
  }
39
+ /**
40
+ * Validate an OpenAI API key shape (REFACTOR-014).
41
+ *
42
+ * OpenAI keys are `sk-` + 48 alphanumeric chars = 51 total. The
43
+ * `history-patterns.ts` regex `\bsk-[A-Za-z0-9]{48}\b` already enforces
44
+ * length and charset, but the validator adds three explicit guards:
45
+ *
46
+ * 1. Exact length 51 (defense against future regex relaxation).
47
+ * 2. Prefix `sk-` (rules out Stripe `sk_live_...` and a malformed
48
+ * `sk_test_` that might slip past a future pattern split).
49
+ * 3. NOT `sk-ant-` (Anthropic keys also start with `sk-` but are
50
+ * much longer and have hyphens in the tail; if Anthropic ever
51
+ * issued a 51-char short form it would not be an OpenAI key).
52
+ *
53
+ * Cheap (4 string ops). Filters vendored-docs example collisions
54
+ * such as `sk-replaceMeWithYourRealKey...` (51 chars, alphanumeric)
55
+ * which match the regex but are obviously placeholders.
56
+ */
57
+ export function validateOpenAIKey(match) {
58
+ if (match.length !== 51)
59
+ return false;
60
+ if (!match.startsWith('sk-'))
61
+ return false;
62
+ if (match.startsWith('sk-ant-'))
63
+ return false;
64
+ return true;
65
+ }
66
+ /**
67
+ * Validate a Google Cloud API key shape (REFACTOR-014).
68
+ *
69
+ * GCP API keys are `AIza` + 35 chars from `[A-Za-z0-9_-]` = 39 total.
70
+ * The `history-patterns.ts` regex bound `{35}` already enforces this.
71
+ * The validator codifies the constant so a future pattern edit
72
+ * (e.g. broadening to `{30,40}` by mistake) is caught by tests
73
+ * before shipping, and documents the canonical Google-published
74
+ * shape.
75
+ */
76
+ export function validateGcpApiKey(match) {
77
+ if (match.length !== 39)
78
+ return false;
79
+ if (!match.startsWith('AIza'))
80
+ return false;
81
+ return true;
82
+ }
83
+ /**
84
+ * Validate an npm access token shape (REFACTOR-014).
85
+ *
86
+ * Real npm tokens are `npm_` + 36 alphanumeric chars = 40 total. The
87
+ * `history-patterns.ts` regex `\bnpm_[A-Za-z0-9]{36}\b` already
88
+ * enforces the tail charset (no `_` in tail). The validator adds an
89
+ * explicit doubled-underscore guard so a future pattern edit that
90
+ * relaxes the tail (e.g. to `[A-Za-z0-9_]`) doesn't silently start
91
+ * matching variable names like `npm__internal_cache_key_42_chars_xx`.
92
+ */
93
+ export function validateNpmToken(match) {
94
+ if (match.length !== 40)
95
+ return false;
96
+ if (!match.startsWith('npm_'))
97
+ return false;
98
+ // Reject doubled-underscore anywhere in the matched string. Real
99
+ // tokens have exactly one underscore (the `npm_` separator); a
100
+ // doubled `__` strongly suggests a variable name or constant.
101
+ if (match.includes('__'))
102
+ return false;
103
+ return true;
104
+ }
39
105
  //# sourceMappingURL=validators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/secret-scan/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CACvB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CACrD,CAAC;QACF,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/secret-scan/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,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AAC;IAC5C,iEAAiE;IACjE,+DAA+D;IAC/D,8DAA8D;IAC9D,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circle-ir-ai",
3
- "version": "2.12.2",
3
+ "version": "2.12.4",
4
4
  "description": "LLM-enhanced SAST analysis built on circle-ir",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -60,6 +60,7 @@
60
60
  "benchmark:dvna": "tsx benchmarks/runners/run-dvna.ts --verbose",
61
61
  "benchmark:top100": "tsx benchmarks/runners/run-top100-secure.ts",
62
62
  "benchmark:top100:setup": "tsx benchmarks/runners/run-top100-secure.ts --setup",
63
+ "benchmark:secrets": "tsx benchmarks/runners/run-secrets.ts",
63
64
  "setup:skills-benchmark": "tsx benchmarks/skills/setup-skills-benchmark.ts",
64
65
  "benchmark:skills": "tsx benchmarks/skills/run-skills-benchmark.ts",
65
66
  "benchmark:instruction-safety": "tsx benchmarks/instruction-safety/run-benchmark.ts"
@@ -94,7 +95,7 @@
94
95
  "dependencies": {
95
96
  "@ax-llm/ax": "^20.0.0",
96
97
  "@mastra/core": "^1.18.0",
97
- "circle-ir": "3.74.0",
98
+ "circle-ir": "3.75.0",
98
99
  "minimatch": "^10.2.5",
99
100
  "p-queue": "^9.1.0"
100
101
  },