feat(web-search): allow custom Exa-compatible endpoints - #1699
Conversation
Read the optional Base URL on each search and reuse the upstream Exa provider for requests and result normalization. Custom endpoints can work without a key; clearing the URL restores the existing built-in routing. Stage the URL in the existing settings card and verify settings writes before clearing drafts. Hide Exa URL drafts while editing DeepSeek. Validated with full tests, typecheck, lint, raw Electron CDP smoke, and four model-driven web_search calls against a local fixture including keyless access, endpoint switching, a configured key, and restart persistence.
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/desktop-electron/resources/dsh/web-search/lib/client.js, packages/desktop-electron/resources/dsh/web-search/lib/index.js, packages/desktop-electron/src/main/dsh-web-search-client.test.ts, packages/desktop-electron/src/main/dsh-web-search-plugin.test.ts)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: Astro-Han/pawwork/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe web-search settings card accepts an optional Exa-compatible base URL. The provider validates and uses that URL for search requests. When the URL and API key are blank, the keyless MCP path remains available. ChangesCustom Exa-compatible endpoint
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant SettingsCard
participant Config
participant searchExa
participant ExaEndpoint
SettingsCard->>Config: Save exaBaseURL
Config->>searchExa: Pass exaBaseURL
searchExa->>ExaEndpoint: Send normalized /search request
Merge Risk: ⚪ Minimal · up to This change adds an optional custom Exa-compatible endpoint to web search. Built-in Exa routing and keyless search are preserved when the field is blank. No merge-blocking risk was identified in the reviewed changes. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Custom destinations can receive search queries and the selected API key. Transport validation and redirect rejection constrain credential exposure, while fresh key references protect ongoing searches during replacement. Remaining uncertainty concerns failed-save recovery and unused stored keys, rather than a demonstrated credential leak. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAllow custom Exa-compatible web search endpoints
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
Reject malformed Exa destinations and credential-bearing remote HTTP searches while retaining loopback and keyless proxies. Report endpoint errors before saving a credential. Store each replacement Exa key under a new reference, then activate the reference and endpoint with one revision-fenced settings mutation. Failed saves retain the previous pair and drafts; in-flight searches keep their original credential. Retain previous references because searches may still be resolving them. Verified 65 focused tests, 122 Node tests, typecheck, lint, build, raw Electron CDP smoke, and real Host refusal/retry/restart tests with model-driven web_search requests. The broader local Vitest run had 583 passes and four existing transitive dsh-web-app resolution failures, also present on main.
|
Addressed the Qodo and CodeRabbit security findings in b3053cd:
The original failed-save leakage was reproduced through the real provider in a regression test. Real Electron CDP also induced an actual Host revision-conflict refusal: searches continued sending old-secret to the old destination; retry sent new-secret to the new destination, including after restart. All credentials were fixture values. 65 focused tests, 122 Node tests, typecheck/lint/build and raw CDP smoke passed. The broad local suite retained four existing dsh-web-app direct-resolution failures (583 passed), also present on main. The CodeRabbit docstring coverage warning does not justify adding redundant comments; its ESLint timeout is covered by the passing local lint check. |
Update only the Astro transitive lockfile resolution from devalue 5.9.0 to 5.9.4 within its existing ^5.8.1 range. This clears GHSA-j22f-vq7h-c4qm, GHSA-mcm9-63f2-9j32, and GHSA-x5rw-q4pp-hg5g, which newly blocked the PR audit check. Frozen install, high audit, site check and site build pass. The complete desktop suite passes through the pnpm-generated launcher: 588 Vitest, 122 Node and 10 label tests. Earlier direct-JS Vitest invocation omitted that launcher NODE_PATH; its four transitive-resolution failures were a test invocation issue, not repository defects.
|
Validation update: the complete local suite passes: 588 Vitest, 122 Node and 10 label checks. The earlier four transitive dsh-web-app failures came from directly invoking Vitest without the NODE_PATH supplied by pnpm’s generated launcher; they are not repository test defects. The new CI audit failure is from three newly published advisories in site → astro → devalue@5.9.0, unrelated to search code. Refreshing only its compatible lockfile resolution to 5.9.4 clears high audit; the site check/build also pass. |
Users running an Exa-compatible proxy can set an optional Base URL under Plugins → Websearch. Saving it sends the next search to that endpoint’s
/search, including keyless proxies; leaving it blank preserves the built-in route. Reuse DSH’s Exa provider for HTTP requests and result normalization.Reject malformed endpoint URLs before saving and at the search boundary. Credential-bearing remote endpoints require HTTPS; loopback HTTP remains supported. Replacement Exa keys use fresh credential references, activated together with the endpoint in one revision-fenced settings mutation. A failed save preserves the previous endpoint/key pair and retains drafts for retry. In-flight searches continue resolving the original reference; previous references are retained for those readers.
Validation: 588 Vitest tests (including 65 focused web-search tests), 122 Node tests and 10 label checks; typecheck, lint and build; real macOS Electron raw CDP smoke. The focused Electron scenario exercised malformed/insecure URL feedback, a real Host revision-conflict refusal, safe failure/retry, four model-driven web_search requests and restart persistence. The complete suite passes through the worktree’s pnpm-generated launcher; direct invocation without its NODE_PATH cannot resolve four transitive-package fixtures. Windows packaging and smoke run in CI.
Refresh only Astro’s transitive devalue lock from 5.9.0 to 5.9.4 to clear three newly published high audit advisories. Astro’s existing dependency range is unchanged. High audit and site check/build pass.
Closes #1694.
Summary by CodeRabbit