Skip to content

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
DrunkOnJava merged 4 commits into
mainfrom
fix/1871-redact-home-paths
Nov 13, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
fix/1871-redact-home-paths

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

redact_path_str, which every --redact runs 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.rs called 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 in column_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 --redact runs 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_PARENTS holds the three folders that hold one folder per user; redact_after walks 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

  • The helper is pure, so it has failure-first tests next to it (the pure-helper exception), seven, written as the ways it can leave a name behind or take more than a name: a Linux home folder (fails on main), five paths of three kinds in one string (fails on main: the second \Users\ path and both /home/ paths keep their names), a name no separator follows, as in an echoed path (fails on main), 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 with cargo test --profile ci --lib.
  • Committed redacted output: git grep -I '/home/' on main finds three tracked files, a Dockerfile's ENV PATH, CI's PII guard pattern and CONTRIBUTING.md's description of it. None is output of a --redact run, so none changes.
  • Measure, rows registered on --redact leaves the user name in /home/<name>/ paths: redact_path_str scrubs only \Users\ and /Users/ #1871 before the run (run 43368277871, unfiltered, against main at 9bb58fe1): ifc.sha256 identical on 146 of 146, diagnostics.json on 121 of 121, no scorer differs beyond what only the head writes, and same-project gates pass on 9a7ce531. The run reads no --redact output, 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 on 7e825868 (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.

…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.
@DrunkOnJava
DrunkOnJava merged commit be4c4fb into main Nov 13, 2026
37 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1871-redact-home-paths branch November 13, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--redact leaves the user name in /home/<name>/ paths: redact_path_str scrubs only \Users\ and /Users/

1 participant