Skip to content

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

Open
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/bc-b696be80-19f0-41fd-bcf6-922b29912af7-5595
Open

fix(security): catalog discovery must use chat egress policy#661
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/bc-b696be80-19f0-41fd-bcf6-922b29912af7-5595

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

Why

PR #642 seeds the org provider catalog and chooses workers by cost-performance. Catalog GET /v1/models 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.

What landed (on top of #642)

  • 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).

Do not merge #642 in parallel. This branch is #642 (ca2dd9f) plus the egress/reseed/health fixes.

Tests

python -m pytest tests/test_catalog_bootstrap.py tests/test_provider_catalog.py \
  tests/test_provider_catalog_robustness.py tests/test_opencode_sidecar_contract.py \
  tests/test_cost_performance_chooser.py tests/test_provider_reliability.py -q
python -m pytest tests -q --ignore=tests/fuzz

Local: 333 passed (full tests minus fuzz).

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.

Open in Web View Automation 

cursoragent and others added 3 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>
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.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Verdict

Do not merge this head (64b69d0). The egress/reseed/health direction is correct, but this branch is #642 at ca2dd9f and is missing 1e82827 (live GET /v1/models as the primary catalog, _provider_slots compose, and the capability-tag cap).

Land #675 instead. That branch is 1e82827 plus this egress policy, persist-replace, sidecar /healthz fail-closed, empty-credential NotConfigured, and marker-only tag_discovered_model (the 1e82827 default-reasoning bug is not on this older compose path).

Next action

Leave this PR unmerged. Review and merge #675, then close #642 and this PR as superseded.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

@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:10
…pt-out

Match tip substrate: bind-only placeholder SQL and audited provider
urllib/TLS paths; product Semgrep gate requires these suppressions.
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