-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathenvironment.ts
More file actions
45 lines (42 loc) · 1011 Bytes
/
Copy pathenvironment.ts
File metadata and controls
45 lines (42 loc) · 1011 Bytes
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
/**
* Environment variable checking for the doctor command.
*/
import type { EnvVarInfo } from '@/bin/doctor/types';
const ENV_VARS: Array<{
name: string;
description: string;
defaultBehavior: string;
}> = [
{
name: 'SAFETY_NET_ASK',
description: 'Prompt user instead of blocking',
defaultBehavior: 'off',
},
{
name: 'SAFETY_NET_STRICT',
description: 'Fail-closed on unparseable commands',
defaultBehavior: 'permissive',
},
{
name: 'SAFETY_NET_PARANOID',
description: 'Enable all paranoid checks',
defaultBehavior: 'off',
},
{
name: 'SAFETY_NET_PARANOID_RM',
description: 'Block rm -rf even within cwd',
defaultBehavior: 'off',
},
{
name: 'SAFETY_NET_PARANOID_INTERPRETERS',
description: 'Block interpreter one-liners',
defaultBehavior: 'off',
},
];
export function getEnvironmentInfo(): EnvVarInfo[] {
return ENV_VARS.map((v) => ({
...v,
value: process.env[v.name],
isSet: v.name in process.env,
}));
}