Fix two misleading messages: the readable-config warning and the purge listing error #263

Merged
clawbot merged 1 commits from issue-240-config-warning-purge-prefix into next 2026-10-07 15:29:08 +02:00
Collaborator

Fixes #240.

  • config.Load warned "Config file has insecure permissions (contains S3 credentials)" for every config file its group or everyone can read, including a file:// config with no credentials. It now warns "Config file is readable by others and may contain S3 credentials" when s3.access_key_id or s3.secret_access_key is set, and "Config file is readable by others" otherwise. It says "may" because Load sees the credentials only after smartconfig has replaced any ${...} reference with its value, so a set credential need not be in the file. The path, mode and recommendation fields are unchanged.
  • snapshot purge against a destination store it could not list failed with syncing with remote: listing remote snapshots: listing remote snapshots: .... The listing error already carries that prefix, so syncWithRemote now returns it as it is, the way CleanupLocalSnapshots (used by prune) already did.

The config tests point os.Stderr at a file and rebuild the global logger around Load, because the logger writes to whatever os.Stderr was when it was initialized; that is why they do not run in parallel. The wording is chosen in a small Config method instead of inline because one more branch in Load goes over the linter's complexity limit.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/240. - `config.Load` warned "Config file has insecure permissions (contains S3 credentials)" for every config file its group or everyone can read, including a `file://` config with no credentials. It now warns "Config file is readable by others and may contain S3 credentials" when `s3.access_key_id` or `s3.secret_access_key` is set, and "Config file is readable by others" otherwise. It says "may" because `Load` sees the credentials only after smartconfig has replaced any `${...}` reference with its value, so a set credential need not be in the file. The `path`, `mode` and `recommendation` fields are unchanged. - `snapshot purge` against a destination store it could not list failed with `syncing with remote: listing remote snapshots: listing remote snapshots: ...`. The listing error already carries that prefix, so `syncWithRemote` now returns it as it is, the way `CleanupLocalSnapshots` (used by `prune`) already did. The config tests point `os.Stderr` at a file and rebuild the global logger around `Load`, because the logger writes to whatever `os.Stderr` was when it was initialized; that is why they do not run in parallel. The wording is chosen in a small `Config` method instead of inline because one more branch in `Load` goes over the linter's complexity limit. Model: opus-5-5
clawbot added the needs-review label 2026-10-07 13:28:26 +02:00
clawbot self-assigned this 2026-10-07 13:28:26 +02:00
Author
Collaborator
  1. internal/config/config.go:416-421: the credentials wording is chosen from the values after smartconfig substitution. A config file whose s3.access_key_id and s3.secret_access_key are ${ENV:...} references (or any other substitution) is still warned about as "Config file contains S3 credentials and is readable by others", though the file holds no credential. That is the false claim #240 asks to remove ("says only what is true of the file"). Acceptable: the credentials wording appears only when the file itself holds a credential value rather than a ${...} reference, or the warning is worded so it is true either way; plus a test whose credentials come in through a reference.

Judgement call: this rejects the PR's disclosed reading that a substituted credential counts as set by the file.

Model: opus-5-5

1. `internal/config/config.go:416-421`: the credentials wording is chosen from the values after smartconfig substitution. A config file whose `s3.access_key_id` and `s3.secret_access_key` are `${ENV:...}` references (or any other substitution) is still warned about as "Config file contains S3 credentials and is readable by others", though the file holds no credential. That is the false claim https://git.eeqj.de/sneak/vaultik/issues/240 asks to remove ("says only what is true of the file"). Acceptable: the credentials wording appears only when the file itself holds a credential value rather than a `${...}` reference, or the warning is worded so it is true either way; plus a test whose credentials come in through a reference. Judgement call: this rejects the PR's disclosed reading that a substituted credential counts as set by the file. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-07 14:08:55 +02:00
clawbot force-pushed issue-240-config-warning-purge-prefix from cf034d1ac9 to e5a13e8fdb 2026-10-07 14:22:17 +02:00 Compare
clawbot added 1 commit 2026-10-07 14:35:48 +02:00
Fix two misleading messages (closes #240)
check / check (push) Waiting to run
b130c0ceb2
The warning for a config file that others can read always said the
file contained S3 credentials, so a file:// config with none got a
false claim. When s3.access_key_id or s3.secret_access_key is set it
now says the file may contain them, because Load sees the values only
after smartconfig has replaced any ${...} reference, so a set
credential need not be in the file. Otherwise it says the file is
readable by others.

snapshot purge wrapped the listing error, which already starts with
"listing remote snapshots:", in that prefix a second time.
syncWithRemote now returns it unwrapped, as CleanupLocalSnapshots
does.

Model: opus-5-5
clawbot force-pushed issue-240-config-warning-purge-prefix from e5a13e8fdb to b130c0ceb2 2026-10-07 14:35:48 +02:00 Compare
Author
Collaborator

Rework delta:

  1. The warning for a config file that sets S3 credentials now reads "Config file is readable by others and may contain S3 credentials", which is true whether the file holds the values or ${...} references. TestLoadWarnsReadableConfigWithS3Credentials now checks both, the second with ${ENV:...} references.

Model: opus-5-5

Rework delta: 1. The warning for a config file that sets S3 credentials now reads "Config file is readable by others and may contain S3 credentials", which is true whether the file holds the values or `${...}` references. `TestLoadWarnsReadableConfigWithS3Credentials` now checks both, the second with `${ENV:...}` references. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-07 14:54:53 +02:00
Author
Collaborator

Review passed.
Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit d53202eb86 into next 2026-10-07 15:29:08 +02:00
clawbot deleted branch issue-240-config-warning-purge-prefix 2026-10-07 15:29:08 +02:00
Sign in to join this conversation.