Skip to content

Fix defects found in a full audit of 1.3.0 - #134

Merged
inxbit merged 20 commits into
mainfrom
fix/audit-2026-11
Nov 17, 2026
Merged

inxbit merged 20 commits into
mainfrom
fix/audit-2026-11

Conversation

@inxbit

@inxbit inxbit commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Fixes for defects found in a full audit of 1.3.0. Each fix has a regression test that failed first, except the capture-index cast (32-bit only).

Behavior changes to know about

  • profiles list|show|validate|test now reject surplus arguments. profiles validate good.yml broken.yml used to report success having read only the first file.
  • strip_ansi (library) and --strip-ansi keep the format effectors (backspace through carriage return) found inside a CSI or a plain escape, as a terminal runs them. They used to be dropped with the control, which joined the lines around an escape cut short at a line end.
  • A profile's strong signals match only where they begin a word. rhel inside ServerHello no longer selects linux-unix.

Fixed

  • Any CSI ending in m counted as SGR. xterm's key modifier option (CSI > 4 ; 1 m, XTMODKEYS) was tracked as bold, so text after each highlight was redrawn bold or faint, and it was deleted from the stream when a prompt's colors were neutralized.
  • profiles test ignored --sanitize and --strip-ansi, so an OSC 52 in a captured fixture reached the terminal.
  • --show-profile and --benchmark printed nothing for an empty input.
  • Filter mode exited with EAGAIN on a non-blocking stdin.
  • prismtty --reload hung on a FIFO in place of the reload marker.
  • An exclusive rule skipped its own overlapping capture groups.
  • --local-echo echoed the tail of SS3 keys (ESC O A printed OA).
  • --trace-io accepted a file with a second hard link.
  • A numeric capture key was narrowed with as usize.

Profiles

  • generic: a good-state word after not is no longer green; bare den is no longer a denial; an IPv6 zone with -, . or _ stays one address.
  • arubacx, fortinet: configuration-context prompts are colored.
  • palo-alto: aggregate interfaces (ae1, ae1.107) are colored.

Release and QA

  • CI builds the crate package (cargo package --locked).
  • The privacy scan checks content and paths separately for IPv6 addresses (a line number used to join an address that began the line) and checks zero-padded IPv4 octets.
  • A prompt matcher test used a real local account name; it is synthetic now.
  • README, CONTRIBUTING and hero animation details corrected.

Verification

  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --locked, node --test tests/*.test.mjs, scripts/privacy-scan.sh, cargo package --locked.
  • A grammar fuzzer over the stdin filter, 8,000 cases against this branch: no panic, no escape left by --strip-ansi, no string control left by --sanitize, bytes preserved in default mode.

profiles list, show, validate and test each read a fixed number of
arguments and dropped the rest without a word, so
`profiles validate good.yml broken.yml` reported success having read
only the first file. A surplus argument is now a usage error that names
it.
An input that ended before its first byte returned ahead of the
--show-profile and --benchmark reports, so both flags printed nothing
for an empty file or a command with no output.
Another program can leave O_NONBLOCK set on the pipe or terminal that
prismtty inherits as stdin. The first read of an empty one then failed
with EAGAIN and the filter exited 1 before any input arrived. Stdin now
goes through the same wait-when-would-block wrapper as stdout.
profiles test printed its fixture through the highlighter without the
escape filtering the two flags ask for, so an OSC 52 clipboard write in
a captured fixture still reached the terminal under --sanitize, and
--strip-ansi left the capture's own colors in place.
The reload marker and pid files were opened for writing before their
file type was checked. A FIFO at that path with no reader made the open
block, so `prismtty --reload` hung forever. The open is now
non-blocking, and the existing regular-file check refuses the rest.
The tracker of the program's own rendition read any CSI ending in `m`
as SGR and skipped the parameters it could not parse. xterm's
modifyOtherKeys control (`CSI > 4 ; 1 m`, sent by fish, vim and tmux)
therefore counted as bold, and the text after each highlight was
redrawn bold or faint. A control with a private marker or an
intermediate byte is no longer SGR, and a C0 control inside the CSI is
no longer taken for part of its parameters.
A terminal runs a line feed or carriage return it meets inside a CSI.
strip_ansi dropped them with the control, which joined the lines around
an escape cut short at a line end.
An exclusive rule marked each span protected as soon as it styled it,
so its own later groups were skipped where they overlapped: with colors
on groups 0 and 1, group 1 was dropped. Its spans are now protected
from later rules once all of its groups are applied.
Removing a prompt's own color took every CSI ending in `m` on the line
with it. xterm's key modifier option (`CSI > 4 ; 1 m`, XTMODKEYS) was
deleted from the stream that way, so the terminal never changed how it
reports keys. One predicate now decides what an SGR is for both the
rendition tracker and this removal.
An arrow or function key sent in application mode (`ESC O A`,
`ESC O P`) had only its ESC skipped, so --local-echo printed the rest
of the key as `OA` or `OP`.
--trace-io checked the file's type, owner and mode but not its link
count, so a trace path that was a hard link appended the session's
input and output to the file's other name.
A numeric capture key was narrowed with `as usize`. On a 32-bit target
4294967296 wrapped to group 0 and colored the whole match instead of
being rejected like the quoted form of the same key.
- generic: a good-state word after `not` (`not reachable`, `not  connected`
  with aligned spacing, `not valid`) was painted green; `not reachable` now
  reads as a bad state like `not connected`.
- generic: bare `den` (a site code, a word) was painted as a denial.
- generic: an IPv6 zone holding `-`, `.` or `_` was split in two colors.
- arubacx, fortinet: configuration-context prompts were left uncolored.
- palo-alto: aggregate interfaces (`ae1`, `ae1.107`) were left uncolored.
The --strip-ansi fix for a line feed inside a CSI left the same hole
for a plain escape: `line1 ESC CR LF next` still lost its line break.
Strong and negative signals were plain substring searches, so ordinary
output selected a vendor profile: `rhel` inside `ServerHello` chose
linux-unix, `ios xe` inside `BIOS XE` and `asa version` inside
`NASA version` chose cisco, `pan-os` inside `japan-osaka` chose
palo-alto. A signal that starts or ends with a word character may no
longer continue a word on that side.
The privacy scan ran its IPv6 check over whole `path:line:content`
records, so the line number joined an address that began the line: a
documentation address there was rejected, and a real one could be read
as a different address. The path and the content are now checked on
their own. The IPv4 check skipped zero-padded octets, which devices
print and which name the same address.
The test literal held a real local account name, against the
synthetic-fixtures rule, and shipped in the published crate source.
- CI now runs `cargo package --locked`, so a file missing from the
  crate's include list fails a pull request instead of a release tag.
- The READMEs said each archive contains its checksum; it is a separate
  file. They now also name the PCRE2 runtime requirement.
- The hero output has six lines but only five had a delay, so the sixth
  animated first.
- CONTRIBUTING named a sidecar file that does not exist.
Requiring a word boundary on both sides lost real banners where the
vendor glues a model or version on (`Nexus9000`, `rhel9`,
`FortiGateRugged`). Only the start has to begin a word; that is what
separates `rhel` from `ServerHello`. Adds a positive case for every
vendor profile.
@inxbit
inxbit marked this pull request as ready for review November 17, 2026 07:28
@inxbit
inxbit merged commit 4e38747 into main Nov 17, 2026
6 checks passed
@inxbit
inxbit deleted the fix/audit-2026-11 branch November 17, 2026 07:32
This was referenced Nov 17, 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.

1 participant