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
Add a tokenless session.api.github.request surface for extensions that routes current-repository GitHub REST requests through the host runtime. The default API is GET-only, repository-relative, and includes client-side validation against arbitrary URLs or repository selection.
Regenerate Node and Rust RPC surfaces, add focused Node coverage for wire payloads and unsafe input rejection, and document the extension API contract.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
54
+
The `session` object provides methods for sending messages, logging to the timeline, listening to events, and accessing host-mediated APIs. See the `.d.ts` files in the SDK package for full type information.
55
+
56
+
## GitHub API requests
57
+
58
+
Extensions can request GitHub REST data for the current session repository through `session.api.github.request(...)`:
59
+
60
+
```js
61
+
constalerts=awaitsession.api.github.request({
62
+
method:"GET",
63
+
path:"/code-scanning/alerts",
64
+
query: { state:"open", per_page:100 },
65
+
paginate:true,
66
+
});
67
+
```
68
+
69
+
This API is tokenless from the extension's perspective. The extension sends a repository-relative path, and the host derives the current repository, selects the signed-in or project account, performs the authenticated request, and returns the response data. The extension does not receive a GitHub token.
70
+
71
+
The default GitHub API surface is intentionally narrow:
72
+
73
+
- Only `GET` requests are supported.
74
+
- Paths must be repository-relative, such as `/code-scanning/alerts`.
75
+
- Full URLs and `/repos/{owner}/{repo}/...` paths are rejected because the extension cannot choose an arbitrary repository.
76
+
- Cross-repository, organization-wide, GraphQL, and write access are not part of the default API.
0 commit comments