Easy-peasy. Just require all software to be cryptographically signed, with a trusted chain that leads to a government-vetted author, and make that author responsible for the wrongdoings of that software's users.
We're most of the way there with "our" locked-down, walled-garden pocket supercomputers. Just extend that breadth and bring it to the rest of computing using the force of law.
---
Can I hear someone saying something like "That will never work!"?
Perhaps we should meditate upon that before we leap into any new age of regulation.
This is well on its way thanks to Microsoft's aggressive push to put a TPM in every Windows 11 PC.