by vxNsr · 6y ago · 0 comments
I know I'm guilty of trying to build something from first principles only to google it after banging my head against edge cases and finding a ready-made library or util that with a tiny bit of finesse or modification does the job.
Maybe a language having a vast standard library won’t suffer from this problem but it will definitely have other problems.
Also regarding these types of mitigations see https://www.youtube.com/watch?v=lG7U3fuNw3A which explains how some good mitigations might not catch all edge cases.
I don't think there is a golden rule for this stuff besides having a very strict CSP that only allows same-site resources and no eval/inline with reporting to see when someone has tried to do something bad.
Also HTMLPurifier for PHP, and probably several others in other languages.