Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Securing your nodejs deployments while you sleep

September 19, 2014

Securing your nodejs deployments while you sleep

JSFoo 2014, Bangalore.

Developers push code at a much faster rate, that your security engineers don’t have enough time to take a look at them. Most of the vulnerabilites like XSS & CSRF comes in to existence when developers try to bring the next uber feature live, by not giving much attention to security or one of them is simply not aware of writing secure code. It has been a problem which is worrying most of the startups and organizations recently. In spite of having a secure framework which inherently takes care of most common security issues, it becomes a nightmare for security engineers / testers to take a look at every code commit for a vulnerability in their code. This talk is about automating the process of finding insecure code pushes for Nodejs deployments.


September 19, 2014

More Decks by Nafeez

Other Decks in Technology


  1. A vulnerability gets out to the internet before the security

    team looks at it or a scanner is run. Code deployment is now near instantaneous
  2. Or maybe you never gave a thought about your front-

    end architecture to prevent against, Cross-Domain attacks
  3. Watch the code as soon as it gets deployed. !

    Do Continuous Integration with security checks relevant to the Diffs / Delta
  4. 1. Use GitHub’s WebHooks.
 2. Get all commits to your

 3. Get the DIFF and send it across various security tests. In 3 simple steps
  5. ! 1. Insecure usage of templates for Cross-Site Scripting (XSS)

    2. Insecure libraries 3. . . . ! ! Simple static analysis !
  6. Imagine an injection context inside a JS variable <html> <script>

    var a = “—-user-input-here—”; alert(‘Finished’); </script> </html>
  7. Principle of Un-obtrusive Javascript Client-Side Templating Content Security Policy Reduce

    the entry point to one What defensive front-end architecture looks like
  8. Templating & XSS <%= %>, {{ }} — HTML Encoded

    - Usually XSS Safe <%- %>, {{{ }}} — No Encoding - Causes XSS in any context. Your design should naturally avoid this.
  9. Things to look out Anything which has <%- or {{{

    needs some attention. Write a simple module which checks the code commits for that.
  10. Scan on new routes being added? In Express, app._router.stack gives

    you all the registered routes. Pretty useful if you want to trigger a scan for a newly added end-point.! Figure out what works for your framework!