mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-26 00:52:18 +03:00
Integration: security tier + self-hosted operator blockers (rebased onto v3.8.51) (#10952)
Validated on the resolved merge against the current tip (527da656 + the post-#11281 rebaseline): the single conflict was a comment-only collision in providers/[id]/models/route.ts (kept the tip's #10828-ordering note). Focused suites 125/125 across all 13 touched test files (build-sqlite-stub, cc-compatible, copilot-claude-messages, copilot-gemini-route, executor-github, ghe-copilot, github-copilot-discovery-token, github-copilot-model-discovery, noauth-sibling-7620, provider-header-profiles, provider-models-config, request-log-payloads, upstream-error-passthrough), typecheck:core clean, file-size/changelog-integrity OK. Merged --admin over the inherited 2026-08-23 base-red cluster (#9985) — the reds are proven tip failures (CLI catalog cluster + @testing-library allowlist, being drained by #11280), not from this diff. Note: the rebase means several items the body listed (relay x-relay-path SSRF, /v1/search blocked-providers, #10736 rotation fence, #10903, #10865, #10899, #10916) already landed upstream and are NOT in this delta — the delta is: better-sqlite3 build guard + build heap/worker caps + telemetry-off (#10060 re-derived), credential-echo passthrough refusal + OCR/moderation redaction + call-log key redaction, Copilot CLI 1.0.81-6 wire identity + Claude→/v1/messages name-matched routing + discovery token fix, CC model_not_found 400, compat overrides for no-auth aliases (#7620-pinned). The Copilot wire-identity change is the one to watch in production. Thank you @arminanton — and the ported-author credits in the commit history (@rqzbeh, yidecode, the #10899/#10916 authors) are preserved. Your config-posture finding (REQUIRE_API_KEY default vs 0.0.0.0) is noted for a maintainer decision, as you scoped it.
This commit is contained in:
@@ -65,10 +65,12 @@ test("GithubExecutor.buildUrl routes response-format models to /responses", () =
|
||||
}
|
||||
});
|
||||
|
||||
test("GithubExecutor.buildUrl keeps GitHub Claude Opus 4.6 on /chat/completions", () => {
|
||||
test("GithubExecutor.buildUrl routes GitHub Claude Opus 4.6 to the native /v1/messages shim", () => {
|
||||
const executor = new GithubExecutor();
|
||||
const url = executor.buildUrl("claude-opus-4.6", true);
|
||||
assert.equal(url, "https://api.githubcopilot.com/chat/completions");
|
||||
// Claude ALWAYS uses the Anthropic-native shim (prompt-cache token counts +
|
||||
// lossless tool blocks), never /chat/completions.
|
||||
assert.equal(url, "https://api.githubcopilot.com/v1/messages");
|
||||
});
|
||||
|
||||
test("GithubExecutor.buildUrl routes unlisted Codex models to /responses (9router#102)", () => {
|
||||
@@ -276,13 +278,49 @@ test("GithubExecutor.buildHeaders prefers Copilot token and sets GitHub-specific
|
||||
|
||||
assert.equal(headers.Authorization, "Bearer copilot-token");
|
||||
assert.equal(headers.Accept, "text/event-stream");
|
||||
assert.equal(headers["editor-version"], "vscode/1.126.0");
|
||||
assert.equal(headers["editor-plugin-version"], "copilot-chat/0.54.0");
|
||||
assert.equal(headers["user-agent"], "GitHubCopilotChat/0.54.0");
|
||||
assert.equal(headers["x-github-api-version"], "2026-06-01");
|
||||
assert.equal(headers["openai-intent"], "conversation-panel");
|
||||
// Copilot CLI wire identity (matches the `copilot` npm package, not VS Code).
|
||||
assert.equal(headers["editor-version"], "copilot/1.0.81-6");
|
||||
assert.equal(headers["user-agent"], "copilot/1.0.81-6");
|
||||
assert.equal(headers["x-github-api-version"], "2026-08-01");
|
||||
assert.equal(headers["openai-intent"], "conversation-agent");
|
||||
assert.equal(headers["copilot-integration-id"], "copilot-developer-cli");
|
||||
assert.equal(headers["x-interaction-type"], "conversation-user");
|
||||
assert.equal(headers["copilot-harness-id"], "copilot-sdk");
|
||||
assert.equal(headers["X-Initiator"], "user");
|
||||
assert.ok(headers["x-request-id"]);
|
||||
// CLI 1.0.81-6 correlation headers.
|
||||
assert.ok(headers["x-client-machine-id"], "stable per-install machine id present");
|
||||
assert.ok(headers["x-interaction-id"], "per-call interaction id present");
|
||||
assert.ok(headers["x-client-session-id"], "per-conversation session id present");
|
||||
assert.ok(headers["x-agent-task-id"], "per-turn task id present");
|
||||
assert.equal(headers["x-github-repository-nwo"], "__no_repository__");
|
||||
assert.equal(headers["x-github-repository-host"], "__no_repository__");
|
||||
assert.equal(headers["x-stainless-helper-method"], "stream");
|
||||
// The CLI does NOT send editor-plugin-version / the vscode library header on
|
||||
// the inference path — those are VS Code Copilot Chat extension only.
|
||||
assert.equal(headers["editor-plugin-version"], undefined);
|
||||
assert.equal(headers["x-vscode-user-agent-library-version"], undefined);
|
||||
});
|
||||
|
||||
test("GithubExecutor.buildHeaders omits x-stainless-helper-method for non-stream and honors client-pinned ids", () => {
|
||||
const executor = new GithubExecutor();
|
||||
const nonStream = executor.buildHeaders({ accessToken: "gh" }, false);
|
||||
assert.equal(
|
||||
nonStream["x-stainless-helper-method"],
|
||||
undefined,
|
||||
"stainless stream signature only on streamed turns"
|
||||
);
|
||||
|
||||
const pinned = executor.buildHeaders({ accessToken: "gh" }, true, {
|
||||
"x-client-session-id": "sess-123",
|
||||
"x-agent-task-id": "task-456",
|
||||
"x-github-repository-nwo": "octo/repo",
|
||||
"x-github-repository-host": "github.com",
|
||||
});
|
||||
assert.equal(pinned["x-client-session-id"], "sess-123", "client-pinned session id honored");
|
||||
assert.equal(pinned["x-agent-task-id"], "task-456", "client-pinned task id honored");
|
||||
assert.equal(pinned["x-github-repository-nwo"], "octo/repo", "client repo nwo forwarded");
|
||||
assert.equal(pinned["x-github-repository-host"], "github.com", "client repo host forwarded");
|
||||
});
|
||||
|
||||
test("GithubExecutor.buildHeaders forwards valid client x-initiator and falls back for invalid values", () => {
|
||||
|
||||
Reference in New Issue
Block a user