v3 candidate

This commit is contained in:
Andy Dixon
2026-06-16 11:51:07 +01:00
parent fcb19c96c8
commit 493bfed599
91 changed files with 28824 additions and 80 deletions
+12
View File
@@ -28,6 +28,8 @@ const (
argonKeyLen = 32
saltLen = 32
maxVaultFileBytes = 10 * 1024 * 1024
)
// SecretStore manages encrypted credential storage.
@@ -331,6 +333,16 @@ func (s *SecretStore) save() error {
// load reads and unmarshals the vault from disc.
func (s *SecretStore) load() (*secretVault, error) {
info, err := os.Stat(s.vaultPath())
if err != nil {
return nil, fmt.Errorf("failed to stat vault file: %w", err)
}
if info.IsDir() {
return nil, errors.New("vault path is a directory")
}
if info.Size() > maxVaultFileBytes {
return nil, fmt.Errorf("vault file is too large: %d bytes exceeds %d bytes", info.Size(), maxVaultFileBytes)
}
data, err := os.ReadFile(s.vaultPath())
if err != nil {
return nil, fmt.Errorf("failed to read vault file: %w", err)