1. A dedicated read-only schema
2. A dedicated user, with only CONNECT to the read-only schema
3. A unique password
4. A dedicated read-only replica DB
you should be safe against pretty much everything.
I'd actually like to be corrected if I'm wrong - this is how I've built numerous externally-facing services.