fix: monitoring.md permissions note and arcup checksum filename validation - #317
Conversation
01b9683 to
ffc1bf3
Compare
|
Both fixes do what they claim, and the existing suite still passes at The arcup change works, verified before/afterSourcing
So the intended case is fixed, the One note on the guard: Two-line test gap
printf '%s\n' "$checksum" > "$checksum_file"
expect_fail "checksum file without filename fails" verify_checksum_file "$archive" "$checksum_file" "$archive_name"(Worth knowing: nothing in The two bugs sitting in the six lines being editedI raised these on #316; repeating them here only because this PR already touches this function, so they're cheap to fold in. Both reproduce on this branch: A valid checksum file with no trailing newline is reported as empty. The file is not empty. This sends an operator hunting a truncated download that never happened. CRLF corrupts the error message itself. The trailing CR stays in The name is not truncated — the CR is overwriting the line as it renders, so the diagnostic actively lies about what it compared. Normalising the line first fixes both, and makes this PR's local line
line=$(tr -d '\r' < "$checksum_path" | head -n1)
if [[ -z "$line" ]]; then
error "Checksum file is empty: $checksum_path"
fi
read -r expected_checksum expected_name <<< "$line"Entirely reasonable to decline as out of scope — but these fail closed with misleading diagnostics on valid input, where the bug being fixed here fails open silently, so they're arguably the higher-value halves of the same six lines. Docs: this drops the searchable symptom stringThis is the one I'd ask to change before merge. The removed sentence was the only occurrence of That literal string is what an operator pastes into search after reading it in the Prometheus logs. The section heading says "a permissions error", which won't match. The clarification and the symptom text aren't in conflict — keeping both costs one sentence. Docs: "cannot occur" is now asserted rather than impliedThe new text states the error cannot occur when following the guide exactly. As I noted on #315, there are two configurations where it occurs anyway with
Previously the guide was merely silent on this. Now it tells an operator staring at a genuine permissions error that their error cannot exist, which is a worse failure mode than the original ambiguity. Softening to something like "this is usually prevented by I won't re-litigate the direction here — I argued on #315 for dropping Minor process pointThese are two unrelated changes with quite different risk profiles — a docs clarification, and a behaviour change to install-time verification that can break fork installs. |
…ation docs/monitoring.md: the troubleshooting section for Prometheus permissions errors contradicted the compose.yaml's own user: "0" setting. Updated to clarify that user: "0" prevents this in most configurations, retain the queries.active symptom string operators search for in logs, and note the two cases (userns-remap, SELinux) where the error can still surface. arcup/arcup: verify_checksum_file had three related defects in the six lines that parse the .sha256 entry: - bare-hash input (no filename field) silently skipped filename validation - no-trailing-newline input was misreported as an empty file - CRLF line endings corrupted the filename comparison and error message Fixed by reading via tr -d '\r' | head -n1 and checking emptiness on the resulting string, then reading into variables with a here-string. arcup/test_arcup.sh: added bare-hash test case to test_checksum_validation. Fixes circlefin#315, circlefin#316
ffc1bf3 to
0527679
Compare
Summary
Two independent correctness fixes in a single PR.
1.
docs/monitoring.mdtroubleshooting section contradictsuser: "0"(#315)The "Prometheus is restarting with a permissions error" section instructs operators to
chown -R 65534:65534the data directory. However, thecompose.yamlin the same guide setsuser: "0"on the Prometheus service (root), so the described UID 65534 write-permission error cannot occur when following the guide as written. Updated the section to clarify thatuser: "0"prevents this error and that thechownstep only applies when Prometheus runs as a non-root user.2.
arcup/arcupverify_checksum_filesilently skips filename check for bare-hash inputs (#316)When a
.sha256file contains only a bare hash (no filename field),expected_nameis empty and theif [[ -n "$expected_name" ]]guard skips filename validation entirely. The archive is accepted on hash match alone, silently violating the function's contract of verifying the checksum was intended for$archive_name. Added anelif [[ -n "$archive_name" ]]branch that errors explicitly in this case.Test plan
verify_checksum_filewith a bare-hash.sha256now returns an error instead of silently passingFixes #315, #316