Skip to content

Improved bugreport redaction - #252

Merged
ventureoo merged 1 commit into
CachyOS:masterfrom
drinkingoutofcups:master
Oct 21, 2026
Merged

ventureoo merged 1 commit into
CachyOS:masterfrom
drinkingoutofcups:master

Conversation

@drinkingoutofcups

Copy link
Copy Markdown
Contributor

From the discussion in #250, I added new matches for SSIDs, IPv6, UUID, "file://", and a condition to not remove hostname when it's "cachyos". Also made some of the printout consistent.

@petejm

petejm commented Aug 14, 2026

Copy link
Copy Markdown

Thanks for picking this up, and for the offer to test. I ran the PR head against a synthetic
report, and the real script with stubbed collectors, on GNU bash 5.3.15 and GNU sed 4.10. Two
of these fail on ordinary machines, so I have put those first.

1. An empty SSID list produces an empty sed expression

nmcli -t -f name,type c | sed -nE 's/(.*)\:.*wireless/\1/p' outputs nothing on a machine
with no saved wireless profile. The <<< herestring still yields one iteration, so the loop
appends an empty regex:

[-e]
[s||<ssid-redacted>|g]

What happens next depends on whether an earlier -e was added:

  • If the hostname guard skipped and SUDO_USER is unset, this is the first expression:
    sed: -e expression #7, char 0: no previous regular expression, exit 1. Under
    set -euo pipefail the script stops before upload, which is the safe direction, but it
    leaves cachyos-bugreport.log on disk completely unredacted, and that is the filename
    users are told to attach.
  • If any earlier -e exists, GNU sed reuses the last executed regex, so the SSID pass
    silently does nothing. Exit 0, no warning.

I hit the same abort two other ways, both verified: nmcli not installed (exit 127, for
anyone on systemd-networkd or iwd) and NetworkManager installed but not running (exit 8).
Both leave the unredacted log.

Suggested gate: [[ -n $ssid_list ]] before the loop, [[ -n $ssid ]] || continue inside it,
and command -v nmcli or a trailing || true on the collection so an absent NetworkManager
cannot abort the whole redaction pass.

2. The hostname guard misses three of the four hostnames CachyOS ships

[[ $hn != "cachyos" ]] is an exact, case-sensitive comparison. It covers the CLI installer
default and the kernel fallback, but not the other three:

Shipped value Source Guard
cachyos linux-cachyos/config:66 CONFIG_DEFAULT_HOSTNAME, and the New-Cli-Installer default matches
cachyos-${cpu} calamares-config, etc/calamares/modules/users.conf:77 template: misses
CachyOS CachyOS-Live-ISO and CachyOS-CLI-ISO, archiso/airootfs/etc/hostname misses
archlinux linux-cachyos-hardened/config:64 misses

The calamares row is the graphical installer, so a normal desktop install produces something
like cachyos-znver4 and gets redacted despite the guard.

The ISO row is the one I would prioritise. Running the PR head with hostname CachyOS
rewrites the report's own boilerplate:

Start of <hostname-redacted> bug report log file. Please send this report,
along with a description of your bug, to <hostname-redacted>.

together with every Distro: CachyOS line from inxi. A report generated on the live ISO stops
saying which distribution it is a report for.

A case-insensitive prefix test covers all four. Either shopt -s nocasematch with
[[ $hn != cachyos* ]], or [[ ${hn,,} != cachyos* ]] if bash 4 is acceptable here, plus
archlinux and the empty string.

The empty hostname matters on its own: the substitution becomes s||<hostname-redacted>|g in
first position and aborts the entire pass exactly as in point 1.

3. Three ways the SSID rule can miss silently

These concern me more than a loud failure, because the resulting log looks redacted.

  • nmcli -t escapes : in names as \:. The capture keeps the backslash and sed_escape
    escapes it again, so a real SSID Cafe:Wifi is never matched.
  • -f name,type returns the connection profile name, not the SSID. The two coincide by
    default and diverge on any renamed profile. The actual field is
    nmcli -g 802-11-wireless.ssid c show <name>; the listing form rejects
    -f 802-11-wireless.ssid, so it has to be queried per connection.
  • The SSID substitution has no \b anchors, unlike the hostname rule above it. A short SSID
    substring-matches anything: with SSID on, nvidia driver 570.86 loaded on card0 becomes
    nvidia driver 570.86 loaded <ssid-redacted> card0.

Smaller notes

  • The file:// pattern is greedy. .\+ runs to the last quote on the line, so
    opened "file:///home/u/a.txt" then errno 5 on device "sda" collapses to
    opened "file://<file-redacted>".
  • The UUID rule also scrubs root=UUID=... out of the kernel cmdline, which is usually
    load-bearing for boot and filesystem triage.
  • The IPv6 pattern matches only the fully expanded eight-group form, as its comment says.
    Journal and dmesg output is nearly always :: compressed.

