From 209840401647686e977d5157cede06663b5bb546 Mon Sep 17 00:00:00 2001 From: Kanat Date: Wed, 25 Nov 2026 14:15:43 -0500 Subject: [PATCH] AI-3870: the fake API's echoed credential is application/json; SDK skill names http connectors CodeQL alert 175 (reflected XSS): /echo-credential wrote request headers into a body with no Content-Type. The SDK skill's createConnector line still said a custom MCP server. Co-Authored-By: Claude Sonnet 5.5 --- .claude/skills/sdk/SKILL.md | 2 +- acceleration/internal/connectors/fakeprovider/api.go | 4 +++- .../internal/connectors/fakeprovider/fakeprovider_test.go | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.claude/skills/sdk/SKILL.md b/.claude/skills/sdk/SKILL.md index 346d4368df..d4c468ff69 100644 --- a/.claude/skills/sdk/SKILL.md +++ b/.claude/skills/sdk/SKILL.md @@ -482,7 +482,7 @@ SDK with a router has moved: `client.Router` (Go, .NET), `client.router` (Python Python, where `Router(...)` stays for the `url`/`customer_id` case. JavaScript has no router yet; when it gets one, start from `client.router(name)`. -Connector definitions can be listed, read and added. `listConnectors` (`GET /v1/agents/connectors`, with `q`, `limit` and `cursor`, answering a `ConnectorPage`), `getConnector` (`GET /v1/agents/connectors/{id}`) and `createConnector` (`POST /v1/agents/connectors`, a `CustomConnectorRequest` for a custom MCP server whose id starts with `custom_`) are all server-side only. A `Connector` shows the schemes, inputs, scopes and `client.registration` (where the OAuth client may come from, a list of `ConnectorClientRegistrationMethod`), never endpoints or the operator's client variables. Name them `connectors.list/get/create`, spelled the way the language spells them, with `list` following the cursor like `Items.Unwind`. Go has the regenerated client (`ListConnectors`, `GetConnector`, `CreateConnector`) and no resource methods yet. JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP need their generated clients regenerated and the three methods added. Swift, Kotlin and Dart need nothing, since none of the three is client-accessible. The schemas were named `ConnectorDefinition` and `ConnectorDefinitionPage` until October 5; they are `Connector` and `ConnectorPage` now, while the store keeps `ConnectorDefinition` for one stored revision. JavaScript and Python have the renamed generated types; .NET, Ruby, Rust and PHP pick the rename up when they regenerate. +Connector definitions can be listed, read and added. `listConnectors` (`GET /v1/agents/connectors`, with `q`, `limit` and `cursor`, answering a `ConnectorPage`), `getConnector` (`GET /v1/agents/connectors/{id}`) and `createConnector` (`POST /v1/agents/connectors`, a `CustomConnectorRequest` for a custom connector, an MCP endpoint or an http API (`.claude/skills/sdk/notes/2026-11-24-ai-3676.md`), whose id starts with `custom_`) are all server-side only. A `Connector` shows the schemes, inputs, scopes and `client.registration` (where the OAuth client may come from, a list of `ConnectorClientRegistrationMethod`), never endpoints or the operator's client variables. Name them `connectors.list/get/create`, spelled the way the language spells them, with `list` following the cursor like `Items.Unwind`. Go has the regenerated client (`ListConnectors`, `GetConnector`, `CreateConnector`) and no resource methods yet. JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP need their generated clients regenerated and the three methods added. Swift, Kotlin and Dart need nothing, since none of the three is client-accessible. The schemas were named `ConnectorDefinition` and `ConnectorDefinitionPage` until October 5; they are `Connector` and `ConnectorPage` now, while the store keeps `ConnectorDefinition` for one stored revision. JavaScript and Python have the renamed generated types; .NET, Ruby, Rust and PHP pick the rename up when they regenerate. Plugins, `plugin_events` and `mcp_servers` are removed (AI-1757): catalog plugins, their logins, options, events and logos, and MCP servers named by URL, were replaced by connectors (a built-in connector, or a custom one for a server's URL). The notes that described them are gone; what is left is the refusal: agent.yaml refuses the keys (AI-1784, AI-2531), the router answers a non-empty list with a 400 (AI-2538), and the generated clients no longer carry their types (AI-2772). diff --git a/acceleration/internal/connectors/fakeprovider/api.go b/acceleration/internal/connectors/fakeprovider/api.go index 872ceffe42..3be426c405 100644 --- a/acceleration/internal/connectors/fakeprovider/api.go +++ b/acceleration/internal/connectors/fakeprovider/api.go @@ -43,7 +43,8 @@ func (s *Server) APIRequests() []APIRequest { // /rest/echo-credential 403 whose body says the APIKeyHeader and Authorization it got, as an // API that echoes the request's credential in its error does; with // ?status=200, the same body as a 200, as one that echoes it in an -// answer does +// answer does; both are application/json, so a browser never reads the +// echoed request as HTML // anything else 200 "ok" func (s *Server) api(w http.ResponseWriter, r *http.Request) { body, _ := io.ReadAll(r.Body) @@ -71,6 +72,7 @@ func (s *Server) api(w http.ResponseWriter, r *http.Request) { if r.URL.Query().Get("status") == "200" { status = http.StatusOK } + w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) _, _ = io.WriteString(w, `{"error":"key `+r.Header.Get(APIKeyHeader)+` and `+r.Header.Get("Authorization")+` may not read this"}`) return diff --git a/acceleration/internal/connectors/fakeprovider/fakeprovider_test.go b/acceleration/internal/connectors/fakeprovider/fakeprovider_test.go index 5e5caf1f47..54adf5bdb0 100644 --- a/acceleration/internal/connectors/fakeprovider/fakeprovider_test.go +++ b/acceleration/internal/connectors/fakeprovider/fakeprovider_test.go @@ -1175,6 +1175,7 @@ func (s *FakeProviderSuite) slack(srv *fakeprovider.Server, method, token string // and echoes the credential in /echo-credential's 403, or in its 200 with ?status=200. func (s *FakeProviderSuite) TestTheHTTPAPITakesItsKeyRecordsEachRequestAndAnswersByPath() { srv := fakeprovider.New(s.T()) + var contentType string send := func(method, path, key string) (int, string) { request, err := http.NewRequest(method, srv.URL+fakeprovider.PathAPI+path, strings.NewReader("sent")) s.Require().NoError(err) @@ -1184,6 +1185,7 @@ func (s *FakeProviderSuite) TestTheHTTPAPITakesItsKeyRecordsEachRequestAndAnswer defer response.Body.Close() body, err := io.ReadAll(response.Body) s.Require().NoError(err) + contentType = response.Header.Get("Content-Type") return response.StatusCode, string(body) } @@ -1205,9 +1207,11 @@ func (s *FakeProviderSuite) TestTheHTTPAPITakesItsKeyRecordsEachRequestAndAnswer status, body = send(http.MethodPost, "/echo-credential", srv.APIKey) s.Equal(http.StatusForbidden, status) s.Contains(body, srv.APIKey) + s.Equal("application/json", contentType, "the echoed request is not sniffed as HTML") status, body = send(http.MethodGet, "/echo-credential?status=200", srv.APIKey) s.Equal(http.StatusOK, status) s.Contains(body, srv.APIKey) + s.Equal("application/json", contentType) requests := srv.APIRequests() s.Require().Len(requests, 10, "the refused ones too")