An empty currentvault, or one naming a vault that does not exist, made secret list report an empty vault with exit 0, and secret add fail on a missing directory. An empty file was read as the vault name vaults.d.
ResolveVaultSymlink now checks the name it reads. An empty or invalid name, or one with no directory under vaults.d, gives an error that wraps ErrVaultNotFound, names the file and says to run secret vault select <name>. Every command that goes through GetCurrentVault gets that error. secret vault list and secret info already carried on when that call failed, so both still run, with no vault shown as current. secret vault select writes a valid name, which fixes it. The README says this under secret vault select.
The new test writes currentvault empty, holding the invalid names . and ../vaults.d/work, and naming a vault that does not exist. Each time it requires secret list to fail with that error, secret vault list to still list the vaults, and secret vault select to make listing work again.
Disclosures:
newSizeTestVault in secrets_size_test.go wrote a full path into currentvault, which resolved only because the last path element was taken as the name; it now relies on CreateVault selecting the vault.
Judgement call: a missing currentvault file keeps its existing error, which does not mention secret vault select; the issue covers an empty, invalid or nonexistent name.
Model: opus-5-5
For https://git.eeqj.de/sneak/secret/issues/156.
An empty `currentvault`, or one naming a vault that does not exist, made `secret list` report an empty vault with exit 0, and `secret add` fail on a missing directory. An empty file was read as the vault name `vaults.d`.
`ResolveVaultSymlink` now checks the name it reads. An empty or invalid name, or one with no directory under `vaults.d`, gives an error that wraps `ErrVaultNotFound`, names the file and says to run `secret vault select <name>`. Every command that goes through `GetCurrentVault` gets that error. `secret vault list` and `secret info` already carried on when that call failed, so both still run, with no vault shown as current. `secret vault select` writes a valid name, which fixes it. The README says this under `secret vault select`.
The new test writes `currentvault` empty, holding the invalid names `.` and `../vaults.d/work`, and naming a vault that does not exist. Each time it requires `secret list` to fail with that error, `secret vault list` to still list the vaults, and `secret vault select` to make listing work again.
Disclosures:
- `newSizeTestVault` in `secrets_size_test.go` wrote a full path into `currentvault`, which resolved only because the last path element was taken as the name; it now relies on `CreateVault` selecting the vault.
- Judgement call: a missing `currentvault` file keeps its existing error, which does not mention `secret vault select`; the issue covers an empty, invalid or nonexistent name.
Model: opus-5-5
Rebased onto the current next. The conflict in internal/cli/secrets_size_test.go was in the imports: kept the ones #170 added (its new tests still use path/filepath), and kept this PR's change to newSizeTestVault, which no longer writes currentvault itself. TODO.md is as it is on next.
Model: opus-5-5
Rework delta:
- Rebased onto the current `next`. The conflict in `internal/cli/secrets_size_test.go` was in the imports: kept the ones https://git.eeqj.de/sneak/secret/pulls/170 added (its new tests still use `path/filepath`), and kept this PR's change to `newSizeTestVault`, which no longer writes `currentvault` itself. `TODO.md` is as it is on `next`.
Model: opus-5-5
internal/cli/current_vault_test.go line 28: the test writes only an empty file and gone, never an invalid name, so the name check at internal/vault/management.go line 82 is not tested. If that check were reduced to rejecting only an empty name, no test would fail, yet a currentvault holding . would bring back the reported bug: the current vault becomes vaults.d itself and secret list shows an empty vault with exit 0. Acceptable: add invalid names, such as . and ../vaults.d/work, to the file contents the test writes.
README.md lines 117 to 120: the new text says every command that uses the current vault fails, with only secret vault list still working, but secret info also reads the current vault and still succeeds, showing Current Vault: (none). Acceptable: name secret info next to secret vault list as still working.
Model: opus-5-5
1. `internal/cli/current_vault_test.go` line 28: the test writes only an empty file and `gone`, never an invalid name, so the name check at `internal/vault/management.go` line 82 is not tested. If that check were reduced to rejecting only an empty name, no test would fail, yet a `currentvault` holding `.` would bring back the reported bug: the current vault becomes `vaults.d` itself and `secret list` shows an empty vault with exit 0. Acceptable: add invalid names, such as `.` and `../vaults.d/work`, to the file contents the test writes.
2. `README.md` lines 117 to 120: the new text says every command that uses the current vault fails, with only `secret vault list` still working, but `secret info` also reads the current vault and still succeeds, showing `Current Vault: (none)`. Acceptable: name `secret info` next to `secret vault list` as still working.
Model: opus-5-5
The test now also writes the invalid names . and ../vaults.d/work into currentvault; both cases fail if the name check is reduced to rejecting only an empty name.
The README under secret vault select now names secret info next to secret vault list as still running, with no vault shown as current.
Model: opus-5-5
Rework delta:
1. The test now also writes the invalid names `.` and `../vaults.d/work` into `currentvault`; both cases fail if the name check is reduced to rejecting only an empty name.
2. The README under `secret vault select` now names `secret info` next to `secret vault list` as still running, with no vault shown as current.
Model: opus-5-5
An empty currentvault, or one naming a vault that does not exist, made
`secret list` report an empty vault with exit 0 and `secret add` fail on a
missing directory. ResolveVaultSymlink now refuses an empty or invalid
name, or one with no directory under vaults.d, with an error that wraps
ErrVaultNotFound, names the file and says to run
`secret vault select <name>`. Every command that uses the current vault
gets it; `secret vault list` and `secret info` still run.
newSizeTestVault wrote a full path into currentvault, which resolved only
because the last path element was taken as the name; it now relies on
CreateVault selecting the vault.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
For #156.
An empty
currentvault, or one naming a vault that does not exist, madesecret listreport an empty vault with exit 0, andsecret addfail on a missing directory. An empty file was read as the vault namevaults.d.ResolveVaultSymlinknow checks the name it reads. An empty or invalid name, or one with no directory undervaults.d, gives an error that wrapsErrVaultNotFound, names the file and says to runsecret vault select <name>. Every command that goes throughGetCurrentVaultgets that error.secret vault listandsecret infoalready carried on when that call failed, so both still run, with no vault shown as current.secret vault selectwrites a valid name, which fixes it. The README says this undersecret vault select.The new test writes
currentvaultempty, holding the invalid names.and../vaults.d/work, and naming a vault that does not exist. Each time it requiressecret listto fail with that error,secret vault listto still list the vaults, andsecret vault selectto make listing work again.Disclosures:
newSizeTestVaultinsecrets_size_test.gowrote a full path intocurrentvault, which resolved only because the last path element was taken as the name; it now relies onCreateVaultselecting the vault.currentvaultfile keeps its existing error, which does not mentionsecret vault select; the issue covers an empty, invalid or nonexistent name.Model: opus-5-5
816e0fd0eeto8c1040b6cdConflicts with
nextininternal/cli/secrets_size_test.go; needs a rebase.Model: opus-5-5
8c1040b6cdto03c3c321d3Rework delta:
next. The conflict ininternal/cli/secrets_size_test.gowas in the imports: kept the ones #170 added (its new tests still usepath/filepath), and kept this PR's change tonewSizeTestVault, which no longer writescurrentvaultitself.TODO.mdis as it is onnext.Model: opus-5-5
03c3c321d3toec27d973efec27d973efto477dc166a9477dc166a9to2f66f6d8edinternal/cli/current_vault_test.goline 28: the test writes only an empty file andgone, never an invalid name, so the name check atinternal/vault/management.goline 82 is not tested. If that check were reduced to rejecting only an empty name, no test would fail, yet acurrentvaultholding.would bring back the reported bug: the current vault becomesvaults.ditself andsecret listshows an empty vault with exit 0. Acceptable: add invalid names, such as.and../vaults.d/work, to the file contents the test writes.README.mdlines 117 to 120: the new text says every command that uses the current vault fails, with onlysecret vault liststill working, butsecret infoalso reads the current vault and still succeeds, showingCurrent Vault: (none). Acceptable: namesecret infonext tosecret vault listas still working.Model: opus-5-5
2f66f6d8edto4ebd36fd6bRework delta:
.and../vaults.d/workintocurrentvault; both cases fail if the name check is reduced to rejecting only an empty name.secret vault selectnow namessecret infonext tosecret vault listas still running, with no vault shown as current.Model: opus-5-5
4ebd36fd6btob3a9eb3bafReview passed.
Model: opus-5-5