-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
34 lines (29 loc) · 1.2 KB
/
Copy pathindex.ts
File metadata and controls
34 lines (29 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Built-in rules index.
*
* This is the registry of all rules that ship with @sentinel-scan/core.
* Only built-in rules in BUILT_IN_RULES are executed today — the runner
* resolves rule IDs from ScanConfig.rules via this map. Unknown rule IDs
* produce a config-warning ScanDiagnostic and are skipped (not executed).
*
* Custom/third-party rule loading is not yet supported and is future work.
*/
import type { Rule } from '../model/rule.js'
import { missingErrorHandler } from './missing-error-handler.js'
import { noHardcodedUrl } from './no-hardcoded-url.js'
export { noHardcodedUrl } from './no-hardcoded-url.js'
export { missingErrorHandler } from './missing-error-handler.js'
/**
* All built-in rules, keyed by their ID.
* The runner uses this map to look up rules by the IDs in ScanConfig.rules.
*/
export const BUILT_IN_RULES: Readonly<Map<string, Rule>> = new Map([
[noHardcodedUrl.meta.id, noHardcodedUrl],
[missingErrorHandler.meta.id, missingErrorHandler],
])
/**
* The set of rules enabled by default (recommended: true).
*/
export const RECOMMENDED_RULES: readonly string[] = Array.from(BUILT_IN_RULES.values())
.filter((rule) => rule.meta.recommended)
.map((rule) => rule.meta.id)