Skip to content

Commit a0d26a5

Browse files
committed
fix(docs): improve security warnings and examples in exec-mode.md
- Add stronger warnings for --skip-permissions-unsafe flag - Quote $file variable in batch processing example - Add production deployment safeguards and checklist - Address security audit recommendations
1 parent ccf41c6 commit a0d26a5

1 file changed

Lines changed: 44 additions & 9 deletions

File tree

docs/exec-mode.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,32 @@ cortex exec --auto high "Deploy to staging and run integration tests"
175175

176176
### Skip Permissions (DANGEROUS)
177177

178-
The `--skip-permissions-unsafe` flag bypasses all permission checks:
178+
> ⚠️ **EXTREME CAUTION REQUIRED** ⚠️
179+
>
180+
> The `--skip-permissions-unsafe` flag is **inherently dangerous** and should be avoided in almost all cases. Using this flag can lead to:
181+
> - Unintended file deletions or modifications
182+
> - Exposure of sensitive data
183+
> - System-wide changes that are difficult to reverse
184+
> - Security vulnerabilities in your environment
185+
186+
The `--skip-permissions-unsafe` flag bypasses **ALL** permission checks:
179187

180188
```bash
181-
# DANGEROUS: Use only in fully trusted environments
189+
# ⚠️ DANGEROUS: Use only in fully isolated, ephemeral environments
190+
# Never use this on production systems or with sensitive data
182191
cortex exec --skip-permissions-unsafe "full system access task"
183192
```
184193

185-
**Warning:** This flag should only be used in isolated, controlled environments where you fully trust the operations being performed.
194+
**When is this acceptable?**
195+
- Isolated Docker containers that are discarded after use
196+
- Ephemeral CI/CD runners with no sensitive data
197+
- Sandboxed testing environments
198+
199+
**When should you NEVER use this?**
200+
- Production systems
201+
- Any environment with sensitive data or credentials
202+
- Shared development machines
203+
- When processing untrusted input
186204

187205
## Output Formats
188206

@@ -308,8 +326,9 @@ cortex exec --auto low \
308326
#!/bin/bash
309327
# Process multiple files
310328
for file in src/*.rs; do
329+
# Quote variable to prevent word splitting and glob expansion
311330
cortex exec --auto low \
312-
"Add documentation comments to all public functions in $file"
331+
"Add documentation comments to all public functions in \"$file\""
313332
done
314333
```
315334

@@ -444,16 +463,32 @@ status=$(echo "$result" | jq -r '.status')
444463

445464
### 4. Validate Before Production
446465

447-
Test in lower environments first:
466+
Test in lower environments first with proper safeguards:
448467

449468
```bash
450-
# Test in staging
451-
cortex exec --auto medium --cwd /staging "test changes"
469+
# Test in staging with timeout and turn limits
470+
cortex exec --auto medium --cwd /staging \
471+
--timeout 300 --max-turns 20 \
472+
"test changes"
452473

453-
# Then production
454-
cortex exec --auto high --cwd /production "deploy"
474+
# Production deployments should include:
475+
# - Explicit timeouts to prevent runaway execution
476+
# - Turn limits for predictable behavior
477+
# - Logging for audit trails
478+
# - Dry-run verification when possible
479+
cortex exec --auto high --cwd /production \
480+
--timeout 600 --max-turns 50 \
481+
-o jsonl "deploy" 2>&1 | tee deploy-$(date +%Y%m%d-%H%M%S).log
455482
```
456483

484+
**Production Safety Checklist:**
485+
- [ ] Run dry-run or staging tests first
486+
- [ ] Set explicit `--timeout` values
487+
- [ ] Set explicit `--max-turns` limits
488+
- [ ] Enable logging with `-o jsonl` and `tee`
489+
- [ ] Have rollback procedures ready
490+
- [ ] Monitor execution in real-time when possible
491+
457492
### 5. Log and Monitor
458493

459494
Capture output for debugging:

0 commit comments

Comments
 (0)