fix(devtools): secure devtools viewer api access - #16042
Merged
Merged
Conversation
gr2m
approved these changes
Jun 12, 2026
Contributor
|
|
5 tasks
gr2m
pushed a commit
that referenced
this pull request
Jun 12, 2026
Resolved the cherry-pick conflict for release-v6.0: - Kept the security fix — removed wildcard `cors()`, bound `serve()` to localhost, and added the `/api/*` Host/Origin allowlist middleware (using `viewerPort`, with `app` exported). - Dropped the stale `remoteDbPath` line from the incoming hunk: v6's viewer never had the network-supplied dbPath feature (its /api/notify already calls `reloadDb()` with no argument), so keeping it would be an unused var. - Omitted the added `server.test.ts`: the v6 devtools package has no vitest dependency, test script, or config, so the test can't run there and its `vitest` import would break type-check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gr2m
pushed a commit
that referenced
this pull request
Jun 12, 2026
Resolved the cherry-pick conflict for release-v6.0: - Kept the security fix — removed wildcard `cors()`, bound `serve()` to localhost, and added the `/api/*` Host/Origin allowlist middleware (using `viewerPort`, with `app` exported). - Dropped the stale `remoteDbPath` line from the incoming hunk: v6's viewer never had the network-supplied dbPath feature (its /api/notify already calls `reloadDb()` with no argument), so keeping it would be an unused var. - Omitted the added `server.test.ts`: the v6 devtools package has no vitest dependency, test script, or config, so the test can't run there and its `vitest` import would break type-check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gr2m
pushed a commit
that referenced
this pull request
Jun 12, 2026
This is an automated backport of #16042 to the release-v6.0 branch. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 12, 2026
Contributor
|
🚀 Published in:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
@ai-sdk/devtoolsserved its API with wildcard CORS and listened without an explicit hostname. any website could fetch against the api route, and LAN peers could potentially hit the viewer directly if reachable.Summary
malicious cross-origin pages and non-local host requests now get 403
Manual Verification
verified that there was no regression by running the viewer and the example
examples/ai-functions/src/generate-text/anthropic/nested-subagent-with-telemetry.tsChecklist
pnpm changesetin the project root)