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
feat!: default-deny permissions across all SDK languages
Previously, the SDKs only set requestPermission=true in the JSON-RPC
session.create/session.resume calls when an onPermissionRequest handler
was provided. When no handler was registered, requestPermission was
omitted/false, allowing the CLI to handle permissions itself (permissive
default).
This change makes requestPermission always true so that all permission
requests are routed through the SDK. The SDK's existing deny-by-default
behavior (returning 'denied-no-approval-rule-and-could-not-request-from-user'
when no handler is registered) now takes effect for all sessions.
BREAKING CHANGE: Apps that do not provide an onPermissionRequest handler
will now have all privileged tool operations (file writes, shell commands,
URL fetches, MCP calls) denied by default. Register a handler to approve
operations:
Node.js:
onPermissionRequest: async (request) => ({ kind: 'approved' })
Python:
'on_permission_request': lambda req, inv: {'kind': 'approved'}
Go:
OnPermissionRequest: func(r PermissionRequest, i PermissionInvocation) (PermissionRequestResult, error) {
return PermissionRequestResult{Kind: 'approved'}, nil
}
.NET:
OnPermissionRequest = (req, inv) => Task.FromResult(new PermissionRequestResult { Kind = 'approved' })
Changes:
- nodejs/src/client.ts: always send requestPermission:true
- python/copilot/client.py: always set requestPermission=True
- go/client.go: always set RequestPermission=true
- dotnet/src/Client.cs: always pass true for RequestPermission
- All samples updated to include onPermissionRequest approve-all handler
- All language READMEs updated with Permission Requests documentation section
- docs/compatibility.md: fix incorrect PermissionRequestResult format and
add default-deny description
- go/types.go: update OnPermissionRequest doc comment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/compatibility.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,19 +124,21 @@ The `--share` option is not available via SDK. Workarounds:
124
124
125
125
### Permission Control
126
126
127
+
The SDK uses a **deny-by-default** permission model. All permission requests (file writes, shell commands, URL fetches, etc.) are denied unless your app provides an `onPermissionRequest` handler.
128
+
127
129
Instead of `--allow-all-paths` or `--yolo`, use the permission handler:
Copy file name to clipboardExpand all lines: dotnet/README.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -495,6 +495,43 @@ var session = await client.CreateSessionAsync(new SessionConfig
495
495
});
496
496
```
497
497
498
+
## Permission Requests
499
+
500
+
The SDK uses a **deny-by-default** permission model. When the Copilot agent needs to perform privileged operations (file writes, shell commands, URL fetches, etc.), it sends a permission request to the SDK. If no `OnPermissionRequest` handler is registered, all such requests are **automatically denied**.
501
+
502
+
To allow operations, provide an `OnPermissionRequest` handler when creating a session:
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `Type: "azure"`, not `Type: "openai"`.
446
446
> - The `BaseURL` should be just the host (e.g., `https://my-resource.openai.azure.com`). Do **not** include `/openai/v1` in the URL - the SDK handles path construction automatically.
447
447
448
+
## Permission Requests
449
+
450
+
The SDK uses a **deny-by-default** permission model. When the Copilot agent needs to perform privileged operations (file writes, shell commands, URL fetches, etc.), it sends a permission request to the SDK. If no `OnPermissionRequest` handler is registered, all such requests are **automatically denied**.
451
+
452
+
To allow operations, provide an `OnPermissionRequest` handler when creating a session:
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `type: "azure"`, not `type: "openai"`.
566
566
> - The `baseUrl` should be just the host (e.g., `https://my-resource.openai.azure.com`). Do **not** include `/openai/v1` in the URL - the SDK handles path construction automatically.
567
567
568
+
## Permission Requests
569
+
570
+
The SDK uses a **deny-by-default** permission model. When the Copilot agent needs to perform privileged operations (file writes, shell commands, URL fetches, etc.), it sends a permission request to the SDK. If no `onPermissionRequest` handler is registered, all such requests are **automatically denied**.
571
+
572
+
To allow operations, provide an `onPermissionRequest` handler when creating a session:
0 commit comments