Herald security fixed rebase

Recreated this pull request after reverting the change on master.

This diff now shows the full diff.