Skip to content

Conversation

@rlmenge
Copy link
Contributor

@rlmenge rlmenge commented Nov 21, 2025

Fedora 43 (systemd 258) introduces OSC (Operating System Command) 3008
ANSI escape sequences for sudo audit logging when PTY is allocated.
These sequences appear in command output and break regex parsing in tools
like lspci.

OSC sequences have format: ESC ] BEL or ESC ] ESC Example: \x1b]3008;start=UUID;user=name;hostname=host;...\x1b
The previous regex pattern had a character class bug: the range -_
(0x5c-0x5f) inadvertently included ] (0x5d), causing the regex to match
ESC and ] as separate characters instead of recognizing the full OSC
sequence.

Changes:

  • Reordered alternation to match OSC pattern first, preventing premature
    matching by the single-character escape range
    detecting ESC \ terminator
  • Supports both BEL (0x07) and ST (ESC , 0x1b 0x5c) terminators

Tested with:

  • OSC 3008 sequences from Fedora 43 systemd 258
  • CSI sequences (existing functionality)
  • Single-character escapes (existing functionality)
  • Both BEL and ST terminators

This fix maintains backward compatibility with existing ANSI escape
filtering while handling modern systemd audit logging.

Fedora 43 (systemd 258) introduces OSC (Operating System Command) 3008
ANSI escape sequences for sudo audit logging when PTY is allocated.
These sequences appear in command output and break regex parsing in tools
like lspci.

OSC sequences have format: ESC ] <data> BEL  or  ESC ] <data> ESC Example: \x1b]3008;start=UUID;user=name;hostname=host;...\x1b
The previous regex pattern had a character class bug: the range \-_
(0x5c-0x5f) inadvertently included ] (0x5d), causing the regex to match
ESC and ] as separate characters instead of recognizing the full OSC
sequence.

Changes:
- Reordered alternation to match OSC pattern first, preventing premature
  matching by the single-character escape range
  detecting ESC \ terminator
- Supports both BEL (0x07) and ST (ESC \, 0x1b 0x5c) terminators

Tested with:
- OSC 3008 sequences from Fedora 43 systemd 258
- CSI sequences (existing functionality)
- Single-character escapes (existing functionality)
- Both BEL and ST terminators

This fix maintains backward compatibility with existing ANSI escape
filtering while handling modern systemd audit logging.
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.

1 participant