DEV Community

Discussion on: Web security knowledge you must understand it (Part I: HTTPS, TLS, SSL, CORS, CSP)

Collapse
 
aghost7 profile image
Jonathan Boudreau

In practice, it isn't easy to implement CSP when libraries come into play. It is nice to add for hardening, but it isn't necessary, and should not be considered a primary form of defence against XSS.

Thread Thread
 
aurelio profile image
Aurelio

Nothing about security is easy and the fact that one method is not easy to implement doesn't make it less valuable.

Also, you can always set the CSP as report-only if you're (correctly) worried about potentially breaking stuff. Implementing a good policy slowly over months is better than never doing it at all.

But anyway, if other methods are preferable in your view it's more constructive to explicitly say which ones, so people reading the comments can actually get value out of the discussion.

Cheers!

Thread Thread
 
aghost7 profile image
Jonathan Boudreau • Edited

I consider CSP to be an advanced topic because it is a additional defence against XSS. I do not consider it a "must know". What I consider essential knowledge is how to reason about trusted and untrusted inputs, making sure to sanitize if your framework or library doesn't already do it.

Also, you can always set the CSP as report-only

Again, I don't consider this a "must know". I mean, its cool and all but I don't consider auditing something everyone should know about. I'd much rather have people know about ways you can actually completely shoot yourself in the foot than know about CSP.

Thread Thread
 
aurelio profile image
Aurelio

Surely, although for me they really are different methods solving different but equally serious problems. But this is now more a personal opinion about what is and what is not a must know, so less valuable/interesting.

Thanks for keeping up the thread and replying with an informed opinion and a link to a reputable site.
I really appreciate it 👍👍👍

Some comments have been hidden by the post's author - find out more