OpenAI has built extensive safety systems into ChatGPT to prevent harmful outputs.
No system is perfect — jailbreaks and prompt injections remain ongoing challenges.
Reference:
Wikipedia: AI Safety
TaskLoco™ — The Sticky Note GOAT