You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Copilot CLI permissions system currently has several critical issues that impact user experience, from incorrect path detection to lack of documentation. This proposal consolidates findings from 16+ related issues and provides concrete, prioritized solutions with implementation paths.
Key Finding: Core permission flags (--allow-all-tools, --allow-all-paths, etc.) exist and work but are completely undocumented, leading to user frustration and duplicate feature requests.
Problem Categories
1. Documentation Gap (Critical)
Current State:
Permission flags exist in --help but not in README
No usage examples or best practices documented
Users assume features don't exist and file duplicate requests
Impact: Medium - Users approve blindly or reject safe operations
Proposed Solutions
Phase 1: Documentation (Immediate - Can be done in 1 week)
Priority: CRITICAL⚠️
Effort: LOW 🟢
Impact: HIGH 📈
Tasks:
Add Permissions Section to README
## Permission System
Copilot CLI includes a flexible permission system for safe autonomous operation.
### Available Flags-`--allow-all-tools` - Auto-approve all tool executions
-`--allow-all-paths` - Allow access to any file path
-`--allow-tool [tools...]` - Allow specific tools only
-`--deny-tool [tools...]` - Block specific tools (takes precedence)
-`--add-dir <directory>` - Add directory to allowlist
### Security Considerations- Use `--allow-all-*` only in isolated environments (Docker, VMs, CI)
- Prefer granular permissions (`--allow-tool`, `--add-dir`) for production
- Use `--deny-tool` to block dangerous operations
- Review session logs in `~/.copilot/logs/` after autonomous runs
Document in Changelog
Add note that flags were added in v0.0.340 (for --allow-all-paths)
Clarify other flags existed earlier
Deliverable: Pull request with updated README.md
Success Metric: Reduction in duplicate permission-related feature requests
// Current (broken): Treats /i as path in "findstr /i pattern"// Fixed: Recognize command flags vs pathsfunctionextractPaths(command){// Parse command structure firstconst{ executable, flags, arguments }=parseCommand(command);// Filter out known flags for each executableconstknownFlags=getKnownFlags(executable);// findstr: ['/i', '/v', ...]// Only extract actual paths, not flagsreturnarguments.filter(arg=>!knownFlags.includes(arg.toLowerCase())&&looksLikePath(arg));}
Test Cases:
✅ findstr /i "text" - Should not detect /i as path
✅ grep -i pattern - Should not detect -i as path
✅ curl -s https://example.com - Should not detect -s as path
interfaceCommandExplanation{tool: string;// "shell(git push)"command: string;// "git push origin main"description: string;// What it doesriskLevel: 'safe'|'moderate'|'dangerous';risks: string[];// Specific risks}asyncfunctionexplainCommand(tool: string,command: string): Promise<CommandExplanation>{// Use LLM to generate explanationconstprompt=` Explain this command for a beginner: Tool: ${tool} Command: ${command} Provide: 1. One sentence: What the tool is 2. One sentence: What this command does 3. Risk level (safe/moderate/dangerous) 4. Specific risks if any `;returnawaitcallLLM(prompt);}
UI Enhancement:
┌─────────────────────────────────────────────────────────────┐
│ Permission Required: shell(git push) │
├─────────────────────────────────────────────────────────────┤
│ Command: git push origin main │
│ │
│ ℹ️ What it does: │
│ Git push uploads your local commits to the remote │
│ repository, making your changes visible to others. │
│ │
│ ⚠️ Risk: MODERATE │
│ • Makes permanent changes to remote repository │
│ • Other team members will see these changes │
│ • Cannot be easily undone if already pulled by others │
│ │
│ Options: │
│ [A] Approve once │
│ [T] Approve for this session │
│ [R] Reject │
│ [?] More details │
└─────────────────────────────────────────────────────────────┘
Total Quick Wins Timeline: 1-2 weeks Total Quick Wins Impact: Resolves 4 issues, improves 10+ others
Testing Strategy
Unit Tests
describe('Path Detection',()=>{it('should not treat command flags as paths',()=>{expect(extractPaths('findstr /i "text"')).toEqual([]);expect(extractPaths('grep -i pattern')).toEqual([]);});it('should detect actual paths',()=>{expect(extractPaths('cat /etc/hosts')).toEqual(['/etc/hosts']);expect(extractPaths('findstr "text" C:\\file.txt')).toEqual(['C:\\file.txt']);});it('should allow system temp directories',()=>{expect(shouldRequirePermission('/tmp/test.txt')).toBe(false);expect(shouldRequirePermission('C:\\TEMP\\test.txt')).toBe(false);});});describe('Permission Flags',()=>{it('should allow all tools when flag set',async()=>{constcli=newCopilotCLI({allowAllTools: true});constresult=awaitcli.execute('shell','ls -la');expect(result.requiresApproval).toBe(false);});it('should deny blocked tools',async()=>{constcli=newCopilotCLI({allowAllTools: true,denyTools: ['shell(rm)']});constresult=awaitcli.execute('shell','rm file.txt');expect(result.denied).toBe(true);});});
Integration Tests
# Test autonomous mode
copilot --allow-all-tools --allow-all-paths -p "create test.txt"# Should NOT prompt for approval# Test granular permissions
copilot --allow-tool 'read' -p "write to file"# SHOULD prompt (write not allowed)# Test deny precedence
copilot --allow-tool 'shell(git:*)' --deny-tool 'shell(git push)' -p "git push"# SHOULD block with clear message# Test system paths
copilot -p "create file in /tmp"# Should NOT prompt (system path)
Regression Tests
Ensure existing workflows still work
Verify no new false positives introduced
Test on Windows, macOS, Linux
Success Metrics
Short-term (3 months)
✅ README documentation merged
✅ Zero false positive reports for path detection
✅ 50% reduction in permission-related support tickets
✅ All 4 quick wins implemented
Medium-term (6 months)
✅ Enhanced approval prompts released
✅ User satisfaction score >4.5/5 for permission system
✅ 80% of users understand permission flags
✅ Command explanations feature opt-in rate >60%
Long-term (12 months)
✅ Configuration profiles released
✅ Per-project permissions adopted by >50% of teams
"I just want to test in my sandbox without constant prompts"
— Issue #307
"The /i flag is not a path, please fix this"
— Issue #67
"I have no idea what this command does, should I approve it?"
— Issue #291
"Why does it ask about /tmp? That's obviously safe"
— Issue #306
Conclusion
The permissions system is foundational to Copilot CLI's value proposition: powerful AI assistance with user safety. Current issues stem primarily from:
Executive Summary
The Copilot CLI permissions system currently has several critical issues that impact user experience, from incorrect path detection to lack of documentation. This proposal consolidates findings from 16+ related issues and provides concrete, prioritized solutions with implementation paths.
Key Finding: Core permission flags (
--allow-all-tools,--allow-all-paths, etc.) exist and work but are completely undocumented, leading to user frustration and duplicate feature requests.Problem Categories
1. Documentation Gap (Critical)
Current State:
--helpbut not in READMEAffected Issues: #307
Impact: High - Wastes user time and creates confusion
2. Path Detection Issues (High Priority)
Problem: Incorrect path parsing triggers false positive permission prompts
Examples:
/iflag infindstr /iincorrectly detected as pathRoot Cause: Overly aggressive path extraction from command arguments
Impact: High - Breaks legitimate workflows, especially on Windows
3. Approval UX Issues (Medium Priority)
Problem: Permission prompts lack context for informed decisions
Examples:
Impact: Medium - Users approve blindly or reject safe operations
Proposed Solutions
Phase 1: Documentation (Immediate - Can be done in 1 week)
Priority: CRITICAL⚠️
Effort: LOW 🟢
Impact: HIGH 📈
Tasks:
Add Permissions Section to README
Add Usage Examples
Safe Mode (Specific Permissions)
Defensive Mode (Block Dangerous Commands)
Add Security Best Practices
Document in Changelog
--allow-all-paths)Deliverable: Pull request with updated README.md
Success Metric: Reduction in duplicate permission-related feature requests
Phase 2: Path Detection Fixes (Short-term - 2-4 weeks)
Priority: HIGH 🔴
Effort: MEDIUM 🟡
Impact: HIGH 📈
Problem Statement:
Current path extraction logic has false positives that break legitimate workflows.
Proposed Solutions:
2.1 Fix Command Argument Parsing
Issue #67 Fix:
Test Cases:
findstr /i "text"- Should not detect/ias pathgrep -i pattern- Should not detect-ias pathcurl -s https://example.com- Should not detect-sas path2.2 Auto-Allow System Directories
Issue #306 Fix:
Configuration Option:
{ "auto_allow_paths": [ "$TEMP", "$TMP", "/tmp", "~/.cache" ] }Deliverable: Fix PR with tests for path detection logic
Success Metric:
Phase 3: Approval UX Improvements (Medium-term - 4-8 weeks)
Priority: MEDIUM 🟠
Effort: MEDIUM 🟡
Impact: MEDIUM 📊
Problem Statement:
Users approve/reject operations blindly because prompts lack context.
Proposed Solutions:
3.1 Add Command Explanations (Issue #291)
Implementation:
UI Enhancement:
Cost Consideration:
--no-explanationsflag3.2 Show Filenames in Edit Prompts (Issue #301)
Current:
Improved:
Implementation:
Deliverable: Enhanced approval prompts with context
Success Metric:
Phase 4: Configuration System (Long-term - 8-12 weeks)
Priority: LOW 🟢
Effort: HIGH 🔴
Impact: HIGH 📈
Problem Statement:
Users need persistent permission configurations without typing flags every time.
Proposed Solution:
4.1 Persistent Permission Profiles
Configuration File:
~/.copilot/permissions.json{ "profiles": { "default": { "mode": "interactive", "auto_allow_system_paths": true, "auto_allow_read_only": false }, "testing": { "mode": "autonomous", "allow_all_tools": true, "allow_all_paths": true, "deny_tools": ["shell(rm -rf)", "shell(sudo)"], "applies_to": ["/tmp/*", "~/sandbox/*"] }, "safe-dev": { "mode": "granular", "allow_tools": ["read", "write", "shell(git:*)"], "deny_tools": ["shell(git push)", "shell(rm)"], "allowed_paths": ["~/projects/*"], "require_confirmation": ["write", "shell"] } }, "active_profile": "default" }Usage:
4.2 Per-Project Permissions
File:
.copilot-permissions.json(in project root){ "project": "my-app", "permissions": { "allow_tools": ["read", "write", "shell(npm:*)", "shell(git:*)"], "deny_tools": ["shell(npm publish)", "shell(git push)"], "allowed_paths": [ "./src/**", "./tests/**", "./node_modules/**" ], "auto_approve": { "read_only": true, "write_to_src": false, "git_commits": true } } }Behavior:
Deliverable: Complete configuration system with profiles
Success Metric:
Implementation Priority Matrix
Quick Wins (Immediate Actions)
These can be done within 1-2 weeks with minimal effort:
1. Update README.md ✅
2. Fix /i Flag False Positive ✅
3. Auto-Allow $TEMP Directory ✅
4. Show Filename in Edit Prompts ✅
Total Quick Wins Timeline: 1-2 weeks
Total Quick Wins Impact: Resolves 4 issues, improves 10+ others
Testing Strategy
Unit Tests
Integration Tests
Regression Tests
Success Metrics
Short-term (3 months)
Medium-term (6 months)
Long-term (12 months)
Risk Assessment
Low Risk
Medium Risk
High Risk
Mitigation:
Alternative Approaches Considered
1. Remove Permissions Entirely
Pros: No UX friction
Cons: Major security risk, not acceptable
Decision: Rejected
2. Always Require Approval
Pros: Maximum security
Cons: Unusable for CI/CD, frustrating for power users
Decision: Rejected - but kept as default
3. AI-Based Risk Assessment
Pros: Intelligent auto-approval of safe operations
Cons: Complex, expensive, unpredictable
Decision: Deferred to future research
Community Input
Related Issues Analysis
From Epic #316, 16 issues identified. Top patterns:
User Quotes
Conclusion
The permissions system is foundational to Copilot CLI's value proposition: powerful AI assistance with user safety. Current issues stem primarily from:
Recommended Immediate Actions:
These 4 actions resolve 40%+ of reported permission issues with minimal effort.
Long-term Vision:
A flexible, intelligent permission system that:
Appendix: Flag Syntax Reference
Complete Flag Reference
Pattern Syntax
Environment Variable
Feedback & Contribution
This proposal is open for community feedback:
Maintainer Contact: @williammartin (GitHub Staff)