-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
66 lines (59 loc) · 1.92 KB
/
index.d.ts
File metadata and controls
66 lines (59 loc) · 1.92 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
export interface Pattern {
id: string;
pattern: string;
message?: string;
category: string;
severity?: 'critical' | 'high' | 'medium';
platforms: ('linux' | 'macos' | 'windows')[];
notes?: string;
added: string;
tests?: {
should_match?: string[];
should_not_match?: string[];
};
}
export interface PatternFile {
version: string;
scope: 'bash' | 'read';
type: 'dangerous' | 'safe' | 'sensitive';
match_mode: 'search' | 'fullmatch';
patterns: Pattern[];
}
export interface Meta {
schema_version: string;
patterns_version: string;
stats: Record<string, number>;
total: number;
regex_notes: Record<string, string>;
compatibility: { python: string; node: string };
}
export interface MatchResult {
matched: boolean;
pattern?: Pattern;
}
export interface CheckOptions {
/**
* Platform filtering.
* - 'auto' (default): detect from process.platform
* - 'linux' | 'macos' | 'windows': explicit platform
* - null: disable filtering (check all patterns regardless of platform)
*/
platform?: 'auto' | 'linux' | 'macos' | 'windows' | null;
}
export const bashDangerous: PatternFile;
export const bashSafe: PatternFile;
export const readDangerous: PatternFile;
export const readSensitive: PatternFile;
export const readSafe: PatternFile;
export const meta: Meta;
export const version: string;
export function checkBashDangerous(command: string, options?: CheckOptions): MatchResult;
export function checkBashSafe(command: string, options?: CheckOptions): MatchResult;
export function checkReadDangerous(filePath: string, options?: CheckOptions): MatchResult;
export function checkReadSensitive(filePath: string, options?: CheckOptions): MatchResult;
export function checkReadSafe(filePath: string, options?: CheckOptions): MatchResult;
/**
* Preload and compile all pattern files. Call at startup to avoid
* sync I/O latency on first check call.
*/
export function preload(): Promise<void>;