Happy to send any of this as a patch on top of your branch if that is easier than reworking it.

Disclosure: Researched and drafted by an AI agent (Claude), guided & reviewed by @petejm

Comment thread usr/bin/cachyos-bugreport.sh Resolved
Comment thread usr/bin/cachyos-bugreport.sh Resolved
@petejm

petejm commented Aug 24, 2026

Copy link
Copy Markdown

Disclosure: posted by an AI agent (Claude) on behalf of @petejm, who reviewed and approved this comment.

Process note rather than a review point.

#255 is also open against the same redaction code in usr/bin/cachyos-bugreport.sh, and also
references #250. It takes a broader approach: enumerate the machine's own values first and
redact those, plus a test suite for the redaction path.

The two will conflict, since both edit the same expressions in the same file. I have reviewed
both and have no stake in which one lands. Flagging it so the choice gets made deliberately
rather than showing up later as a merge conflict.

Separately, on your note in #250 that "more testing would be nice": happy to run the same
reproduction set I used on #255 against this PR if that would be useful. cc @alexsmolya

@linearity7

linearity7 commented Sep 25, 2026 •

Copy link
Copy Markdown

TL;DR: Stricter, no-compromises IPv6 redaction; IPv6 should have a much higher priority than IPv4.

The IPv6 regex argument redacts only the most basic format of an IPv6 address, while IPv6 addresses can be expressed in many ways. For example:

  1. The regex argument will catch `fe08:0000:0000:0000:0000:0000:0024:e1ab
    But there are multiple abbreviations that can be made here:

  2. Remove leading zeros: fe08:0:0:0:0:0:24:e1ab

  3. Shortening groups of zeros: fe08::0024:e1ab

  4. Combined: fe08::24:e1ab

These are all official ways to express IPv6 addresses. And while I'm unaware of any programs that shorten the addresses, I think it's worth adding regex options for other expressions so long as the regex has near 100% specificity (no false positives) which I'm fairly confident is possible.

It might not be needed but we certainly lose nothing if we add it. Ptr says that IPv6 addresses are more private than IPv4 ones. However, in the age of the mighty CGNAT, not only is your OS oblivious to what your public IPv4 address is, but so is your router. This is not the case with IPv6 though. Your OS not only knows what your public IPv6 is, but it can choose one for itself if instructed in the network stack's config files. Moreover, peer-to-peer networks will mostly use IPv6 as IPv4 is not ideal when behind CGNAT, this has the potential to expose the user's recent activities on peer-to-peer networks (all activity if using persistent IPv6). And if the router itself does not have a rotating prefix, an attacker can scan all IPs on the prefix to find other exposed devices on the network (theoretically).

I know these are all hypotheticals and I might sound paranoid but it's crazy to me that cachyos-bugreport didn't even redact any IPv6 addresses to begin with, especially when there's just no downsides to doing so.

@linearity7

Copy link
Copy Markdown

Also not related but I'd really like to have the changes affect current installations as-well. I know the request is far-fetched but I think it's worth a try 😅.

Ptr was against renaming cachyos-bugreport.sh to cachyos-bugreport. This could be a good opportunity to introduce a cachyos-bugreport package to the CachyOS repos instead of the script being there on installation. I think it's a pretty important script because it's usually the first thing CachyOS staff members ask for when trouble shooting, and the logs are available to the tens of thousands of members of the Discord server, or even worse, exposed to the open internet if on the forum.

@ventureoo

Copy link
Copy Markdown
Member

Also not related but I'd really like to have the changes affect current installations as-well. I know the request is far-fetched but I think it's worth a try 😅.

I'm going to review this today and I will make a new release at end of week.

@ptr1337
ptr1337 requested a balanced review from Copilot September 25, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr1337
ptr1337 requested a balanced review from Copilot September 25, 2026 13:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

Comment thread usr/bin/cachyos-bugreport.sh Resolved
Comment thread usr/bin/cachyos-bugreport.sh Resolved
Comment thread usr/bin/cachyos-bugreport.sh Resolved
@ventureoo
ventureoo force-pushed the master branch 2 times, most recently from 0860418 to 72c008c Compare October 21, 2026 22:21
…cachyos" hostname. Some tidying up elsewhere

Co-authored-by: Vasiliy Stelmachenok <[email protected]>
Signed-off-by: Vasiliy Stelmachenok <[email protected]>
@ventureoo
ventureoo merged commit f79b237 into CachyOS:master Oct 21, 2026
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.

5 participants