feat(db): add experimental db tunnel (MySQL over WebSocket) - #249
Open
mcolakovic-godaddy wants to merge 1 commit into
Open
feat(db): add experimental db tunnel (MySQL over WebSocket)#249mcolakovic-godaddy wants to merge 1 commit into
db tunnel (MySQL over WebSocket)#249mcolakovic-godaddy wants to merge 1 commit into
Conversation
Add `gddy db tunnel`, an experimental streaming command that opens a local TCP port and bridges raw MySQL bytes over a single WebSocket per connection to an application's agent, which dials the app's own database. The tunnel is a byte pump: it never parses MySQL and never injects credentials, so MySQL auth and TLS are negotiated end-to-end between the client and the database. The command authenticates the one-time token mint with the CLI's own OAuth credential, receives a short-lived app-scoped token and the agent URL from the hosting API, and presents that token to the agent. The `db` module is gated behind the experimental stage and hidden at the GA default. Includes the public proposal at docs/proposals/db-tunnel.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The WebSocket URL builder can generate invalid URLs for IPv6 agent hosts (missing required brackets), which can break connections in valid environments.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an experimental gddy db tunnel command group for tunneling MySQL traffic from a local TCP listener to a hosted app’s agent via per-connection WebSockets, plus the hosting API client support needed to mint short-lived agent tokens.
Changes:
- Registers a new experimental
dbcommand group and adds CLI-stage gating tests. - Implements
db tunnelas a streaming command that relays raw bytes between TCP and WebSocket connections. - Extends the hosting Node.js client with an
agent-tokenmint endpoint and associated unit test; adds required Rust dependencies and a design proposal doc.
File summaries
| File | Description |
|---|---|
| rust/src/main.rs | Wires in the db module and adds a gating/help-surface test for db tunnel. |
| rust/src/hosting/nodejs/client.rs | Adds get_agent_token API call and a unit test for request/response shape. |
| rust/src/db/tunnel.rs | Implements the streaming tunnel command, URL derivation, token minting, and byte relay. |
| rust/src/db/mod.rs | Adds the experimental db group wiring and registers db tunnel. |
| rust/Cargo.toml | Adds futures-util and tokio-tungstenite dependencies for WS + stream utilities. |
| rust/Cargo.lock | Locks new transitive dependencies for tungstenite/rustls stack. |
| docs/proposals/db-tunnel.md | Documents the design, security model, and rationale for db tunnel. |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+482
to
+488
| let host = parsed | ||
| .host_str() | ||
| .ok_or_else(|| GddyError::network(format!("agent URL '{agent_url}' has no host")))?; | ||
| let authority = match parsed.port() { | ||
| Some(port) => format!("{host}:{port}"), | ||
| None => host.to_owned(), | ||
| }; |
jpage-godaddy
approved these changes
Sep 4, 2026
jpage-godaddy
left a comment
Collaborator
There was a problem hiding this comment.
This looks great.
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.
Summary
Adds
gddy db tunnel, an experimental streaming command that opens a local TCP port and bridges raw MySQL bytes over a single WebSocket per connection to an application's agent, which in turn dials the application's own database. This lets a developer point any local MySQL client (mysql, TablePlus, DataGrip, an ORM) at a hosted app's database without exposing that database publicly.Full design and rationale:
docs/proposals/db-tunnel.md.How it works
dbgroup is registered behind the experimental stage and hidden at the GA default, so it does not appear in normal help output.Security
Testing
cargo fmt --check,cargo clippy -- -D warnings,cargo test(757 tests),cargo check --locked, and the module-size check all pass.Notes