Bug: NumSecrets() always returns 0 due to incorrect directory traversal #4
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
In
internal/vault/vault.go, theNumSecrets()method counts secrets by looking for non-directory files (excludingcurrent) directly under each secret's directory:However, the actual directory structure of a secret is:
The only direct children of a secret directory are
current(excluded by the filter) andversions(excluded by!vFile.IsDir()). This means the condition is never true andNumSecrets()always returns 0.Impact
UnlockersRemoveusesNumSecrets()to check if removing the last unlocker is safe. Since it always returns 0, users can always remove the last unlocker without--force, even when secrets exist.infocommand may show incorrect secret counts.Fix
Should check if the
versionssubdirectory contains entries, or simply check for the existence of thecurrentfile.