Repository navigation
Python: narrow unscoped Copilot URL session approvals - #10149
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change that limits unscoped URL approvals to a single request.
No open issues 🎉
What changed in this PR
This PR narrows unscoped URL permission approvals in the Python GitHub Copilot integration, preventing inferred hostname scopes from granting broader session access than intended.
Changes:
- Converts bare URL session approvals to one-time approvals while preserving explicit
domain=scopes and structured tool approvals. - Expands regression coverage for URL variants and explicit-domain pass-through.
- Documents the fallback behavior and removes URL-domain inference code.
| File | Description |
|---|---|
python/packages/github_copilot/tests/test_github_copilot_agent.py |
Tests one-time URL approvals and preservation of explicit domains. |
python/packages/github_copilot/README.md |
Explains URL approval fallback and explicit session scopes. |
python/packages/github_copilot/agent_framework_github_copilot/_agent.py |
Removes hostname inference and narrows unscoped URL approvals to one request. |
Review effort: Balanced
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 9ff75e163c93
Model: gpt-5.6-sol
Overview
The change fails closed by converting bare URL session approvals to one-time approvals while preserving explicit domains and structured non-URL session scopes. The wrapper remains applied across new and resumed sessions, and the regression matrix covers URL parsing boundaries, malformed input, explicit scopes, and decision pass-through. No publishable Critical, High, or Medium issue was established.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Motivation & Context
A bare
PermissionDecisionApproveForSession()does not specify a URL permission scope. Deriving that scope from only the requested hostname can discard meaningful URL boundaries such as the scheme and explicit port, allowing the resulting session approval to cover more than the triggering request.This change keeps the existing crash avoidance for under-specified decisions while ensuring URL permissions fail closed to a single request unless the caller provides an explicit
domain=scope.Description & Review Guide
PermissionDecisionApproveOnce()instead of a framework-derived hostname approval. Explicit caller-supplieddomain=values remain unchanged. The regression matrix covers protocol, default and non-default ports, IPv4, IPv6, IDNA, trailing dots, userinfo, parser ambiguity, malformed URLs, and explicit domains. The package README documents the behavior.domain=. Structured tool session approvals and public API signatures are unchanged.Related Issue
N/A - maintainer-directed correction to URL permission scope normalization; no public issue or competing pull request.
AI Assistance
AI assistance details: Implementation, regression tests, documentation, and PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix such as "Python:" or ".NET:") — a workflow keeps the label and the title prefix in sync automatically.