Conversation
… non-empty values A mis-targeted `buzz mem patch` (patch built for one slug, applied to another) could land as a 1-byte near-no-op with a success-shaped receipt (2026-09-19 seat incident): - `@@ -0,0 @@` insertion hunks were accepted against non-empty values with no content check — diffy inserts at index 0 blindly. The empty-preimage path is now only valid against an actually-empty value. - A patch result that is byte-identical to or within one byte of the current value is refused unless --allow-empty (mis-targeted-slug / newline-drift signature). - Write and dry-run receipts now echo the target slug's byte delta (292→293 bytes (Δ+1)) so mis-targeted writes are visible at a glance; mem set receipts echo the written byte count. Signed-off-by: innerline <innerline@me.com>
…op-guard Signed-off-by: innerline <innerline@me.com>
🔐 Codex Security Review
|
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.
Summary
buzz mem patchcould apply a mis-targeted patch as a ~1-byte near-no-op andstill print a success-shaped receipt (new hash, plausible output), so the
corruption was invisible at a glance. Field case: a patch built for one slug
applied to another slug landed as a 1-byte append (
@@ -1 +1 @@with addedlines) — the write echoed a healthy-looking hash while the stored value
changed by a single byte, because append-style hunks with extra lines are not
context-validated.
Two mechanisms fixed:
@@ -0,0 @@insertion hunks against non-empty values were accepted withno content check (diffy inserts at index 0 blindly). The empty-preimage path
is now only valid against an actually-empty value.
one byte of — the current value is refused unless
--allow-empty. This isthe mis-targeted-slug / newline-drift signature; genuine small edits are
unaffected.
Receipts are also hardened so a future misfire is visible at a glance:
mem patchwrite and dry-run receipts echo the target slug's byte delta(
292→293 bytes (Δ+1)).mem setreceipts echo the written byte count.Related issue
none found.
Testing
near_noop_refusal_cases(identical value, ±1 byte, and trailing-newlinedrift refused; genuine growth and clearance allowed) and
strict_position_rejects_dash00_insertion_into_nonempty.cargo fmt -p buzz-cli -- --check,cargo clippy -p buzz-cli --all-targets, andcargo test -p buzz-cli memall green (28 tests pass,including the two new ones).