Edgio / waflz

multitenant ModSecurity compatible WAF engine from Edgio
89 stars 25 forks source link

Example of using Waflz from C++ #269

Closed vasicvuk closed 2 years ago

vasicvuk commented 2 years ago

It would be great to have an example of how to call Waflz from C++ executing rules on sample request body or response.

tinselcity commented 2 years ago

I think the most straight forward example is the internal one using is2.

To integrate into a server or even a standalone application:

Define Callbacks

Define/set callbacks for getting the bits from the http request:

Configure with ruleset

This part is somewhat tricky but there's a basic example in the README.md:

waflz can consume "modsecurity" rules in a few formats including the native modsecurity rule format:

Process

Then call the profile process from the "waf" object:

This might be the best example of how to use:

Apologies for the complexity. We probably haven't spent enough time making it easy to use and play with outside of servers, but it was designed with server-less development in mind, especially for mocking in tests: