@rigour-labs/core 3.0.5 → 4.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.
Files changed (85) hide show
  1. package/dist/deep/fact-extractor.d.ts +80 -0
  2. package/dist/deep/fact-extractor.js +626 -0
  3. package/dist/deep/index.d.ts +14 -0
  4. package/dist/deep/index.js +12 -0
  5. package/dist/deep/prompts.d.ts +22 -0
  6. package/dist/deep/prompts.js +374 -0
  7. package/dist/deep/verifier.d.ts +16 -0
  8. package/dist/deep/verifier.js +388 -0
  9. package/dist/gates/deep-analysis.d.ts +28 -0
  10. package/dist/gates/deep-analysis.js +302 -0
  11. package/dist/gates/deprecated-apis-rules-lang.d.ts +21 -0
  12. package/dist/gates/deprecated-apis-rules-lang.js +311 -0
  13. package/dist/gates/deprecated-apis-rules-node.d.ts +19 -0
  14. package/dist/gates/deprecated-apis-rules-node.js +199 -0
  15. package/dist/gates/deprecated-apis-rules.d.ts +6 -0
  16. package/dist/gates/deprecated-apis-rules.js +6 -0
  17. package/dist/gates/deprecated-apis.js +1 -502
  18. package/dist/gates/hallucinated-imports-lang.d.ts +16 -0
  19. package/dist/gates/hallucinated-imports-lang.js +374 -0
  20. package/dist/gates/hallucinated-imports-stdlib.d.ts +12 -0
  21. package/dist/gates/hallucinated-imports-stdlib.js +228 -0
  22. package/dist/gates/hallucinated-imports.d.ts +0 -98
  23. package/dist/gates/hallucinated-imports.js +10 -678
  24. package/dist/gates/phantom-apis-data.d.ts +33 -0
  25. package/dist/gates/phantom-apis-data.js +398 -0
  26. package/dist/gates/phantom-apis.js +1 -393
  27. package/dist/gates/phantom-apis.test.js +52 -0
  28. package/dist/gates/promise-safety-helpers.d.ts +19 -0
  29. package/dist/gates/promise-safety-helpers.js +101 -0
  30. package/dist/gates/promise-safety-rules.d.ts +7 -0
  31. package/dist/gates/promise-safety-rules.js +19 -0
  32. package/dist/gates/promise-safety.d.ts +1 -21
  33. package/dist/gates/promise-safety.js +51 -257
  34. package/dist/gates/runner.d.ts +4 -2
  35. package/dist/gates/runner.js +46 -1
  36. package/dist/gates/test-quality-lang.d.ts +30 -0
  37. package/dist/gates/test-quality-lang.js +188 -0
  38. package/dist/gates/test-quality.d.ts +0 -14
  39. package/dist/gates/test-quality.js +13 -186
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.js +12 -2
  42. package/dist/inference/cloud-provider.d.ts +34 -0
  43. package/dist/inference/cloud-provider.js +126 -0
  44. package/dist/inference/index.d.ts +17 -0
  45. package/dist/inference/index.js +23 -0
  46. package/dist/inference/model-manager.d.ts +26 -0
  47. package/dist/inference/model-manager.js +106 -0
  48. package/dist/inference/sidecar-provider.d.ts +15 -0
  49. package/dist/inference/sidecar-provider.js +153 -0
  50. package/dist/inference/types.d.ts +77 -0
  51. package/dist/inference/types.js +19 -0
  52. package/dist/pattern-index/indexer-helpers.d.ts +38 -0
  53. package/dist/pattern-index/indexer-helpers.js +111 -0
  54. package/dist/pattern-index/indexer-lang.d.ts +13 -0
  55. package/dist/pattern-index/indexer-lang.js +244 -0
  56. package/dist/pattern-index/indexer-ts.d.ts +22 -0
  57. package/dist/pattern-index/indexer-ts.js +258 -0
  58. package/dist/pattern-index/indexer.d.ts +4 -106
  59. package/dist/pattern-index/indexer.js +58 -707
  60. package/dist/pattern-index/staleness-data.d.ts +6 -0
  61. package/dist/pattern-index/staleness-data.js +262 -0
  62. package/dist/pattern-index/staleness.js +1 -258
  63. package/dist/settings.d.ts +104 -0
  64. package/dist/settings.js +186 -0
  65. package/dist/storage/db.d.ts +16 -0
  66. package/dist/storage/db.js +132 -0
  67. package/dist/storage/findings.d.ts +14 -0
  68. package/dist/storage/findings.js +38 -0
  69. package/dist/storage/index.d.ts +9 -0
  70. package/dist/storage/index.js +8 -0
  71. package/dist/storage/patterns.d.ts +35 -0
  72. package/dist/storage/patterns.js +62 -0
  73. package/dist/storage/scans.d.ts +42 -0
  74. package/dist/storage/scans.js +55 -0
  75. package/dist/templates/index.d.ts +12 -16
  76. package/dist/templates/index.js +11 -527
  77. package/dist/templates/paradigms.d.ts +2 -0
  78. package/dist/templates/paradigms.js +46 -0
  79. package/dist/templates/presets.d.ts +14 -0
  80. package/dist/templates/presets.js +227 -0
  81. package/dist/templates/universal-config.d.ts +2 -0
  82. package/dist/templates/universal-config.js +190 -0
  83. package/dist/types/index.d.ts +438 -15
  84. package/dist/types/index.js +41 -1
  85. package/package.json +6 -2
