Repository navigation
Fixed two spots that failed toward the permissive answer - #73
Merged
Merged
Conversation
…y gave up Two Low-severity drift entries, both the same shape: code that noticed something wrong and produced a value that looked fine anyway. `hex_to_bytes` mapped an unparseable hex pair to `0` and carried on. That is the fail-toward-valid-looking direction, and it rendered as a well-formed SRI string. The only place a digest was ever shown was the mismatch message naming the expected value, so a corrupt or hand-edited digest came back as a confident looking digest with bytes silently zeroed. It is fallible now, and `to_sri` returns a Result for the same reason. The reachability is via direct struct construction, not `Checksum::parse`, which validates its hex on the way in; that is now a test rather than an assumption. Three permission-hardening steps in `store.rs` were `let _ =`: the data-directory chmod to 0o700, the pre-create of the database at 0o600, and the database chmod to 0o600. All three propagate now. The pre-create was the load-bearing one: `Connection::open` creates the file at whatever the umask allows, so when the pre-create failed the database came up at a default mode and the step whose whole job was narrowing it had failed in silence. No change on the success path. The modes were always being set; only the failure handling was missing, and `enforces_unix_file_and_directory_permissions` still pins the resulting modes. Mutation testing over both changed files found three survivors, all in code this change does not touch (`audit_entries`, `default_db_path`, and the sha512 length guard in `parse_token`, all pre-existing and untested). Recorded in the drift notes for whoever picks those up. Commit made by Step 5 Preview Free in OpenCode on behalf of Kriday.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR made by step-5-preview from opencode on behalf of Kriday.
Two Low-severity drift entries from the repo's own drift table, both the same shape: code that spotted something wrong and produced a value that looked fine anyway.
hex_to_bytesmapped an unparseable hex pair to0and carried on, so a corrupt digest still rendered as a well-formed SRI string. The only place such a digest ever surfaced was the mismatch message naming the expected value, which meant an operator got a confident looking digest with bytes silently zeroed. It is fallible now, andto_srireturns aResultfor the same reason.Three permission hardening steps in
store.rswere written aslet _ =, so their failures were invisible. The pre-create at0o600was the load-bearing one.Connection::opencreates the database file at whatever the umask allows, so when the pre-create failed the database still came up, just at a default mode. The step whose whole job was narrowing it had failed without saying so. All three propagate now.Summary:
hex_to_bytesrefuses a digest that is not clean hex instead of mapping a bad pair to byte0Checksum::to_srireturnsResult, so the decode failure has somewhere to golet _ =permission steps instore.rsnow propagate: the0o700directory chmod, the0o600pre-create, and the0o600database chmodNo behaviour change on the success path. The modes were already being set and the honest digests already round-tripped. Only the failure handling was missing, and
enforces_unix_file_and_directory_permissionsstill pins the resulting modes.Mutation testing over both changed files found three survivors, all in code this change does not touch:
audit_entries,default_db_path, and the sha512 length guard inparse_token. All three are pre-existing and untested. Recorded in the drift notes rather than folded in here.Toolchain caveat: there is no
rustupon this machine, sorust-toolchain.tomlis inert and the local gate ran on systemrustc 1.98.1rather than the pinned1.97.1. A green local run here is necessary, not sufficient.