Repository navigation
fix(redact): redact_path_str scrubs the user name of /home/<name>/ and of every path in a string, not the first of each kind (#1871) - #1873
Merged
Conversation
…d of every path in a string, not the first of each kind (#1871) The scrubber behind every --redact knew \Users\<name>\ and /Users/<name>/ only, so a file under /home/<name>/ or an error naming one kept the name, while CI's PII guard already treats /home/<name>/ as a home path. It also replaced only the first path of each kind in a string, so a message naming two files kept the second one's user name. The scan now moves through the whole string, past each replacement, and a string that is already redacted comes back unchanged. A name the string ends at, with no separator after it, is left as it was, as before. The pure helper has failure-first tests: a Linux home folder, several paths of every kind in one string, names the string ends at, folders that only start like a home folder, names with spaces, dots and accents, and a second pass over redacted text.
…measured of a column node's two boxes, and what its test requires of them (#1825) The module doc called the two boxes' x and y extents equal, and its fail-closed paragraph left out that a node's two boxes must agree to 1e-9 ft before either is compared with the record. Of the 3,658 comparisons the census of #1825 made on 18 models, 3,519 agree to 1e-12 ft (3,165 of them exactly) and 139 differ by more than 1e-6 ft, all of them in column_cut_extents (Core Interior 80, Snowdon Towers Architectural 58, the BIM4LCA timber office at permit 1); none fell between the two, which is the margin the 1e-9 test rests on. The doc now says that. No code changes.
…p to the first space, quote, bracket, comma, semicolon or colon, or the end of the string (#1871) The first version of the fix left a name alone when the string ended at it. That is the form a home folder takes in an error message or a CLI argument echoed back ("No such file: /Users/alice", "cwd /home/alice"), so the leak #1871 is about stayed. Where a separator follows, the name still ends there, so a profile folder named "Alice Smith" is one name. Where none does, the name ends at the first character that ends a name in running text; a name with a space is then scrubbed only up to the space, which leaves less of it than leaving the whole name would. A home folder with nothing after it, or with a separator right after it, is left as it is. The test that wrote the leak in as behaviour is flipped to the failure it guards (the name is gone), and a second one keeps the nameless cases whole. Review of #1873 by rvtDevelop.
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
redact_path_str, which every--redactruns a path through, now scrubs the user name of/home/<name>/as it does/Users/<name>/and\Users\<name>\, and scrubs every path of a string where it scrubbed only the first of each kind (a message that named two files kept the second one's user name). A name no separator follows, as in a path an error echoes back (No such file: /Users/alice), is scrubbed up to the first space, quote, closing bracket, comma, semicolon or colon, or the end of the string (rvtDevelop's review of this PR; the first version left it alone); a home folder with nothing after it is left as it is.A second commit corrects a module doc that #1825's closing comment promised to correct:
partition_column_nodes.rscalled a column node's two boxes' x and y extents equal. The raw lines of the census's Measure run show 3,519 of its 3,658 comparisons agree to 1e-12 ft (3,165 exactly) and 139 differ by more than 1e-6 ft, none between, so the doc says that and what the test requires of the boxes (1e-9 ft). The closing comment said "equal to 1e-12" without the 139; they are all incolumn_cut_extents(Core Interior 80, Snowdon Towers Architectural 58, the BIM4LCA timber office at permit 1). No code changes there.Motivation
#1871, found while reading #1852:
rvt-diff --elements --redactruns its error text through this function, and CI's PII guard already treats/home/<name>/as a home path in committed files, so the scrubber and the guard disagreed. The first-path-only behaviour is the same bug in the same loop.Changes
src/redact.rs:HOME_PARENTSholds the three folders that hold one folder per user;redact_afterwalks the whole string and moves past each replacement, so a string that is already redacted comes back unchanged. The doc example shows a Linux path and a string of two.changelog.d/fixed/1871-redact-home-paths.md.src/research/partition_column_nodes.rs: module doc only.Testing
main), five paths of three kinds in one string (fails onmain: the second\Users\path and both/home/paths keep their names), a name no separator follows, as in an echoed path (fails onmain), a home folder with nothing after it, a folder that only starts like a home folder (/srv/homework/...), names with spaces, dots and accents, and a second pass over redacted text. CI's Linux test job runs them withcargo test --profile ci --lib.git grep -I '/home/'onmainfinds three tracked files, a Dockerfile'sENV PATH, CI's PII guard pattern and CONTRIBUTING.md's description of it. None is output of a--redactrun, so none changes.mainat9bb58fe1):ifc.sha256identical on 146 of 146,diagnostics.jsonon 121 of 121, no scorer differs beyond what only the head writes, andsame-project gatespass on9a7ce531. The run reads no--redactoutput, so it shows only that no export moves; the helper's behaviour is the seven tests above. The rule for a name no separator follows came after that run, so a second run on7e825868(no base side, rows registered on --redact leaves the user name in /home/<name>/ paths: redact_path_str scrubs only \Users\ and /Users/ #1871) gives the gates verdict for it and is compared with the first.Related issues
Closes #1871. Refs #1825.