@@ -0,0 +1,6 @@
1
+ import type { DeprecationEntry } from './types.js';
2
+ /**
3
+ * Built-in deprecation database.
4
+ * Bundled with Rigour and updated with releases.
5
+ */
6
+ export declare const BUILT_IN_DEPRECATIONS: DeprecationEntry[];
@@ -0,0 +1,262 @@
1
+ /**
2
+ * Built-in deprecation database.
3
+ * Bundled with Rigour and updated with releases.
4
+ */
5
+ export const BUILT_IN_DEPRECATIONS = [
6
+ // React deprecations
7
+ {
8
+ pattern: 'componentWillMount',
9
+ library: 'react',
10
+ deprecatedIn: '16.3.0',
11
+ replacement: 'useEffect(() => { ... }, [])',
12
+ severity: 'error',
13
+ reason: 'Unsafe lifecycle method removed in React 18',
14
+ docs: 'https://react.dev/reference/react/Component#unsafe_componentwillmount'
15
+ },
16
+ {
17
+ pattern: 'componentWillReceiveProps',
18
+ library: 'react',
19
+ deprecatedIn: '16.3.0',
20
+ replacement: 'getDerivedStateFromProps or useEffect',
21
+ severity: 'error',
22
+ reason: 'Unsafe lifecycle method removed in React 18'
23
+ },
24
+ {
25
+ pattern: 'componentWillUpdate',
26
+ library: 'react',
27
+ deprecatedIn: '16.3.0',
28
+ replacement: 'getSnapshotBeforeUpdate or useEffect',
29
+ severity: 'error',
30
+ reason: 'Unsafe lifecycle method removed in React 18'
31
+ },
32
+ {
33
+ pattern: 'UNSAFE_componentWillMount',
34
+ library: 'react',
35
+ deprecatedIn: '18.0.0',
36
+ replacement: 'useEffect(() => { ... }, [])',
37
+ severity: 'warning',
38
+ reason: 'Prepare for React 19 removal'
39
+ },
40
+ {
41
+ pattern: 'ReactDOM.render',
42
+ library: 'react-dom',
43
+ deprecatedIn: '18.0.0',
44
+ replacement: 'createRoot(container).render(<App />)',
45
+ severity: 'error',
46
+ reason: 'Legacy root API deprecated in React 18'
47
+ },
48
+ {
49
+ pattern: 'ReactDOM.hydrate',
50
+ library: 'react-dom',
51
+ deprecatedIn: '18.0.0',
52
+ replacement: 'hydrateRoot(container, <App />)',
53
+ severity: 'error',
54
+ reason: 'Legacy hydration API deprecated in React 18'
55
+ },
56
+ // Package deprecations
57
+ {
58
+ pattern: "import.*from ['\"]moment['\"]",
59
+ deprecatedIn: 'ecosystem',
60
+ replacement: "import { format } from 'date-fns'",
61
+ severity: 'warning',
62
+ reason: 'moment.js is in maintenance mode since September 2020',
63
+ docs: 'https://momentjs.com/docs/#/-project-status/'
64
+ },
65
+ {
66
+ pattern: "require\\(['\"]request['\"]\\)",
67
+ deprecatedIn: 'ecosystem',
68
+ replacement: 'Use native fetch or axios',
69
+ severity: 'error',
70
+ reason: 'request package deprecated in February 2020'
71
+ },
72
+ {
73
+ pattern: "import.*from ['\"]request['\"]",
74
+ deprecatedIn: 'ecosystem',
75
+ replacement: 'Use native fetch or axios',
76
+ severity: 'error',
77
+ reason: 'request package deprecated in February 2020'
78
+ },
79
+ // JavaScript/TypeScript deprecations
80
+ {
81
+ pattern: '\\bvar\\s+\\w+\\s*=',
82
+ deprecatedIn: 'es6',
83
+ replacement: 'Use const or let',
84
+ severity: 'warning',
85
+ reason: 'var has function scope which leads to bugs. Use block-scoped const/let'
86
+ },
87
+ // Redux deprecations
88
+ {
89
+ pattern: 'createStore\\(',
90
+ library: 'redux',
91
+ deprecatedIn: '4.2.0',
92
+ replacement: "configureStore from '@reduxjs/toolkit'",
93
+ severity: 'warning',
94
+ reason: 'Redux Toolkit is now the recommended way',
95
+ docs: 'https://redux.js.org/introduction/why-rtk-is-redux-today'
96
+ },
97
+ // Node.js deprecations
98
+ {
99
+ pattern: 'new Buffer\\(',
100
+ deprecatedIn: 'node@6.0.0',
101
+ replacement: 'Buffer.alloc() or Buffer.from()',
102
+ severity: 'error',
103
+ reason: 'Buffer constructor is a security hazard'
104
+ },
105
+ // Express deprecations
106
+ {
107
+ pattern: 'app\\.del\\(',
108
+ library: 'express',
109
+ deprecatedIn: '4.0.0',
110
+ replacement: 'app.delete()',
111
+ severity: 'warning',
112
+ reason: 'app.del() was renamed to app.delete()'
113
+ },
114
+ // TypeScript patterns to avoid
115
+ {
116
+ pattern: '\\benum\\s+\\w+',
117
+ deprecatedIn: 'best-practice',
118
+ replacement: 'const object with as const assertion',
119
+ severity: 'info',
120
+ reason: 'Enums have quirks. Consider using const objects for better tree-shaking',
121
+ docs: 'https://www.typescriptlang.org/docs/handbook/enums.html#const-enums'
122
+ },
123
+ // Next.js deprecations
124
+ {
125
+ pattern: 'getInitialProps',
126
+ library: 'next',
127
+ deprecatedIn: '13.0.0',
128
+ replacement: 'getServerSideProps or App Router with async components',
129
+ severity: 'warning',
130
+ reason: 'getInitialProps prevents static optimization'
131
+ },
132
+ {
133
+ pattern: "from ['\"]next/router['\"]",
134
+ library: 'next',
135
+ deprecatedIn: '13.0.0',
136
+ replacement: "useRouter from 'next/navigation' in App Router",
137
+ severity: 'info',
138
+ reason: 'Use next/navigation for App Router projects'
139
+ },
140
+ // ============================================================
141
+ // SECURITY PATTERNS - Cross-language security vulnerabilities
142
+ // ============================================================
143
+ // Python CSRF disabled
144
+ {
145
+ pattern: 'csrf\\s*=\\s*False',
146
+ deprecatedIn: 'security',
147
+ replacement: "Never disable CSRF protection. Remove 'csrf = False' and use proper CSRF tokens.",
148
+ severity: 'error',
149
+ reason: 'CSRF protection is critical for security. Disabling it exposes users to cross-site request forgery attacks.'
150
+ },
151
+ {
152
+ pattern: 'WTF_CSRF_ENABLED\\s*=\\s*False',
153
+ deprecatedIn: 'security',
154
+ replacement: "Never disable CSRF. Remove 'WTF_CSRF_ENABLED = False' from config.",
155
+ severity: 'error',
156
+ reason: 'Flask-WTF CSRF protection should never be disabled in production.'
157
+ },
158
+ {
159
+ pattern: "@csrf_exempt",
160
+ deprecatedIn: 'security',
161
+ replacement: "Remove @csrf_exempt decorator. Use proper CSRF token handling instead.",
162
+ severity: 'error',
163
+ reason: 'csrf_exempt bypasses CSRF protection, creating security vulnerabilities.'
164
+ },
165
+ // Python hardcoded secrets
166
+ {
167
+ pattern: "SECRET_KEY\\s*=\\s*['\"][^'\"]{1,50}['\"]",
168
+ deprecatedIn: 'security',
169
+ replacement: "Use os.environ.get('SECRET_KEY') or secrets.token_hex(32)",
170
+ severity: 'error',
171
+ reason: 'Hardcoded secrets are exposed in version control and logs. Use environment variables.'
172
+ },
173
+ {
174
+ pattern: "API_KEY\\s*=\\s*['\"][^'\"]+['\"]",
175
+ deprecatedIn: 'security',
176
+ replacement: "Use os.environ.get('API_KEY') for API credentials",
177
+ severity: 'error',
178
+ reason: 'Hardcoded API keys are a security risk. Use environment variables.'
179
+ },
180
+ {
181
+ pattern: "PASSWORD\\s*=\\s*['\"][^'\"]+['\"]",
182
+ deprecatedIn: 'security',
183
+ replacement: "Never hardcode passwords. Use environment variables or secret managers.",
184
+ severity: 'error',
185
+ reason: 'Hardcoded passwords are a critical security vulnerability.'
186
+ },
187
+ // JavaScript/TypeScript prototype pollution
188
+ {
189
+ pattern: '\\.__proto__',
190
+ deprecatedIn: 'security',
191
+ replacement: "Use Object.getPrototypeOf() or Object.setPrototypeOf() instead of __proto__",
192
+ severity: 'error',
193
+ reason: 'Direct __proto__ access enables prototype pollution attacks.'
194
+ },
195
+ {
196
+ pattern: '\\[\\s*[\'"]__proto__[\'"]\\s*\\]',
197
+ deprecatedIn: 'security',
198
+ replacement: "Never allow user input to access __proto__. Validate and sanitize object keys.",
199
+ severity: 'error',
200
+ reason: 'Bracket notation access to __proto__ is a prototype pollution vector.'
201
+ },
202
+ {
203
+ pattern: '\\[\\s*[\'"]constructor[\'"]\\s*\\]\\s*\\[',
204
+ deprecatedIn: 'security',
205
+ replacement: "Block access to constructor property from user input.",
206
+ severity: 'error',
207
+ reason: 'constructor[constructor] pattern enables prototype pollution.'
208
+ },
209
+ // SQL Injection patterns
210
+ {
211
+ pattern: 'cursor\\.execute\\s*\\(\\s*f[\'"]',
212
+ deprecatedIn: 'security',
213
+ replacement: "Use parameterized queries: cursor.execute('SELECT * FROM users WHERE id = %s', (user_id,))",
214
+ severity: 'error',
215
+ reason: 'F-string SQL queries are vulnerable to SQL injection attacks.'
216
+ },
217
+ {
218
+ pattern: '\\.execute\\s*\\([^)]*\\+[^)]*\\)',
219
+ deprecatedIn: 'security',
220
+ replacement: "Use parameterized queries instead of string concatenation.",
221
+ severity: 'error',
222
+ reason: 'String concatenation in SQL queries enables SQL injection.'
223
+ },
224
+ // XSS patterns
225
+ {
226
+ pattern: 'dangerouslySetInnerHTML',
227
+ deprecatedIn: 'security',
228
+ replacement: "Sanitize HTML with DOMPurify before using dangerouslySetInnerHTML, or use safe alternatives.",
229
+ severity: 'warning',
230
+ reason: 'dangerouslySetInnerHTML can lead to XSS vulnerabilities if content is not sanitized.'
231
+ },
232
+ {
233
+ pattern: '\\.innerHTML\\s*=',
234
+ deprecatedIn: 'security',
235
+ replacement: "Use textContent for text, or sanitize HTML before setting innerHTML.",
236
+ severity: 'warning',
237
+ reason: 'Direct innerHTML assignment can lead to XSS attacks.'
238
+ },
239
+ // Insecure session/cookie settings
240
+ {
241
+ pattern: 'SESSION_COOKIE_SECURE\\s*=\\s*False',
242
+ deprecatedIn: 'security',
243
+ replacement: "Set SESSION_COOKIE_SECURE = True in production",
244
+ severity: 'error',
245
+ reason: 'Insecure cookies can be intercepted over HTTP connections.'
246
+ },
247
+ {
248
+ pattern: 'SESSION_COOKIE_HTTPONLY\\s*=\\s*False',
249
+ deprecatedIn: 'security',
250
+ replacement: "Set SESSION_COOKIE_HTTPONLY = True to prevent XSS cookie theft",
251
+ severity: 'error',
252
+ reason: 'Non-HTTPOnly cookies are accessible via JavaScript, enabling XSS attacks.'
253
+ },
254
+ // Debug mode in production
255
+ {
256
+ pattern: 'DEBUG\\s*=\\s*True',
257
+ deprecatedIn: 'security',
258
+ replacement: "Use DEBUG = os.environ.get('DEBUG', 'False') == 'True'",
259
+ severity: 'warning',
260
+ reason: 'Debug mode in production exposes sensitive information and stack traces.'
261
+ }
262
+ ];
@@ -11,264 +11,7 @@ import semver from 'semver';
11
11
  * Built-in deprecation database.
