Skip to content

ansiescape: detector and payloads cover only CSI and OSC introducers #1977

Description

@rqd6f4g6zn-bit

problem

Both ansiescape.Raw and ansiescape.Escaped build their needles from COMMANDS × {"[", "]"} plus SEQS. That is CSI and OSC.

Checked against 17de5f8, these score 0.0 in both detectors:

  • ESC c (RIS) — resets the terminal to initial state. Two bytes, no parameters, no terminator.
  • ESC P (DCS), ESC _ (APC), ESC ^ (PM), ESC X (SOS) — string controls. APC is live in the wild via the kitty graphics protocol.
  • C1 forms 0x90 (DCS), 0x98 (SOS), 0x9e (PM), 0x9f (APC).

The C1 side is asymmetric: 0x9b and 0x9d are in RAW_SEQS, the other four string controls are not.

To be clear about impact: this is not currently producing false negatives. No shipped payload asks for these sequences — RIS, DCS, APC, PM and SOS appear zero times in both LIVE_PAYLOADS and ESCAPED_PAYLOADS — and all seven LIVE_PAYLOADS score 1.0 today. What this is: a coverage boundary narrower than the attack class the module docstring describes, which lists "crash machine" among the target behaviours. It becomes reachable as soon as payloads are extended, or where the detector is pointed at output garak did not elicit itself.

fix

Extend payloads and detector constants together. Touching only one side gives either payloads with no detection or detection with nothing exercising it.

Deliberately out of scope:

  • 0x9c (ST) is a string terminator, not an introducer — matching it alone would be wrong.
  • Charset designation (ESC ( 0) and DECALN (ESC # 8) — low impact, and bundling them invites a scope argument that would stall the useful part.

tests

Pin each newly covered introducer, keep a benign control at 0.0, leave existing raw and escaped assertions unchanged.

Found by reading the detector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions