Skip to content

fix(web): remove the unauthenticated provider proxy routes - #229

Merged
Arcadi4 merged 7 commits into
mainfrom
chore/remove-provider-proxies
Oct 3, 2026
Merged

Arcadi4 merged 7 commits into
mainfrom
chore/remove-provider-proxies

Conversation

@a2751012962

@a2751012962 a2751012962 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Stacked on #217.

Why

/api/deepseek, /api/tavily and /api/gemini were public relays: each took the caller's request body, attached the Worker's own provider key, and forwarded it. There was no auth and no rate limit. /api/tavily and /api/gemini also answered preflights with Access-Control-Allow-Origin: *, so any website could call them from a visitor's browser. Anyone could spend the DeepSeek, Tavily and Google quotas through iguide.chat.

None of them is needed. Chat never went through them: the /api/chat agent calls api.deepseek.com (worker/agent/loop.ts) and api.tavily.com (worker/tools/web-search.ts) directly from inside the Worker. The only callers were the review translate button, which is no longer wanted, and a Gemini provider that the fixed providerKey = "deepseek" made unreachable.

What changes

  • Drops the review translate button, the only caller of /api/deepseek.
  • Drops the unused Gemini chat provider, the only caller of /api/gemini.
  • Removes the three routes, their prompt files, and the config only they read: the GOOGLE_API_KEY secret binding and the legacy VITE_DEEPSEEK_API_KEY alias. .dev.vars.example now says chat needs DEEPSEEK_API_KEY and web search needs TAVILY_API_KEY.
  • Updates AGENTS.md, which still required these routes to exist for a CI check that was removed in ab9cc30, and the READMEs.
  • Separately corrects claims in the guides that no longer match the code: the Cloudflare plugin runs under vp dev too (since 507b491), vp build writes only .cloudflare/output/ (no dist/, and the CI bundle scan is gone), worker/lib/ does not exist, and nothing reads LLM_REQUEST_DUMP.

DEEPSEEK_API_KEY and TAVILY_API_KEY stay, since /api/chat needs both.

Verification

  • vp lint apps/web exits 0 (only the existing test-file warnings).
  • node --test "worker/**/*.test.ts" "src/**/*.test.ts" in apps/web: 152/154 pass. The 2 failures (loop.test.ts, loop.baseline.test.ts) fail the same way on the base, because plain Node can't import the .txt prompts.
  • vp build and cf build succeed. The built Worker bundle only references /api/chat, /api/health and /api/integrations, and no client asset references the removed paths.
  • Before the change, zero-cost requests to production confirmed all three routes were live, unauthenticated, and had keys configured.

After deploy

The removed paths will return the Worker's 404 JSON. The GOOGLE_API_KEY Worker secret, and VITE_DEEPSEEK_API_KEY if it was ever set, are no longer read and can be deleted from the uiuc Worker.

Rebased

Rebased onto the force-pushed feat/auth (7654d56). The checks above were re-run on the new head b54ea2f: vp check --no-fmt 0 errors and the same 221 warnings as main, node --test 152/154 with the same 2 known failures.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
b54ea2f 2026-10-02T07:31:00.978Z View logs ↗
  • Build: Failed ❌

View logs ↗
8859646 2026-10-02T05:54:40.240Z View logs ↗
  • Build: Cancelled 🚫

View logs ↗
e574606 2026-10-02T05:53:24.343Z View logs ↗

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

React Doctor found 1 new issue in 1 file · 1 warning · score 89 / 100 (Great) · 1 fixed · vs main

1 warning

src/components/housing/DormDetailReviews.tsx

  • ⚠️ L35 React function has high control-flow complexity no-high-complexity-react-function

Reviewed by React Doctor for commit 5c824db. See inline comments for fixes.

@a2751012962
a2751012962 force-pushed the chore/remove-provider-proxies branch from e574606 to 8859646 Compare October 2, 2026 05:54
@Arcadi4
Arcadi4 force-pushed the feat/auth branch 2 times, most recently from 18c0b76 to 7654d56 Compare October 2, 2026 07:04
@a2751012962
a2751012962 force-pushed the chore/remove-provider-proxies branch from 8859646 to b54ea2f Compare October 2, 2026 07:30
@Arcadi4
Arcadi4 changed the base branch from feat/auth to main October 3, 2026 06:53
Arcadi4 and others added 7 commits October 3, 2026 02:55
It was the only caller of the public /api/deepseek proxy, and the feature is no longer wanted.
The provider switch is fixed to DeepSeek, so this was dead code and the only caller of the public /api/gemini proxy.
/api/deepseek, /api/tavily and /api/gemini relayed any caller's request with the Worker's own keys and no auth, and the last two allowed any origin. Nothing in the app calls them any more, since the chat agent calls DeepSeek and Tavily directly, so the routes go along with GOOGLE_API_KEY and the VITE_DEEPSEEK_API_KEY alias that only they read.
The web guide still said the Cloudflare plugin only runs for builds and that
`vp dev` proxies `/api/*`, but 507b491 registered it for `serve` too, so dev
boots the real Worker with `.dev.vars`. It also described a `vp build` SPA in
`dist/` for a CI bundle scan; the scan went with ab9cc30 and both `vp build`
and `cf build` now write only `.cloudflare/output/`. `worker/lib/` no longer
exists, and nothing reads `LLM_REQUEST_DUMP` since the dev gateways were
removed in f466972.
Removing the provider proxy modules left the Worker's URL table importing them and left the entry point no longer building the HTTP app, so every request failed before reaching a handler even though the bundle still built.

The entry point builds the app again and the table no longer registers the deleted proxies, which is what the endpoint list now advertises for unknown API paths.
@Arcadi4
Arcadi4 force-pushed the chore/remove-provider-proxies branch from b54ea2f to 5c824db Compare October 3, 2026 07:08
@Arcadi4
Arcadi4 merged commit 57bac28 into main Oct 3, 2026
1 check passed
@Arcadi4
Arcadi4 deleted the chore/remove-provider-proxies branch October 3, 2026 07:08
const isChinese = (text: string) => /[\u4e00-\u9fff]/.test(text)
const detectLang = (text: string): "zh" | "en" => (isChinese(text) ? "zh" : "en")

export const DormDetailReviews: React.FC<DormDetailReviewsProps> = ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

React Doctor · react-doctor/no-high-complexity-react-function (warning)

DormDetailReviews has cyclomatic complexity 17, cognitive complexity 23, and maximum nesting depth 4, so its React logic is hard to understand and change. Extract independent branches into components or hooks.

Fix → Extract independent render branches and state logic into focused components or hooks until the control flow is easy to follow.

Docs

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