that’s utterly trivial for a sufficiently paranoid user’s browser to detect
How many of their users do you think are sufficiently paranoid?
And if it is utterly trivial, I am curious how you think a sufficiently paranoid user actually would go about detecting such an attack, much less detecting it prior to running the malicious javascript and having their keys exfiltrated. For detecting it after the code has already run, ok, I know how to use mitm proxy to record the javascript being sent to my browser. (Which is the first step of detecting an attack... the next steps involve analyzing the legitimate changes to the code and discerning them from malicious changes.)
I could also imagine a variety of ways (using mitm proxy, or a browser extension) to try to avoid running new javascript before seeing it and having a chance to analyze it - but all of the ways I can imagine would require a substantial amount of work, including writing new software.
Do you know of any existing browser extension or other software which sufficiently paranoid protonmail users can/should/do use to detect and/or actually prevent the type of targeted attack I'm describing?
doesn’t work for users on the imap bridge
Yes that is why i said "when using Proton's web mail interface" - which I expect 100% of users of other interfaces also sometimes log in to.