beads/internal/storage/doltutil
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
..
close.go fix: remove stale embedded Dolt references after server-only migration 2026-02-21 16:59:44 -08:00
close_test.go tests: add tests for doltutil and factory packages 2026-02-07 18:21:48 -08:00
dsn.go fix: explicitly disable TLS in Dolt connections when not configured (#3107) 2026-04-10 13:55:06 -07:00
dsn_test.go fix: explicitly disable TLS in Dolt connections when not configured (#3107) 2026-04-10 13:55:06 -07:00
remotes.go security: harden remote URL validation at config parse time (#3210) 2026-04-13 09:58:50 -07:00
remotes_test.go fix: use CLI fallback for all git-protocol remotes, not just SSH (GH#2268) 2026-03-02 14:00:58 -08:00