Commit graph

14 commits

Author SHA1 Message Date
Shaun Taheri
a78e58388f
feat: support Unix domain sockets for Dolt server connections (#3300)
Add ServerSocket config field and BEADS_DOLT_SERVER_SOCKET env var to
connect to Dolt via unix sockets instead of TCP. This eliminates port
conflicts between concurrent projects and simplifies sandbox integration.

- Wire --server-socket CLI flag through bd init and bd dolt set (dolt.socket)
- Add GetDoltServerSocket() to configfile with env var precedence
- Socket mode disables auto-start with socket-specific error hints
- TLS settings honored regardless of transport
- Integration test: starts dolt sql-server --socket, verifies end-to-end SQL
- Document in README.md server mode table

Closes #2939
2026-04-21 22:12:15 -07:00
Harry Miller
7ea14b23d2
security: harden remote URL validation at config parse time (#3210)
Add strict security validation for remote URLs and remote names to prevent
injection attacks when multi-remote support lands.

Changes:
- Add ValidateRemoteURL() with control character rejection, CLI flag
  injection prevention, scheme allowlist, and per-scheme structural
  validation (host/path requirements)
- Add ValidateRemoteName() aligned with existing peer-name policy
  (letter-start, alphanumeric + hyphen/underscore, max 64 chars)
- Add MatchesRemotePattern() and ValidateRemoteURLWithPatterns() for
  enterprise lockdown via federation.allowed-remote-patterns config
- Move config validation from simple IsRemoteURL() classifier to strict
  ValidateRemoteURL() security boundary
- Add defense-in-depth validation in AddCLIRemote/RemoveCLIRemote
- Add validation at clone entry points (cache.Ensure, bootstrap)
- Tighten SCP-style URL regex to exclude control characters in path
- Add comprehensive test coverage for null bytes, control chars,
  newline injection, CLI flag injection, scheme validation, structural
  validation, remote name edge cases, and pattern matching

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-13 09:58:50 -07:00
Graeme Foster
1a218aa56f
fix: explicitly disable TLS in Dolt connections when not configured (#3107)
go-sql-driver/mysql v1.8+ changed the default TLS mode from "false" to
"preferred", causing all connections to attempt TLS negotiation. Dolt
servers without TLS configured reject this with "TLS requested but server
does not support TLS" instead of gracefully declining.

- ServerDSN.String() now explicitly sets tls=false when TLS is not enabled
- All ServerDSN call sites plumb cfg.GetDoltServerTLS() so Hosted Dolt
  users with BEADS_DOLT_SERVER_TLS=1 get TLS on every code path
- Added dsn_test.go with explicit TLS on/off assertions

Authored-by: Graeme Foster <80714+GraemeF@users.noreply.github.com>
2026-04-10 13:55:06 -07:00
coffeegoddd☕️✨
fef1d1898c /{cmd,internal,scripts}: use dsn helpers 2026-04-06 15:56:37 -07:00
beads/crew/darcy
bb6b712168 fix: use CLI fallback for all git-protocol remotes, not just SSH (GH#2268)
git+https:// remotes hit the same MySQL readTimeout=10s as SSH remotes,
causing bd dolt push to fail with i/o timeout. Generalize isSSHRemote to
isGitProtocolRemote to detect git+https://, git+http://, and git:// URLs
in addition to SSH, routing them all through the CLI fallback path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:00:58 -08:00
quartz
72fc86cf1e fix: shell-quote interpolated args in dolt remote fallback messages (bd-6dvy)
The CLI remote fallback warning messages in doltRemoteAddCmd and
doltRemoteRemoveCmd interpolated name/url/dbPath directly into
suggested shell commands. If values contained shell metacharacters
and a user copied the suggested command, this could be exploited.

Add ShellQuote helper (single-quote wrapping with embedded quote
escaping) and apply it to all interpolated values in the two
warning messages.

Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
2026-03-01 10:28:49 -08:00
beads/crew/emma
ae182e4171 fix: address review feedback on SSH push/pull fallback
- Fix pluralization bug: "discrepanc(ies)" → "discrepancies"
- Add unit tests for IsSSHURL (13 cases) and extractSSHHost (8 cases)
- Accidentally committed .beads/backup/ files removed during rebase

Co-authored-by: Mitesh Ashar <miteshashar@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-28 23:55:39 -08:00
Mitesh Ashar
bcb22df28e refactor: extract ToRemoteNameMap() helper for DRY
Consolidate duplicate map-building logic from doctor/remotes.go and
doctor/fix/remotes.go into doltutil.ToRemoteNameMap(). Standardizes
how RemoteInfo slices are converted for O(1) lookup by name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-28 23:53:40 -08:00
Mitesh Ashar
66574d8fc1 refactor: consolidate SSH detection and CLI remote helpers into doltutil
- Extract IsSSHURL(), ListCLIRemotes(), AddCLIRemote(), RemoveCLIRemote(),
  FindCLIRemote() into internal/storage/doltutil/remotes.go (DRY/SSOT)
- Remove duplicate implementations from dolt.go, doctor/remotes.go,
  doctor/fix/remotes.go
- Fix confirmOverwrite() to auto-approve on non-tty (was hanging in CI)
- isSSHRemote() now checks both SQL and CLI surfaces (covers drift)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-28 23:53:40 -08:00
beads/crew/emma
bd68c87b00 fix: remove stale embedded Dolt references after server-only migration
Delete broken store_nocgo_test.go (references undefined errNoCGO),
remove dead bootstrapEmbeddedDolt/hasDoltSubdir functions, and clean up
stale comments and docs that still referenced embedded mode, CGO
requirements, or in-process Dolt across 20 files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-21 16:59:44 -08:00
beads/crew/emma
2137693dad revert: restore embedded Dolt mode (was only supposed to be removed from Gas Town)
Revert commits e5330641 and 0df41523 which removed embedded Dolt mode
from the beads codebase. The embedded Dolt removal was only intended for
Gas Town, not for Beads.

Restores:
- dolthub/driver dependency and embedded connection path
- Advisory flock (AccessLock) for concurrent process protection
- Embedded connector lifecycle management in DoltStore
- All CGO build tags across ~45 files
- Vendored go-icu-regex library
- nocgo stub files for non-CGO builds
- Bootstrap and embedded_uow helpers
- factory_dolt_test.go and dolt_singleprocess_test.go

Merge conflict resolutions:
- store.go: TCP fail-fast check wrapped inside if cfg.ServerMode
- store.go: backtick-quoting for embedded CREATE DATABASE (prefix-based names)
- perf_dolt.go: port references updated from 3306 to 3307
- ci.yml: restored continue-on-error for Nix (dolthub/driver requires Go 1.25.6+)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-07 21:21:24 -08:00
beads/crew/lizzy
df08dd44d0 tests: add tests for doltutil and factory packages
Added tests for the only two packages with zero test coverage:
- doltutil: CloseWithTimeout success, error, and timeout cases
- factory: SQLite backend creation, read-only mode, backend registry,
  unknown backend errors, config loading, and Options zero value

Closes dolt-test-cg7

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:21:48 -08:00
obsidian
e533064122 feat: remove embedded Dolt mode, keep server-only connections (bd-esqfe)
Remove the embedded Dolt driver (dolthub/driver) and all associated code,
keeping only server-mode connections via MySQL protocol to dolt sql-server.

Key changes:
- Remove dolthub/driver dependency and go-icu-regex vendored dep
- Remove embedded connection path, access locks, bootstrap, nocgo stubs
- Remove CGO build tags from all ~40 files
- Remove CGO/ICU settings from Makefile and scripts/test.sh
- Simplify configfile: Dolt is always server mode now
- Update doctor checks, factory, daemon guard for server-only
- Binary size reduced from ~120MB to ~44MB

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-05 21:30:53 -08:00
Evan Jacobson
888e3e69ee Fix other instances of dolt db lock due to hanging process 2026-02-04 14:58:36 -07:00