Search code examples
flaskherokumod-securityweb-application-firewall

How to integrate a Web Application firewall (ModSecurity) with Heroku?


I have an application running on the flask server in Heroku. This there any way to integrate ModSecurity or any open-source Web Application Firewall (WAF) to protect my application in Heroku. Any other related answer or help regarding this is also highly appreciated.


Solution

  • There is a Python binding for libmodsecurity3: https://github.com/pymodsecurity/pymodsecurity. In the README, you can find an example for Django - may be you can use that in case of Flask too.

    Note, that binding supports only v3.0.3, but the current version is v3.0.4 (libmodsecurity3), and that's nearly 1 year old. The current master branch contains so many changes from that version.