I used to do research (mostly computer science) at university X, including work on my master's thesis, parts of which I now want to publish.

However, I recently started working at another academic institution, university Y, where my research focus is slightly different – so there's no big topical overlap.

If I had submitted a paper a few months ago, I would have listed myself and my thesis supervisor as the authors, with my old affiliation of university X. But now, should I just change my affiliation to university Y? Would it be considered unethical to publish something that wasn't approved by them? (Even if I did it in my spare time?)

What is the recommended way to follow here?