Skip to content

Commit 6a5ab36

Browse files
improve the cli to identify issues quickly
1 parent 6f1a675 commit 6a5ab36

13 files changed

Lines changed: 734 additions & 84 deletions

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,18 @@ Key scripts designed to boost developer productivity:
103103

104104
**`osa copilot audit-auto-approve`** - Audit GitHub Copilot Auto-Approve Tasks
105105

106-
- **Problem Solved**: Ensures VSCode Copilot autoApproveTasks only contain safe Gradle patterns
107-
- **How It Works**: Scans VSCode settings for risky auto-approve patterns in Gradle build files
108-
- **Usage**: `osa copilot audit-auto-approve [--allow-prefix <prefixes>] [--fail-on-risk] [--json]`
106+
- **Problem Solved**: Ensures VSCode Copilot autoApproveTasks only contain safe patterns and blocks dangerous commands
107+
- **Security Guards**: Blocks rm -rf, directory traversal (..), privilege escalation (sudo), system operations, and more
108+
- **How It Works**: Scans VSCode user settings (~/.vscode/settings.json) and workspace settings (.vscode/settings.json) for risky auto-approve patterns
109+
- **Usage**: `osa copilot audit-auto-approve [--allow-prefix <prefixes>] [--settings-file <path>] [--scan-prefixes] [--fail-on-risk] [--json]`
109110
- **Options**:
110-
- `--allow-prefix`: Comma-separated allowed prefixes (default: "tachyon")
111+
- `--allow-prefix`: Optional comma-separated allowed prefixes for safe Gradle tasks (auto-scans if not provided)
112+
- `--settings-file`: Optional path to specific VSCode settings.json (searches user & workspace by default)
113+
- `--scan-prefixes`: Auto-scan and report health of all prefixes found
111114
- `--fail-on-risk`: Exit with error if risky patterns found
112115
- `--json`: Output results in JSON format
116+
- **Risky Patterns Blocked**: rm -rf (with dangerous paths), directory traversal, sudo, system commands, eval/exec, dangerous globs
117+
- **Safe rm -rf targets**: node_modules, build, dist, .next, .cache, temp directories
113118
- **Perfect For**: Security auditing, CI/CD pipelines, team policy enforcement
114119

115120
## Productivity Benefits

js/cli.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,33 @@ copilot
2727
.description("Audit VSCode Copilot autoApproveTasks for safe Gradle patterns")
2828
.option(
2929
"--allow-prefix <list>",
30-
"Comma-separated prefixes (e.g. tachyon,vllc)",
31-
"tachyon",
30+
"Comma-separated allowed prefixes (optional - will auto-scan if not provided)",
3231
)
33-
.option("--fail-on-risk", "Exit non-zero if risky patterns found", false)
32+
.option(
33+
"--settings-file <path>",
34+
"Path to VSCode settings.json file to audit (searches user & workspace by default)",
35+
)
36+
.option("--fail-on-risk", "Exit non-zero if risky patterns found", true)
3437
.option("--json", "Output JSON", false)
35-
.action(auditAutoApprove);
38+
.option("--scan-prefixes", "Auto-scan and report prefix health", false)
39+
.option("--silent", "Suppress success messages", false)
40+
.action(async (opts: {
41+
allowPrefix?: string;
42+
settingsFile?: string;
43+
failOnRisk: boolean;
44+
json: boolean;
45+
scanPrefixes: boolean;
46+
silent: boolean;
47+
}) => {
48+
await auditAutoApprove({
49+
allowPrefix: opts.allowPrefix,
50+
settingsFile: opts.settingsFile,
51+
failOnRisk: opts.failOnRisk,
52+
json: opts.json,
53+
scanPrefixes: opts.scanPrefixes,
54+
silent: opts.silent,
55+
});
56+
});
3657

3758
// Command: setup
3859
program

0 commit comments

Comments
 (0)