What's the psalmist's secret? A correct understanding of God's law.
The rules God made are not meant to be a prison, keeping us from something we need. That was the serpent's lie in the Garden of Eden. Instead, they're supposed to be a guardrail, keeping us from danger.