Could (/should) this be mitigated on the repository host side by scanning for and flagging malicious commits?
A paper from last year evaluating this on Github achieves a ~50% success rate[0].
Given Github already training ml models across all repositories for Copilot I would guess higher rates would be possible.
[0] https://arxiv.org/abs/2103.03846
Edit: add link