-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue
The VaultPath configuration is not validated when loaded or set.
Problem
- User might enter invalid paths (relative, non-existent, etc.)
- Silent failures occur if path doesn't exist
- No user feedback about bad configuration
Current Behavior
// In config.go - path accepted without validation
cfg.General.VaultPath = absPath // No checks\!Solution
Add validation function:
func validateVaultPath(path string) error {
// Check if path is absolute
if \!filepath.IsAbs(path) {
return fmt.Errorf("vault path must be absolute, got: %s", path)
}
// Check if path exists
if _, err := os.Stat(path); os.IsNotExist(err) {
return fmt.Errorf("vault path does not exist: %s", path)
}
// Check if readable
if err := os.Access(path, os.R_OK|os.W_OK); err \!= nil {
return fmt.Errorf("vault path not readable/writable: %w", err)
}
return nil
}Apply in LoadConfig() and on user input.
Benefits
- Catch configuration errors early
- Better user feedback
- Prevent silent failures
Impact
🟢 Low - UX improvement
Metadata
Metadata
Assignees
Labels
No labels