Skip to content

[AI-3870] Fix the fake provider's CodeQL alert; SDK skill names http connectors - #2483

Merged
kanat merged 1 commit into
feature/ai-3669-http-connectorsfrom
connectors/http-p5-nits
Nov 25, 2026
Merged

kanat merged 1 commit into
feature/ai-3669-http-connectorsfrom
connectors/http-p5-nits

Conversation

@kanat

@kanat kanat commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Targets the feature branch feature/ai-3669-http-connectors (not main). Two Nits (R1.2, R1.3) from the joint review of #2312.

fakeprovider/api.go   /rest/echo-credential  403 or 200 body: Content-Type application/json (was none: CodeQL alert 175)
.claude/skills/sdk/SKILL.md:485  createConnector: "a custom connector, an MCP endpoint or an http API" -> notes/2026-11-24-ai-3676.md
  • The fake is test code: go list -deps ./cmd/router has no fakeprovider. Behaviour is otherwise the same; no other handler in the package echoes request input (channel.go:170 is a static body).
  • Test: TestFakeProviderSuite now asserts Content-Type: application/json on both echo answers. Mutation: removing the Set line fails it.
  • Ran: go test ./internal/connectors/fakeprovider/ ./internal/connectors/sources/http/; go test -tags integration -run TestSessionConnectorsSuite ./internal/api/ (the users of the fake API); both vets. CodeQL not run locally (no CLI): the PR's CodeQL check will tell.

🤖 Generated with Claude Code

…ill 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 <noreply@anthropic.com>
@github-actions github-actions Bot added the docs label Nov 25, 2026

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: GO

Reviewed 209840401 (already contains base feature/ai-3669-http-connectors at 6b221728d; no merge needed) in a scratch worktree. Draft PR: no CI on this head (go and integration skipped; CI runs at gh pr ready). Checks read once: labeler and GitGuardian pass. No CodeQL check on this head yet.

Findings: none. No Blocker, Should fix, Nit or Question.