12
12
  * This is bundled with Rigour and updated with releases.
13
13
  */
14
- const BUILT_IN_DEPRECATIONS = [
15
- // React deprecations
16
- {
17
- pattern: 'componentWillMount',
18
- library: 'react',
19
- deprecatedIn: '16.3.0',
20
- replacement: 'useEffect(() => { ... }, [])',
21
- severity: 'error',
22
- reason: 'Unsafe lifecycle method removed in React 18',
23
- docs: 'https://react.dev/reference/react/Component#unsafe_componentwillmount'
24
- },
25
- {
26
- pattern: 'componentWillReceiveProps',
27
- library: 'react',
28
- deprecatedIn: '16.3.0',
29
- replacement: 'getDerivedStateFromProps or useEffect',
30
- severity: 'error',
31
- reason: 'Unsafe lifecycle method removed in React 18'
32
- },
33
- {
34
- pattern: 'componentWillUpdate',
35
- library: 'react',
36
- deprecatedIn: '16.3.0',
37
- replacement: 'getSnapshotBeforeUpdate or useEffect',
38
- severity: 'error',
39
- reason: 'Unsafe lifecycle method removed in React 18'
40
- },
41
- {
42
- pattern: 'UNSAFE_componentWillMount',
43
- library: 'react',
44
- deprecatedIn: '18.0.0',
45
- replacement: 'useEffect(() => { ... }, [])',
46
- severity: 'warning',
47
- reason: 'Prepare for React 19 removal'
48
- },
49
- {
50
- pattern: 'ReactDOM.render',
51
- library: 'react-dom',
52
- deprecatedIn: '18.0.0',
53
- replacement: 'createRoot(container).render(<App />)',
54
- severity: 'error',
55
- reason: 'Legacy root API deprecated in React 18'
56
- },
57
- {
58
- pattern: 'ReactDOM.hydrate',
59
- library: 'react-dom',
60
- deprecatedIn: '18.0.0',
61
- replacement: 'hydrateRoot(container, <App />)',
62
- severity: 'error',
63
- reason: 'Legacy hydration API deprecated in React 18'
64
- },
65
- // Package deprecations
66
- {
67
- pattern: "import.*from ['\"]moment['\"]",
68
- deprecatedIn: 'ecosystem',
69
- replacement: "import { format } from 'date-fns'",
70
- severity: 'warning',
71
- reason: 'moment.js is in maintenance mode since September 2020',
72
- docs: 'https://momentjs.com/docs/#/-project-status/'
73
- },
74
- {
75
- pattern: "require\\(['\"]request['\"]\\)",
76
- deprecatedIn: 'ecosystem',
77
- replacement: 'Use native fetch or axios',
78
- severity: 'error',
79
- reason: 'request package deprecated in February 2020'
80
- },
81
- {
82
- pattern: "import.*from ['\"]request['\"]",
83
- deprecatedIn: 'ecosystem',
84
- replacement: 'Use native fetch or axios',
85
- severity: 'error',
86
- reason: 'request package deprecated in February 2020'
87
- },
88
- // JavaScript/TypeScript deprecations
89
- {
90
- pattern: '\\bvar\\s+\\w+\\s*=',
91
- deprecatedIn: 'es6',
92
- replacement: 'Use const or let',
93
- severity: 'warning',
94
- reason: 'var has function scope which leads to bugs. Use block-scoped const/let'
95
- },
96
- // Redux deprecations
97
- {
98
- pattern: 'createStore\\(',
99
- library: 'redux',
100
- deprecatedIn: '4.2.0',
101
- replacement: "configureStore from '@reduxjs/toolkit'",
102
- severity: 'warning',
103
- reason: 'Redux Toolkit is now the recommended way',
104
- docs: 'https://redux.js.org/introduction/why-rtk-is-redux-today'
105
- },
106
- // Node.js deprecations
107
- {
108
- pattern: 'new Buffer\\(',
109
- deprecatedIn: 'node@6.0.0',
110
- replacement: 'Buffer.alloc() or Buffer.from()',
111
- severity: 'error',
112
- reason: 'Buffer constructor is a security hazard'
113
- },
114
- // Express deprecations
115
- {
116
- pattern: 'app\\.del\\(',
117
- library: 'express',
118
- deprecatedIn: '4.0.0',
119
- replacement: 'app.delete()',
120
- severity: 'warning',
121
- reason: 'app.del() was renamed to app.delete()'
122
- },
123
- // TypeScript patterns to avoid
124
- {
125
- pattern: '\\benum\\s+\\w+',
126
- deprecatedIn: 'best-practice',
127
- replacement: 'const object with as const assertion',
128
- severity: 'info',
129
- reason: 'Enums have quirks. Consider using const objects for better tree-shaking',
130
- docs: 'https://www.typescriptlang.org/docs/handbook/enums.html#const-enums'
131
- },
132
- // Next.js deprecations
133
- {
134
- pattern: 'getInitialProps',
135
- library: 'next',
136
- deprecatedIn: '13.0.0',
137
- replacement: 'getServerSideProps or App Router with async components',
138
- severity: 'warning',
139
- reason: 'getInitialProps prevents static optimization'
140
- },
141
- {
142
- pattern: "from ['\"]next/router['\"]",
143
- library: 'next',
144
- deprecatedIn: '13.0.0',
145
- replacement: "useRouter from 'next/navigation' in App Router",
146
- severity: 'info',
147
- reason: 'Use next/navigation for App Router projects'
148
- },
149
- // ============================================================
150
- // SECURITY PATTERNS - Cross-language security vulnerabilities
151
- // ============================================================
152
- // Python CSRF disabled
153
- {
154
- pattern: 'csrf\\s*=\\s*False',
155
- deprecatedIn: 'security',
156
- replacement: "Never disable CSRF protection. Remove 'csrf = False' and use proper CSRF tokens.",
157
- severity: 'error',
158
- reason: 'CSRF protection is critical for security. Disabling it exposes users to cross-site request forgery attacks.'
159
- },
160
- {
161
- pattern: 'WTF_CSRF_ENABLED\\s*=\\s*False',
162
- deprecatedIn: 'security',
163
- replacement: "Never disable CSRF. Remove 'WTF_CSRF_ENABLED = False' from config.",
164
- severity: 'error',
165
- reason: 'Flask-WTF CSRF protection should never be disabled in production.'
166
- },
167
- {
168
- pattern: "@csrf_exempt",
169
- deprecatedIn: 'security',
170
- replacement: "Remove @csrf_exempt decorator. Use proper CSRF token handling instead.",
171
- severity: 'error',
172
- reason: 'csrf_exempt bypasses CSRF protection, creating security vulnerabilities.'
173
- },
174
- // Python hardcoded secrets
175
- {
176
- pattern: "SECRET_KEY\\s*=\\s*['\"][^'\"]{1,50}['\"]",
177
- deprecatedIn: 'security',
178
- replacement: "Use os.environ.get('SECRET_KEY') or secrets.token_hex(32)",
179
- severity: 'error',
180
- reason: 'Hardcoded secrets are exposed in version control and logs. Use environment variables.'
181
- },
182
- {
183
- pattern: "API_KEY\\s*=\\s*['\"][^'\"]+['\"]",
184
- deprecatedIn: 'security',
185
- replacement: "Use os.environ.get('API_KEY') for API credentials",
186
- severity: 'error',
187
- reason: 'Hardcoded API keys are a security risk. Use environment variables.'
188
- },
189
- {
190
- pattern: "PASSWORD\\s*=\\s*['\"][^'\"]+['\"]",
191
- deprecatedIn: 'security',
192
- replacement: "Never hardcode passwords. Use environment variables or secret managers.",
193
- severity: 'error',
194
- reason: 'Hardcoded passwords are a critical security vulnerability.'
195
- },
196
- // JavaScript/TypeScript prototype pollution
197
- {
198
- pattern: '\\.__proto__',
199
- deprecatedIn: 'security',
200
- replacement: "Use Object.getPrototypeOf() or Object.setPrototypeOf() instead of __proto__",
201
- severity: 'error',
202
- reason: 'Direct __proto__ access enables prototype pollution attacks.'
203
- },
204
- {
205
- pattern: '\\[\\s*[\'"]__proto__[\'"]\\s*\\]',
206
- deprecatedIn: 'security',
207
- replacement: "Never allow user input to access __proto__. Validate and sanitize object keys.",
208
- severity: 'error',
209
- reason: 'Bracket notation access to __proto__ is a prototype pollution vector.'
210
- },
211
- {
212
- pattern: '\\[\\s*[\'"]constructor[\'"]\\s*\\]\\s*\\[',
213
- deprecatedIn: 'security',
214
- replacement: "Block access to constructor property from user input.",
215
- severity: 'error',
216
- reason: 'constructor[constructor] pattern enables prototype pollution.'
217
- },
218
- // SQL Injection patterns
219
- {
220
- pattern: 'cursor\\.execute\\s*\\(\\s*f[\'"]',
221
- deprecatedIn: 'security',
222
- replacement: "Use parameterized queries: cursor.execute('SELECT * FROM users WHERE id = %s', (user_id,))",
223
- severity: 'error',
224
- reason: 'F-string SQL queries are vulnerable to SQL injection attacks.'
225
- },
226
- {
227
- pattern: '\\.execute\\s*\\([^)]*\\+[^)]*\\)',
228
- deprecatedIn: 'security',
229
- replacement: "Use parameterized queries instead of string concatenation.",
230
- severity: 'error',
231
- reason: 'String concatenation in SQL queries enables SQL injection.'
232
- },
233
- // XSS patterns
234
- {
235
- pattern: 'dangerouslySetInnerHTML',
236
- deprecatedIn: 'security',
237
- replacement: "Sanitize HTML with DOMPurify before using dangerouslySetInnerHTML, or use safe alternatives.",
238
- severity: 'warning',
239
- reason: 'dangerouslySetInnerHTML can lead to XSS vulnerabilities if content is not sanitized.'
240
- },
241
- {
242
- pattern: '\\.innerHTML\\s*=',
243
- deprecatedIn: 'security',
244
- replacement: "Use textContent for text, or sanitize HTML before setting innerHTML.",
245
- severity: 'warning',
246
- reason: 'Direct innerHTML assignment can lead to XSS attacks.'
247
- },
248
- // Insecure session/cookie settings
249
- {
250
- pattern: 'SESSION_COOKIE_SECURE\\s*=\\s*False',
251
- deprecatedIn: 'security',
252
- replacement: "Set SESSION_COOKIE_SECURE = True in production",
253
- severity: 'error',
254
- reason: 'Insecure cookies can be intercepted over HTTP connections.'
255
- },
256
- {
257
- pattern: 'SESSION_COOKIE_HTTPONLY\\s*=\\s*False',
258
- deprecatedIn: 'security',
259
- replacement: "Set SESSION_COOKIE_HTTPONLY = True to prevent XSS cookie theft",
260
- severity: 'error',
261
- reason: 'Non-HTTPOnly cookies are accessible via JavaScript, enabling XSS attacks.'
262
- },
263
- // Debug mode in production
264
- {
265
- pattern: 'DEBUG\\s*=\\s*True',
266
- deprecatedIn: 'security',
267
- replacement: "Use DEBUG = os.environ.get('DEBUG', 'False') == 'True'",
268
- severity: 'warning',
269
- reason: 'Debug mode in production exposes sensitive information and stack traces.'
270
- }
271
- ];
14
+ import { BUILT_IN_DEPRECATIONS } from './staleness-data.js';
272
15
  /**
273
16
  * Staleness Detector class.
274
17
  */
