fix(term): loop defang_paste until no embedded bracketed markers remain
The bracketed paste defanging in send_paste strips embedded \x1b[200~ and \x1b[201~ sequences from pasted text so an attacker can't inject their own paste boundaries. The current code does a single pass of str::replace, which finds non-overlapping matches. That means a crafted input like \x1b\x1b[200~[200~ gets the inner pair stripped on pass one, leaving \x1b[200~[200~ — the outer sequences recombine into a valid marker that hits the terminal.
The fix extracts a defang_paste helper that loops until the output stabilises. On each iteration it clones the current string, runs both replaces, and breaks if nothing changed. The logic is the same, it just runs it to a fixed point.
Added six unit tests: plain text, single start marker, single end marker, both markers, the reporter's double-nested exploit case, triple nesting, and mixed double-nested start+end. The double-nested case fails on the old single-pass code (asserts "[200~injected" against "injected") and passes with the loop. Ran the full term test suite — all 231 existing tests pass plus the 6 new ones.
Closes #7784.
[!WARNING] This looks a lot like a bot account, it was created yesterday and opened 15 security issues on 15 repos, as well as ~30 PRs (most closed by the account itself..)..
The changes might be good though, worth checking out (except the doc comments ^^')
Fair observation. The account's new and I've been shipping a lot of small fixes, I get that the volume looks odd from the outside. Happy to address any review notes.