While this was done to simplify UX, it's really not a good idea in retrospect.
Even as something simple as a different chat frame that only allowed script commands, into which only local script output can go, would also serve as an effective mitigation.
The attacker is executing script through the RemoveExtraSpaces function that gets run on every chat message, not by executing it with either player's chat console.
Or maybe forbid rebinding any system-provided global symbols at all?
Breaking a huge number of addons in the process, for literally no benefit because the attacker can just use that other name.
> and to prevent rebinding the 'RemoveExtraSpaces' function by anything else
Which wouldn't really solve anything because the attacker can just find some other function that is regularly executed with attacker-supplied input and use that instead.
When this was revealed, Blizzard quickly patched in a warning dialog that warns against running scripts from untrusted sources, including being social-engineered to enter stuff yourself (which is what's happening here). That attitude seems prudent, but isn't entirely helpful, as many players in fact use Lua in their chatbox to do complex actions or calculations.
Like this one that prints your current position in 'map coordinates':
or the 'CTC macro' that was used to calculate a value that raid tanks must have attained: It's true that users shouldn't run untrusted code, but realistically, they'll probably click through most warnings to run legitimate functions like this. A better fix is to prevent rebinding the 'RunScript' function to some other name, and to prevent rebinding the 'RemoveExtraSpaces' function by anything else.