Various Crypsis Fixes

PENDING PULL REQUEST, DO NOT MERGE!!!! YET...

This pull request should be used for reference of incoming changes. It contains some merges from external remote branches.

References: #2585
XSS vulnerability