Skip to content

fix(security): catalog discovery must use chat egress policy - #675

Closed
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/bc-0b2ddae4-9905-46fe-858f-4e0269a59466-827b
Closed

fix(security): catalog discovery must use chat egress policy#675
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/bc-0b2ddae4-9905-46fe-858f-4e0269a59466-827b

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

Why

PR #642 made live GET /v1/models the primary catalog (1e82827) and chooses workers by cost-performance. Catalog discovery still sent the KV Bearer token after only a hostname + HTTPS check, followed redirects, and treated any http:// seed URL as insecure-ok. That is a credential leak chat would have refused.

#661 attempted the same egress fix on ca2dd9f and is missing 1e82827 (primary catalog rewrite + capability-tag cap). Do not merge #642 or #661 in parallel with this branch.

What landed (on top of #642 1e82827)

  • Shared provider_base_url_rejection for chat and discovery (public HTTPS, allowlist, getaddrinfo private/loopback/link-local/reserved).
  • Discovery uses a no-redirect opener. HTTP is opt-in via allow_insecure_discovery only (loopback lab fixtures).
  • persist_catalog_to_agents_db replaces the sqlite agent_pool so a later static reseed cannot keep stale discovered workers.
  • Sidecar workflow fails if /healthz never succeeds; no-secrets smoke skip happens only after a healthy serve.
  • Empty / whitespace KV credentials are not ready (NotConfigured, no GitHub Models fallback).
  • tag_discovered_model tags reasoning / review / coding only when the model id matches a marker (the previous or "reasoning" not in tags default made every discovered worker a thinker/worker/synthesizer).

Tests

python -m pytest tests/test_catalog_bootstrap.py tests/test_catalog_discovery.py \
  tests/test_provider_catalog_robustness.py tests/test_opencode_sidecar_contract.py \
  tests/test_cost_performance_chooser.py tests/test_provider_catalog.py \
  tests/test_security_hardening.py tests/test_provider_reliability.py -q

Local: 76 passed on that set; conventions + paper contracts also passed.

Papers

Same claim boundary as docs/doctoring/provider-catalog.md and docs/doctoring/cost_performance_routing.md (APA 7). Discovery egress is now an explicit claim: no private/loopback/redirect leak of the KV key.

Reviewer next action

Merge this PR instead of #642 / #661. Then point OpenCode/Strix at http://127.0.0.1:8000/v1 model contextual-orchestrator with the five org secrets in the KV.

Open in Web View Automation 

cursoragent and others added 4 commits August 16, 2026 16:23
Register NVIDIA NIM, OpenAI, OpenRouter, and Bytez credentials into the
KV, compose a production agent pool (no GitHub Models), and fail closed
on missing keys, 429 failover, and malformed upstream responses.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Replace keyword scoring and YAML-order failover with a single
quality-per-unit-cost chooser. 429/5xx/timeout re-runs that chooser on
the remaining healthy pool. Empty pool fail-closes without GitHub Models.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Discover chat models after each org secret is in the KV. Static seed is
fallback only. Expose GET /v1/models on the gateway. No GitHub Models.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Discovery now reuses the chat-path host/IP checks, refuses redirects that
would carry a KV Bearer token, and treats HTTP as an explicit lab hook.
Reseed replaces the sqlite agent pool so stale discovered workers cannot
linger. Sidecar CI fails when /healthz never comes up. Empty credentials
are not treated as ready. Discovered models are tagged only when the id
matches a capability marker.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@seonghobae
seonghobae enabled auto-merge (squash) August 16, 2026 17:06
@seonghobae seonghobae closed this Aug 16, 2026
auto-merge was automatically disabled August 16, 2026 18:22

Pull request was closed

@seonghobae

Copy link
Copy Markdown
Contributor

Superseded by tip #691 (cumulative honesty substrate ≥ #689). Closing to free Full unit + Semgrep runners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants