Repository navigation
The publication audit reads each reachable blob through its encoding, and reports one that does not decode as unread - #340
Merged
Conversation
… and reports one that does not decode as unread audit --for-publication read every reachable blob with String::from_utf8_lossy. A UTF-16 file became replacement characters with NULs between them, so a private name inside it matched nothing, and the blob was still counted among the surfaces read. With a forge that answered, the run ended on "every surface a flip would republish was read, and every one of them is clean" and exit 0, over a name the same text in UTF-8 is refused for, immediately before the flip that cannot be taken back. A blob that was not text at all, such as a Latin-1 file, was counted as read the same way. The blobs now go through the decoder the guards already use, which honours a byte-order mark. Text is searched as the text it holds. A blob that is neither text nor binary is listed among the surfaces this run could not read, is left out of the count of surfaces read, and makes the exit 2. It is still searched lossily, as before, because that keeps every ASCII byte: a private name written in ASCII inside a Latin-1 file is still a finding, and the finding outranks the unread surface, so that run exits 1 with both printed. A binary blob is still searched as its bytes, as it always was here: the guards skip one for want of lines to point at, but a name written into a binary is published by the flip all the same. The CLI tests cover a private name in a UTF-16 file, a Latin-1 blob reaching exit 2 without being counted as read, a private name in a Latin-1 blob found and the blob still listed as unread, and a name in a binary blob still being found. The reference documents how blobs are decoded. Claude-Session: https://claude.ai/code/session_01TG5hbR4Re6gcEZTpBCBymc
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #340 +/- ##
=======================================
Coverage 94.32% 94.32%
=======================================
Files 46 46
Lines 22820 22835 +15
=======================================
+ Hits 21524 21539 +15
Misses 1296 1296 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
audit --for-publicationdecoded every reachable blob withString::from_utf8_lossy. A UTF-16 file that named a private owner was therefore searched as replacement characters, so the name matched nothing, and the blob still counted among the surfaces read. When the forge was reachable, the run ended with "every one of them is clean" and exit 0, just before the private-to-public flip, which cannot be undone.Blobs now go through
guard::scope::decode, the decoder the guards already use. A UTF-16 file with a byte-order mark is decoded and searched as the text it holds. A binary blob is still searched lossily, as before, because a name written into a binary is still published by the flip. A blob that does not decode (for example Latin-1) is listed among the surfaces the run could not read and is not counted as read, and the run exits 2. It is still searched for what its bytes spell in ASCII. If anything is found, exit 1 takes precedence and both are printed.Tests added in
tests/audit_publication_cli.rs:a_name_in_a_utf16_file_is_founda_blob_that_does_not_decode_is_reported_unreada_name_in_a_blob_that_does_not_decode_is_still_founda_name_in_a_binary_blob_is_still_founddocs/REFERENCE.mdnow documents how the audit decodes blobs.https://claude.ai/code/session_01TG5hbR4Re6gcEZTpBCBymc