4 ms·
One thing that always seemed pretty hard to do in Go was security. Most companies will stop at SQL Injections but I consider defense against XSS, and CSRF atta
by Matt3o12_ 11y ago
One thing that always seemed pretty hard to do in Go was security.
Most companies will stop at SQL Injections but I consider defense against XSS, and CSRF attacks just as important. And that is something Go does not excel at because I have not found any framework that makes adding these features as painless as possible. (I have only toyed with Go for the web so I might be wrong).
Django (a python web-framework), on the other hand, is pretty good at these things[1] because they require little to no extra work, so that junior developers like me will get it right. That is the reason I would always go to Python for web development instead of Go, although, I like Go just as much and it is so much quicker.
I'd be interested to hear how the big projects migrate these kind of attacks in Go.
[1] https://docs.djangoproject.com/en/1.9/topics/security/ https://docs.djangoproject.com/en/1.9/topics/security/
- masklinn 11y agoI may be mistaken, but I'm reasonably sure with respect to XSS (in HTML templates anyway), the built-in html/template autoescapes provided parameters by default, much as Django templates do. You have to mark "trusted" or "pre-escaped" parameters explicitly by wrapping them in e.g. `template.HTML`.
- mayhew 11y agonosurf [1] is a pretty popular CSRF protection package for Go. You need to realize that Go's built in "web framework" is extremely minimal unlike Django. It's more comparable to something like Flask, which also doesn't have CSRF protection built-in. [1] https://github.com/justinas/nosurf https://github.com/justinas/nosurf