@tankgate/cli 0.1.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.
- package/dist/commands/audit.d.ts +14 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +138 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/config.d.ts +11 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +128 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +125 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/policy-add-rule.d.ts +16 -0
- package/dist/commands/policy-add-rule.d.ts.map +1 -0
- package/dist/commands/policy-add-rule.js +125 -0
- package/dist/commands/policy-add-rule.js.map +1 -0
- package/dist/commands/policy-edit.d.ts +11 -0
- package/dist/commands/policy-edit.d.ts.map +1 -0
- package/dist/commands/policy-edit.js +34 -0
- package/dist/commands/policy-edit.js.map +1 -0
- package/dist/commands/policy-show.d.ts +11 -0
- package/dist/commands/policy-show.d.ts.map +1 -0
- package/dist/commands/policy-show.js +111 -0
- package/dist/commands/policy-show.js.map +1 -0
- package/dist/commands/preset.d.ts +14 -0
- package/dist/commands/preset.d.ts.map +1 -0
- package/dist/commands/preset.js +115 -0
- package/dist/commands/preset.js.map +1 -0
- package/dist/commands/status.d.ts +11 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +52 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/validate.d.ts +10 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +123 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/policy/validate.d.ts +7 -0
- package/dist/policy/validate.d.ts.map +1 -0
- package/dist/policy/validate.js +89 -0
- package/dist/policy/validate.js.map +1 -0
- package/dist/presets/index.d.ts +57 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +231 -0
- package/dist/presets/index.js.map +1 -0
- package/package.json +65 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* TankGate CLI
|
|
4
|
+
*
|
|
5
|
+
* Runtime policy and containment layer for AI coding agents.
|
|
6
|
+
*
|
|
7
|
+
* Quick Start:
|
|
8
|
+
* tankgate init --preset safe # Initialize with safe preset
|
|
9
|
+
* tankgate config # Interactive configuration
|
|
10
|
+
* tankgate audit # See what's been blocked
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
import { init } from './commands/init';
|
|
14
|
+
import { status } from './commands/status';
|
|
15
|
+
import { validate } from './commands/validate';
|
|
16
|
+
import { audit } from './commands/audit';
|
|
17
|
+
import { policyValidate } from './policy/validate';
|
|
18
|
+
import { policyEdit } from './commands/policy-edit';
|
|
19
|
+
import { policyShow } from './commands/policy-show';
|
|
20
|
+
import { policyAddRule } from './commands/policy-add-rule';
|
|
21
|
+
import { preset, applyPreset } from './commands/preset';
|
|
22
|
+
import { config } from './commands/config';
|
|
23
|
+
const program = new Command();
|
|
24
|
+
program
|
|
25
|
+
.name('tankgate')
|
|
26
|
+
.description('Runtime policy and containment layer for AI coding agents')
|
|
27
|
+
.version('0.1.0');
|
|
28
|
+
// Init command
|
|
29
|
+
program
|
|
30
|
+
.command('init')
|
|
31
|
+
.description('Initialize TankGate in current project')
|
|
32
|
+
.option('-p, --path <dir>', 'Project directory', '.')
|
|
33
|
+
.option('--detect', 'Auto-detect existing agent', false)
|
|
34
|
+
.option('-f, --force', 'Overwrite existing configuration', false)
|
|
35
|
+
.option('--agent <type>', 'Agent type (openclaw|aider|claude-code|cline|continue|custom)')
|
|
36
|
+
.option('--mode <mode>', 'Security mode (contained|convenience)')
|
|
37
|
+
.option('--preset <preset>', 'Security preset (safe|balanced|permissive|readonly)')
|
|
38
|
+
.option('--profile <profile>', 'Scanner profile (fast|standard|paranoid)')
|
|
39
|
+
.option('--approval <channel>', 'Approval channel (telegram|none)')
|
|
40
|
+
.option('-y, --yes', 'Skip prompts, use defaults', false)
|
|
41
|
+
.action(init);
|
|
42
|
+
// Config command - EASY configuration
|
|
43
|
+
program
|
|
44
|
+
.command('config')
|
|
45
|
+
.description('Interactive configuration - answer questions to set up security')
|
|
46
|
+
.option('-p, --path <file>', 'Policy file path', '.tankgate/policies/default.yaml')
|
|
47
|
+
.action(config);
|
|
48
|
+
// Preset command - QUICK preset switching
|
|
49
|
+
program
|
|
50
|
+
.command('preset [name]')
|
|
51
|
+
.description('Switch between security presets (safe|balanced|permissive|readonly)')
|
|
52
|
+
.option('-p, --path <file>', 'Policy file path', '.tankgate/policies/default.yaml')
|
|
53
|
+
.option('--list', 'List available presets', false)
|
|
54
|
+
.action(async (name, options) => {
|
|
55
|
+
if (name) {
|
|
56
|
+
await applyPreset(name, options.path);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
await preset(options);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
// Status command
|
|
63
|
+
program
|
|
64
|
+
.command('status')
|
|
65
|
+
.description('Show TankGate status')
|
|
66
|
+
.option('--json', 'Output as JSON', false)
|
|
67
|
+
.option('-u, --url <url>', 'TankGate URL', 'http://localhost:8080')
|
|
68
|
+
.action(status);
|
|
69
|
+
// Validate command
|
|
70
|
+
program
|
|
71
|
+
.command('validate')
|
|
72
|
+
.description('Validate TankGate configuration')
|
|
73
|
+
.option('-p, --path <dir>', 'Config directory', '.tankgate')
|
|
74
|
+
.action(validate);
|
|
75
|
+
// Audit command - SEE THE VALUE!
|
|
76
|
+
program
|
|
77
|
+
.command('audit')
|
|
78
|
+
.description('View audit log - see what TankGate has protected you from')
|
|
79
|
+
.option('-l, --limit <n>', 'Number of entries to show', '20')
|
|
80
|
+
.option('-b, --blocked', 'Show only blocked actions', false)
|
|
81
|
+
.option('--json', 'Output as JSON', false)
|
|
82
|
+
.option('--db <path>', 'Path to audit database', './.tankgate/audit.db')
|
|
83
|
+
.action(audit);
|
|
84
|
+
// Policy commands (for advanced users)
|
|
85
|
+
const policy = program.command('policy').description('Policy management (advanced)');
|
|
86
|
+
policy
|
|
87
|
+
.command('validate <file>')
|
|
88
|
+
.description('Validate a policy file')
|
|
89
|
+
.action(policyValidate);
|
|
90
|
+
policy
|
|
91
|
+
.command('edit')
|
|
92
|
+
.description('Edit policy file in your editor ($EDITOR)')
|
|
93
|
+
.option('-p, --path <file>', 'Policy file path', '.tankgate/policies/default.yaml')
|
|
94
|
+
.action(policyEdit);
|
|
95
|
+
policy
|
|
96
|
+
.command('show')
|
|
97
|
+
.description('Display current policy')
|
|
98
|
+
.option('-p, --path <file>', 'Policy file path', '.tankgate/policies/default.yaml')
|
|
99
|
+
.option('--json', 'Output as JSON', false)
|
|
100
|
+
.action(policyShow);
|
|
101
|
+
policy
|
|
102
|
+
.command('add-rule')
|
|
103
|
+
.description('Interactively add a new rule to the policy')
|
|
104
|
+
.option('-p, --path <file>', 'Policy file path', '.tankgate/policies/default.yaml')
|
|
105
|
+
.option('--tool <tool>', 'Tool name (Bash, Read, Write, etc.)')
|
|
106
|
+
.option('--action <action>', 'Action name')
|
|
107
|
+
.option('--level <level>', 'Action level (level_0 to level_4)')
|
|
108
|
+
.option('--pattern <pattern>', 'Match pattern (regex)')
|
|
109
|
+
.option('--name <name>', 'Rule name')
|
|
110
|
+
.action(policyAddRule);
|
|
111
|
+
// Parse arguments
|
|
112
|
+
program.parse();
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,E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AC,aAAa,CAAC,CAAC;AAEzB,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/policy/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFhE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tankgate policy validate command
|
|
3
|
+
*
|
|
4
|
+
* Validates a single policy YAML file.
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { parse } from 'yaml';
|
|
8
|
+
export async function policyValidate(file) {
|
|
9
|
+
console.log(chalk.bold(`\n🔍 Validating policy: ${file}\n`));
|
|
10
|
+
try {
|
|
11
|
+
const content = await Bun.file(file).text();
|
|
12
|
+
const policy = parse(content);
|
|
13
|
+
// Validate structure
|
|
14
|
+
const errors = [];
|
|
15
|
+
// Check apiVersion
|
|
16
|
+
if (!policy.apiVersion) {
|
|
17
|
+
errors.push('Missing apiVersion');
|
|
18
|
+
}
|
|
19
|
+
else if (policy.apiVersion !== 'tankgate.dev/v1') {
|
|
20
|
+
errors.push(`Invalid apiVersion: ${policy.apiVersion}`);
|
|
21
|
+
}
|
|
22
|
+
// Check kind
|
|
23
|
+
if (!policy.kind) {
|
|
24
|
+
errors.push('Missing kind');
|
|
25
|
+
}
|
|
26
|
+
else if (policy.kind !== 'AgentPolicy') {
|
|
27
|
+
errors.push(`Invalid kind: ${policy.kind}`);
|
|
28
|
+
}
|
|
29
|
+
// Check metadata
|
|
30
|
+
if (!policy.metadata) {
|
|
31
|
+
errors.push('Missing metadata');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (!policy.metadata.name) {
|
|
35
|
+
errors.push('Missing metadata.name');
|
|
36
|
+
}
|
|
37
|
+
if (!policy.metadata.version) {
|
|
38
|
+
errors.push('Missing metadata.version');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Check tools
|
|
42
|
+
if (!policy.tools) {
|
|
43
|
+
errors.push('Missing tools section');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const validTools = ['filesystem', 'shell', 'network', 'vcs'];
|
|
47
|
+
for (const tool of Object.keys(policy.tools)) {
|
|
48
|
+
if (!validTools.includes(tool)) {
|
|
49
|
+
errors.push(`Unknown tool: ${tool}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Count rules
|
|
54
|
+
let ruleCount = 0;
|
|
55
|
+
if (policy.tools) {
|
|
56
|
+
for (const tool of Object.values(policy.tools)) {
|
|
57
|
+
if (tool && typeof tool === 'object') {
|
|
58
|
+
for (const action of Object.values(tool)) {
|
|
59
|
+
if (action && typeof action === 'object' && 'rules' in action) {
|
|
60
|
+
ruleCount += action.rules?.length ?? 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Print results
|
|
67
|
+
if (errors.length === 0) {
|
|
68
|
+
console.log(chalk.green(`✓ Valid policy: ${policy.metadata.name}`));
|
|
69
|
+
console.log(chalk.gray(` Version: ${policy.metadata.version}`));
|
|
70
|
+
console.log(chalk.gray(` Rules: ${ruleCount}`));
|
|
71
|
+
if (policy.extends && policy.extends.length > 0) {
|
|
72
|
+
console.log(chalk.gray(` Extends: ${policy.extends.join(', ')}`));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.log(chalk.red('✗ Invalid policy'));
|
|
77
|
+
for (const error of errors) {
|
|
78
|
+
console.log(chalk.red(` ✗ ${error}`));
|
|
79
|
+
}
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
console.log(chalk.red(`✗ Failed to read policy file`));
|
|
85
|
+
console.log(chalk.red(` ${e instanceof Error ? e.message : 'Unknown error'}`));
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/policy/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAe7B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,IAAI,IAAI,CAAC,CAAC,CAAC;IAE7D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAe,CAAC;QAE5C,qBAAqB;QACrB,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,mBAAmB;QACnB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;aAAM,IAAI,MAAM,CAAC,UAAU,KAAK,iBAAiB,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,uBAAuB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,aAAa;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9B,CAAC;aAAM,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,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AAC,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TankGate Policy Presets
|
|
3
|
+
*
|
|
4
|
+
* Pre-built configurations for common use cases.
|
|
5
|
+
* Users don't need to understand the DSL - just pick a preset.
|
|
6
|
+
*/
|
|
7
|
+
export type PresetName = 'safe' | 'balanced' | 'permissive' | 'readonly';
|
|
8
|
+
export interface PolicyPreset {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
level: string;
|
|
12
|
+
rules: any[];
|
|
13
|
+
commands?: {
|
|
14
|
+
allowed?: string[];
|
|
15
|
+
blocked?: string[];
|
|
16
|
+
};
|
|
17
|
+
paths?: {
|
|
18
|
+
allowed?: string[];
|
|
19
|
+
blocked?: string[];
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SAFE PRESET
|
|
24
|
+
* Maximum security - blocks anything potentially dangerous
|
|
25
|
+
* Use for: Production systems, sensitive codebases
|
|
26
|
+
*/
|
|
27
|
+
export declare const SAFE_PRESET: PolicyPreset;
|
|
28
|
+
/**
|
|
29
|
+
* BALANCED PRESET
|
|
30
|
+
* Good balance of security and convenience
|
|
31
|
+
* Use for: Most development work
|
|
32
|
+
*/
|
|
33
|
+
export declare const BALANCED_PRESET: PolicyPreset;
|
|
34
|
+
/**
|
|
35
|
+
* PERMISSIVE PRESET
|
|
36
|
+
* Minimal restrictions - just logs
|
|
37
|
+
* Use for: Trusted environments, experimentation
|
|
38
|
+
*/
|
|
39
|
+
export declare const PERMISSIVE_PRESET: PolicyPreset;
|
|
40
|
+
/**
|
|
41
|
+
* READ-ONLY PRESET
|
|
42
|
+
* OpenClaw can only read, never modify
|
|
43
|
+
* Use for: Code review, analysis, learning
|
|
44
|
+
*/
|
|
45
|
+
export declare const READONLY_PRESET: PolicyPreset;
|
|
46
|
+
/**
|
|
47
|
+
* SERVICE ALLOWLIST
|
|
48
|
+
* Pre-defined service configurations
|
|
49
|
+
*/
|
|
50
|
+
export declare const SERVICE_PRESETS: Record<string, string[]>;
|
|
51
|
+
export declare const PRESETS: Record<PresetName, PolicyPreset>;
|
|
52
|
+
export declare function getPreset(name: PresetName): PolicyPreset;
|
|
53
|
+
export declare function listPresets(): {
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
}[];
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;AAEzE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,YA6DzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,YA4C7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAoB/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,YAgD7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAOpD,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,CAKpD,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAExD;AAED,wBAAgB,WAAW,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAAE,CAKrE"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TankGate Policy Presets
|
|
3
|
+
*
|
|
4
|
+
* Pre-built configurations for common use cases.
|
|
5
|
+
* Users don't need to understand the DSL - just pick a preset.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* SAFE PRESET
|
|
9
|
+
* Maximum security - blocks anything potentially dangerous
|
|
10
|
+
* Use for: Production systems, sensitive codebases
|
|
11
|
+
*/
|
|
12
|
+
export const SAFE_PRESET = {
|
|
13
|
+
name: 'Safe Mode',
|
|
14
|
+
description: 'Maximum security. Blocks dangerous operations. Requires approval for most changes.',
|
|
15
|
+
level: 'level_3', // Default to approval required
|
|
16
|
+
rules: [
|
|
17
|
+
// Block dangerous shell commands
|
|
18
|
+
{
|
|
19
|
+
name: 'Block destructive commands',
|
|
20
|
+
level: 'level_4',
|
|
21
|
+
match: { tool: 'Bash', pattern: 'rm\\s+-rf|sudo|chmod\\s+777|dd\\s+if=' },
|
|
22
|
+
message: 'Destructive commands are blocked in Safe mode'
|
|
23
|
+
},
|
|
24
|
+
// Block production/secret paths
|
|
25
|
+
{
|
|
26
|
+
name: 'Block sensitive files',
|
|
27
|
+
level: 'level_4',
|
|
28
|
+
match: { tool: '*', pattern: '\\.env|secrets|credentials|\\.pem|\\.key|password' },
|
|
29
|
+
message: 'Access to sensitive files is blocked'
|
|
30
|
+
},
|
|
31
|
+
// Block network operations
|
|
32
|
+
{
|
|
33
|
+
name: 'Block network tools',
|
|
34
|
+
level: 'level_4',
|
|
35
|
+
match: { tool: 'Bash', pattern: 'curl|wget|nc|netcat|ssh|scp|rsync' },
|
|
36
|
+
message: 'Network operations are blocked in Safe mode'
|
|
37
|
+
},
|
|
38
|
+
// Block package publishing
|
|
39
|
+
{
|
|
40
|
+
name: 'Block publishing',
|
|
41
|
+
level: 'level_4',
|
|
42
|
+
match: { tool: 'Bash', pattern: 'npm publish|docker push|git push' },
|
|
43
|
+
message: 'Publishing is blocked in Safe mode'
|
|
44
|
+
},
|
|
45
|
+
// Require approval for file writes
|
|
46
|
+
{
|
|
47
|
+
name: 'Approve file changes',
|
|
48
|
+
level: 'level_3',
|
|
49
|
+
match: { tool: 'Write' },
|
|
50
|
+
message: 'File changes require approval in Safe mode'
|
|
51
|
+
},
|
|
52
|
+
// Require approval for file edits
|
|
53
|
+
{
|
|
54
|
+
name: 'Approve file edits',
|
|
55
|
+
level: 'level_3',
|
|
56
|
+
match: { tool: 'Edit' },
|
|
57
|
+
message: 'File edits require approval in Safe mode'
|
|
58
|
+
},
|
|
59
|
+
// Log all bash commands
|
|
60
|
+
{
|
|
61
|
+
name: 'Log commands',
|
|
62
|
+
level: 'level_1',
|
|
63
|
+
match: { tool: 'Bash' },
|
|
64
|
+
message: null
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
commands: {
|
|
68
|
+
blocked: ['rm', 'sudo', 'chmod', 'chown', 'curl', 'wget', 'nc', 'ssh', 'scp']
|
|
69
|
+
},
|
|
70
|
+
paths: {
|
|
71
|
+
blocked: ['.env', 'secrets/', 'credentials/', '*.pem', '*.key']
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* BALANCED PRESET
|
|
76
|
+
* Good balance of security and convenience
|
|
77
|
+
* Use for: Most development work
|
|
78
|
+
*/
|
|
79
|
+
export const BALANCED_PRESET = {
|
|
80
|
+
name: 'Balanced Mode',
|
|
81
|
+
description: 'Good balance of security and convenience. Blocks dangerous ops, logs others.',
|
|
82
|
+
level: 'level_1', // Default to logging
|
|
83
|
+
rules: [
|
|
84
|
+
// Block destructive commands
|
|
85
|
+
{
|
|
86
|
+
name: 'Block destructive commands',
|
|
87
|
+
level: 'level_4',
|
|
88
|
+
match: { tool: 'Bash', pattern: 'rm\\s+-rf|sudo|chmod\\s+777' },
|
|
89
|
+
message: 'Destructive commands are blocked'
|
|
90
|
+
},
|
|
91
|
+
// Block sensitive files
|
|
92
|
+
{
|
|
93
|
+
name: 'Block sensitive files',
|
|
94
|
+
level: 'level_4',
|
|
95
|
+
match: { tool: '*', pattern: '\\.env\\.prod|secrets/|credentials/|\\.pem|\\.key' },
|
|
96
|
+
message: 'Access to production secrets is blocked'
|
|
97
|
+
},
|
|
98
|
+
// Block publishing (require approval)
|
|
99
|
+
{
|
|
100
|
+
name: 'Approve publishing',
|
|
101
|
+
level: 'level_3',
|
|
102
|
+
match: { tool: 'Bash', pattern: 'npm publish|docker push' },
|
|
103
|
+
message: 'Publishing requires approval'
|
|
104
|
+
},
|
|
105
|
+
// Notify on sensitive file access
|
|
106
|
+
{
|
|
107
|
+
name: 'Notify on config access',
|
|
108
|
+
level: 'level_2',
|
|
109
|
+
match: { tool: '*', pattern: '\\.env|config/' },
|
|
110
|
+
message: 'Config file accessed'
|
|
111
|
+
},
|
|
112
|
+
// Log all commands
|
|
113
|
+
{
|
|
114
|
+
name: 'Log all commands',
|
|
115
|
+
level: 'level_1',
|
|
116
|
+
match: { tool: 'Bash' },
|
|
117
|
+
message: null
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
commands: {
|
|
121
|
+
blocked: ['rm -rf', 'sudo']
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* PERMISSIVE PRESET
|
|
126
|
+
* Minimal restrictions - just logs
|
|
127
|
+
* Use for: Trusted environments, experimentation
|
|
128
|
+
*/
|
|
129
|
+
export const PERMISSIVE_PRESET = {
|
|
130
|
+
name: 'Permissive Mode',
|
|
131
|
+
description: 'Minimal restrictions. Logs everything but rarely blocks.',
|
|
132
|
+
level: 'level_0', // Default to silent allow
|
|
133
|
+
rules: [
|
|
134
|
+
// Only block truly dangerous operations
|
|
135
|
+
{
|
|
136
|
+
name: 'Block system destruction',
|
|
137
|
+
level: 'level_4',
|
|
138
|
+
match: { tool: 'Bash', pattern: 'rm\\s+-rf\\s+/' },
|
|
139
|
+
message: 'System destruction is always blocked'
|
|
140
|
+
},
|
|
141
|
+
// Log everything
|
|
142
|
+
{
|
|
143
|
+
name: 'Log all actions',
|
|
144
|
+
level: 'level_1',
|
|
145
|
+
match: { tool: '*' },
|
|
146
|
+
message: null
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* READ-ONLY PRESET
|
|
152
|
+
* OpenClaw can only read, never modify
|
|
153
|
+
* Use for: Code review, analysis, learning
|
|
154
|
+
*/
|
|
155
|
+
export const READONLY_PRESET = {
|
|
156
|
+
name: 'Read-Only Mode',
|
|
157
|
+
description: 'OpenClaw can only read files. No modifications allowed.',
|
|
158
|
+
level: 'level_4', // Block by default
|
|
159
|
+
rules: [
|
|
160
|
+
// Allow reads
|
|
161
|
+
{
|
|
162
|
+
name: 'Allow reading',
|
|
163
|
+
level: 'level_0',
|
|
164
|
+
match: { tool: 'Read' },
|
|
165
|
+
message: null
|
|
166
|
+
},
|
|
167
|
+
// Allow safe bash (ls, cat, grep, etc.)
|
|
168
|
+
{
|
|
169
|
+
name: 'Allow safe commands',
|
|
170
|
+
level: 'level_0',
|
|
171
|
+
match: { tool: 'Bash', pattern: '^(ls|cat|grep|find|head|tail|wc|sort|uniq|git status|git log|git diff|git branch)' },
|
|
172
|
+
message: null
|
|
173
|
+
},
|
|
174
|
+
// Block all writes
|
|
175
|
+
{
|
|
176
|
+
name: 'Block writes',
|
|
177
|
+
level: 'level_4',
|
|
178
|
+
match: { tool: 'Write' },
|
|
179
|
+
message: 'Write operations are blocked in Read-Only mode'
|
|
180
|
+
},
|
|
181
|
+
// Block all edits
|
|
182
|
+
{
|
|
183
|
+
name: 'Block edits',
|
|
184
|
+
level: 'level_4',
|
|
185
|
+
match: { tool: 'Edit' },
|
|
186
|
+
message: 'Edit operations are blocked in Read-Only mode'
|
|
187
|
+
},
|
|
188
|
+
// Block dangerous bash
|
|
189
|
+
{
|
|
190
|
+
name: 'Block modifying commands',
|
|
191
|
+
level: 'level_4',
|
|
192
|
+
match: { tool: 'Bash', pattern: 'rm|mv|cp|mkdir|rmdir|touch|chmod|chown|sudo' },
|
|
193
|
+
message: 'Modifying commands are blocked in Read-Only mode'
|
|
194
|
+
},
|
|
195
|
+
// Block web search (optional - remove if you want to allow)
|
|
196
|
+
{
|
|
197
|
+
name: 'Log web searches',
|
|
198
|
+
level: 'level_1',
|
|
199
|
+
match: { tool: 'WebSearch' },
|
|
200
|
+
message: null
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* SERVICE ALLOWLIST
|
|
206
|
+
* Pre-defined service configurations
|
|
207
|
+
*/
|
|
208
|
+
export const SERVICE_PRESETS = {
|
|
209
|
+
git: ['git status', 'git log', 'git diff', 'git branch', 'git add', 'git commit', 'git push', 'git pull'],
|
|
210
|
+
npm: ['npm install', 'npm run', 'npm test', 'npm build'],
|
|
211
|
+
docker: ['docker ps', 'docker logs', 'docker compose up', 'docker compose down'],
|
|
212
|
+
python: ['python', 'pip install', 'pytest'],
|
|
213
|
+
bun: ['bun install', 'bun run', 'bun test'],
|
|
214
|
+
all: ['*'] // Allow all
|
|
215
|
+
};
|
|
216
|
+
export const PRESETS = {
|
|
217
|
+
safe: SAFE_PRESET,
|
|
218
|
+
balanced: BALANCED_PRESET,
|
|
219
|
+
permissive: PERMISSIVE_PRESET,
|
|
220
|
+
readonly: READONLY_PRESET
|
|
221
|
+
};
|
|
222
|
+
export function getPreset(name) {
|
|
223
|
+
return PRESETS[name];
|
|
224
|
+
}
|
|
225
|
+
export function listPresets() {
|
|
226
|
+
return Object.entries(PRESETS).map(([key, preset]) => ({
|
|
227
|
+
name: key,
|
|
228
|
+
description: preset.description
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,oFAAoF;IACjG,KAAK,EAAE,SAAS,EAAE,+BAA+B;IACjD,KAAK,EAAE;QACL,iCAAiC;QACjC;YACE,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,uCAAuC,EAAE;YACzE,OAAO,EAAE,+CAA+C;SACzD;QACD,gCAAgC;QAChC;YACE,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,mDAAmD,EAAE;YAClF,OAAO,EAAE,sCAAsC;SAChD;QACD,2BAA2B;QAC3B;YACE,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mCAAmC,EAAE;YACrE,OAAO,EAAE,6CAA6C;SACvD;QACD,2BAA2B;QAC3B;YACE,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,EAAE;YACpE,OAAO,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,WAAW,CAAC;IACxD,MAAM,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,qBAAqB,CAAC;IAChF,MAAM,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,CAAC;IAC3C,GAAG,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC;IAC3C,GAAG,EAAE,CAAC,GAAG,CAAC,CAAE,YAAY;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAqC;IACvD,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;IACzB,UAAU,EAAE,iBAAiB;IAC7B,QAAQ,EAAE,eAAe;CAC1B,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,IAAgB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tankgate/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Runtime policy and containment layer for AI coding agents",
|
|
5
|
+
"author": "TankPkg",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/tankpkg/tankgate.git",
|
|
10
|
+
"directory": "packages/cli"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/tankpkg/tankgate#readme",
|
|
13
|
+
"bugs": "https://github.com/tankpkg/tankgate/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai",
|
|
16
|
+
"agent",
|
|
17
|
+
"security",
|
|
18
|
+
"policy",
|
|
19
|
+
"openclaw",
|
|
20
|
+
"aider",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"containment"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bin": {
|
|
26
|
+
"tankgate": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc",
|
|
42
|
+
"dev": "tsc --watch",
|
|
43
|
+
"prepublishOnly": "bun run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@tankgate/core": "workspace:*",
|
|
47
|
+
"@inquirer/prompts": "^7.0.0",
|
|
48
|
+
"chalk": "^5.3.0",
|
|
49
|
+
"commander": "^12.0.0",
|
|
50
|
+
"ora": "^8.0.0",
|
|
51
|
+
"yaml": "^2.8.2",
|
|
52
|
+
"zod": "^4.3.6"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/bun": "latest",
|
|
56
|
+
"typescript": "^5"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public",
|
|
60
|
+
"registry": "https://registry.npmjs.org/"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=18"
|
|
64
|
+
}
|
|
65
|
+
}
|