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
[Node] Let Extensions Request Sensitive Environment Variables (#2348)
* [Node] Let Extensions Request Sensitive Environment Variables
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* - Add E2E coverage for the extension environment request
- Fix the factory join-path assertion broken by the new argument
- Pass extension join options only when an extension asks for variables
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* - Treat an empty env list as no environment request
- Apply only approved names from a grant
- Match the docs heading style in the extensions guide
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Keep the client type imports in order
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Rename the extension join option to requestedEnvironmentVariables
`env` means a map of values to supply to a process everywhere else in
this SDK, so a list of names the extension asks for needs its own name.
The new name also matches the wire field exactly.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,21 @@ See [GitHub Releases](https://github.com/github/copilot-sdk/releases) for the fu
7
7
8
8
## [Unreleased]
9
9
10
+
### Feature: extensions can request sensitive environment variables
11
+
12
+
Copilot CLI extensions can now ask for named sensitive environment variables when they join a session. `joinSession()` accepts a `requestedEnvironmentVariables` option listing the variable names the extension needs. The CLI shows a permission prompt naming the extension and the exact variables requested. On approval, only those variables reach that extension and their values are written into the extension process's `process.env` before `joinSession()` resolves. On denial, `joinSession()` rejects, the extension does not load, and its tools never reach the model.
13
+
14
+
An approval is remembered against the exact set of names the user saw, so an extension that later asks for one more variable prompts again. Names that are unset, or that the CLI does not filter from extensions, are not prompted for. This is the client half of the feature; it requires a Copilot CLI that supports extension environment access, and older CLIs ignore the request and grant nothing.
Session create and resume accept a new optional `managedSettings` option that injects an enterprise permissions policy at session startup, alongside the existing `enableManagedSettings` self-fetch flag. The current contract is permissions-only: `disableBypassPermissionsMode` (the literal `"disable"`), plus `deny`, `ask`, and `allow` rule lists. The layer composes restrictively with any server- or device-level managed settings (deny/ask are unioned, every present allow list must admit a tool, and `disableBypassPermissionsMode` is deny-wins).
The `session` object provides methods for sending messages, logging to the timeline, listening to events, and accessing the RPC API. See the `.d.ts` files in the SDK package for full type information.
55
55
56
+
## Requesting Sensitive Environment Variables
57
+
58
+
The CLI strips sensitive environment variables (for example `GITHUB_TOKEN`) from every extension process before it starts. An extension that needs one asks for it by name:
// Granted values are in process.env once joinSession resolves.
68
+
consttoken=process.env.GITHUB_TOKEN;
69
+
```
70
+
71
+
The CLI prompts the user with the extension's name and the exact list of variables requested. If the user approves, only those variables reach this extension and their values are written into `process.env` before `joinSession()` resolves. If the user denies, `joinSession()` rejects, the extension does not load, and its tools never reach the model.
72
+
73
+
An approval is remembered against the exact set of names the user saw, so an extension that later asks for an additional variable prompts again. Names that are unset, or that the CLI does not filter from extensions, are not prompted for.
74
+
75
+
An approved extension can pass a granted value to anything it starts, so ask only for what the extension genuinely needs.
76
+
56
77
## Further Reading
57
78
58
79
-`examples.md` — Practical code examples for tools, hooks, events, and complete extensions
0 commit comments