report: keep four-part versions after v or ==
The IPv4 rule replaced not1mm's new version in "v26.11.10.1" and "not1mm==26.11.10.1" with <ip> (report CD-GB29BZ), because only a digit or dot before an address kept it. Also keep ones after v, V or ==; an address after a single =, as in addr=192.168.1.20, is still replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -55,7 +55,9 @@ regex_escape() {
|
||||
# terminal codes or progress redraws, and with personal details replaced.
|
||||
# LC_ALL=C so the ranges mean bytes, whatever the locale. IPv4 addresses are
|
||||
# replaced twice because a match takes the character after an address, which
|
||||
# can be the one before the next; dotted versions such as 1.0.4.1.3 are kept.
|
||||
# can be the one before the next; dotted versions such as 1.0.4.1.3 are kept,
|
||||
# and so are four-part ones after v or == (v26.11.10.1, not1mm==26.11.10.1).
|
||||
# A single = doesn't count, so addr=192.168.1.20 is still replaced.
|
||||
redact() {
|
||||
local home user host
|
||||
home="$(regex_escape "$HOME")"
|
||||
@@ -68,8 +70,8 @@ redact() {
|
||||
-e "s#${home}([/[:space:]'\":]|\$)#~\\1#g" \
|
||||
-e 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/<email>/g' \
|
||||
-e 's/[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.ts\.net/<tailscale-name>/g' \
|
||||
-e 's/(^|[^0-9.])([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
|
||||
-e 's/(^|[^0-9.])([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
|
||||
-e 's/(^=?|[^0-9.vV=]|[^=]=)([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
|
||||
-e 's/(^=?|[^0-9.vV=]|[^=]=)([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
|
||||
-e "s/(^|[^A-Za-z0-9_-])${user}([^A-Za-z0-9_-]|\$)/\\1<user>\\2/g" \
|
||||
-e "s/(^|[^A-Za-z0-9_-])${host}([^A-Za-z0-9_-]|\$)/\\1<host>\\2/g" \
|
||||
"$1"
|
||||
|
||||
Reference in New Issue
Block a user