-
Notifications
You must be signed in to change notification settings - Fork 913
Breaking change: deny all permissions by default #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
ca0e7f7
07bdcd1
7ba9d36
64256b9
a7bee9d
ae9a038
1135709
2ade8c3
f124485
9941b3a
6091fd7
9ca4554
a5cc0b7
594196b
63852b5
8aa82f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| namespace GitHub.Copilot.SDK; | ||
|
|
||
| /// <summary>Provides pre-built <see cref="PermissionRequestHandler"/> implementations.</summary> | ||
| public static class PermissionHandler | ||
| { | ||
| /// <summary>A <see cref="PermissionRequestHandler"/> that approves all permission requests.</summary> | ||
| public static PermissionRequestHandler ApproveAll { get; } = | ||
| (_, _) => Task.FromResult(new PermissionRequestResult { Kind = "approved" }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package copilot | ||
|
|
||
| // PermissionHandler provides pre-built OnPermissionRequest implementations. | ||
| var PermissionHandler = struct { | ||
| // ApproveAll approves all permission requests. | ||
| ApproveAll func(PermissionRequest, PermissionInvocation) (PermissionRequestResult, error) | ||
| }{ | ||
| ApproveAll: func(_ PermissionRequest, _ PermissionInvocation) (PermissionRequestResult, error) { | ||
| return PermissionRequestResult{Kind: "approved"}, nil | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,10 @@ func main() { | |
| } | ||
| defer client.Stop() | ||
|
|
||
| session, err := client.CreateSession(ctx, nil) | ||
| session, err := client.CreateSession(ctx, &copilot.SessionConfig{ | ||
| CLIPath: cliPath, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invalid field in SessionConfig
This line should be removed. The correct code should be: session, err := client.CreateSession(ctx, &copilot.SessionConfig{
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
})This appears to be a copy-paste error. The other language samples (Node.js, Python, .NET) correctly omit the CLI path from their session configuration.
|
||
| OnPermissionRequest: copilot.PermissionHandler.ApproveAll, | ||
| }) | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same documentation enhancement suggestion as for
SessionConfig.OnPermissionRequestabove - clarify the deny-by-default behavior.