@@ -0,0 +1,104 @@
1
+ /**
2
+ * RigourSettings Interface
3
+ * Defines the schema for ~/.rigour/settings.json global user configuration
4
+ */
5
+ export interface RigourSettings {
6
+ providers?: {
7
+ anthropic?: string;
8
+ openai?: string;
9
+ groq?: string;
10
+ deepseek?: string;
11
+ mistral?: string;
12
+ together?: string;
13
+ gemini?: string;
14
+ ollama?: string;
15
+ [key: string]: string | undefined;
16
+ };
17
+ deep?: {
18
+ defaultProvider?: string;
19
+ defaultModel?: string;
20
+ apiBaseUrl?: string;
21
+ maxTokens?: number;
22
+ temperature?: number;
23
+ };
24
+ agents?: {
25
+ [agentName: string]: {
26
+ model?: string;
27
+ provider?: string;
28
+ fallback?: string;
29
+ };
30
+ };
31
+ cli?: {
32
+ defaultPreset?: string;
33
+ colorOutput?: boolean;
34
+ verboseOutput?: boolean;
35
+ };
36
+ }
37
+ /**
38
+ * Resolved deep options from CLI flags merged with settings.json
39
+ */
40
+ export interface ResolvedDeepOptions {
41
+ apiKey?: string;
42
+ provider?: string;
43
+ apiBaseUrl?: string;
44
+ modelName?: string;
45
+ maxTokens?: number;
46
+ temperature?: number;
47
+ }
48
+ /**
49
+ * CLI options that may override settings
50
+ */
51
+ export interface CLIDeepOptions {
52
+ apiKey?: string;
53
+ provider?: string;
54
+ apiBaseUrl?: string;
55
+ modelName?: string;
56
+ maxTokens?: number;
57
+ temperature?: number;
58
+ }
59
+ /**
60
+ * Get the settings file path: ~/.rigour/settings.json
61
+ */
62
+ export declare function getSettingsPath(): string;
63
+ /**
64
+ * Load settings from ~/.rigour/settings.json
65
+ * Returns empty object if file not found or is malformed
66
+ */
67
+ export declare function loadSettings(): RigourSettings;
68
+ /**
69
+ * Save settings to ~/.rigour/settings.json
70
+ */
71
+ export declare function saveSettings(settings: RigourSettings): void;
72
+ /**
73
+ * Resolve deep analysis options by merging CLI flags with settings.json
74
+ * CLI flags always take precedence over settings.json values
75
+ *
76
+ * @param cliOptions CLI flags provided by user
77
+ * @returns Merged options with CLI taking precedence
78
+ */
79
+ export declare function resolveDeepOptions(cliOptions: CLIDeepOptions): ResolvedDeepOptions;
80
+ /**
81
+ * Get a specific provider's API key from settings
82
+ * Supports both normalized names (claude -> anthropic) and exact keys
83
+ */
84
+ export declare function getProviderKey(providerName: string): string | undefined;
85
+ /**
86
+ * Get agent configuration from settings
87
+ */
88
+ export declare function getAgentConfig(agentName: string): {
89
+ model?: string;
90
+ provider?: string;
91
+ fallback?: string;
92
+ } | undefined;
93
+ /**
94
+ * Get CLI preferences from settings
95
+ */
96
+ export declare function getCliPreferences(): RigourSettings['cli'];
97
+ /**
98
+ * Update a specific provider key in settings
99
+ */
100
+ export declare function updateProviderKey(provider: string, apiKey: string): void;
101
+ /**
102
+ * Remove a provider key from settings
103
+ */
104
+ export declare function removeProviderKey(provider: string): void;