Checked and sound:

  • acceleration/internal/connectors/fakeprovider/api.go:75: the only change is the Content-Type: application/json set before WriteHeader, on the /echo-credential answers (403 and ?status=200). Nothing else in the fake's behaviour moves. The fakeprovider package is not in go list -deps ./cmd/router.
  • Mutation: TestFakeProviderSuite/TestTheHTTPAPITakesItsKeyRecordsEachRequestAndAnswersByPath fails on four mutants (header deleted, set only on the 403, set after WriteHeader, text/plain), each showing text/plain; charset=utf-8 where the test expects application/json.
  • Tests on this head: go test ./internal/connectors/fakeprovider/ ./internal/connectors/sources/http/ pass; go test -tags integration -run TestSessionConnectorsSuite ./internal/api/ passes (62 PASS on the reviewer's own DB). Vet clean.
  • .claude/skills/sdk/SKILL.md:485: CustomConnectorRequest has endpoint and http (acceleration/internal/api/connectors.go:185-197), and the id starts with custom_ (connectors.go:192). The cited note .claude/skills/sdk/notes/2026-11-24-ai-3676.md exists.

Unverified: whether CodeQL still reports alert 175 on this head. The alert's most recent instance is on refs/pull/2312/head at 6b221728d, line 75. It clears only when CodeQL runs on this head.

@kanat
kanat marked this pull request as ready for review November 25, 2026 19:20
@kanat
kanat merged commit 469960b into feature/ai-3669-http-connectors Nov 25, 2026
11 checks passed
@kanat
kanat deleted the connectors/http-p5-nits branch November 25, 2026 19:20
kanat added a commit that referenced this pull request Nov 26, 2026
Feature branch for [AI-3669](https://linear.app/stream/issue/AI-3669):
the router gets an `http` tool source. A file
`connectors/http/<name>.yaml` names a public https base URL and
read-only tools. Once synced, an agent calls those tools with a user's
credential.

## What it does

```
connectors/http/<name>.yaml
  │  CLI sync
  v
POST /v1/agents/connectors   (http block)
  │
  v
manifest, sources/http
  │  agent session offers the tool
  v
session tool call -> base_url + path, with the connection's credential
```

Safety rules. Each is checked when the connector is saved, at each call,
or both:

| Rule | Effect | Checked |
|---|---|---|
| Public https only | `base_url` goes through the egress check; private
and plain-http hosts are refused | save (`CheckBaseURL`), and every
call, as the connection's client is the egress client |
| `read_only` GET and HEAD | other methods are refused on `read_only`
tools | save. A tool whose definition changed since its grant is not
offered (the grant pins a digest of method, path and `read_only`) |
| Override args refused | the model cannot change the method, host or
headers | save refuses a parameter or header named like a method
override; a call refuses an argument the tool does not declare, before
anything is sent |
| Path segments escaped | `..%2Fadmin` stays one segment | every call |
| Size caps | 4 MiB read from the provider, 32 KiB to the model (with a
marker) | every call |
| Egress limits | the same egress client and the same 4 MiB read cap as
the MCP source, and #2430's import limits | every call; import |

## Pieces

All merged into this branch, each reviewed on its own PR. Three commits
on the branch itself follow the last main sync: the feature's caps
become core's after #2430, a subtest split of #2480's test, and a test
that an http custom connector meets an MCP one's limits.

| Piece | Ticket | PR | Merge commit |
|---|---|---|---|
| Manifest model for http tools | AI-3673 |
[#2303](#2303) | 7d1d6b7 |
| `sources/http` tool source | AI-3674 |
[#2316](#2316) | 2a29dac |
| Call-time safety | AI-3675 |
[#2324](#2324) | 5a798ad |
| API accepts http connectors (keystone) | AI-3676 |
[#2344](#2344) | aed810a |
| A connector's answer names its source kind | AI-3871 |
[#2464](#2464) | c72f50f |
| Pin delegation's digest check; own SDK note | AI-3870 |
[#2480](#2480) | 73e80f2 |
| Fake provider's CodeQL alert; SDK skill names http connectors |
AI-3870 | [#2483](#2483) |
469960b |

Main was merged into the branch 9 times; the last is main `f58ff6eb3`.
An earlier one, main `c4119ba23`, carries
[#2430](#2430 import limits.
Imported http connectors are held to the same limits.

The merge of main `8232d25af` brings in two changes that touch http
connectors:
- [#2485](#2485) refuses
imported agent configs that break the sensitive-connector rule. An http
connector's tools are weighed by their own rule: a tool that is not
read-only, or a read-only tool granted without its digest, is refused. A
test covers this
(`TestAnImportedHTTPConnectorAnAgentBindsBesideASensitiveOneIsWeighedByItsTools`).
- [#2434](#2434) adds
`check_changes` to a custom connector create. An http connector takes
the same path as an MCP one, and a test covers the http case
(`TestACheckedSyncOfAnHTTPConnectorIsRefusedOnlyOverAnEditNoSyncWrote`).

## Acceptance

AC-1..AC-9 are frozen in the epic. The staging window was opened twice
on the branch build, then staging was restored.

| AC | Result | Checked |
|---|---|---|
| AC-1 | pass | staging windows 1 and 2 (router part). The CLI line
(first sync prints the connector id) is in
[GetStream/cli#128](GetStream/cli#128) |
| AC-2 | pass | staging window 1 and 2 |
| AC-3 | pass | staging window 1 and 2: one tool call, the agent
answered from it |
| AC-4 | pass | staging window 1 and 2 |
| AC-5 | pass | staging window 1 and 2 |
| AC-6 | pass | local router: override args refused, the fake provider
saw 0 requests |
| AC-7 | pass | staging, by API and by CLI |
| AC-8 | pass | staging window 1 and 2: a JSON body comes back as
`application/json` |
| AC-9 | pass | local router: 100 KiB cut to 32768 B with a marker, 5
MiB cut at the 4 MiB read cap |

Rulings by Kanat (2026-11-25):

- AC-4: the "no token" clause is read as a wrong token. A wrong token
gives a tool error 401. A connection with no token at all stays
`not_connected` and its tool is not offered, as before.
- AC-5: the CLI refuses a `read_only` POST or DELETE locally, before any
request. The router refuses the same with a 400 on a direct POST.

## Gates for the merge into main

| Gate | What |
|---|---|
| a | Done: [#2481](#2481)
merged into main (`96d535d9d`), which fixed main's integration build at
`scheduled_unpaid_test.go:814`. This branch builds and vets with the
integration tag merged onto main `aa4c2d4d9` |
| b | Full CI green once this PR leaves draft (a draft runs none of the
go or integration jobs) |
| c | [GetStream/cli#128](GetStream/cli#128)
merges after this is deployed, then the docs leaf AI-3678 |
| d | SDK releases that carry `Connector.sources` go out only after the
router deploy: the generated Python and Rust clients cannot parse a
connector from an older router |
| e | No migration, no flag. A rollback to the previous build fails
closed: an http binding is unavailable, and every http tool counts as
sending out |

## Breaking change

From `CHANGELOG.md` on the branch, under Unreleased, Breaking Changes:
**`CustomConnectorRequest`'s endpoint is optional in the Go, Rust, PHP
and Python SDKs**

- Go: `CustomConnectorRequest.Endpoint` is now `*string`. Set it with a
pointer (for example `Endpoint: &url`); a caller that set a plain string
no longer compiles.
- Rust: `CustomConnectorRequest.endpoint` is now `Option<String>`. Set
it with `Some(url)`; a struct literal with a plain `String`, or a read
of one, no longer compiles.
- PHP: the `CustomConnectorRequest` constructor takes `$endpoint` after
`$schemes`, not first. A positional call no longer matches; named
arguments work as before.
- Python (`plugins/stream`): the generated `CustomConnectorRequest`
takes `endpoint` after `schemes`, not first. A positional call no longer
matches; keyword arguments work as before.

## Rollout

```
merge this PR -> deploy to staging
  -> recheck AC-3 and AC-8 live -> merge cli#128 -> docs (AI-3678)
  -> SDK releases with Connector.sources
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant