Implement database handshake protocol in RPC layer
- Add ExpectedDB field to RPC Request - Server validates client's expected DB matches daemon's DB - Return clear error on mismatch with both paths - Old clients (no ExpectedDB) still work with warning - Add Path() method to storage.Storage interface - Tests verify cross-database connections rejected Prevents database pollution when client connects to wrong daemon. Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -42,6 +42,7 @@ type Request struct {
|
||||
RequestID string `json:"request_id,omitempty"`
|
||||
Cwd string `json:"cwd,omitempty"` // Working directory for database discovery
|
||||
ClientVersion string `json:"client_version,omitempty"` // Client version for compatibility checks
|
||||
ExpectedDB string `json:"expected_db,omitempty"` // Expected database path for validation (absolute)
|
||||
}
|
||||
|
||||
// Response represents an RPC response from daemon to client
|
||||
|
||||
Reference in New Issue
Block a user